swaggerhub-maven-plugin icon indicating copy to clipboard operation
swaggerhub-maven-plugin copied to clipboard

Add support for downloading resolved specs

Open olensmar opened this issue 5 years ago • 4 comments

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

olensmar avatar Jul 03 '19 12:07 olensmar

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>

andrii-ashomok avatar Jul 04 '19 06:07 andrii-ashomok

@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?

michaelmelody91 avatar Jul 15 '19 19:07 michaelmelody91

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 avatar Jul 17 '19 11:07 olensmar

@olensmar I've came to the realization that you were right in creating this issue! Currently facing my own issues with unresolved definitions...

michaelmelody91 avatar Oct 14 '19 10:10 michaelmelody91