Skip to content

glaze silently has different JSON schemas for parsing and serializaition due to partial parsing #2508

@CoinFuMasterShifu

Description

@CoinFuMasterShifu

I have detected differences between input and output JSON schemas:
Output schemas

  • objects should have the required: [ <required keys list>] property because after serialization they are guarranteed to exist.
  • arrays that come from tuples should also have the minItems set to the same value of maxItems property because the tuple will always serialize with full length.

Input schemas

  • My understanding of the library is not deep enough but I guess due to partial parsing input schemas for objects do not have the required property.
  • In a recent pull jsonchema prefixItems for tuples and arrays #2461 you added the maxItems for tuple parsing but did not include the minElements because glaze supports partial parsing (I don't find that anymore but I think I have read it)

I think we should make this difference explicit and pass an option to whether we want the input or output JSON schema of a C++ struct because strictly speaking they are different since output has other guarrantees than input has requirements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions