Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
martin-tarjanyi opened this issue Feb 25, 2021 · 1 comment
Closed

Comments

@martin-tarjanyi
Copy link
Contributor

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."
					}
				}
			}
		}
	}
}
@bnasslahsen
Copy link
Collaborator

@martin-tarjanyi,

The resolution is not handled by springdoc-openapi.
You can check the following schema, generated by swagger-core.

	ResolvedSchema resolvedSchema =	ModelConverters.getInstance()
				.resolveAsResolvedSchema(
						new AnnotatedType(Request.class));

You can ask the swagger-core project instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants