You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What
Add a flatc importer for JSON Schema that reconstructs the same IR you’d get from parsing the original .fbs, when the JSON Schema was produced by FlatBuffers’ exporter.
Why
Complete the round-trip (IDL → JSON Schema → IR) to reduce friction for teams that start with JSON Schema and to enable deterministic CI tests.
How
• New mode: flatc --schema-in path/to/schema.json [--lang ...]
• Prefer x-flatbuffers-* hints emitted by the exporter.
• Map JSON Schema → FlatBuffers:
• type: object → table; x-flatbuffers-struct: true → struct
• type: array → vector
• integer/string enums → enum (respect x-flatbuffers-enum-base)
• oneOf (+ discriminator/x-flatbuffers-union) → union
• $defs/$ref → named types/refs; required → (required); default → field default
• Map-like additionalProperties with x-flatbuffers-map: true
• Type inference from minimum/maximum:
• Choose narrowest signed/unsigned scalar (byte…ulong) covering bounds
• number defaults to double unless x-flatbuffers-float:"float"
• Clear diagnostics for unmappable features (e.g., complex allOf, patternProperties).
Done when
• Importing JSON Schemas generated by flatc yields IR ≡ importing the source .fbs.
• Minimal-width integer/unsigned types are inferred correctly from bounds.
• Unions/enums/structs/tables and FB attributes round-trip exactly.
• Helpful errors for unsupported constructs.
• Tests: golden round-trip corpus, numeric-inference property tests, unions/maps cases.
Activity