-
Notifications
You must be signed in to change notification settings - Fork 115
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
Generate API protocols based on tags #285
Comments
I think that's a good idea. Would help with large documents, and even when implementing servers, it could help break up the API handler a bit. This should be doable even in a backwards compatible way, as we could continue to generate
Still, this should go through a proposal, but should be considered before 1.0 in case we choose to do it in an API-breaking way. If anyone wants to take it on and go through the proposal and implementation process, that'd be great. We can help guide you through the process. |
Proposal in #287 |
@olejnjak Thanks for taking the time to file this and to write up the proposal! As it happens, we've been considering adding support for pruning the OpenAPI document to just the things a user wants to use. We were considering a more expressive approach that extends beyond the OpenAPI tags. For example, you could ask to generate:
The feature would then prune the OpenAPI document before generation to only include these items and the transitive closure of all those items dependencies. Generation would then proceed as it does today, on this subset. The missing part from the proposal above is that we would not make changes to the generated namespaces—we would still have Would this fit your use case? |
Just to add to Si, you could then generate all the operations for one tag into one module, making the fully qualified protocol name |
### Motivation We'd like to run a proposal for filtering the OpenAPI document for just the required parts prior to generating. ### Modifications - Add SOAR-0008: OpenAPI document filtering (See the proposal itself for details)[^1] ### Result n/a ### Test Plan n/a ### Related Issues #285 [^1]: https://github.com/apple/swift-openapi-generator/pull/303/files --------- Signed-off-by: Si Beaumont <beaumont@apple.com>
Currently OpenAPI generator generates a single
APIProtocol
for all client calls.It would be a good improvement if it would be possible to generate a protocol based on tags in the spec. So given the following spec, two protocols would be generated
PetsAPIProtocol
&StoreAPIProtocol
.Based on https://x.com/czechboy0/status/1703869135682195838?s=20
The text was updated successfully, but these errors were encountered: