You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I have a polymorphic class and add @JsonSchemaDescription at the visible type property, the description is ignored and not put in the Schema.
While generating the schema, I see this log (thanks for that, guess it saved some hours of research):
WARN com.kjetland.jackson.jsonSchema.JsonSchemaGenerator - Ignoring property 'type' in [simple type, class java.lang.String] since it has already been added, probably as type-property using polymorphism
Here is a simple example to reproduce:
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
property = "type",
include = JsonTypeInfo.As.EXISTING_PROPERTY,
visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = SomeSuperclass.SomeSubType.class, name = "some"),
@JsonSubTypes.Type(value = SomeSuperclass.SomeOtherSubType.class, name = "other")
})
publicclassSomeSuperclass {
@JsonSchemaDescription("Defines the type.")
privateStringtype;
publicStringgetType() {
returntype;
}
publicvoidsetType(Stringtype) {
this.type = type;
}
publicstaticclassSomeSubTypeextendsSomeSuperclass {}
publicstaticclassSomeOtherSubTypeextendsSomeSuperclass {}
}
So my description is missing. I als tried to merge the description in the property spec with different variants of @JsonSchemaInject and @JsonSchemaString at the property, the super class and the sub classes. None of my variants did the trick.
Is there any workaround to add a description to a type property that is used with @JsonTypeInfo?
Hi,
when I have a polymorphic class and add
@JsonSchemaDescription
at the visible type property, the description is ignored and not put in the Schema.While generating the schema, I see this log (thanks for that, guess it saved some hours of research):
Here is a simple example to reproduce:
I get JSON Schema for the two subtypes like this:
So my description is missing. I als tried to merge the description in the property spec with different variants of
@JsonSchemaInject
and@JsonSchemaString
at the property, the super class and the sub classes. None of my variants did the trick.Is there any workaround to add a description to a type property that is used with
@JsonTypeInfo
?Thanks in advance for any ideas that help.
My desired output would be like this:
The text was updated successfully, but these errors were encountered: