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

[General] default value of enum property that are $ref-ed is not recognized #1323

Closed
fujigon opened this issue Oct 26, 2018 · 2 comments
Closed

Comments

@fujigon
Copy link
Contributor

fujigon commented Oct 26, 2018

Description

openapi-generator doesn't recognize default value of enum property that are $ref-ed.

openapi-generator version

current master eb4dfe0

OpenAPI declaration file content or url

https://gist.github.com/fujigon/4ae17fc6497cb599d1dfb53c2ebeadea#file-openapi-yaml

Command line used for generation
# git clone, etc
mvn package
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i my-api-spec/openapi.yaml -g jaxrs-jersey -o generated-code/ -v
Steps to reproduce

When I execute the generator with the gisted openapi.yaml file, I get
https://gist.github.com/fujigon/4ae17fc6497cb599d1dfb53c2ebeadea#file-inlineresponsedefault-java

The problem is that default value of enum property that are $ref-ed is null

https://gist.github.com/fujigon/4ae17fc6497cb599d1dfb53c2ebeadea#file-inlineresponsedefault-java-L39

Related issues/PRs
Suggest a fix/enhancement

I investigated and found that https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java#L703 is the problem.

current implementation of unaliasSchema method doesn't return the ref-resolved schema.

I'm working to file the PR to fix this issue.

@jmini
Copy link
Member

jmini commented Feb 12, 2019

It sounds like #1981 what I have tried to address with #2001

During my tests and for @ajdergute it seems to work.

So we need to understand what additional case you need to support.

@fujigon
Copy link
Contributor Author

fujigon commented Feb 21, 2019

I confirmed that following up issue #2127 is fixed and now this issue is completely resolved.

Thanks for support! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants