weaver.wps_restapi.swagger_definitions
Schema definitions for OpenAPI generation and validation of data from received requests and returned responses.
This module should contain any and every definition in use to build the Swagger UI and the OpenAPI JSON schema so that one can update the specification without touching any other files after the initial integration.
Schemas defined in this module are employed (through deserialize method calls) to validate that data conforms to
reported definitions. This makes the documentation of the API better aligned with resulting code execution under it.
It also provides a reference point for external users to understand expected data structures with complete schema
definitions generated on the exposed endpoints (JSON and Swagger UI).
The definitions are also employed to generate the OpenAPI definitions reported in the documentation published on Weaver’s ReadTheDocs page.
Module Contents
- weaver.wps_restapi.swagger_definitions.DOC_URL = 'https://pavics-weaver.readthedocs.io//en/latest'[source]
- weaver.wps_restapi.swagger_definitions.CWL_REPO_URL = 'https://github.com/common-workflow-language'[source]
- weaver.wps_restapi.swagger_definitions.CWL_SCHEMA_REPO = 'https://raw.githubusercontent.com/common-workflow-language/cwl-v1.2'[source]
- weaver.wps_restapi.swagger_definitions.CWL_SCHEMA_URL = 'https://raw.githubusercontent.com/common-workflow-language/cwl-v1.2/v1.2.1/json-schema/cwl.yaml'[source]
- weaver.wps_restapi.swagger_definitions.CWL_SPEC_URL = 'https://www.commonwl.org/#Specification'[source]
- weaver.wps_restapi.swagger_definitions.CWL_USER_GUIDE_URL = 'https://www.commonwl.org/user_guide'[source]
- weaver.wps_restapi.swagger_definitions.CWL_CMD_TOOL_URL = 'https://www.commonwl.org/v1.2/CommandLineTool.html'[source]
- weaver.wps_restapi.swagger_definitions.CWL_WORKFLOW_URL = 'https://www.commonwl.org/v1.2/Workflow.html'[source]
- weaver.wps_restapi.swagger_definitions.CWL_DOC_MESSAGE = 'Note that multiple formats are supported and not all specification variants or parameters are...[source]
- weaver.wps_restapi.swagger_definitions.IO_INFO_IDS = 'Identifier of the {first} {what}. To merge details between corresponding {first} and {second}...[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_REPO_URL = 'https://github.com/opengeospatial/ogcapi-processes'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_SCHEMA_URL = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_SCHEMA_BASE = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_SCHEMA_CORE = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/openapi/schemas/processes-core'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_EXAMPLES_CORE = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/examples'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_SCHEMA_EXT_DEPLOY = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/openapi/schemas/processes-dru'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_EXAMPLES_EXT_DEPLOY = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/extensions/deploy_repla...[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_SCHEMA_EXT_BILL = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/openapi/schemas/process...[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_SCHEMA_EXT_QUOTE = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/openapi/schemas/process...[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_SCHEMA_EXT_WORKFLOW = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/openapi/schemas/process...[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_COMMON_PART1_BASE = 'https://schemas.opengis.net/ogcapi/common/part1/1.0'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_COMMON_PART1_SCHEMAS = 'https://schemas.opengis.net/ogcapi/common/part1/1.0/openapi/schemas'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PART1_BASE = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PART1_SCHEMAS = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PART1_RESPONSES = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/responses'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PART1_PARAMETERS = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/parameters'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PART1_EXAMPLES = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/examples'[source]
- weaver.wps_restapi.swagger_definitions.OGC_WPS_1_SCHEMAS = 'https://schemas.opengis.net/wps/1.0.0'[source]
- weaver.wps_restapi.swagger_definitions.OGC_WPS_2_SCHEMAS = 'https://schemas.opengis.net/wps/2.0'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_BBOX_SCHEMA = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/bbox.yaml'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PROFILE_PROC_DESC_URL = 'https://www.opengis.net/dev/profile/OGC/0/ogc-process-description'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PROFILE_PROC_LIST_URL = 'https://www.opengis.net/dev/profile/OGC/0/ogc-process-list'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PROFILE_EXECUTE_URL = 'https://www.opengis.net/dev/profile/OGC/0/ogc-execute-request'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PROFILE_RESULTS_URL = 'https://www.opengis.net/dev/profile/OGC/0/ogc-results'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PROFILE_RESULTS_REL = '[ogc-rel:results]'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PROFILE_JOB_DESC_URL = 'https://www.opengis.net/dev/profile/OGC/0/job-description'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_PROC_PROFILE_JOB_LIST_URL = 'https://www.opengis.net/dev/profile/OGC/0/jobs-list'[source]
- weaver.wps_restapi.swagger_definitions.OGC_API_SCHEMA_JOB_STATUS_URL = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/statusInfo.yaml'[source]
- weaver.wps_restapi.swagger_definitions.OGC_WPS_1_SCHEMA_JOB_STATUS_URL = 'https://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd'[source]
- weaver.wps_restapi.swagger_definitions.OPENEO_API_SCHEMA_URL = 'https://openeo.org/documentation/1.0/developers/api/openapi.yaml'[source]
- weaver.wps_restapi.swagger_definitions.OPENEO_API_SCHEMA_JOB_STATUS_URL = 'https://openeo.org/documentation/1.0/developers/api/openapi.yaml#/components/schemas/batch_job'[source]
- weaver.wps_restapi.swagger_definitions.WEAVER_SCHEMA_URL = 'https://raw.githubusercontent.com/crim-ca/weaver/master/weaver/schemas'[source]
- weaver.wps_restapi.swagger_definitions.PROCESS_DESCRIPTION_FIELD_FIRST = ['id', 'title', 'version', 'mutable', 'abstract', 'description', 'keywords', 'metadata',...[source]
- weaver.wps_restapi.swagger_definitions.PROCESS_DESCRIPTION_FIELD_AFTER = ['processDescriptionURL', 'processEndpointWPS1', 'executeEndpoint', 'deploymentProfile', 'links'][source]
- weaver.wps_restapi.swagger_definitions.PROCESS_DESCRIPTION_FIELD_FIRST_OLD_SCHEMA = ['process'][source]
- weaver.wps_restapi.swagger_definitions.PROCESS_DESCRIPTION_FIELD_AFTER_OLD_SCHEMA = ['links'][source]
- weaver.wps_restapi.swagger_definitions.PROCESS_IO_FIELD_FIRST = ['id', 'title', 'description', 'minOccurs', 'maxOccurs'][source]
- weaver.wps_restapi.swagger_definitions.PROCESS_IO_FIELD_AFTER = ['literalDataDomains', 'formats', 'crs', 'bbox'][source]
- weaver.wps_restapi.swagger_definitions.PROCESSES_LISTING_FIELD_FIRST = ['description', 'processes', 'providers'][source]
- weaver.wps_restapi.swagger_definitions.PROCESSES_LISTING_FIELD_AFTER = ['page', 'limit', 'count', 'total', 'links'][source]
- weaver.wps_restapi.swagger_definitions.PROVIDER_DESCRIPTION_FIELD_FIRST = ['id', 'title', 'version', 'mutable', 'description', 'url', 'type', 'public', 'keywords', 'metadata'][source]
- weaver.wps_restapi.swagger_definitions.JOB_STATUS_FIELD_FIRST = ['jobID', 'processID', 'providerID'][source]
- weaver.wps_restapi.swagger_definitions.JOB_STATUS_FIELD_AFTER = ['jobID', 'processID', 'providerID', 'type', 'status', 'message', 'created', 'started',...[source]
- weaver.wps_restapi.swagger_definitions.JOBS_LISTING_FIELD_FIRST = ['description', 'jobs', 'groups'][source]
- weaver.wps_restapi.swagger_definitions.JOBS_LISTING_FIELD_AFTER = ['page', 'limit', 'count', 'total', 'links'][source]
- weaver.wps_restapi.swagger_definitions.QUOTES_LISTING_FIELD_FIRST = ['description', 'quotations'][source]
- weaver.wps_restapi.swagger_definitions.QUOTES_LISTING_FIELD_AFTER = ['page', 'limit', 'count', 'total', 'links'][source]
- class weaver.wps_restapi.swagger_definitions.SLUG(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.Tag(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.URL(*args, **kwargs)[source]
String format that will be automatically mapped to a URL-pattern validator.
See also
- class weaver.wps_restapi.swagger_definitions.URI(*args, **kwargs)[source]
String format that will be automatically mapped to a URI-pattern validator.
See also
- class weaver.wps_restapi.swagger_definitions.Email(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.MediaType(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.QueryBoolean(*_: Any, **__: Any)[source]
A type representing a boolean object.
The constructor accepts these keyword arguments:
false_choices: The set of strings representing aFalsevalue on deserialization.true_choices: The set of strings representing aTruevalue on deserialization.false_val: The value returned on serialization of a False value.true_val: The value returned on serialization of a True value.
During deserialization, a value contained in
false_choices, will be consideredFalse.The behaviour for values not contained in
false_choicesdepends ontrue_choices: if it’s empty, any value is consideredTrue; otherwise, only values contained intrue_choicesare consideredTrue, and an Invalid exception would be raised for values outside of bothfalse_choicesandtrue_choices.Serialization will produce
true_valorfalse_valbased on the value.If the
colander.nullvalue is passed to the serialize method of this class, thecolander.nullvalue will be returned.The subnodes of the
colander.SchemaNodethat wraps this type are ignored.Initializes the extended boolean schema node.
When arguments
true_choicesorfalse_choicesare provided, the corresponding string values are respectively considered as valid truthy/falsy values. Otherwise (default),strictvalues only of explicit typeboolwill be considered valid.When values are specified
colanderconverts them to string lowercase to compare against truthy/falsy values it should accept. For real OpenAPI typing validation, do NOT add other values like"1"to avoid conflict withExtendedIntegertype for schemas that support both variants. If an OpenAPI field is expected to support truthy/falsy values, it is recommended to explicitly define its schema using aoneOfkeyword of all relevant schemas it supports, an any applicable validators for explicit values. This is the safest way to ensure the generated OpenAPI schema corresponds to expected type validation.
- class weaver.wps_restapi.swagger_definitions.DateTimeInterval(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- _schema = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/parameters/datetime.yaml'[source]
- class weaver.wps_restapi.swagger_definitions.S3BucketReference(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.FileLocal(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.FileURL(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.VaultReference(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ProcessURL(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ReferenceURL(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteReferenceURL(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.UUID(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.AnyIdentifier(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLFileName(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ProcessIdentifier(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ProcessIdentifierTag(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobID(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.Version(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ContentTypeHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ContentLengthHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ContentDispositionHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.DateHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.LastModifiedHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.AcceptHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.AcceptLanguageHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.AcceptProfileHeader(*args, **kwargs)[source]
String format that will be automatically mapped to a URI-pattern validator.
See also
- class weaver.wps_restapi.swagger_definitions.JsonHeader(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.HtmlHeader(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.XmlHeader(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.XAuthDockerHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.RequestContentTypeHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ResponseContentTypeHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ResponseContentTypePlainTextHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.PreferHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.RequestHeadersNoBody(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.RequestHeaders(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.ResponseHeaders(*args, **kwargs)[source]
Headers describing resulting response.
- class weaver.wps_restapi.swagger_definitions.ResponsePlainTextHeaders(*args, **kwargs)[source]
Headers describing resulting response.
- class weaver.wps_restapi.swagger_definitions.RedirectHeaders(*args, **kwargs)[source]
Headers describing resulting response.
- class weaver.wps_restapi.swagger_definitions.AcceptFormatHeaders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OutputFormatQuery(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.FormatQueryValue(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.FormatQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.FormatQueryJSON(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NoContent(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.FileUploadHeaders(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.FileUploadContent(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.FileResponseHeaders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AccessToken(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.DescriptionSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.KeywordList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.Language(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ValueLanguage(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LinkLanguage(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LinkHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.MetadataBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.MetadataRole(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LinkRelationshipType(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.LinkRelationship(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LinkBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.Link(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.MetadataValueField(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.MetadataValue(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.MetadataLink(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.MetadataContent(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.Metadata(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.MetadataList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.LinkList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.LandingPage(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ReferenceOAS(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.TypeOAS(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.EnumItemOAS(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.EnumOAS(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.RequiredOAS(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.MultipleOfOAS(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.PermissiveDefinitionOAS(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.PseudoObjectOAS(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.KeywordObjectOAS(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalPropertiesOAS(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AnyValueOAS(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.PropertyOAS(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.- required[source]
A property which returns
Trueif themissingvalue related to this node was not specified.A return value of
Trueimplies that amissingvalue wasn’t specified for this node or that themissingvalue of this node iscolander.required. A return value ofFalseimplies that a ‘real’missingvalue was specified for this node.
- class weaver.wps_restapi.swagger_definitions.AnyPropertyOAS(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ObjectPropertiesOAS(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ObjectOAS(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DefinitionOAS(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.OAS(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.FormatSchema(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- _one_of[source]
Sequence of applicable schema nested under the
oneOfkeyword.Must be overridden in the schema definition using it.
- deserialize(cstruct)[source]
Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstructvalue is deserialized into anappstructunconditionally.If
appstructreturned by type deserialization and preparation is the valuecolander.null, do something special before attempting validation:If the
missingattribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missingattribute of this node has not been set explicitly, raise acolander.Invalidexception error.
If the appstruct is not
colander.nulland cannot be validated , acolander.Invalidexception will be raised.If a
cstructargument is not explicitly provided, it defaults tocolander.null.
- class weaver.wps_restapi.swagger_definitions.FormatMimeType(*args, **kwargs)[source]
Used to respect
mimeTypefield to work with pre-existing processes.
- class weaver.wps_restapi.swagger_definitions.Format(*args, **kwargs)[source]
Used to respect
mediaTypefield as suggested per OGC-API.
- class weaver.wps_restapi.swagger_definitions.FormatDefaultMimeType(*args, **kwargs)[source]
Used to respect
mimeTypefield to work with pre-existing processes.
- class weaver.wps_restapi.swagger_definitions.FormatDefaultMediaType(*args, **kwargs)[source]
Used to respect
mediaTypefield as suggested per OGC-API.
- class weaver.wps_restapi.swagger_definitions.FormatSelection(*args, **kwargs)[source]
Validation against
mimeTypeormediaTypeformat.Note
Format are validated to be retro-compatible with pre-existing/deployed/remote processes.
- class weaver.wps_restapi.swagger_definitions.FormatDescription(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.FormatDefault(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescriptionFormat(*args, **kwargs)[source]
Used to respect
mediaTypefield as suggested per OGC-API.
- class weaver.wps_restapi.swagger_definitions.DeploymentFormat(*args, **kwargs)[source]
Validation against
mimeTypeormediaTypeformat.Note
Format are validated to be retro-compatible with pre-existing/deployed/remote processes.
- class weaver.wps_restapi.swagger_definitions.ResultFormat(*args, **kwargs)[source]
Format employed for reference results respecting ‘OGC API - Processes’ schemas.
- class weaver.wps_restapi.swagger_definitions.DescriptionFormatList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeploymentFormatList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParameterUnique(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParameterListing(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParameterValues(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParameterDefinition(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParameterList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParametersMeta(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParameters(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParametersItem(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AdditionalParametersList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.Content(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.Offering(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSContext(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescriptionBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescriptionLinks(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessContext(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescriptionExtra(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescriptionType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeploymentType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescriptionMeta(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessDeployMeta(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InputOutputDescriptionMeta(*args: Any, **kwargs: Any)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InputOutputDescriptionSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.MinOccursDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.MaxOccursDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DescribeMinMaxOccurs(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployMinMaxOccurs(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessDescriptionType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InputIdentifierType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OutputIdentifierType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescribeWithFormats(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployWithFormats(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescribeComplexInputType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployComplexInputType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AnyCRS(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AnyFilterExpression(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AnyFilterLanguage(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- description = 'Filter expression language to use for parsing. Supports multiple variants of OGC Common Query...[source]
- deserialize(cstruct: Any) str | colander.null[source]
Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstructvalue is deserialized into anappstructunconditionally.If
appstructreturned by type deserialization and preparation is the valuecolander.null, do something special before attempting validation:If the
missingattribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missingattribute of this node has not been set explicitly, raise acolander.Invalidexception error.
If the appstruct is not
colander.nulland cannot be validated , acolander.Invalidexception will be raised.If a
cstructargument is not explicitly provided, it defaults tocolander.null.
- class weaver.wps_restapi.swagger_definitions.FilterSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- static parse(filter_expr: weaver.typedefs.JSON | str, filter_lang: str) pygeofilter.ast.AstType[source]
- validate(filter_expr: weaver.typedefs.JSON | str, filter_lang: str) pygeofilter.ast.AstType[source]
- deserialize(cstruct: weaver.typedefs.JSON) weaver.typedefs.JSON | colander.null[source]
Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstructvalue is deserialized into anappstructunconditionally.If
appstructreturned by type deserialization and preparation is the valuecolander.null, do something special before attempting validation:If the
missingattribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missingattribute of this node has not been set explicitly, raise acolander.Invalidexception error.
If the appstruct is not
colander.nulland cannot be validated , acolander.Invalidexception will be raised.If a
cstructargument is not explicitly provided, it defaults tocolander.null.
- class weaver.wps_restapi.swagger_definitions.SortByExpression(*arg, **kw)[source]
Utility that will automatically deserialize a string to its list representation using the validator delimiter.
See also
CommaSeparatedStringOneOf
In order to use this utility, it is important to place it first in the schema node class definition.
class NewNodeSchema(ExpandStringList, ExtendedSchemaNode): schema_type = String validator = CommaSeparated()
- class weaver.wps_restapi.swagger_definitions.SortBySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SupportedCRS(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SupportedCRSList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.BoundingBoxInputType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AnyLiteralType(*args, **kwargs)[source]
Submitted values that correspond to literal data.
- class weaver.wps_restapi.swagger_definitions.Number(*args, **kwargs)[source]
Represents a literal number, integer or float.
- class weaver.wps_restapi.swagger_definitions.NumericType(*args, **kwargs)[source]
Represents a numeric-like value.
- class weaver.wps_restapi.swagger_definitions.DecimalType(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.PositiveNumber(*args, **kwargs)[source]
Represents a literal number, integer or float, of positive value.
- class weaver.wps_restapi.swagger_definitions.LiteralReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NameReferenceType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DataTypeSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.UomSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SupportedUoM(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.MeasurementDataDomain(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AllowedValuesList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.AllowedRange(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AllowedRangesList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.AllowedValues(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AnyValue(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ValuesReference(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ArrayLiteralType(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ArrayLiteralDataType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ArrayLiteralValueType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AnyLiteralDataType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AnyLiteralValueType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AnyLiteralDefaultType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LiteralDataValueDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.LiteralDataDomain(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LiteralDataDomainList(*args, **kwargs)[source]
Constraints that apply to the literal data values.
- class weaver.wps_restapi.swagger_definitions.LiteralDataType(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.LiteralInputType(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DescribeInputTypeDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DeployInputTypeDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DescribeInputType(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DescribeInputTypeWithID(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployInputType(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DeployInputTypeWithID(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescribeInputTypeList(*args, **kwargs)[source]
Listing of process inputs descriptions.
- class weaver.wps_restapi.swagger_definitions.DescribeInputTypeMap(*args: Any, **kwargs: Any)[source]
Description of all process inputs under mapping.
- class weaver.wps_restapi.swagger_definitions.DeployInputTypeList(*args, **kwargs)[source]
Listing of process input definitions to deploy.
- class weaver.wps_restapi.swagger_definitions.DeployInputTypeMap(*args: Any, **kwargs: Any)[source]
Definition of all process inputs under mapping.
- class weaver.wps_restapi.swagger_definitions.DeployInputTypeAny(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.LiteralOutputType(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.BoundingBoxOutputType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescribeComplexOutputType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployComplexOutputType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescribeOutputTypeDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DeployOutputTypeDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DescribeOutputType(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DescribeOutputTypeWithID(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DescribeOutputTypeList(*args, **kwargs)[source]
Listing of process outputs descriptions.
- class weaver.wps_restapi.swagger_definitions.DescribeOutputTypeMap(*args: Any, **kwargs: Any)[source]
Definition of all process outputs under mapping.
- class weaver.wps_restapi.swagger_definitions.DeployOutputType(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DeployOutputTypeWithID(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployOutputTypeList(*args, **kwargs)[source]
Listing of process output definitions to deploy.
- class weaver.wps_restapi.swagger_definitions.DeployOutputTypeMap(*args: Any, **kwargs: Any)[source]
Definition of all process outputs under mapping.
- class weaver.wps_restapi.swagger_definitions.DeployOutputTypeAny(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobExecuteModeEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobControlOptionsEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobResponseOptionsEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.TransmissionModeEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobStatusEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobStatusCreate(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobStatusSearchEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobTypeEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobTitle(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobSortEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ProcessSortEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.QuoteSortEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobTagsCommaSeparated(*arg, **kw)[source]
Utility that will automatically deserialize a string to its list representation using the validator delimiter.
See also
CommaSeparatedStringOneOf
In order to use this utility, it is important to place it first in the schema node class definition.
class NewNodeSchema(ExpandStringList, ExtendedSchemaNode): schema_type = String validator = CommaSeparated()
- class weaver.wps_restapi.swagger_definitions.JobGroupsCommaSeparated(*arg, **kw)[source]
Utility that will automatically deserialize a string to its list representation using the validator delimiter.
See also
CommaSeparatedStringOneOf
In order to use this utility, it is important to place it first in the schema node class definition.
class NewNodeSchema(ExpandStringList, ExtendedSchemaNode): schema_type = String validator = CommaSeparated()
- class weaver.wps_restapi.swagger_definitions.JobExecuteSubscribers(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LaunchJobQuerystring(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VisibilityValue(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobAccess(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.VisibilitySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteEstimatorConfigurationSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- _schema = 'https://raw.githubusercontent.com/crim-ca/weaver/master/weaver/schemas/quotation/quote-estimator...[source]
- deserialize(cstruct)[source]
Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstructvalue is deserialized into anappstructunconditionally.If
appstructreturned by type deserialization and preparation is the valuecolander.null, do something special before attempting validation:If the
missingattribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missingattribute of this node has not been set explicitly, raise acolander.Invalidexception error.
If the appstruct is not
colander.nulland cannot be validated , acolander.Invalidexception will be raised.If a
cstructargument is not explicitly provided, it defaults tocolander.null.
- class weaver.wps_restapi.swagger_definitions.QuoteEstimatorWeightedParameterSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteEstimatorInputParametersSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteEstimatorOutputParametersSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteEstimatorSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LocalProcessQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LocalProcessPath(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderPath(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderProcessPath(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobPath(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BillPath(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuotePath(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ResultPath(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.FrontpageEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VersionsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ConformanceQueries(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ConformanceEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OpenAPIAcceptHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OpenAPIRequestHeaders(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.OpenAPIEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OpenAPIFormatRedirect(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SwaggerUIEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.RedocUIEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSNamespace[source]
Object that provides mapping to known XML extensions for OpenAPI schema definition.
Name of the schema definition in the OpenAPI will use
prefixand the schema class name. Prefix can be omitted from the schema definition name by setting it tocolander.drop.See also
- class weaver.wps_restapi.swagger_definitions.WPSNamespace[source]
Object that provides mapping to known XML extensions for OpenAPI schema definition.
Name of the schema definition in the OpenAPI will use
prefixand the schema class name. Prefix can be omitted from the schema definition name by setting it tocolander.drop.See also
- class weaver.wps_restapi.swagger_definitions.XMLNamespace[source]
Object that provides mapping to known XML extensions for OpenAPI schema definition.
Name of the schema definition in the OpenAPI will use
prefixand the schema class name. Prefix can be omitted from the schema definition name by setting it tocolander.drop.See also
- class weaver.wps_restapi.swagger_definitions.XMLReferenceAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.MimeTypeAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.EncodingAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSVersion(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSAcceptVersions(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSLanguage(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSLanguageAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSService(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSServiceAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSVersionAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSLanguageAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSParameters(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOperationGetNoContent(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOperationPost(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSGetCapabilitiesPost(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSIdentifier(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSProcessIdentifier(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.OWSProcessIdentifierList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSTitle(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSAbstract(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSMetadataLink(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSMetadata(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSDescribeProcessPost(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSExecuteDataInputs(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSExecutePost(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSRequestBody(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WPSHeaders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSEndpointGet(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSEndpointPost(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.XMLBooleanAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.XMLString(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSString(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSKeywordList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSPhone(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSAddress(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSContactInfo(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSServiceContact(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSServiceProvider(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSDescriptionType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSServiceIdentification(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSOperationName(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OperationLink(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OperationRequest(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWS_HTTP(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWS_DCP(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.Operation(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OperationsMetadata(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessVersion(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSProcessSummary(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSProcessOfferings(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSLanguagesType(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSLanguageSpecification(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSResponseBaseType(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.WPSProcessVersion(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSInputDescriptionType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSLiteralInputType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSLiteralData(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.XMLStringCRS(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WPSCRSsType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSSupportedCRS(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSSupportedCRSType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSBoundingBoxData(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSFormatDefinition(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSFileFormat(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSFormatList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSComplexInputType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSComplexData(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSInputFormChoice(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WPSMinOccursAttribute(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WPSMaxOccursAttribute(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WPSDataInputDescription(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSDataInputItem(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WPSDataInputs(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOutputDescriptionType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessOutputs(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSGetCapabilities(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.WPSProcessDescriptionType(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.WPSProcessDescriptionList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSDescribeProcess(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.WPSStatusLocationAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSServiceInstanceAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CreationTimeAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSStatusSuccess(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSStatusFailed(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.WPSStatus(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSProcessSummary(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOutputBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOutputDefinitionItem(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOutputDefinitions(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOutputLiteral(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOutputReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSOutputData(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WPSDataOutputItem(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WPSProcessOutputs(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSExecuteResponse(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.WPSXMLSuccessBodySchema(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.OWSExceptionCodeAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSExceptionLocatorAttribute(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSExceptionText(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSException(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OWSExceptionReport(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPSException(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkWPSResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ErrorWPSResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessDescriptionQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderProcessEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LocalProcessDescriptionQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LocalProcessEndpointHeadersNoBody(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LocalProcessEndpointHeaders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.KVPInputLiteralValue(*args, **kwargs)[source]
KVP input parameter for literal value.
- description = Multiline-String[source]
Show Value
"""Input parameter value for process execution using KVP encoding. The parameter name corresponds to the input identifier defined in the process description. Replace ``{inputID}`` with the actual input ID. Value can be a simple literal, comma-separated array, or URL-encoded JSON object/array. Examples: - Simple literal: ``message=hello`` - Numeric: ``count=42`` - Array: ``values=a,b,c``"""
- class weaver.wps_restapi.swagger_definitions.KVPInputReferenceURI(*args, **kwargs)[source]
KVP input parameter for reference by URL.
- description = Multiline-String[source]
Show Value
"""Input parameter reference URL for process execution using KVP encoding with ``deepObject`` style. The parameter name uses bracket notation where the input identifier is followed by ``[href]``. Replace ``{inputID}`` with the actual input ID (e.g., ``fileInput[href]=http://example.com/file.txt``). Use with corresponding ``{inputID}[type]`` to specify the media type. Example: ``fileInput[href]=http://example.com/data.txt&fileInput[type]=text/plain``"""
- class weaver.wps_restapi.swagger_definitions.KVPInputQualifiedValue(*args, **kwargs)[source]
KVP input parameter for qualified value with format specifications.
Allows providing an input value along with format qualifiers (mediaType, encoding, schema, profile).
- description = Multiline-String[source]
Show Value
"""Input parameter qualified value for process execution using KVP encoding with ``deepObject`` style. The parameter name uses bracket notation where the input identifier is followed by ``[value]``. Replace ``{inputID}`` with the actual input ID. This allows specifying format qualifiers alongside the value. **Combinable with:** - ``{inputID}[mediaType]`` - Media type of the value - ``{inputID}[encoding]`` - Encoding (e.g., base64, gzip) - ``{inputID}[schema]`` - Schema or profile URI - ``{inputID}[profile]`` - Content profile URI Examples: - Binary data: ``data[value]=SGVsbG8=&data[mediaType]=text/plain&data[encoding]=base64`` - Structured data: ``geojson[value]={...}&geojson[mediaType]=application/geo+json&geojson[profile]=http://www.opengis.net/spec/ogcapi-features-1/1.0``"""
- class weaver.wps_restapi.swagger_definitions.KVPInputQualifiedMediaType(*args, **kwargs)[source]
KVP input parameter media type qualifier for qualified value.
- description = Multiline-String[source]
Show Value
"""Media type qualifier for input parameter qualified value using KVP encoding with ``deepObject`` style. Used in conjunction with ``{inputID}[value]`` to specify the content type. Replace ``{inputID}`` with the actual input ID. Example: ``data[value]={...}&data[mediaType]=application/json``"""
- class weaver.wps_restapi.swagger_definitions.KVPInputQualifiedEncoding(*args, **kwargs)[source]
KVP input parameter encoding qualifier for qualified value.
- description = Multiline-String[source]
Show Value
"""Encoding qualifier for input parameter qualified value using KVP encoding with ``deepObject`` style. Used in conjunction with ``{inputID}[value]`` to specify the encoding (e.g., base64, gzip). Replace ``{inputID}`` with the actual input ID. Example: ``data[value]=SGVsbG8=&data[encoding]=base64``"""
- class weaver.wps_restapi.swagger_definitions.KVPInputQualifiedSchema(*args, **kwargs)[source]
KVP input parameter schema qualifier for qualified value.
- description = Multiline-String[source]
Show Value
"""Schema qualifier for input parameter qualified value using KVP encoding with ``deepObject`` style. Used in conjunction with ``{inputID}[value]`` to specify a schema URI or definition. Replace ``{inputID}`` with the actual input ID. Example: ``data[value]={{...}}&data[schema]=http://example.com/schema.json``"""
- class weaver.wps_restapi.swagger_definitions.KVPInputQualifiedProfile(*args, **kwargs)[source]
KVP input parameter profile qualifier for qualified value.
- description = Multiline-String[source]
Show Value
"""Profile qualifier for input parameter qualified value using KVP encoding with ``deepObject`` style. Used in conjunction with ``{inputID}[value]`` to specify a content profile URI. Replace ``{inputID}`` with the actual input ID. Example: ``data[value]={{...}}&data[mediaType]=application/geo+json&data[profile]=http://www.opengis.net/spec/ogcapi-features-1/1.0``"""
- class weaver.wps_restapi.swagger_definitions.KVPInputReferenceMediaType(*args, **kwargs)[source]
KVP input parameter media type qualifier for reference.
- description = Multiline-String[source]
Show Value
"""Media type qualifier for input parameter reference using KVP encoding with ``deepObject`` style. Used in conjunction with ``{inputID}[href]`` to specify the content type of the referenced input. Replace ``{inputID}`` with the actual input ID. Example: ``fileInput[href]=http://example.com/feature.json&fileInput[type]=application/geo+json``"""
- class weaver.wps_restapi.swagger_definitions.KVPInputBBoxCRS(*args, **kwargs)[source]
KVP input parameter CRS qualifier for bounding box.
- description = Multiline-String[source]
Show Value
"""Coordinate Reference System qualifier for bounding box input using KVP encoding with ``deepObject`` style. Used in conjunction with a bbox input parameter to specify the CRS. Replace ``{inputID}`` with the actual bbox input ID. Example: ``bbox=5.8,47.2,15.1,55.1&bbox[crs]=http://www.opengis.net/def/crs/OGC/1.3/CRS84``"""
- class weaver.wps_restapi.swagger_definitions.KVPOutputInclude(*args, **kwargs)[source]
KVP output parameter to request specific outputs.
- description = Multiline-String[source]
Show Value
"""Output parameter selector for process execution using KVP encoding with ``deepObject`` style. Set to ``true`` to request a specific output. The parameter name uses bracket notation where the output identifier is followed by ``[include]``. Replace ``{outputID}`` with the actual output ID. Example: ``output1[include]=true&output2[include]=true``"""
- class weaver.wps_restapi.swagger_definitions.KVPOutputMediaType(*args, **kwargs)[source]
KVP output parameter to request specific output format.
- description = Multiline-String[source]
Show Value
"""Output format specification for process execution using KVP encoding with ``deepObject`` style. Specifies the desired media type for a specific output. Replace ``{outputID}`` with the actual output ID. Used in conjunction with ``{outputID}[include]=true``. Example: ``result[include]=true&result[mediaType]=application/json``"""
- class weaver.wps_restapi.swagger_definitions.KVPOutputProfile(*args, **kwargs)[source]
KVP input/output parameter to specify content profile.
- description = Multiline-String[source]
Show Value
"""Content profile negotiation for input or output using KVP encoding with ``deepObject`` style. Specifies a profile URI or well-known identifier for the format. Replace ``{inputID}`` or ``{outputID}`` with the actual identifier. Example: ``data[profile]=http://www.opengis.net/spec/ogcapi-features-1/1.0``"""
- class weaver.wps_restapi.swagger_definitions.KVPResponseFormat(*args, **kwargs)[source]
KVP response format parameter.
- description = Multiline-String[source]
Show Value
"""Response format specification for process execution using KVP encoding with ``deepObject`` style. Behaves in the same way as the HTTP ``Accept`` header and allows certain short name format indicators. Specifies the desired media type for the execution response. Example: ``response[f]=application/json``"""
Longer description of the parameter.
- class weaver.wps_restapi.swagger_definitions.KVPResponseFormatAlias(*args, **kwargs)[source]
KVP response format parameter (alias).
- description = Multiline-String[source]
Show Value
"""Response format specification for process execution using KVP encoding with ``deepObject`` style. Alias for ``response[f]``. Behaves in the same way as the HTTP ``Accept`` header and allows certain short name format indicators. Specifies the desired media type for the execution response. Example: ``response[format]=application/json``"""
Longer description of the parameter.
- class weaver.wps_restapi.swagger_definitions.KVPResponsePrefer(*args, **kwargs)[source]
KVP response preference parameter.
- description = Multiline-String[source]
Show Value
"""Response preference specification for process execution using KVP encoding with ``deepObject`` style. Behaves in the same way as the HTTP ``Prefer`` header. Specifies execution preferences in terms of [Execution Mode](https://pavics-weaver.readthedocs.io/en/latest/processes.html#execution-mode) such as ``respond-async`` or ``wait=10`` as well as [Execution Results](https://pavics-weaver.readthedocs.io/en/latest/processes.html#execution-results) control directives. Example: ``response[prefer]=respond-async;return=minimal``"""
Longer description of the parameter.
- class weaver.wps_restapi.swagger_definitions.KVPResponseProfile(*args, **kwargs)[source]
KVP response profile parameter.
- description = Multiline-String[source]
Show Value
"""Response profile negotiation for process execution using KVP encoding with ``deepObject`` style. Specifies the desired profile URI or well-known identifier for the response. Behaves like the HTTP ``Accept-Profile`` header or ``profile`` query parameter *depending on context*. **Execution Mode Behavior:** - **Synchronous**: The ``response[profile]`` applies to the immediate[*Execution Results*](https://pavics-weaver.readthedocs.io/en/latest/processes.html#proc-exec-results) response (same as``Accept-Profile`` header or ``profile`` query) - **Asynchronous**: The ``response[profile]`` applies to the final [*Job Results*](https://pavics-weaver.readthedocs.io/en/latest/processes.html#job-results) profile, whereas the ``profile`` query applies to the [*Job Status*](https://pavics-weaver.readthedocs.io/en/latest/processes.html#alternate-job-status) response Example: ``response[profile]=http://www.opengis.net/spec/ogcapi-features-1/1.0``"""
Longer description of the parameter.
- class weaver.wps_restapi.swagger_definitions.ProcessExecutionKVPInputOutputParameters(*args, **kwargs)[source]
KVP-encoded inputs and outputs parameters for execution of the process.
- class weaver.wps_restapi.swagger_definitions.ProcessExecutionKVPInputOutputQuery(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.- required = True[source]
A property which returns
Trueif themissingvalue related to this node was not specified.A return value of
Trueimplies that amissingvalue wasn’t specified for this node or that themissingvalue of this node iscolander.required. A return value ofFalseimplies that a ‘real’missingvalue was specified for this node.
- explode = True[source]
Whether to explode the parameter into separate parameters (e.g.: for arrays and objects).
- description = Multiline-String[source]
Show Value
"""KVP-encoded inputs and outputs parameters for execution of the process. **Variable Parameters** (replace placeholder with actual ID): - ``<inputID>=value`` - Simple literal value, array, bbox or URL-encoded object - ``<inputID>[crs]=crs`` - CRS for bounding box input (URI, CURIE, URN or short code) - ``<inputID>[value]=value`` - Qualified value representation to allow format specification - ``<inputID>[mediaType]=type`` - Qualified value desired media-type for the input - ``<inputID>[encoding]=encode`` - Qualified value encoding to consider (eg: bas64, binary, gzip) - ``<inputID>[schema]=schema`` - Qualified value schema indication (URL or well-known OGC profile) - ``<inputID>[profile]=profile`` - Qualified value content profile (URI or well-known identifier) - ``<inputID>[href]=url`` - Input by reference with URL - ``<inputID>[type]=mediaType`` - Media type for referenced input - ``<outputID>[include]=true`` - Request specific output (required) - ``<outputID>[mediaType]=format`` - Desired output format media-type - ``<outputID>[encoding]=encode`` - Desired output format encoding - ``<outputID>[schema]=schema`` - Desired output format schema or profile - ``<outputID>[profile]=profile`` - Desired output format content profile """
Longer description of the parameter.
- class weaver.wps_restapi.swagger_definitions.ProcessExecutionKVPQuery(*args, **kwargs)[source]
Query parameters for KVP-encoded process execution.
- class weaver.wps_restapi.swagger_definitions.ProcessExecutionKVPEndpoint(*args, **kwargs)[source]
Endpoint schema for KVP-encoded process execution.
- class weaver.wps_restapi.swagger_definitions.ProcessPackageEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderProcessPackageEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessPayloadEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessQuoteEstimatorGetEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessQuoteEstimatorPutEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessQuoteEstimatorDeleteEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessVisibilityGetEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessVisibilityPutEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobStatusQueryProfileSchema(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.GetJobQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProviderJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessInputsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderInputsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobInputsOutputsQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobInputsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobResultsQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LocalProcessJobResultsQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessOutputsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderOutputsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessResultEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderResultEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobResultEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessResultsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderResultsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobResultsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobResultsTriggerExecutionEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessJobResultsTriggerExecutionEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderExceptionsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobExceptionsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessExceptionsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderLogsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobLogsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessLogsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobStatisticsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessJobStatisticsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderJobStatisticsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderPublic(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CreateProviderRequestBody(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputDataType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteOutputDataType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteOutputDefinition(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteOutputItem(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteOutputSpecList(*args, **kwargs)[source]
Filter list of outputs to be obtained from execution and their reporting method.
- class weaver.wps_restapi.swagger_definitions.ExecuteOutputMapAdditionalProperties(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteOutputSpecMap(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteOutputSpec(*args, **kwargs)[source]
Filter list of outputs to be obtained from execution and define their reporting method.
- class weaver.wps_restapi.swagger_definitions.ProviderNameSchema(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ProviderSummarySchema(*args, **kwargs)[source]
Service provider summary definition.
- class weaver.wps_restapi.swagger_definitions.ProviderCapabilitiesSchema(*args, **kwargs)[source]
Service provider detailed capabilities.
- class weaver.wps_restapi.swagger_definitions.TransmissionModeList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobControlOptionsList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExceptionReportType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessControl(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessLocations(*args, **kwargs)[source]
Additional endpoint locations specific to the process.
- class weaver.wps_restapi.swagger_definitions.ProcessSummary(*args, **kwargs)[source]
Summary process definition.
- _schema = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/processSummary.yaml'[source]
- class weaver.wps_restapi.swagger_definitions.ProcessSummaryList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessNamesList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessListing(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ProcessCollection(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessPagingQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessVisibility(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessDeploymentProfile(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.Process(*args, **kwargs)[source]
Old nested process schema for process description.
- class weaver.wps_restapi.swagger_definitions.ProcessDescriptionOLD(*args, **kwargs)[source]
Old schema for process description.
- class weaver.wps_restapi.swagger_definitions.ProcessDescriptionOGC(*args, **kwargs)[source]
OGC-API schema for process description.
- _schema = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/process.yaml'[source]
- class weaver.wps_restapi.swagger_definitions.ProcessDescription(*args, **kwargs)[source]
Supported schema representations of a process description (based on specified query parameters).
- class weaver.wps_restapi.swagger_definitions.ProcessDeployment(*args, **kwargs)[source]
Summary process definition.
- _schema = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/openapi/schemas/process...[source]
- class weaver.wps_restapi.swagger_definitions.Duration(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.DurationISO(*args, **kwargs)[source]
Duration represented using ISO-8601 format.
See also
- deserialize(cstruct: datetime.timedelta | str) str[source]
Deserialize the cstruct into an appstruct based on the schema, run this appstruct through the preparer, if one is present, then validate the prepared appstruct. The
cstructvalue is deserialized into anappstructunconditionally.If
appstructreturned by type deserialization and preparation is the valuecolander.null, do something special before attempting validation:If the
missingattribute of this node has been set explicitly, return its value. No validation of this value is performed; it is simply returned.If the
missingattribute of this node has not been set explicitly, raise acolander.Invalidexception error.
If the appstruct is not
colander.nulland cannot be validated , acolander.Invalidexception will be raised.If a
cstructargument is not explicitly provided, it defaults tocolander.null.
- class weaver.wps_restapi.swagger_definitions.JobProcess(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobStatusInfo(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- _schema = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/statusInfo.yaml'[source]
- class weaver.wps_restapi.swagger_definitions.JobEntrySchema(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobCollection(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CreatedJobStatusSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PagingBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetPagingJobsSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobCategoryFilters(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.GroupedJobsCategorySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GroupedCategoryJobsSchema(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetGroupedJobsSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetQueriedJobsSchema(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DismissedJobSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DataEncodingAttributes(*args, **kwargs)[source]
Validation against
mimeTypeormediaTypeformat.Note
Format are validated to be retro-compatible with pre-existing/deployed/remote processes.
- class weaver.wps_restapi.swagger_definitions.ReferenceBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.Reference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ArrayReference(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ArrayReferenceValueType(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteCollectionFormatEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ExecuteCollectionInput(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteNestedProcessReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteNestedProcessParameters(*args, **kwargs)[source]
Dynamically defines the nested process parameters with recursive schema handling.
This class must create the nested properties dynamically because the required classes are not yet defined, and those required definitions also depend on this class to define the nested process as a possible input value.
- class weaver.wps_restapi.swagger_definitions.ExecuteNestedProcessInput(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- _schema = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/execute.yaml'[source]
- class weaver.wps_restapi.swagger_definitions.ExecuteInputAnyType(*args, **kwargs)[source]
Permissive variants that we attempt to parse automatically.
- class weaver.wps_restapi.swagger_definitions.ExecuteInputItem(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputListValues(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputFileLink(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputFile(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputInlineLiteral(*args, **kwargs)[source]
Submitted values that correspond to literal data.
- class weaver.wps_restapi.swagger_definitions.BoundingBox2D(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.BoundingBox3D(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.BoundingBoxValue(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.BoundingBoxObject(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputInlineBoundingBox(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputInlineValue(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputMeasurement(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputObjectData(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputAnyObjectValue(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputQualifiedLiteralValue(*args, **kwargs)[source]
Used to respect
mediaTypefield as suggested per OGC-API.
- class weaver.wps_restapi.swagger_definitions.ExecuteInputQualifiedAnyObjectValue(*args, **kwargs)[source]
Used to respect
mediaTypefield as suggested per OGC-API.
- class weaver.wps_restapi.swagger_definitions.ExecuteInputQualifiedValue(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputInlineOrRefData(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputArrayValues(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputData(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputMapAdditionalProperties(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputMapValues(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputValues(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteInputOutputs(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteParameters(*args, **kwargs)[source]
Basic execution parameters that can be submitted to run a process.
These parameters can be either for a top-level process job, or any nested process call.
- class weaver.wps_restapi.swagger_definitions.ExecuteProcessParameters(*args, **kwargs)[source]
Basic execution parameters that can be submitted to run a process.
These parameters can be either for a top-level process job, or any nested process call.
- _schema = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/execute.yaml'[source]
- class weaver.wps_restapi.swagger_definitions.ExecuteJobParameters(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.Execute(*args, **kwargs)[source]
Main execution parameters that can be submitted to run a process.
Additional parameters are only applicable to the top-most process in a nested definition.
- _schema = 'https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/execute.yaml'[source]
- class weaver.wps_restapi.swagger_definitions.QuoteStatusSchema(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.PartialQuoteSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DecimalRegex(regex, msg=None, flags=0)[source]
Regular expression validator.
Initialize it with the string regular expression
regexthat will be compiled and matched againstvaluewhen validator is called. It uses Python’sre.match(), which only matches at the beginning of the string and not at the beginning of each line. To match the entire string, enclose the regular expression with^and$. Ifmsgis supplied, it will be the error message to be used; otherwise, defaults to ‘String does not match expected pattern’.The
regexexpression behaviour can be modified by specifying anyflagsvalue taken byre.compile.The
regexargument may also be a pattern object (the result ofre.compile) instead of a string.When calling, if
valuematches the regular expression, validation succeeds; otherwise,colander.Invalidis raised with themsgerror message.
- class weaver.wps_restapi.swagger_definitions.PriceAmount(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.PriceCurrency(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.PriceSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteProcessParameters(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.QuoteEstimateValue(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.QuoteStepChainedInputLiteral(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteStepChainedInputComplex(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteStepChainedInput(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.QuoteStepOutputParameters(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteProcessResults(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.- _schema = 'https://raw.githubusercontent.com/crim-ca/weaver/master/weaver/schemas/quotation/quote-estimatio...[source]
- class weaver.wps_restapi.swagger_definitions.UserIdSchema(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.StepQuotation(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.StepQuotationList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.Quotation(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteStepReferenceList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteSummary(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuotationList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuotationListSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CreatedQuotedJobStatusSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BillSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BillList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.BillListSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SupportedValues(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DefaultValues(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLClass(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLExpression(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.RequirementClass(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CUDAComputeCapability(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CUDAComputeCapabilityArray(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CUDAComputeCapabilitySchema(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CUDARequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CUDARequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CUDARequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.NetworkAccessRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.NetworkAccessRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NetworkAccessRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.ResourceRequirementValue(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ResourceRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.ResourceRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ResourceRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.DockerRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.DockerRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DockerRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.DockerGpuRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.DockerGpuRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DockerGpuRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.DirectoryListingItem(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.InitialWorkDirListing(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.InitialWorkDirRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.InitialWorkDirRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InitialWorkDirRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.InlineJavascriptLibraries(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.InlineJavascriptRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.InlineJavascriptRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InlineJavascriptRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.InplaceUpdateRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.InplaceUpdateRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InplaceUpdateRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.LoadContents(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.LoadListingEnum(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.LoadListingRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.LoadListingRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.LoadListingRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.IdentifierArray(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.MultipleInputRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.MultipleInputRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.MultipleInputRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.ScatterIdentifiersSchema(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ScatterFeatureReference(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.ScatterFeatureRequirementSpecification(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ScatterFeatureRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ScatterFeatureRequirementClass(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SecretsRequirementSpecification(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SecretsRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SecretsRequirementClass(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.StepInputExpressionSpecification(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.StepInputExpressionRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.StepInputExpressionRequirementClass(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SubworkflowRequirementSpecification(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SubworkflowRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SubworkflowRequirementClass(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.TimeLimitValue(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ToolTimeLimitRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.ToolTimeLimitRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ToolTimeLimitRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.EnableReuseValue(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WorkReuseRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.WorkReuseRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WorkReuseRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.BuiltinRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.BuiltinRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BuiltinRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.ESGF_CWT_RequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.ESGF_CWT_RequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WeaverESGF_CWT_RequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ESGF_CWT_RequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.OGCAPIRequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.OGCAPIRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WeaverOGCAPIRequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OGCAPIRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.WPS1RequirementSpecification(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.WPS1RequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WeaverWPS1RequirementMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.WPS1RequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.UnknownRequirementMap(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.UnknownRequirementClass(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLRequirementsMapDefinitions(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLRequirementsMapSupported(*_: Any, **__: Any)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchemaInitialize the mapping to allow only supported CWL requirements.
Because
StrictMappingSchemais used, initialized sub-nodes are equivalent the following JSON schema definition, with a key of every known requirement name.{ "<supported-requirement>": {}, "additionalProperties: false }
The actual validation of nested fields under each requirement will be handled by their respective schema in
CWLRequirementsMapDefinitions.
- class weaver.wps_restapi.swagger_definitions.CWLRequirementsMap(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLRequirementsItem(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLRequirementsList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLRequirements(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLHintsMap(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLHintsItem(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLHintsList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLHints(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLArguments(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLTypeString(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLTypeSymbolValues(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLTypeSymbols(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLTypeEnum(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLTypeArrayItemObject(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLTypeArrayItems(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLTypeArray(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLTypeBase(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLTypeList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLType(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.AnyLiteralList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLDefault(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLInputObject(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLTypeStringList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLInputType(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLInputMap(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLInputItem(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLInputList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLInputEmpty(*args: Any, **kwargs: Any)[source]
Mapping that guarantees it is completely empty for validation during deserialization.
Any children added to this schema are removed automatically.
- class weaver.wps_restapi.swagger_definitions.CWLInputsDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.OutputBinding(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLOutputObject(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLOutputType(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLOutputMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLOutputItem(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLOutputList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLOutputsDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLCommandParts(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLCommand(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLVersion(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLIdentifier(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLIntentURL(*args, **kwargs)[source]
String format that will be automatically mapped to a URL-pattern validator.
See also
- class weaver.wps_restapi.swagger_definitions.CWLIntent(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLNamespaces(*args, **kwargs)[source]
Mapping of CWL namespace definitions for shorthand notation.
Note
Use a combination of strict mapping and
variable(seevarfield) such that any additional namespace other than the ones explicitly listed are allowed, but if provided, they must succeed URI validation minimally. If no additional namespace is provided, including none at all, the mapping definition remains valid because ofmissing=dropundervar. If a URI is invalid for additional namespaces, the failing validation causes the property to be unmapped to the variable, which leads to an"unknown"property raised by the strict mapping. For explicit URI definitions, the specific URI combinations provided must be matched exactly to succeed. This ensures that no invalid mapping gets applied for commonly-known URI namespaces.
- class weaver.wps_restapi.swagger_definitions.CWLSchemas(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLPerson(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLAuthors(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLDateCreated(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLMetadata(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLScatterMulti(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLScatter(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLScatterMethod(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLScatterDefinition(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLTool(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepRunDefinition(*args, **kwargs)[source]
Allows specifying all mapping schemas that can be matched for an underlying schema definition.
Corresponds to the
anyOfspecifier of OpenAPI specification.Contrary to
OneOfKeywordSchemathat MUST be validated with exactly one schema, this definition will continue parsing all possibilities and apply validated sub-schemas on top of each other. Not all schemas have to be valid like in the case ofAllOfKeywordSchemato succeed, as long as at least one of them is valid.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class RequiredFields(ExtendedMappingSchema): field_str = ExtendedSchemaNode(String()) field_int = ExtendedSchemaNode(Integer()) class AnyRequired(AnyKeywordSchema): _any_of = [RequiredItem(), RequiredType(), RequiredFields()] # following is valid because their individual parts have all required sub-fields, result is their composition AnyRequired().deserialize({"type": "test", "item": "valid"}) # result: {"type": "test", "item": "valid"} # following is also valid because even though 'item' is missing, the 'type' is present AnyRequired().deserialize({"type": "test"}) # result: {"type": "test"} # following is invalid because every one of the sub-field of individual parts are missing AnyRequired().deserialize({"type": "test"}) # following is invalid because fields of 'RequiredFields' are only partially fulfilled AnyRequired().deserialize({"field_str": "str"}) # following is valid because although fields of 'RequiredFields' are not all fulfilled, 'RequiredType' is valid AnyRequired().deserialize({"field_str": "str", "type": "str"}) # result: {"type": "test"} # following is invalid because 'RequiredFields' field 'field_int' is incorrect schema type AnyRequired().deserialize({"field_str": "str", "field_int": "str"}) # following is valid, but result omits 'type' because its schema-type is incorrect, while others are valid AnyRequired().deserialize({"field_str": "str", "field_int": 1, "items": "fields", "type": 1}) # result: {"field_str": "str", "field_int": 1, "items": "fields"}
Warning
Because valid items are applied on top of each other by merging fields during combinations, conflicting field names of any valid schema will contain only the final valid parsing during deserialization.
See also
OneOfKeywordSchemaAllOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInputSourceValue(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInputSourceList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInputSource(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.LinkMergeMethod(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.PickValueMethod(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInputObject(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInputItem(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInput(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInputMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInputList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepInputDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepOutputID(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepOutputObject(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepOutputItem(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepOutputList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepOutputDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepObject(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepItem(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepsMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepsList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLWorkflowStepsDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLApp(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWL(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecutionUnitCWL(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecutionUnitNested(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderSummaryList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderNamesList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderListing(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ProvidersBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderProcessesSchema(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputArrayReference(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputQualifiedValueLiteral(*args, **kwargs)[source]
Used to respect
mediaTypefield as suggested per OGC-API.
- class weaver.wps_restapi.swagger_definitions.JobOutputQualifiedDataLiteral(*args, **kwargs)[source]
Used to respect
mediaTypefield as suggested per OGC-API.
- class weaver.wps_restapi.swagger_definitions.JobOutputLiteral(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputArrayLiteral(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputValueObject(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputFields(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputItem(*args, **kwargs)[source]
Allows specifying all the required partial mapping schemas for an underlying complete schema definition.
Corresponds to the
allOfspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class RequiredType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class AllRequired(AnyKeywordSchema): _all_of = [RequiredItem(), RequiredType()]
Value parsed with schema this definition will be valid only when every since one of the sub-schemas is valid. Any sub-schema raising an invalid error for any reason with make the whole schema validation fail.
See also
OneOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputs(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ResultLiteral(*args, **kwargs)[source]
Submitted values that correspond to literal data.
- class weaver.wps_restapi.swagger_definitions.ResultLiteralList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ValueFormatted(*args, **kwargs)[source]
Format employed for reference results respecting ‘OGC API - Processes’ schemas.
- class weaver.wps_restapi.swagger_definitions.ValueFormattedList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ResultBoundingBox(*args, **kwargs)[source]
Object schema that will
raiseany unknown field not represented by children schema.This is equivalent to OpenAPI object mapping with
additionalProperties: false. This type is useful for defining a dictionary that matches exactly a specific set of values and children schema.- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key is fails validation.
See also
PermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ResultReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ResultReferenceList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ResultData(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ResultsDocument(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ResultsContent(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.ResultsBody(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.WpsOutputContextHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobExecuteHeaders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobInputsBody(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobOutputsBody(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobExceptionPlain(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobExceptionDetailed(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobException(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.JobExceptionsSchema(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobLogsSchema(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ApplicationStatisticsSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessStatisticsSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OutputStatisticsSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OutputStatisticsMap(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobStatisticsSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.FrontpageParameterSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.FrontpageParameters(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.FrontpageSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OpenAPISpecSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.SwaggerUISpecSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VersionsSpecSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VersionsList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.VersionsSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ConformanceList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ConformanceSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PackageBody(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecutionUnit(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecutionUnitList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessDeploymentWithContext(*args, **kwargs)[source]
Summary process definition.
- class weaver.wps_restapi.swagger_definitions.ProcessVersionField(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployProcessOfferingContext(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployProcessDescriptionContext(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DeployProcessContextChoiceType(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DeployProcessOffering(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployProcessDescription(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- _not[source]
Sequence of applicable schema nested under the
notkeyword.Must be overridden in the schema definition using it.
- class weaver.wps_restapi.swagger_definitions.DeployReference(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessDescriptionChoiceType(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecutionUnitVariations(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ExecutionUnitDefinition(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployParameters(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployOGCAppPackage(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- _schema = 'https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/openapi/schemas/process...[source]
- class weaver.wps_restapi.swagger_definitions.DeployContextDefinition(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.CWLGraphItem(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.CWLGraphList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.CWLGraphBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.UpdateVersion(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployCWLGraph(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeployCWL(*args, **kwargs)[source]
Allows specifying specific schema conditions that fails underlying schema definition validation if present.
Corresponds to the
notspecifier of OpenAPI specification.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] class MappingOnlyNotType(NotKeywordSchema): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"}) # following will return successfully with only 'item' because 'type' was not present MappingWithoutType().deserialize({"item": "valid", "value": "ignore"}) # result: {"item": "valid"} # following will return an empty mapping dropping 'item' since it only needs to ensure 'type' was not present, # but did not provide any additional fields requirement from other class inheritances MappingOnlyNotType().deserialize({"item": "valid"}) # result: {}
See also
OneOfKeywordSchemaAllOfKeywordSchemaAnyOfKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DeployOGCRemoteProcess(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.Deploy(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.DeployContentType(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.DeployHeaders(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.PostProcessesEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostProcessesEndpointCWLYAML(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.UpdateInputOutputBase(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.UpdateInputOutputItem(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.UpdateInputOutputList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.UpdateInputOutputMap(*args: Any, **kwargs: Any)[source]
Object schema that will
preserveany unknown field to remain present in the resulting deserialization.This type is useful for defining a dictionary where some field names are not known in advance, or when more optional keys that don’t need to all be exhaustively provided in the schema are acceptable.
- ..note::
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignorethem). With this schema, content under an unknown key usingpreserveare passed down without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.
See also
StrictMappingSchemaExample:
class AnyKeyObject(PermissiveMappingSchema): known_key = SchemaNode(String()) AnyKeyObject().deserialize({"unknown": "kept", "known_key": "requirement"})) # result: dictionary returned as is instead of removing 'unknown' entry # 'known_key' is still validated with its string schema
Note
This class is only a shorthand definition of
unknownkeyword for convenience. Allcolander.MappingSchemasupport this natively.
- class weaver.wps_restapi.swagger_definitions.UpdateInputOutputDefinition(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.PatchProcessBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PutProcessBodySchema(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.PatchProcessEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PutProcessEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ExecuteHeadersBase(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.ExecuteHeadersJSON(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.ExecuteHeadersXML(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.PostJobsEndpointJSON(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostProcessJobsEndpointJSON(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostJobsEndpointXML(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostProcessJobsEndpointXML(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobTitleNullable(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.PatchJobBodySchema(*args, **kwargs)[source]
Basic execution parameters that can be submitted to run a process.
These parameters can be either for a top-level process job, or any nested process call.
- class weaver.wps_restapi.swagger_definitions.PatchJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PatchProcessJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PatchProviderJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PagingQueries(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetJobsQueries(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProcessJobsQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProviderJobsQueries(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetJobsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProcessJobsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProviderJobsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobIdentifierList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeleteJobsBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeleteJobsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeleteProcessJobsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeleteProviderJobsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProcessJobQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProcessJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeleteJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeleteProcessJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.DeleteProviderJobEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BillsEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BillEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessQuotesEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessQuoteEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetQuotesQueries(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuotesEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostProcessQuote(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostQuote(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuoteProcessParametersSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostProcessQuoteRequestEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProvidersQuerySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProviders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostProvider(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessDetailQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessLinksQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessRevisionsQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderProcessesQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderProcessesEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProviderProcess(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PostProviderProcessJobRequest(*args, **kwargs)[source]
Launching a new process request definition.
- class weaver.wps_restapi.swagger_definitions.GenericHTMLResponse(*args, **kwargs)[source]
Generic HTML response.
Generates a derived HTML response schema with direct forwarding of custom parameters to the body’s schema.
This strategy allows the quicker definition of schema variants without duplicating class definitions only providing alternate documentation parameters.
Note
Method
__new__is used instead of__init__because somecornice_swaggeroperations will look explicitly forschema_node.__class__.__name__. If using__init__, the first instance would set the name value for all following instances instead of the intended reusable meta-schema class.
- class weaver.wps_restapi.swagger_definitions.OWSErrorCode(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OWSExceptionResponse(*args, **kwargs)[source]
Error content in XML format.
- class weaver.wps_restapi.swagger_definitions.ErrorDetail(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ErrorSource(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ErrorCause(*args, **kwargs)[source]
Allows specifying multiple supported mapping schemas variants for an underlying schema definition.
Corresponds to the
oneOfspecifier of OpenAPI specification.Example:
class Variant1(MappingSchema): [...fields of Variant1...] class Variant2(MappingSchema): [...fields of Variant2...] class RequiredByBoth(MappingSchema): [...fields required by both Variant1 and Variant2...] class OneOfWithRequiredFields(OneOfKeywordSchema, RequiredByBoth): _one_of = (Variant1, Variant2) [...alternatively, field required by all variants here...]
In the above example, the validation (ie:
deserialize) process will succeed if only one of the_one_ofvariants’ validator completely succeed, and will fail if every variant fails validation execution. The operation will also fail if more than one validation succeeds.Note
Class
OneOfWithRequiredFieldsin the example is a shortcut variant to generate a specification that represents the pseudo-codeoneOf([<list-of-objects-with-same-base>]).The real OpenAPI method to implement the above very commonly occurring situation is as presented by the following pseudo-code:
oneOf[allOf[RequiredByBoth, Variant1], allOf[RequiredByBoth, Variant2]]
This is both painful to read and is a lot of extra code to write when you actually expand it all into classes (each
oneOf/allOfis another class). ClassOneOfKeywordSchemawill actually simplify this by automatically making theallOfdefinitions for you if it detects other schema nodes thanoneOfspecified in the class bases. You can still do the fulloneOf/allOfclasses expansion manually though, it will result into the same specification.Warning
When
oneOf/allOfautomatic expansion occurs during schema generationWarning
When calling
deserialize(), because the validation process requires exactly one of the variants to succeed to consider the whole object to evaluate as valid, it is important to insert more permissive validators later in the_one_ofiterator (orvalidatorkeyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop) inserted as first item in_one_ofwill make it always succeed regardless of following variants (since an empty schema with everything dropped is valid for optional-only elements). This would have as side effect of potentially failing the validation if other object are also valid depending on the received schema because the schema cannot be discriminated between many. If this occurs, it means the your schemas are too permissive.In the event that you have very similar schemas that can sometime match except one identifier (e.g.: field
typedefining the type of object), consider adding avalidatorto each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminatorcan be provided to try matching as a last resort.For example:
class Animal(ExtendedMappingSchema): name = ExtendedSchemaNode(String()) type = ExtendedSchemaNode(String()) # with explicit definition, this shouldn't be here ## With explicit definitions, each below 'Animal' class should be defined as follows ## type = ExtendedSchemaNode(String(), validator=colander.OneOf(['<animal>'])) class Cat(Animal): [...] # many **OPTIONAL** fields class Dog(Animal): [...] # many **OPTIONAL** fields # With the discriminator keyword, following is possible # (each schema must provide the same property name) class SomeAnimal(OneOfMappingSchema): discriminator = "type" _one_of = [ Cat(), Dog(), ] # If more specific mapping resolutions than 1-to-1 by name are needed, # an explicit dictionary can be specified instead. class SomeAnimal(OneOfMappingSchema): discriminator = { "propertyName": "type", # correspond to 'type' of 'Animal' "mapping": { "cat": Cat, "dog": Dog # map expected values to target schemas } } _one_of = [ Cat(), Dog(), ]
Note
Keyword
discriminatorsupports a map of key-string to schemas-type as presented in the example, and the key must be located at the top level of the mapping. If onlydiscriminator = "<field>"is provided, the definition will be created automatically using theexample(which should be only the matching value) of the corresponding field of each node within the_one_ofmapping.When multiple valid schemas are matched against the input data, the error will be raised and returned with corresponding erroneous elements for each sub-schema (fully listed).
See also
AllOfKeywordSchemaAnyOfKeywordSchemaNotKeywordSchema
- class weaver.wps_restapi.swagger_definitions.ErrorJsonResponseBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ServerErrorBaseResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BadRequestResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ConflictRequestResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.UnprocessableEntityResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.UnsupportedMediaTypeResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.MethodNotAllowedErrorResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NotAcceptableErrorResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NotFoundResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ForbiddenProcessAccessResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ForbiddenProviderAccessResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ForbiddenProviderLocalResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InternalServerErrorResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetFrontpageResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OpenAPIResponseContentTypeHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OpenAPIResponseHeaders(*args, **kwargs)[source]
Headers describing resulting response.
- class weaver.wps_restapi.swagger_definitions.OkGetSwaggerJSONResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetSwaggerUIResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetRedocUIResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetVersionsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetConformanceResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProvidersListResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProviderCapabilitiesSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NoContentDeleteProviderSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NotImplementedDeleteProviderResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProviderProcessesSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProcessesQuery(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GetProcessesEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderProcessesListing(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderProcessesList(*args, **kwargs)[source]
Sequence schema that supports all applicable extended schema node functionalities.
Combines
DefaultSequenceSchemaandDefaultSequenceSchemaextensions so thatdefaultkeyword is used first to resolve a missing sequence duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
ExtendedSchemaNodeExtendedMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProvidersProcessesCollection(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessListingLinks(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessListingMetadata(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessesListing(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.MultiProcessesListing(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProcessesListResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkPostProcessDeployBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkPostProcessesResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkPatchProcessUpdatedBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkPatchProcessResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BadRequestGetProcessInfoResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NotFoundProcessResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProcessInfoResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProcessPackageSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProcessPayloadSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessVisibilityResponseBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProcessVisibilitySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkPutProcessVisibilitySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ForbiddenVisibilityUpdateResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkDeleteProcessUndeployBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkDeleteProcessResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetProviderProcessDescriptionResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CreatedPostProvider(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NotImplementedPostProviderResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.PreferenceAppliedHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.LocationHeader(*args, **kwargs)[source]
String format that will be automatically mapped to a URL-pattern validator.
See also
- class weaver.wps_restapi.swagger_definitions.CreatedJobLocationHeader(*args, **kwargs)[source]
Headers describing resulting response.
- class weaver.wps_restapi.swagger_definitions.CreatedLaunchJobResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CompletedJobLocationHeader(*args, **kwargs)[source]
Headers describing resulting response.
- class weaver.wps_restapi.swagger_definitions.CompletedJobStatusSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CompletedJobResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.FailedSyncJobResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InvalidJobParametersResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkDeleteProcessJobResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetQueriedJobsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BatchDismissJobsBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkBatchDismissJobsResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkDismissJobResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NoContentJobUpdatedResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetJobStatusResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.InvalidJobResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NotFoundJobResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GoneJobResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobProvAcceptHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.JobProvRequestHeaders(*args, **kwargs)[source]
Headers that can indicate how to adjust the behavior and/or result to be provided in the response.
- class weaver.wps_restapi.swagger_definitions.JobProvEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessJobProvEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderJobProvEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetJobProvResponseHeaders(*args, **kwargs)[source]
Headers describing resulting response.
- class weaver.wps_restapi.swagger_definitions.OkGetJobProvResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobProvMetadataRequestHeaders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobProvMetadataEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProcessJobProvMetadataEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ProviderJobProvMetadataEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.JobProvMetadataResponseBody(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.OkGetJobProvMetadataResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NotFoundJobProvResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GoneJobProvResponseSchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetJobInputsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetJobOutputsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.RedirectResultResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetJobResultsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NoContentJobResultsHeaders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NoContentJobResultsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CreatedQuoteExecuteResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.CreatedQuoteResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.AcceptedQuoteResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.QuotePaymentRequiredResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetQuoteInfoResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.NotFoundQuoteResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetQuoteListResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetEstimatorResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkPutEstimatorResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkDeleteEstimatorResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetBillDetailResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetBillListResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetJobExceptionsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetJobLogsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkGetJobStatsResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VaultFileID(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.VaultAccessToken(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.VaultEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VaultUploadBody(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.VaultUploadEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VaultFileUploadedBodySchema(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VaultFileUploadedHeaders(*args, **kwargs)[source]
Headers describing resulting response.
- class weaver.wps_restapi.swagger_definitions.OkVaultFileUploadedResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BadRequestVaultFileUploadResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.UnprocessableEntityVaultFileUploadResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.XAuthVaultFileHeader(*args, **kwargs)[source]
Base schema node with support of extended functionalities.
Combines all
colander.SchemaNodeextensions so thatdefaultkeyword is used first to resolve a missing field value duringdeserialize()call, and then removes the node completely if nodefaultwas provided, and evaluate variables as needed.See also
ExtendedMappingSchemaExtendedSequenceSchemaDefaultSchemaNodeDropableSchemaNodeVariableSchemaNode
- class weaver.wps_restapi.swagger_definitions.VaultFileRequestHeaders(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.VaultFileEndpoint(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkVaultFileDetailResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.OkVaultFileDownloadResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.BadRequestVaultFileAccessResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.ForbiddenVaultFileDownloadResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- class weaver.wps_restapi.swagger_definitions.GoneVaultFileDownloadResponse(*args, **kwargs)[source]
Combines multiple extensions of
colander.MappingSchemahandle their corresponding keywords.Resolution is done so that
defaultkeyword is used first to resolve a missing object duringdeserialize()call, and then removes the node completely if nodefaultwas provided.See also
DefaultSchemaNodeDropableSchemaNodeVariableSchemaNodeExtendedSchemaNodeExtendedSequenceSchemaSchemaRefMappingSchemaSortableMappingSchemaPermissiveMappingSchema
- weaver.wps_restapi.swagger_definitions.derive_responses(responses: Dict[str, weaver.wps_restapi.colander_extras.ExtendedSchemaNode], response_schema: weaver.wps_restapi.colander_extras.ExtendedSchemaNode, status_code: int = 200) Dict[str, weaver.wps_restapi.colander_extras.ExtendedSchemaNode][source]
Generates a derived definition of the responses mapping using the specified schema and status code.
- Parameters:
responses – Mapping of status codes to response schemas.
response_schema – Desired response schema to apply.
status_code – Desired status code for which to apply the response schema.
- Returns:
Derived responses mapping.
- weaver.wps_restapi.swagger_definitions.datetime_interval_parser(datetime_interval: str) weaver.typedefs.DatetimeIntervalType[source]
This function parses a given datetime or interval into a dictionary that will be easy for database process.
- weaver.wps_restapi.swagger_definitions.validate_node_schema(schema_node: weaver.wps_restapi.colander_extras.ExtendedMappingSchema, cstruct: weaver.typedefs.JSON) weaver.typedefs.JSON[source]
Validate a schema node defined against a reference schema within
WEAVER_SCHEMA_DIR.If the reference contains an anchor (e.g.:
#/definitions/Def), the sub-schema of that reference will be used for validation against the data structure.