swagger-api/swaggerhub-maven-plugin

Add support for domains

batwad opened this issue ยท 8 comments

I've started using domains in my APIs but this tool cannot upload or download them

Nobody asked for it till now!
Should be fairly straightforward to add support for this.

Could you describe your use case @batwad?

Could you describe your use case @batwad?

This is so I can have an offline copy of the APIs in sync with whatever's in swaggerhub.

I have a build process at the moment which uses the codegen plugin, but it means the code can't be built if swaggerhub is down (which never happens of course) or a dev is working offline. I want to build a separate build that will download the APIs and push them to our on-prem git repo, a poor man's version of your git sync integration if you like.

๐Ÿ‘

We would like to do some openapi validation on incoming requests. We don't want to connect online to swaggerhub in order to retrieve the spec plus all references.

SwaggerParser provides some nice functionality in order to facilitate this: dereference and bundle.

Maybe this plugin could use that and provide an option to have the downloaded file completely dereferenced or bundled into one big file. Otherwise you'd probably have to tweak the $ref uris, I imagine.

Ok, gotcha.

Yeah I think you're right @octmueller, it looks like SwaggerParser/OpenAPIParser is probably the way to go here. Maybe add an optional boolean <resolve> parameter to the plugin config.

I was hoping that a relative address would work in a $ref, thereby avoiding the problem @octmueller mentioned. But downloading a resolved version of the API would be even better.

Still, I'd like the ability to download domains so that I can mirror them in our SCM.

Yes, it would be great to download resolved version of api with models included from domains

v. 1.0.8 now supports downloading and uploading domains. Use the <definitionType>domain</definitionType> configuration parameter to indicate that the target file is a domain.