Skip to content

Creating a json schema from a class containing EnumMap where all possible enum values are used as keys #376

Closed Answered by CarstenWickner
lmerynda asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Uprzejmy,

I've created an example showcasing how your described scenario can be configured:
https://github.com/victools/jsonschema-generator/blob/main/jsonschema-examples/src/main/java/com/github/victools/jsonschema/examples/EnumMapExample.java
The resulting schema looks like this:

{
    "$schema" : "https://json-schema.org/draft/2020-12/schema",
    "$defs" : {
        "JobDetails" : {
            "type" : "object",
            "properties" : {
                "trainingCosts" : {
                    "properties" : {
                        "wood" : {
                            "type" : "integer"
                        },
                        "food" : {
                            

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CarstenWickner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants