h1st.schema.schema_validator module

class h1st.schema.schema_validator.SchemaValidator[source]

Bases: object

validate(data, schema)h1st.schema.schema_validation_result.SchemaValidationResult[source]

Validate the given data with a schema.:

data = [1, 2, 3, 4, 5]  # list of integer
schema = {'type': list, 'item': str}
result = SchemaValidator().validate(data, schema)
print(result.errors)

The current implementation infers the schema from the data, and then compare two schema together. In the future, we will use data directly to compare the schema.

Parameters
  • data – data to be validated, it can be anything.

  • schema – target schema

Returns

validation result

validate_downstream_schema(source, target)h1st.schema.schema_validation_result.SchemaValidationResult[source]

Compare two schema and return the differences.

Parameters
  • source – source schema

  • target – target schema

Returns

validation result