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

Maps all unique content-types for operations and set passthroughBehavior to never in CORS preflight integration #2290

Merged
merged 4 commits into from
May 22, 2024

Conversation

jfkisafk
Copy link
Contributor

@jfkisafk jfkisafk commented May 17, 2024

Background

  • What do these changes do?
    • Maps all unique content-types for operations in CORS preflight integration template, in addition to the application/json template that is currently added.
    • Sets the passthroughBehavior for the mock integration to "never" to fail-fast with 415 Unsupported in case a request is made with unsupported Content-Type.
    • Both these features are behind a new OpenAPI configuration syncCorsPreflightIntegration (not sure about the name), which the service teams can turn on.
  • Why are they important?
    • So that API Gateway does not error out when OPTIONS request is made with a custom payload and a Content-Type other than application/json. This will pass the request to the actual GET/PUT/... method.
    • Requests made with unsupported Content-Type fail fast with 415 Unsupported instead of receiving 500 InternalServerError from API Gateway.

Testing

  • How did you test these changes?
    • Added test cases for the new changes.
    • Checked backwards compatibility by running ./gradlew clean build.

Links


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jfkisafk jfkisafk changed the title fix(cors): maps all unique operation mime types in cors preflight Maps all unique content-types for operations in CORS preflight integration template May 17, 2024
@jfkisafk jfkisafk marked this pull request as ready for review May 17, 2024 02:50
@jfkisafk jfkisafk requested a review from a team as a code owner May 17, 2024 02:50
@jfkisafk jfkisafk requested a review from kstich May 17, 2024 02:50
@jfkisafk
Copy link
Contributor Author

Please lmk if this feature should be launched behind a feature flag in openapi settings or if I need to update the docs as well?

…a new flag

The new Open API setting is `syncCorsPreflightIntegration`.

Added the docs as well.

closes #2289
@jfkisafk jfkisafk changed the title Maps all unique content-types for operations in CORS preflight integration template Maps all unique content-types for operations and set passthroughBehavior to never in CORS preflight integration May 22, 2024
@jfkisafk jfkisafk requested a review from kstich May 22, 2024 10:23
@jfkisafk jfkisafk requested a review from kstich May 22, 2024 18:44
@kstich kstich merged commit 3575395 into smithy-lang:main May 22, 2024
13 checks passed
@jfkisafk jfkisafk deleted the cors/preflight branch May 22, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with when_no_match passthroughBehavior for @cors preflight integration in openapi definition
2 participants