Skip to content

[Refactor] String type in Json Schema #363

@giulong

Description

@giulong

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:

Image

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.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions