Skip to content

preserve float/double distinction in JSON schema output via format metadata#9141

Open
akkik04 wants to merge 1 commit into
google:masterfrom
akkik04:akshith/test
Open

preserve float/double distinction in JSON schema output via format metadata#9141
akkik04 wants to merge 1 commit into
google:masterfrom
akkik04:akshith/test

Conversation

@akkik04

@akkik04 akkik04 commented Jun 15, 2026

Copy link
Copy Markdown

Directly related to: #9071

Summary

This PR addresses an issue where the JSON schema generator does not distinguish between BASE_TYPE_FLOAT and BASE_TYPE_DOUBLE, emitting both as: "type": "number".This makes the schema less precise for downstream consumers that rely on JSON Schema for: documentation, code generation, and schema introspection

Change

This change updates idl_gen_json_schema.cpp to preserve floating-point precision information using a new "format" key in the metadata.

Testing

  • flattests passes locally upon re-building flatc with my new changes
    -verified JSON schema output using flatc --jsonschema shows correct distinction between float and double

@akkik04 akkik04 requested a review from dbaileychess as a code owner June 15, 2026 23:44
@google-cla

google-cla Bot commented Jun 15, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions Bot added c++ codegen Involving generating code from schema json labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant