New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export filtered APIs with specified tags or other ways #661
Comments
@oreo0725 you may need to figure out a workaround since swagger doesn't not support this and I don't see it implemented. Since you have 2 APIs , you may use to create 2 endopints http://api.domain.com and http://internal-api.domain com or you can have different roots line /api/new and /internal/new . |
@ubogdan, |
@oreo0725 This is an Open Source project. Please feel free and contribute via PR and we will be more than welcome to add this feature. |
@oreo0725 Do you plan on creating PR from your forked branch? |
I'm in the same boat. We have a monorepo with both internal and public API's, using the exclude flag doesn't really work at all times (depending on how you've created your package structure). It seems avyfinans#1 added the ability to parse by extension (awesome addition!): Add comment tag like on cli use swag init --parseExtension public result will be that only those operations with @x-public true will be saved to the swagger definition The new feature isn't merged here yet though, #1219 @igorkova what do you have left to do on it? Anything we can help with @ubogdan? |
Ok. We are back on this one. I see that in the meantime we got something similar in #1379, however, that doesn't solve the use-case we have. The main reason it doesn't work is that we would need to be able to expose only some endpoints from a certain Tag (imagine we have a tag called We can't use @Trial97 Is there a way to achieve what we need with #1379 (maybe something we are missing to understand there) |
I believe this has to be done via go-build tags. |
@oreo0725 I believe you had much better approach of filtering out operations even before they are parsed (your We've made now Looks like workflow is green since today so now we'll just wait for some reviews as soon as maintainers get some time. |
Is your feature request related to a problem? Please describe.
Sometime we have to only export partial APIs to generate the document for external partners.
For example,
I have 2 APIs
/user/new
and/internal/user/new
inusers_resource.go
/user/new
I wanna export it to aswagger-public.yaml
/user/new
andinternal/user/new
should be exported to anotherswagger.yaml
Describe the solution you'd like
Is that possible to have a --exclude-tags or --include-tag options for the generator function?
or just a whole new annotation to fullfil this requirement
Describe alternatives you've considered
Use
@Tags
may not be a good choice because it will create a new layout group for HTML generated by such swagger-codegenThe text was updated successfully, but these errors were encountered: