admin管理员组

文章数量:1123231

Here is my problem: I am working on a Stoplight project for a specific use case and want to utilize one of the shared models in Stoplight, such as Model_1. When I added Model_1, this line was added to my YAML project:

title: Myapi
x-stoplight:
  type: object
  x-internal: false
  properties:
    id:
      type: string
      x-stoplight:
        id: env6e1e1evebr
      readOnly: true
    model2:
      $ref: 'https://path/common/models/Model_1.v1.yaml?deref=bundle'

When I run the build to generate code using the openapi-generator-maven-plugin, I encounter the following error:

[ERROR] unable to read javax.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.ssl.Alert.createSSLException (Alert.java:131)

After that I tried to use path to raw data in the repo of the model I need


  model2:    $ref: 'https://path/ccommon/models/Model_1.v1.yaml#master'
Or using the credential
model2:    $ref: 'https://${AR_USER}:${AR_PASSWORD}path/ccommon/models/Model_1.v1.yaml#master' 

However, I still encounter the security error, regardless of whether I pass the credentials or not.

-[ERROR] unable to readjava.io.IOException: Server returned HTTP response code: 401 for URL: https://path/ccommon/models/Model_1.v1.yaml#master at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:77) at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstanceWithCaller (Constructor.java:500) at java.lang.reflect.Constructor.newInstance (Constructor.java:481)

here my configuration plugin of openapi

<plugin>
    <groupId>org.openapitools</groupId>
    <artifactId>openapi-generator-maven-plugin</artifactId>
    <version>7.10.0</version>
    <configuration>
        <!-- .md -->
        <generatorName>jaxrs-spec</generatorName>
        <generateApiTests>false</generateApiTests>
        <inputSpec>${project.basedir}/reference/myApi.yaml</inputSpec>
        <modelPackage>package.dto</modelPackage>
        <configOptions>
            <sourceFolder>src</sourceFolder>
            <apiPackage>path.api</apiPackage>
            <useTags>true</useTags>
            <dateLibrary>java8-localdatetime</dateLibrary>
            <interfaceOnly>true</interfaceOnly>
            <returnResponse>true</returnResponse>
            <generateBuilders>true</generateBuilders>
            <serializableModel>true</serializableModel>
            <useJakartaEe>true</useJakartaEe>
        </configOptions>
    </configuration>
    <executions>
        <execution>
            <id>generate-api</id>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
</plugin>

How can I pass the token or credentials to access the shared model, or is there an alternative way to resolve this issue to avoid duplication of the model

本文标签: javaopenapi generator unauthorized 401 via ref url in yamlStack Overflow