[BUG] Params named "default" get replaced with "_default", resulting in incompatible clients
See original GitHub issueDescription
My api has a request object that contains a key called default
, however when I generate client code from this spec, it gets converted to _default
. Since my api expects default
, the generated client code does not work.
I’m guessing this is escaping that happens in java since default
is a java keyword. Is there any way around this?
Expected generated:
export interface RbacAddRoleRequest {
default?: boolean;
Actual generated:
export interface RbacAddRoleRequest {
_default?: boolean;
openapi-generator version
4.0.0
OpenAPI declaration file content or url
https://gist.github.com/seanlaff/d2aef0244adeeea95c1396952b28d987
Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.0.0-beta generate \
-i /local/test.yaml \
-g typescript-axios \
-o /local/out/ts
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:14 (7 by maintainers)
Top Results From Across the Web
How to set default query string parameter value for webapi?
The name parameter needs to have a default value, if I use string name = "world", it seems not working and throw "errors":{"name":["The...
Read more >Bug Patterns - Error Prone
Defaults for AutoValue Builders should be set in the factory method ... The called constructor accepts a parameter with the same name and...
Read more >"Least Astonishment" and the Mutable Default Argument
then if default parameters were bound at function execution rather than ... Now, suppose the behaviour of defaults could be changed so that...
Read more >Redis-specific parameters - Amazon ElastiCache for Redis
You can't change the values of any parameters in the default parameter group. ... If enabled, clients who attempt to write to a...
Read more >Breaking changes in 7.0 | Elasticsearch Guide [7.17] | Elastic
This default limit can be changed for a particular index with the index setting ... Using the old name in new indices created...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I use a dirty sed to get around this for now
gsed -i 's/_default?:/default?:/' src/models/*;
I switched to Autorest now. Works like a charm, and is so much more stable and reliable. It also supports way more features it seems.