Skip to content

fix: Changes to address the field name error: json shadows a BaseModel attribute #270

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 6 commits into from
Apr 11, 2025

Conversation

rsareddy0329
Copy link
Contributor

Issue #, if available:
aws/sagemaker-python-sdk#4944

Description of changes:
Error details:
NameError: Field name "json" shadows a BaseModel attribute; use a different field name with "alias='json'"

Updated the shapes codegen scripts and service json file to handle the "alias" if included in a structure field type.

Test

  • Unit tests are succesful - pytest tst
  • Built the sagemakerCore locally and installing the build files on personal aws account and tested with sagemaker core example notebook. Confirmed with the imports provided in the issue, there is no error or warning message after the change - from sagemaker.jumpstart.types import JumpStartLaunchedRegionInfo

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@rsareddy0329 rsareddy0329 requested a review from a team as a code owner March 27, 2025 08:44
@rsareddy0329 rsareddy0329 requested a review from nargokul March 27, 2025 08:44
Comment on lines 30862 to 30866
"Json":{
"JsonFormat":{
"shape":"MonitoringJsonDatasetFormat",
"documentation":"<p>The JSON dataset used in the monitoring job</p>"
"documentation":"<p>The JSON dataset used in the monitoring job</p>",
"alias": "json"
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

SO this is going to get overridden on the next botocore sync .

I think we should handle this condition in codegen engine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is handled in the codegen as well.
Updated the service json and shapes_extractor and shapes_codegen accordingly.
This file was generated using the codegen run in local.

@rsareddy0329 rsareddy0329 merged commit 9e15426 into aws:main Apr 11, 2025
13 of 14 checks passed
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.

2 participants