Jyro 0.7.6, Now with Schema Validation

We've added two new functions to the Jyro standard library: ValidateSchema and GetSchemaErrors. These bring JSON Schema validation directly into your scripts, making it easy to validate API responses, user input, or any structured data before processing.

These can be used when:

  • Consuming external APIs where response formats might vary

  • Validating user-submitted data before processing

  • Enforcing contracts between script components.

ValidateSchema(data, schema) returns a simple boolean - pass or fail. Use this when you just need to know if data conforms to your schema:

var isValid = ValidateSchema(apiResponse, expectedSchema)
if not isValid then
    fail "Invalid response format"
end

GetSchemaErrors(data, schema) returns an array of error objects when validation fails, each with path, keyword, and message properties. Use this when you need to know what failed:

var errors = GetSchemaErrors(userInput, formSchema)
if Length(errors) > 0 then
    Data.validationErrors = errors
end

These functions are powered by JsonSchema.Net, supporting JSON Schema Draft 2020-12 down to Draft 6. This means you get full support for type, required, properties, items, enum, minimum/maximum, pattern, and all the other schema keywords you'd expect.

Previous
Previous

Jyro 0.8.0

Next
Next

Jyro 0.7.5