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

Add support for title and description on Enums #975

Closed
john-tipper opened this issue Apr 30, 2019 · 0 comments
Closed

Add support for title and description on Enums #975

john-tipper opened this issue Apr 30, 2019 · 0 comments
Milestone

Comments

@john-tipper
Copy link
Contributor

Enums defined at the root level do not support titles or descriptions.

{
        "type" : "string",
        "title": "MyEnumTitle",
        "description": "Some description of my enum.",
        "enum" : ["one", "secondOne", "3rd one"]
}

The above json does not cause either the title or description to be created for the enum. However, the following does generate docs:

{
        "type" : "object",
        "properties" : {
            "myEnum" : {
                "title": "MyEnumTitle",
                "description": "Some description of my enum.",
                "type" : "string",
                "enum" : ["one", "secondOne", "3rd one"]
            }
        }
}

This appears to be because enums are treated differently to objects: they do not apply the TitleRule or Description rule (https://github.com/joelittlejohn/jsonschema2pojo/blob/master/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/EnumRule.java#L100).

john-tipper added a commit to john-tipper/jsonschema2pojo that referenced this issue Apr 30, 2019
john-tipper added a commit to john-tipper/jsonschema2pojo that referenced this issue Apr 30, 2019
…' of github.com:john-tipper/jsonschema2pojo into joelittlejohn#975-add-enum-documentation
@joelittlejohn joelittlejohn added this to the 1.0.2 milestone May 1, 2019
john-tipper added a commit to john-tipper/jsonschema2pojo that referenced this issue May 1, 2019
Fix joelittlejohn#975: Add support for root level enum titles and descriptions. (#…
@joelittlejohn joelittlejohn changed the title Title and description not supported for Enums Support title and description on Enums Jan 8, 2020
@joelittlejohn joelittlejohn changed the title Support title and description on Enums Add support for title and description on Enums Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants