Skip to content

Conversation

czechboy0
Copy link
Contributor

Motivation

The runtime changes for apple/swift-openapi-generator#315.

Modifications

  • Introduces a new SPI method Converter.bestContentType that takes a received content type value and from a provided list of other content types, picks the most appropriate one. This actually follows the specification now, by going from most specific (including parameter matching) to least specific (most wildcard-y).
  • Deprecates the previously used methods Converter.makeUnexpectedContentTypeError and Converter.isMatchingContentType.

Result

SPI methods that the generated code can use to correctly match content types.

Test Plan

Added unit tests.

Copy link

@gjcairo gjcairo left a 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 left a few comments with some pretty small nits.

@czechboy0 czechboy0 merged commit 333d73a into apple:main Oct 30, 2023
@czechboy0 czechboy0 deleted the hd-improved-content-type-matching branch October 30, 2023 15:15
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants