pytest_jsonschema_snapshot.tools.genson_addon

Submodules

Classes

JsonToSchemaConverter

A thin wrapper around genson.SchemaBuilder.

Package Contents

class JsonToSchemaConverter(
schema_uri: str = 'https://json-schema.org/draft/2020-12/schema',
*,
format_mode: _FormatMode = 'on',
)[source]

A thin wrapper around genson.SchemaBuilder.

add_object(obj: Any, path: str = 'root') None[source]

Modify the schema to accommodate an object.

Parameters:

obj – any object or scalar that can be serialized in JSON

to_schema() Dict[str, Any][source]

Generate a schema based on previous inputs.

Return type:

dict