avro icon indicating copy to clipboard operation
avro copied to clipboard

Fix Avro integer to JSON type mapping in specification documentation

Open glywk opened this issue 11 months ago • 5 comments

What is the purpose of the change

This pull request fix the mapping type between Avro Type and JSON type for integral numbers

Verifying this change

This change concerns only documentation

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

glywk avatar Jan 14 '25 23:01 glywk

draft-bhutton-json-schema-validation-01 supports "type": "integer".

What justifies changing already released versions of the specification?

KalleOlaviNiemitalo avatar Jan 15 '25 07:01 KalleOlaviNiemitalo

Standard ECMA-404 (The JSON Data Interchange Syntax) 2nd edition does not mention "integer". For numbers, it defines only syntax and does not specify which differences must or must not be ignored by parsers; for example, whether 1E0 is the same as 1E00.

KalleOlaviNiemitalo avatar Jan 15 '25 08:01 KalleOlaviNiemitalo

draft-bhutton-json-schema-validation-01 supports "type": "integer".

What justifies changing already released versions of the specification?

This patch does not change the code of the released version. It only fixes the specifications available on the site. I propose to patch all the release documentation to provide proper website documentation for people who are not able to upgrade to the latest version immediately for some reason.

glywk avatar Jan 15 '25 23:01 glywk

Standard ECMA-404 (The JSON Data Interchange Syntax) 2nd edition does not mention "integer". For numbers, it defines only syntax and does not specify which differences must or must not be ignored by parsers; for example, whether 1E0 is the same as 1E00.

The RFC8259 values does not defined integer as a valid type. All are include in numbers

glywk avatar Jan 15 '25 23:01 glywk

Although the RFC does indeed not define an integer type, I think we should follow the JSON Schema spec on this:

  • int and long cannot have a fractional part
  • whole numbers are ubiquitous enough to warrant a shorter definition than "number without a factional part"

Based on the ubiquity of integer numbers, one can even argue that the addition of integer in JSON schemas actually fixes an omission in the RFC (just as one can argue the opposite, because it makes the spec simpler).

opwvhk avatar Jun 10 '25 14:06 opwvhk