-
Notifications
You must be signed in to change notification settings - Fork 53
[Runtime] Accept header #37
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glbrntt
reviewed
Aug 10, 2023
glbrntt
reviewed
Aug 14, 2023
gjcairo
reviewed
Aug 17, 2023
…ft-openapi-runtime into hd-accept-header-prototype
gjcairo
reviewed
Aug 24, 2023
glbrntt
reviewed
Aug 24, 2023
Co-authored-by: George Barnett <gbarnett@apple.com>
…ft-openapi-runtime into hd-accept-header-prototype
gjcairo
approved these changes
Aug 24, 2023
czechboy0
added a commit
to apple/swift-openapi-generator
that referenced
this pull request
Aug 24, 2023
[Generator] Accept header ### Motivation Fixes #160. SOAR-0003 was accepted, this is the generator side of the implementation. The runtime side, which must land first, is at: apple/swift-openapi-runtime#37. ### Modifications - Adapted the generator logic for the changes - see the file-based reference tests for concrete examples of what the generated `AcceptableContentType` enum looks like. - Introduced `translateRawRepresentableEnum`, which allows sharing logic between generating this new enum and other string-based enums. - Explicitly skip parameters that match reserved headers, as dictated by the specification. ### Result SOAR-0003 as proposed, working behind the `multipleContentTypes` feature flag. ### Test Plan Adapted PetstoreConsumerTests to test the new behavior, adapter reference tests. Reviewed by: gjcairo, glbrntt Builds: ✔︎ pull request validation (5.8) - Build finished. ✔︎ pull request validation (5.9) - Build finished. ✔︎ pull request validation (docc test) - Build finished. ✔︎ pull request validation (integration test) - Build finished. ✔︎ pull request validation (nightly) - Build finished. ✔︎ pull request validation (soundness) - Build finished. #185
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
SOAR-0003 was accepted, this is the runtime side of the implementation.
Modifications
AcceptableProtocol
, which all the generated, operation-specific Accept enums conform to.QualityValue
, which wraps the quality parameter of the content type. Since the precision is capped at 3 decimal places, the internal storage is in 1000's, allowing for more reliable comparisons, as floating point numbers are only used when serialized into headers.AcceptHeaderContentType
, generic overAcceptableProtocol
, which addsQualityValue
to each generated Accept enum.Converter
that allow setting and getting the Accept header.Result
These are the requirements for apple/swift-openapi-generator#185.
Test Plan
Added unit tests for both
QualityValue
andAcceptHeaderContentType
, and for the newConverter
methods.