pyoaev.configuration.connector_config_schema_generator

Module Contents

class pyoaev.configuration.connector_config_schema_generator.ConnectorConfigSchemaGenerator(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE)

Bases: pydantic.json_schema.GenerateJsonSchema

!!! abstract “Usage Documentation”

[Customizing the JSON Schema Generation Process](../concepts/json_schema.md#customizing-the-json-schema-generation-process)

A class for generating JSON schemas.

This class generates JSON schemas based on configured parameters. The default schema dialect is [https://json-schema.org/draft/2020-12/schema](https://json-schema.org/draft/2020-12/schema). The class uses by_alias to configure how fields with multiple names are handled and ref_template to format reference names.

Attributes:
schema_dialect: The JSON schema dialect used to generate the schema. See

[Declaring a Dialect](https://json-schema.org/understanding-json-schema/reference/schema.html#id4) in the JSON Schema documentation for more information about dialects.

ignored_warning_kinds: Warnings to ignore when generating the schema. self.render_warning_message will

do nothing if its argument kind is in ignored_warning_kinds; this value can be modified on subclasses to easily control which warnings are emitted.

by_alias: Whether to use field aliases when generating the schema. ref_template: The format string used when generating reference names. core_to_json_refs: A mapping of core refs to JSON refs. core_to_defs_refs: A mapping of core refs to definition refs. defs_to_core_refs: A mapping of definition refs to core refs. json_to_defs_refs: A mapping of JSON refs to definition refs. definitions: Definitions in the schema.

Args:

by_alias: Whether to use field aliases in the generated schemas. ref_template: The format string to use when generating reference names.

Raises:

JsonSchemaError: If the instance of the class is inadvertently reused after generating a schema.

static dereference_schema(schema_with_refs)

Return a new schema with all internal $ref resolved.

static flatten_config_loader_schema(root_schema: dict)

Flatten config loader schema so all config vars are described at root level.

Parameters:

root_schema – Original schema.

Returns:

Flatten schema.

static filter_schema(schema)
generate(schema, mode='validation')

Generates a JSON schema for a specified schema in a specified mode.

Args:

schema: A Pydantic model. mode: The mode in which to generate the schema. Defaults to ‘validation’.

Returns:

A JSON schema representing the specified schema.

Raises:

PydanticUserError: If the JSON schema generator has already been used to generate a JSON schema.

nullable_schema(schema)

Generates a JSON schema that matches a schema that allows null values.

Args:

schema: The core schema.

Returns:

The generated JSON schema.

Notes:

This method overrides GenerateJsonSchema.nullable_schema to generate schemas without anyOf keyword.