connexion.json_schema

Module containing all code related to json schema validation.

Module Contents

Classes

ExtendedSafeLoader

Extends the yaml SafeLoader to coerce all keys to string so the result is valid json.

FileHandler

Handler to resolve file refs.

URLHandler

Handler to resolve url refs.

Functions

resolve_refs(spec, store=None, handlers=None)

Resolve JSON references like {"$ref": <some URI>} in a spec.

allow_nullable(validation_fn: Callable) → Callable

Extend an existing validation function, so it allows nullable values to be null.

validate_required(validator, required, instance, schema)

validate_readOnly(validator, ro, instance, schema)

validate_writeOnly(validator, wo, instance, schema)

Attributes

default_handlers

NullableTypeValidator

NullableEnumValidator

Draft4RequestValidator

Draft4ResponseValidator

class connexion.json_schema.ExtendedSafeLoader(stream)

Bases: yaml.SafeLoader

Extends the yaml SafeLoader to coerce all keys to string so the result is valid json.

Initialize the scanner.

NON_PRINTABLE
ESCAPE_REPLACEMENTS
ESCAPE_CODES
DEFAULT_TAGS
bool_values
inf_value = 1e+300
nan_value
timestamp_regexp
yaml_constructors
yaml_multi_constructors
DEFAULT_SCALAR_TAG = tag:yaml.org,2002:str
DEFAULT_SEQUENCE_TAG = tag:yaml.org,2002:seq
DEFAULT_MAPPING_TAG = tag:yaml.org,2002:map
yaml_implicit_resolvers
yaml_path_resolvers
extended_construct_mapping(self, node, deep=False)
peek(self, index=0)
prefix(self, length=1)
forward(self, length=1)
get_mark(self)
determine_encoding(self)
check_printable(self, data)
update(self, length)
update_raw(self, size=4096)
check_token(self, *choices)
peek_token(self)
get_token(self)
need_more_tokens(self)
fetch_more_tokens(self)
next_possible_simple_key(self)
stale_possible_simple_keys(self)
save_possible_simple_key(self)
remove_possible_simple_key(self)
unwind_indent(self, column)
add_indent(self, column)
fetch_stream_start(self)
fetch_stream_end(self)
fetch_directive(self)
fetch_document_start(self)
fetch_document_end(self)
fetch_document_indicator(self, TokenClass)
fetch_flow_sequence_start(self)
fetch_flow_mapping_start(self)
fetch_flow_collection_start(self, TokenClass)
fetch_flow_sequence_end(self)
fetch_flow_mapping_end(self)
fetch_flow_collection_end(self, TokenClass)
fetch_flow_entry(self)
fetch_block_entry(self)
fetch_key(self)
fetch_value(self)
fetch_alias(self)
fetch_anchor(self)
fetch_tag(self)
fetch_literal(self)
fetch_folded(self)
fetch_block_scalar(self, style)
fetch_single(self)
fetch_double(self)
fetch_flow_scalar(self, style)
fetch_plain(self)
check_directive(self)
check_document_start(self)
check_document_end(self)
check_block_entry(self)
check_key(self)
check_value(self)
check_plain(self)
scan_to_next_token(self)
scan_directive(self)
scan_directive_name(self, start_mark)
scan_yaml_directive_value(self, start_mark)
scan_yaml_directive_number(self, start_mark)
scan_tag_directive_value(self, start_mark)
scan_tag_directive_handle(self, start_mark)
scan_tag_directive_prefix(self, start_mark)
scan_directive_ignored_line(self, start_mark)
scan_anchor(self, TokenClass)
scan_tag(self)
scan_block_scalar(self, style)
scan_block_scalar_indicators(self, start_mark)
scan_block_scalar_ignored_line(self, start_mark)
scan_block_scalar_indentation(self)
scan_block_scalar_breaks(self, indent)
scan_flow_scalar(self, style)
scan_flow_scalar_non_spaces(self, double, start_mark)
scan_flow_scalar_spaces(self, double, start_mark)
scan_flow_scalar_breaks(self, double, start_mark)
scan_plain(self)
scan_plain_spaces(self, indent, start_mark)
scan_tag_handle(self, name, start_mark)
scan_tag_uri(self, name, start_mark)
scan_uri_escapes(self, name, start_mark)
scan_line_break(self)
dispose(self)
check_event(self, *choices)
peek_event(self)
get_event(self)
parse_stream_start(self)
parse_implicit_document_start(self)
parse_document_start(self)
parse_document_end(self)
parse_document_content(self)
process_directives(self)
parse_block_node(self)
parse_flow_node(self)
parse_block_node_or_indentless_sequence(self)
parse_node(self, block=False, indentless_sequence=False)
parse_block_sequence_first_entry(self)
parse_block_sequence_entry(self)
parse_indentless_sequence_entry(self)
parse_block_mapping_first_key(self)
parse_block_mapping_key(self)
parse_block_mapping_value(self)
parse_flow_sequence_first_entry(self)
parse_flow_sequence_entry(self, first=False)
parse_flow_sequence_entry_mapping_key(self)
parse_flow_sequence_entry_mapping_value(self)
parse_flow_sequence_entry_mapping_end(self)
parse_flow_mapping_first_key(self)
parse_flow_mapping_key(self, first=False)
parse_flow_mapping_value(self)
parse_flow_mapping_empty_value(self)
process_empty_scalar(self, mark)
check_node(self)
get_node(self)
get_single_node(self)
compose_document(self)
compose_node(self, parent, index)
compose_scalar_node(self, anchor)
compose_sequence_node(self, anchor)
compose_mapping_node(self, anchor)
construct_scalar(self, node)
flatten_mapping(self, node)
construct_mapping(self, node, deep=False)
construct_yaml_null(self, node)
construct_yaml_bool(self, node)
construct_yaml_int(self, node)
construct_yaml_float(self, node)
construct_yaml_binary(self, node)
construct_yaml_timestamp(self, node)
construct_yaml_omap(self, node)
construct_yaml_pairs(self, node)
construct_yaml_set(self, node)
construct_yaml_str(self, node)
construct_yaml_seq(self, node)
construct_yaml_map(self, node)
construct_yaml_object(self, node, cls)
construct_undefined(self, node)
check_data(self)
check_state_key(self, key)

