Skip to content

@Schema annotation is not picked up when using @JsonValue from Jackson #1077

@martin-tarjanyi

Description

@martin-tarjanyi

Describe the bug
When using @JsonValue from Jackson, the @Schema on the field is not picked up by swagger and not present in the docs.

To Reproduce

  • Spring Boot 2.4.2
  • Springdocs 1.5.2
    class Request {
        @Schema(description = "Description of ID.")
        private Id id;

        public Id getId() {
            return id;
        }

        public void setId(Id id) {
            this.id = id;
        }
    }
    class Id {
        private String value;

        @JsonValue
        public String getValue() {
            return value;
        }
    }

Actual API docs

{
	"components": {
		"schemas": {
			"Request": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string"
					}
				}
			}
		}
	}
}

Expected behavior
Expected API Docs

{
	"components": {
		"schemas": {
			"Request": {
				"type": "object",
				"properties": {
					"id": {
						"type": "string",
						"description": "Description of ID."
					}
				}
			}
		}
	}
}

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