-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[typescript-axios] Fix model property naming #10447
[typescript-axios] Fix model property naming #10447
Conversation
@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) |
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.
LGtM
@aiven-hh can you please resolve merge the latest master and re-generate the samples? |
Disables MODEL_PROPERTY_NAMING for typescript-axios generator as this was never supported (templates have no mapping between original property names and formatted names). Wraps all properties in model interfaces with '' to support most characters except ' for now. Also fixes missing options typing that was any before.
34a8637
to
ef3c20b
Compare
Rebased, all major changes still in the first commit. New sample and |
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.
LGTM
@aiven-hh thanks for your contribution. One minir thing: if the model property name contains a dot, it is still converted to underscore |
Looks like this breaks the build:
Ref: https://app.travis-ci.com/github/OpenAPITools/openapi-generator/builds/238968898 Can you please take a look when you've time? |
@wing328 Hmm, the change exposed another bug in the original templates, the generated code uses options.query when axios does not actually use |
@macjohnny are you sure? If you check the original example here: Lines 1797 to 1803 in 026dd8d
openapi-generator/samples/client/petstore/typescript-axios/builds/test-petstore/api.ts Lines 1556 to 1569 in 026dd8d
|
@aiven-hh would you like to provide a fix? Or should we first revert the PR? |
Whatever you prefer, I can send the fix pr in a few minutes after I verify the fix. |
@macjohnny the fix is now in #10512 |
The property names in typescript-axios models were using formatted names instead of baseName and the template has no mapping to original baseName so this PR introduces a fix by:
''
for now to support at least all characters except 'This should fix #9524.
Also adds fake petstore example to be able verify these changes at least by eye, see
samples/client/petstore/typescript-axios/builds/test-petstore/api.ts
andSpecialModelName
interface as an example.In addition adds typing for options that was typed as any before.
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(5.3.0),6.0.x