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

fix: normalize the open api version #3551

Merged
merged 3 commits into from
Feb 28, 2024
Merged

Conversation

xazhao
Copy link
Contributor

@xazhao xazhao commented Feb 27, 2024

Issue #, if available

In Serverless Api, if OpenApiVersion is different from openapi value in DefinitionBody, SAM will missconfigure the updated openApi definition body.

Description of changes

When openapi is in the DefinitionBody, we use that value instead of OpenApiVersion property in the resource.

Description of how you validated changes

Transform tests covering both cases.

Checklist

Examples?

Please reach out in the comments if you want to add an example. Examples will be
added to sam init through aws/aws-sam-cli-app-templates.

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

@xazhao xazhao requested a review from a team as a code owner February 27, 2024 01:37
@xazhao xazhao changed the title fix: check if OpenApiVersion matches to openapi value in DefinitionBody fix: override OpenApiVersion when openapi exists in DefinitionBody Feb 28, 2024
@xazhao xazhao changed the title fix: override OpenApiVersion when openapi exists in DefinitionBody fix: normalize the open api version Feb 28, 2024
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

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

I don't see how we handle the scenario when open api version mismatches between definition body and api property.

@xazhao
Copy link
Contributor Author

xazhao commented Feb 28, 2024

I don't see how we handle the scenario when open api version mismatches between definition body and api property.

Basically when openapi exists in definition body, we use that value and ignore OpenApiVersion property with the following code:

normalized_open_api_version = definition_body.get("openapi", self.open_api_version)

@xazhao xazhao merged commit 6499b50 into aws:develop Feb 28, 2024
7 checks passed
aaythapa added a commit that referenced this pull request Mar 8, 2024
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.

5 participants