genson_generator module¶
A JSON schema generation tool¶
-
class
gemseo.third_party.genson_generator.
Schema
(merge_arrays=True, additional_items=True, additional_props=True, match_props=[], exclude_at_merge=None)[source]¶ Bases:
object
Basic schema generator class. Schema objects can be loaded up with existing schemas and objects before being serialized.
Builds a schema generator object.
merge_arrays (default True): Assume all array items share the same schema (as they should). The alternate behavior is to create a different schema for each item in every array.
additional_items (default ‘True’): If True, allow tuple-validated arrays to be followed by unvalidated items. If False, generate an “additionalItems”: False element so that array items not specified in the schema cause a ValidationError. Not used with list-validated (merged) arrays.
additional_props (default ‘True’): If True, allow objects to include unvalidated properties. If False, generate an “additionalProperties”: False element so that properties not specified in the schema cause a ValidationError.
match_props (default ‘[]’): List of regular expressions to compare with property keys. Properties with matching keys share the same “patternProperties” schema.
-
add_object
(obj, descr=None)[source]¶ Modify the schema to accomodate an object.
- Parameters
obj – required
a – JSON object to use in generate the schema