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
版权声明:本文标题:java - openapi generator unauthorized 401 via $ref url in yaml - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736557851a1944604.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论