Override the JsonPropertyDescription for $ref

Author: sureshmsCreated Feb 6, 2023Updated Jan 31, 2026

This project is awesome. This is the heart of open-source project we are building - OpenMetadata. Thank you .

In the following case where type.json has the following:

{
  "definitions": {
    "entityName": {
      "description": "Name that identifies an entity.",
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    }
  }
}

This type is reused to defined entity names as shown below in person.json as follows:

{
  "properties": {
    "name": {
      "description": "Name of the person.",
      "$ref": "type.json#/definitions/entityName"
    }
  }
}

When code is generated for Person.java, the name field has JsonPropertyDescription that corresponds to the $ref Name that identifies an entity, instead of Name of the person. Is there any way to override the $ref description with the description where it is being referenced?

Source: joelittlejohn/jsonschema2pojo