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 overriding imports #702

Merged
merged 3 commits into from
Nov 7, 2024
Merged

Conversation

habara-k
Copy link
Contributor

@habara-k habara-k commented Nov 6, 2024

This resolves #698.

@@ -1368,7 +1368,7 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
modelsToImport.add("from " + packageName + ".models." + underscore(modelImport) + " import " + modelImport);
}

model.getVendorExtensions().putIfAbsent("x-py-model-imports", modelsToImport);
model.getVendorExtensions().put("x-py-model-imports", modelsToImport);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The method putIfAbsent does nothing because the value is set in AbstractPythonCodegen.java at line 1022, which is called by PythonNextgenCustomClientGenerator.java at line 1085.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other parts will be fixed in #703.

@Yang-33
Copy link
Contributor

Yang-33 commented Nov 6, 2024

Thank you! Let me approve this change after #704 is merged, and run the new job by fetching the change into this PR. If there is no extra changes(= this change doesn't forget committing some files), it's ok for me.

@Yang-33
Copy link
Contributor

Yang-33 commented Nov 6, 2024

A change to detect import failure not to cause #698
-> #701

@Yang-33 Yang-33 merged commit e6bac30 into line:master Nov 7, 2024
10 checks passed
habara-k added a commit that referenced this pull request Nov 19, 2024
This wil be merged after
#702.

## Changes

As mentioned in
#702 (comment),
`putIfAbsent` does not overwrite values, so it is meaningless.
This change is intended to correct all instances where it is used,
although it currently does not affect the generated codes.

---------

Co-authored-by: Yuta Kasai <[email protected]>
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.

Can't import TextMessage in version 3.14.0
2 participants