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

schemaType of LongSerializer is wrong #3742

Closed
luozhenyu opened this issue Jan 18, 2023 · 1 comment
Closed

schemaType of LongSerializer is wrong #3742

luozhenyu opened this issue Jan 18, 2023 · 1 comment
Milestone

Comments

@luozhenyu
Copy link
Contributor

luozhenyu commented Jan 18, 2023

Describe the bug
The schemaType of LongSerializer and ShortSerializer should be integer instead of number.
https://github.com/FasterXML/jackson-databind/blob/2.15/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java#L188-L190

Version information
2.x

To Reproduce

ObjectMapper mapper = new ObjectMapper();
JsonSchema jsonSchema = mapper.generateJsonSchema(Long.class);
System.out.println(mapper.writeValueAsString(jsonSchema));
// stdout: {"type":"number"}

Expected behavior

  1. Do you think we should fix it up? change the schemaType of LongSerializer and ShortSerializer from number to integer.
  2. I notice the interface SchemaAware is removed in 3.x , but the latest release is still 2.x . New developers may still override methods of SchemaAware. I think interface SchemaAware should be marked with @Deprecated.
@luozhenyu luozhenyu added the to-evaluate Issue that has been received but not yet evaluated label Jan 18, 2023
@cowtowncoder
Copy link
Member

@luozhenyu Yes, I think you are right, these should be changed to give more specific type. This can go in 2.15.

As to SchemaAware... it might make sense to mark it deprecated; the main problem is that this will lead to lots of warnings for serializer implementation in databind package.
But other 2 types in that package are indeed deprecated so maybe it should be.
Could you please file a separate issue suggesting adding deprecation?
And I'll go ahead change schema type under this issue.

@cowtowncoder cowtowncoder removed the to-evaluate Issue that has been received but not yet evaluated label Jan 19, 2023
@cowtowncoder cowtowncoder changed the title The schemaType of LongSerializer is wrong schemaType of LongSerializer is wrong Jan 19, 2023
@cowtowncoder cowtowncoder added this to the 2.15.0 milestone Jan 19, 2023
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