Skip to content

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

@fuj1g0n

Description

@fuj1g0n
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions