spectrum
spectrum copied to clipboard
[Refactor] String type in Json Schema
These are all valid strings in yaml:
a: "quoted"
b: 'with apostrophe'
c: just text
d: 123
e: 1.23
f: true
The issue is that the schema validation raises a warning if we have unquoted non-strings values:
To get rid of this warning, we currently need to explicitly annotate the corresponding field in the Java class with @JsonSchemaTypes:
@JsonPropertyDescription("height of the video in the extent report. Check https://developer.mozilla.org/en-US/docs/Web/CSS/height")
@JsonSchemaTypes({String.class, int.class})
private String height;
We would like to have the JsonSchemaInternalGeneratorModule.java automatically resolve all Java String fields to multiple types such as:
- String
- int
- double
- boolean
Add a new target type override resolver to the Json schema generator and remove the @JsonSchemaTypes from String fields.
Hello @giulong, may I take a look at this one?