Skip to content

Schema description of one field overrides descriptions of other fields of same class #3900

Closed
@pchmieli

Description

@pchmieli

Let's take an example of two simple classes:

public class GeoPointDto {

	@Schema(description = "Longitude of geo point ( -180, 180 >")
	private double lon;

	@Schema(description = "Latitude of geo point < -90, 90 >")
	private double lat;
}
public class RouteDto {

	@Schema(description = "Point where the route begins")
	private GeoPointDto startPoint;

	@Schema(description = "Intermediate point of the route")
	private GeoPointDto intermediatePoint;

	@Schema(description = "Point where the route ends")
	private GeoPointDto endPoint;
}

Expected behavior is to have three fields inside RouteDto with different descirption each.
Actual behavior is that all fields has same description = "Point where the route ends" which is the description of third field.

UI:
image

JSON:

  "components" : {
    "schemas" : {
      "RouteDto" : {
        "type" : "object",
        "properties" : {
          "startPoint" : {
            "$ref" : "#/components/schemas/GeoPointDto"
          },
          "intermediatePoint" : {
            "$ref" : "#/components/schemas/GeoPointDto"
          },
          "endPoint" : {
            "$ref" : "#/components/schemas/GeoPointDto"
          }
        }
      },
      "GeoPointDto" : {
        "type" : "object",
        "properties" : {
          "lon" : {
            "type" : "number",
            "description" : "Longitude of geo point ( -180, 180 >",
            "format" : "double"
          },
          "lat" : {
            "type" : "number",
            "description" : "Latitude of geo point < -90, 90 >",
            "format" : "double"
          }
        },
        "description" : "Point where the route ends"
      }
    }
  }

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