Skip to content

Name classes for schema URI by default #35

@gertvv

Description

@gertvv

The following schema (example repo):

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/schema/outer.schema.json",
  "type": "object",
  "properties": {
    "inners": {
      "type": "array",
      "items": {
        "$ref": "classpath:/com/example/inner.schema.json"
      },
    },
    "additionalInner": {
      "$ref": "classpath:/com/example/inner.schema.json"
    }
  },
  "required": [
    "inners"
  ]
}

Currently generates three classes: com.example.Outer, com.example.Inners, and com.example.AdditionalInner. I would suggest that naming the class after the schema URI (if there is one), as is done for the top-level schema, would result in more meaningful class names (com.example.Inner) and less duplication.

Follow-up to #29.

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