Block special attributes/methods from being set in a newly created object, to prevent user-controlled methods from being called during deserialization

get_data(self)
get_single_data(self)
construct_document(self, node)
construct_object(self, node, deep=False)
construct_sequence(self, node, deep=False)
construct_pairs(self, node, deep=False)
classmethod add_constructor(cls, tag, constructor)
classmethod add_multi_constructor(cls, tag_prefix, multi_constructor)
classmethod add_implicit_resolver(cls, tag, regexp, first)
classmethod add_path_resolver(cls, tag, path, kind=None)
descend_resolver(self, current_node, current_index)
ascend_resolver(self)
check_resolver_prefix(self, depth, path, kind, current_node, current_index)
resolve(self, kind, value, implicit)
class connexion.json_schema.FileHandler

Handler to resolve file refs.

__call__(self, uri)
class connexion.json_schema.URLHandler

Handler to resolve url refs.

__call__(self, uri)
connexion.json_schema.default_handlers
connexion.json_schema.resolve_refs(spec, store=None, handlers=None)

Resolve JSON references like {“$ref”: <some URI>} in a spec. Optionally takes a store, which is a mapping from reference URLs to a dereferenced objects. Prepopulating the store can avoid network calls.

connexion.json_schema.allow_nullable(validation_fn: Callable) Callable

Extend an existing validation function, so it allows nullable values to be null.

connexion.json_schema.validate_required(validator, required, instance, schema)
connexion.json_schema.validate_readOnly(validator, ro, instance, schema)
connexion.json_schema.validate_writeOnly(validator, wo, instance, schema)
connexion.json_schema.NullableTypeValidator
connexion.json_schema.NullableEnumValidator
connexion.json_schema.Draft4RequestValidator
connexion.json_schema.Draft4ResponseValidator