-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Better importMapping handling when aliasing references #4350
Conversation
- type of TypeAlias changed from 'string' to 'object' (not sure if importMapping is supposed also for 'string' types...) - there might be better ways to write the test, it's kind of a brute force test (generate a file and parse it with a regexp)
The patch from @bkoziak also fixes my test case OpenAPITools#3589
Do I need to do anything so that the PR can be merged? Should I declare the Bug #3589 as fixed now or only once this PR has been merged? |
UDPATE: merged latest master into this branch but got the following error:
Updated that test case but found that python experimental petstore samples will have some changes such as --- a/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py
+++ b/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py
@@ -538,7 +538,7 @@ class FakeApi(object):
async_req (bool): execute request asynchronously
Returns:
- outer_number.OuterNumber
+ float
If the method is called asynchronously, returns the request
thread.
"""
@@ -565,7 +565,7 @@ class FakeApi(object):
self.fake_outer_number_serialize = Endpoint(
settings={
- 'response_type': (outer_number.OuterNumber,),
+ 'response_type': (float,), so I need some time to figure out why there's a change to codegenOperation.returnBaseType: - Assert.assertEquals(codegenOperation.returnBaseType, "V1beta3Binding");
+ Assert.assertEquals(codegenOperation.returnBaseType, "v1beta3_binding.V1beta3Binding"); |
I found the reason for the test failure (my branch introduced a new method in an ancestor class of the I'll have a fix shortly |
Fixes broken unit test after merge from master
@pe-st thanks for the quick fix. All tests passed. I'll take a look tomorrow and merge if no question from me or anyone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed and I'm ok with the approach to use import mapping to change how unalias-reference works. Let's have this in 4.3.0 release and see if our users have other feedback on this.
* type aliasing issue * Add example OpenAPI document from issue 3589 OpenAPITools#3589 * Add test to reproduce the issue - type of TypeAlias changed from 'string' to 'object' (not sure if importMapping is supposed also for 'string' types...) - there might be better ways to write the test, it's kind of a brute force test (generate a file and parse it with a regexp) * Remove duplicate test file * Add new method override handleMethodResponse Fixes broken unit test after merge from master Co-authored-by: bkoziak <[email protected]> Co-authored-by: William Cheng <[email protected]>
@pe-st thanks for the PR, which has been included in the 4.3.0 release: https://twitter.com/oas_generator/status/1243455743937789952 |
Fix from @bkoziak to make
importMapping
work for Java: #3589All the code in this PR was contributed by @bkoziak, I did just the merging and added one unit test.
PR checklist
./bin/
(or Windows batch scripts under.\bin\windows
) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the code or mustache templates for a language ({LANG}
) (e.g. php, ruby, python, etc).master
,4.1.x
,5.0.x
. Default:master
.