Skip to content
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

[Generator] Improve parameter handling of MIME types in content types #646

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

czechboy0
Copy link
Contributor

Motivation

The generator piece of apple/swift-openapi-runtime#113.

This is needed for APIs such as Kubernetes, that has both application/json and application/json; watch=true in a single operation.

Currently the parameters weren't taken into account, which could lead to incorrect matching of content types.

Modifications

Use the full MIME type, including the parameters, for matching.

Result

More correct behavior, now we correctly handle multiple MIME types with the same type/subtype in an operation.

Test Plan

Added a unit test.

Copy link
Contributor

@simonjbeaumont simonjbeaumont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome—thanks @czechboy0!

@czechboy0 czechboy0 enabled auto-merge (squash) November 28, 2024 13:27
@czechboy0 czechboy0 added semver/patch No public API change. and removed semver/patch No public API change. labels Nov 28, 2024
@czechboy0 czechboy0 merged commit cdc23b5 into apple:main Nov 28, 2024
36 checks passed
@czechboy0 czechboy0 deleted the hd-mime-type-params branch November 28, 2024 14:36
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