-
Notifications
You must be signed in to change notification settings - Fork 928
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
Is there an easy way to denote internal and external endpoints, and a way to generate internal or external swagger docs? #415
Comments
This not build-in, keep me posted on your progress, I think it would be a nice add-on for the related projects page. |
@prodikl I was just searching for this too, since I will soon have to maintain both internal and external API docs from the same basecode. I would be very interested to hear from you if you make any progress on this. @bfanger Wouldn't it be nice to have this in the core of swagger-php? Or is there any other way to do it in the current version? Thanks, |
In the current version you can use a custom properties For example: The output swagger-php generates will contain all documentation, but it's just json, so splitting it into 2 json files should be trivial for a php developer 😉 |
@babarizbak unfortunately my company didn't want me to devote time to this issue and instead we're generating normally and chopping down by hand for limited external docs. i'd still consider adding something like this in my personal time but i think as a community we'd need to decide what the steps should look like
|
@prodikl I ran across the same issue regarding selective publishing of Swagger Docs. What I ended up doing was building additional functionality into my commercial product (https://getcapi.org) which leverages the CMS's group ACL to selectively render the swagger json which feeds into the Swagger UI. This all works, however, because I build REST APIs endpoint collections as CMS plugins. These plugins occupy known directory paths. Within my code, I am able to look up ACL configuration, map it against the user making the request and in real-time generate the Swagger json based on the allowed paths for the zircote Doctrine processor (done via a foreach loop which builds the director paths array). Without such pre-processing of the Swagger json generation, you would need to modify the source code for Swagger UI to do such things as:
I'm not sure it would be a good idea to customize zircote/swagger-php to follow such custom rule sets for Doctrine parsing. From my experience, it seems to provide enough functionality to allow the end user to choose which directory paths to pass to the parser class. |
@bfanger OK, it may be not that hard to use custom properties and then parse the JSON file, but it still needs some hand-writing-glue-code. @prodikl I agree with your proposal:
Clean and easy. |
What is, and is not part of an environment (or api-version) could be as simple as filtering based on 'v1' vs 'v2' in the path. I've decided that filtering the generated documentation is outside of the scope of the swagger-php project. It can be done, but requires insight into your api and building your own filtering logic like @annatech has done, is the recommended solution. |
So far this library has been a huge help to our organization.
I wanted to mark endpoints internal or external, then when I build the documentation, ideally I could pass in a parameter "internal" or "external."
This way, we could hide away endpoints that are just for internal use.
I was going to fork and add my own annotation (e.g. @swg\Environment or just @swg\Internal / External) but I wanted to ask first if there was a way to do this already!
Thanks
The text was updated successfully, but these errors were encountered: