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

IntegerSchema instead NumberSchema at 2.4.0/2.4.1 #46

Closed
alexei-zaycev opened this issue Sep 4, 2014 · 3 comments
Closed

IntegerSchema instead NumberSchema at 2.4.0/2.4.1 #46

alexei-zaycev opened this issue Sep 4, 2014 · 3 comments
Milestone

Comments

@alexei-zaycev
Copy link

HI!

final ObjectMapper mapper = new ObjectMapper();
final JsonSchemaGenerator generator = new JsonSchemaGenerator(mapper);
final JsonSchema schema = generator.generateSchema(Double.class);
mapper.writeValue(System.out, schema);

at version 2.4.0/2.4.1 result:

{"type":"integer"}

at version 2.3.4 result:

{"type":"number"}
@cowtowncoder
Copy link
Member

Interesting. Right, double not an int (ditto for Double vs Integer)

@alexei-zaycev
Copy link
Author

in 2.4.3 the problem persists

pojo:

public class T {
    public final int x;
    public final double y;
}

schema generator:

final ObjectMapper mapper = new ObjectMapper();
final JsonSchemaGenerator generator = new JsonSchemaGenerator(mapper);
final JsonSchema schema = generator.generateSchema(T.class);
mapper.writeValue(System.out, schema);

result:

{
    "type":"object",
    "properties": {
        "x":{"type":"integer"},
        "y":{"type":"integer"}
    }
}

although it should be:

{
    "type":"object",
    "properties": {
        "x":{"type":"integer"},
        "y":{"type":"number"}
    }
}

@cowtowncoder cowtowncoder added this to the 2.4.4 milestone Nov 7, 2014
@cowtowncoder
Copy link
Member

Actual fix is in jackson-databind, but with 2.4.4 release it should be resolved. There is one residual problem with BigDecimal/BigInteger, which will be fully fixed in 2.5.0.

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