Skip to content

JSON Schema example no longer works #25

@ErikBjare

Description

@ErikBjare

The example at https://github.com/rustless/valico#json-schema has a few issues:

When I try to run something very similar to it I get the following errors:

error[E0308]: mismatched types
  --> main.rs:82:49
   |
82 |     let event_schema = scope.compile_and_return(event_schema_json.clone(), true).ok().unwrap();
   |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `rustless::Value`, found enum `serde_json::Value`
   |
   = note: expected type `rustless::Value`
              found type `serde_json::Value`

error[E0308]: mismatched types
  --> main.rs:83:52
   |
83 |     println!("Is valid: {}", event_schema.validate(&event_schema_json).is_valid());
   |                                                    ^^^^^^^^^^^^^^^^^^ expected enum `rustless::Value`, found enum `serde_json::Value`
   |
   = note: expected type `&rustless::Value`
              found type `&serde_json::Value`

I've tried to figure out why this happens by looking at scope.compile_and_return but as far as I can gather it's using serde_json::Value and not rustless::Value (which I can't find the definition for).

I'm unable to get this working in anyway, so assistance/clarification very welcome.

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