Skip to content

Commit

Permalink
Fix #46
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Nov 7, 2014
1 parent 8180c0d commit c6c5c42
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Project: jackson-module-jsonSchema

2.4.4 (not yet released)

#46: Incorrect number type for `Double`, `Float` and `BigDecimal`.
(reported by Alexei Z, alexei-zaycev@github)
#47: VisitorContext results in incomplete json schema output
(reported by Greg A)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.fasterxml.jackson.module.jsonSchema;

import java.math.*;

import com.fasterxml.jackson.databind.ObjectMapper;

public class TestJDKTypes extends SchemaTestBase
{
private final ObjectMapper MAPPER = new ObjectMapper();

/**
* Test simple generation for simple/primitive numeric types
*/
public void testSimpleNumbers() throws Exception
{
JsonSchemaGenerator generator = new JsonSchemaGenerator(MAPPER);
JsonSchema schema;

schema = generator.generateSchema(Long.class);
assertEquals("{\"type\":\"integer\"}", MAPPER.writeValueAsString(schema));

/* 07-Nov-2014, tatu: Won't work correctly before 2.5, due to various things; will work
* with 2.5. Uncomment then.
*/
/*
schema = generator.generateSchema(BigInteger.class);
assertEquals("{\"type\":\"integer\"}", MAPPER.writeValueAsString(schema));
*/

schema = generator.generateSchema(Double.class);
assertEquals("{\"type\":\"number\"}", MAPPER.writeValueAsString(schema));

schema = generator.generateSchema(BigDecimal.class);
assertEquals("{\"type\":\"number\"}", MAPPER.writeValueAsString(schema));

}
}

0 comments on commit c6c5c42

Please sign in to comment.