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
Add support for filtering OpenAPI document #319
Add support for filtering OpenAPI document #319
Conversation
7af3794
to
79b031c
Compare
Signed-off-by: Si Beaumont <beaumont@apple.com>
Signed-off-by: Si Beaumont <beaumont@apple.com>
Signed-off-by: Si Beaumont <beaumont@apple.com>
c383f47
to
5c2aa45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall, just a few small suggestions.
Tests/OpenAPIGeneratorCoreTests/Hooks/FilteredDocumentTests.swift
Outdated
Show resolved
Hide resolved
Signed-off-by: Si Beaumont <beaumont@apple.com>
Signed-off-by: Si Beaumont <beaumont@apple.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more comments, otherwise looks great.
Sources/swift-openapi-generator/Documentation.docc/Articles/Configuring-the-generator.md
Outdated
Show resolved
Hide resolved
Sources/swift-openapi-generator/Documentation.docc/Articles/Configuring-the-generator.md
Outdated
Show resolved
Hide resolved
Sources/swift-openapi-generator/Documentation.docc/Articles/Configuring-the-generator.md
Show resolved
Hide resolved
Co-authored-by: Honza Dvorsky <honza@apple.com>
Signed-off-by: Si Beaumont <beaumont@apple.com>
4297010
to
a27f103
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Motivation
When generating client code, Swift OpenAPI Generator generates code for the entire OpenAPI document, even if the user only makes use of a subset of its types and operations.
Generating code that is unused constitutes overhead for the adopter:
This is particularly noticeable when working with a small subset of a large API, which can result in O(100k) lines of unused code and long generation and compile times.
For a more detailed motivation and design, see the proposal in #303.
Modifications
Result
Users can filter a document before code-generation. For large APIs, this can result in >90% speedup (see proposal).
Test Plan