Skip to content

JSON Schema validation is not working #2401

@acl-cqc

Description

@acl-cqc

On main, this test added to hugr-core/src/hugr/serialize/test.rs passes:

#[test]
fn not_a_hugr() {
    let val = serde_json::Value::from("Hello, world!");
    NamedSchema::check_schemas(&val, get_testing_schemas(true));
}

Clearly it shouldn't! Adding this to testing_hugr_schema_live.json causes the schema violation to be detected (similarly for testing_hugr_schema_strict_live.json):

"$ref": "#/$defs/TestingHugr"

....but, lo, there are a bunch of other new failures in:

    hugr::serialize::test::proptest::prop_roundtrip_opdef
    hugr::serialize::test::proptest::prop_roundtrip_optype
    hugr::serialize::test::proptest::prop_roundtrip_poly_func_type
    hugr::serialize::test::proptest::prop_roundtrip_type
    hugr::serialize::test::proptest::prop_roundtrip_value

Moreover, the "non-testing" schemas will also need some kind of update - I conjecture possibly "$ref": "#/$defs/Package" (or a oneOf including package and SerialHugr?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions