swaggerhub-maven-plugin
swaggerhub-maven-plugin copied to clipboard
Add support for downloading resolved specs
My OAS3 spec references a domain - when downloading I would like to get that resolved in the same way as the "Export/Download API/JSON/YAML Resolved" menu actions in SwaggerHub
I found workaround using swagger-codegen-maven-plugin with:
<id>spec-generator</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${swaggerhub.apis.host}/${portal-api.apis.owner}/${portal.api.name}/${portal.api.version}</inputSpec>
<!-- If the API is private or uses private domains, specify your SwaggerHub API key -->
<auth>Authorization: ${swaggerhub.apis.token}</auth>
<!-- Use 'openapi-yaml' to get resolved YAML or 'openapi' to get resolved JSON -->
<language>openapi-yaml</language>
<!-- Default is ${project.build.directory}/generated-sources/swagger -->
<output>${codegen.directory}</output>
<configOptions>
<!-- Default file name is openapi.yaml or openapi.json -->
<outputFile>${portal.app.swagger.file}</outputFile>
</configOptions>
</configuration>
</execution>
@olensmar I have to agree with @scorpioa on this one. As part of our backend services, we use the swaggerhub-maven-plugin in conjunction with the swagger-codegen-maven-plugin. Firstly to download the unresolved definition and then to use that for generation.
This plugin is in essence a wrapper of the SwaggerHub API. At this time, there is no API available to download resolved definitions.
I'll close this issue unless there are any objections?
thanks @michaelmelodysmartbear - i'm fine with that workaround for now - although I think we should revisit this if we start seeing external usage of the plugin for other purposes than running the downloaded spec through codegen!
@olensmar I've came to the realization that you were right in creating this issue! Currently facing my own issues with unresolved definitions...