FasterXML / FasterXML/jackson-module-jsonSchema

"minimum": 0.0 is not set when @Min(0) is used

Offen
#83 9 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
387
Forks
136
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Consider the following:

```
public class Person {
@Min(0)
private int id;
}
```

when serialized to json schema, will output:

```
{
"type" : "object",
"id" : "urn:jsonschema:xxx:Person",
"properties" : {
"id" : {
"type" : "integer"
}
}
```

instead of:

```
{
"type" : "object",
"id" : "urn:jsonschema:xxx:Person",
"properties" : {
"id" : {
"type" : "integer",
"minimum" : 0.0
}
}
```

everything works fine if we define any other number than 0.

By looking at the ValidationConstraintResolver/AnnotationConstraintResolver, why the minimumValue/maximumValue is always converted to double?

When the type is integer, shoudn't the minimum/maximum value stays to an integer format?
When I look at the following documentation:
http://spacetelescope.github.io/understanding-json-schema/reference/numeric.html
Under range, the integer format is preserved. Should I open different issues for this?

Thank you very much!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.