weaver.wps_restapi.swagger_definitions
¶
This module should contain any and every definitions in use to build the swagger UI, so that one can update the swagger without touching any other files after the initial integration
Module Contents¶
-
weaver.wps_restapi.swagger_definitions.
CWL_REPO_URL
= https://github.com/common-workflow-language[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]¶
-
class
weaver.wps_restapi.swagger_definitions.
SLUG
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
URL
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
S3Bucket
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
FileLocal
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
FileURL
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
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
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that 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 ofAllOfKeywordSchema
to 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
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
UUID
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
AnyIdentifier
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
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
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that 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 ofAllOfKeywordSchema
to 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
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
Version
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
ContentTypeHeader
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
AcceptHeader
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
AcceptLanguageHeader
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JsonHeader
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
HtmlHeader
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
XmlHeader
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
RequestContentTypeHeader
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition. Corresponds to the
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResponseContentTypeHeader
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition. Corresponds to the
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
RequestHeaders
(*args, **kwargs)[source]¶ Headers that can indicate how to adjust the behavior and/or result the 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.
RedirectHeaders
(*args, **kwargs)[source]¶ Headers describing resulting response.
-
class
weaver.wps_restapi.swagger_definitions.
NoContent
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
KeywordList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Language
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
ValueLanguage
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkLanguage
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataRole
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkRelationship
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Link
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataValue
(*args, **kwargs)[source]¶ Allows specifying specific schema conditions that fails underlying schema definition validation if present.
This is equivalent to OpenAPI object mapping with
additionalProperties: false
, but is more explicit in the definition of invalid or conflicting field names with explicit definitions during deserialization.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"})
See also
OneOfKeywordSchema
AllOfKeywordSchema
AnyOfKeywordSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
MetadataList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LinkList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LandingPage
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Format
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FormatDefault
(*args, **kwargs)[source]¶ Format for process input are assumed plain text if the MIME-type was omitted and is not one of the known formats by this instance. When executing a job, the best match will be used to run the process, and will fallback to the default as last resort.
-
class
weaver.wps_restapi.swagger_definitions.
FormatExtra
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FormatDescription
(*args, **kwargs)[source]¶ Format for process input are assumed plain text if the MIME-type was omitted and is not one of the known formats by this instance. When executing a job, the best match will be used to run the process, and will fallback to the default as last resort.
-
class
weaver.wps_restapi.swagger_definitions.
FormatMedia
(*args, **kwargs)[source]¶ Format employed for reference results respecting ‘OGC-API - Processes’ schemas.
-
class
weaver.wps_restapi.swagger_definitions.
FormatDescriptionList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameterValuesList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameter
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameterList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParametersMeta
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParameters
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that 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 ofAllOfKeywordSchema
to 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
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
AdditionalParametersList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Content
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Offering
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSContext
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionOWS
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionExtra
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionMeta
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDeployMeta
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputOutputDescriptionMeta
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WithMinMaxOccurs
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputIdentifierType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputIdentifierType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WithFormats
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ComplexInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SupportedCRS
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SupportedCRSList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BoundingBoxInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NameReferenceType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DataTypeSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
UomSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedValuesList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedValues
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedRange
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedRangesList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AllowedRanges
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyValue
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ValuesReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralDataType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralValueType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralDefaultType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralDataDomainDefinition
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralDataDomainConstraints
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition. Corresponds to the
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralDataDomainList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralInputType
(*args, **kwargs)[source]¶ Allows specifying specific schema conditions that fails underlying schema definition validation if present.
This is equivalent to OpenAPI object mapping with
additionalProperties: false
, but is more explicit in the definition of invalid or conflicting field names with explicit definitions during deserialization.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"})
See also
OneOfKeywordSchema
AllOfKeywordSchema
AnyOfKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputTypeDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition. Corresponds to the
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputType
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition. Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that 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 ofAllOfKeywordSchema
to 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
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputTypeList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
LiteralOutputType
(*args, **kwargs)[source]¶ Allows specifying specific schema conditions that fails underlying schema definition validation if present.
This is equivalent to OpenAPI object mapping with
additionalProperties: false
, but is more explicit in the definition of invalid or conflicting field names with explicit definitions during deserialization.Example:
class RequiredItem(ExtendedMappingSchema): item = ExtendedSchemaNode(String()) class MappingWithType(ExtendedMappingSchema): type = ExtendedSchemaNode(String()) class MappingWithoutType(NotKeywordSchema, RequiredItem): _not = [MappingWithType()] # following will raise invalid error even if 'item' is valid because 'type' is also present MappingWithoutType().deserialize({"type": "invalid", "item": "valid"})
See also
OneOfKeywordSchema
AllOfKeywordSchema
AnyOfKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
BoundingBoxOutputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ComplexOutputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputTypeDefinition
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition. Corresponds to the
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputType
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition. Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that 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 ofAllOfKeywordSchema
to 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
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputDescriptionList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobExecuteModeEnum
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobControlOptionsEnum
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobResponseOptionsEnum
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
TransmissionModeEnum
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobStatusEnum
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
JobSortEnum
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
QuoteSortEnum
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
LaunchJobQuerystring
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VisibilityValue
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
Visibility
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuotePath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultPath
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FrontpageEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VersionsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ConformanceEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OpenAPIEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SwaggerUIEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
RedocUIEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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 :prop:`prefix` and the schema class name. Prefix can be omitted from the schema definition name by setting it to
colander.drop
. The value oftitle
provided as option orSee 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 :prop:`prefix` and the schema class name. Prefix can be omitted from the schema definition name by setting it to
colander.drop
. The value oftitle
provided as option orSee 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 :prop:`prefix` and the schema class name. Prefix can be omitted from the schema definition name by setting it to
colander.drop
. The value oftitle
provided as option orSee also
-
class
weaver.wps_restapi.swagger_definitions.
XMLReferenceAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
MimeTypeAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
EncodingAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSVersion
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSAcceptVersions
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSLanguage
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSLanguageAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSService
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSServiceAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSVersionAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSLanguageAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSParameters
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOperationGetNoContent
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOperationPost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSGetCapabilitiesPost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSIdentifier
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSIdentifierList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSTitle
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSAbstract
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSMetadataLink
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSMetadata
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDescribeProcessPost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSExecuteDataInputs
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSExecutePost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSHeaders
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSEndpointGet
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSEndpointPost
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
XMLBooleanAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
XMLString
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSString
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSKeywordList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSPhone
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSAddress
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSContactInfo
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSServiceContact
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSServiceProvider
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSServiceIdentification
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSOperationName
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OperationLink
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OperationRequest
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWS_HTTP
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWS_DCP
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Operation
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OperationsMetadata
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVersion
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSProcessSummary
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessOfferings
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSLanguagesType
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSLanguageSpecification
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSResponseBaseType
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessVersion
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSInputDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSLiteralInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSLiteralData
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSCRSsType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSSupportedCRS
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSSupportedCRSType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSBoundingBoxData
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSFormatDefinition
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSFileFormat
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSFormatList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSComplexInputType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSComplexData
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDataInputDescription
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
allOf
specifier 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
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDataInputs
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputDescriptionType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessOutputs
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSGetCapabilities
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessDescriptionType
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessDescriptionList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSDescribeProcess
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPSStatusLocationAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSServiceInstanceAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
CreationTimeAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSStatusSuccess
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSStatusFailed
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
WPSStatus
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessSummary
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputDefinitionItem
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputDefinitions
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputLiteral
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSOutputReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
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
allOf
specifier 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
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSProcessOutputs
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSExecuteResponse
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support 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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionCodeAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionLocatorAttribute
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionText
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSException
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionReport
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPSException
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkWPSResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ErrorWPSResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderProcessEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessPackageEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessPayloadEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVisibilityGetEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVisibilityPutEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderJobEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessInputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderInputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobInputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessOutputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderOutputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutputsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessResultEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderResultEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobResultEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessResultsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderResultsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobResultsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderExceptionsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobExceptionsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessExceptionsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderLogsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobLogsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessLogsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreateProviderRequestBody
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InputDataType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputDataType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Output
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProviderSummarySchema
(*args, **kwargs)[source]¶ WPS provider summary definition.
-
class
weaver.wps_restapi.swagger_definitions.
ProviderCapabilitiesSchema
(*args, **kwargs)[source]¶ WPS provider capabilities.
-
class
weaver.wps_restapi.swagger_definitions.
TransmissionModeList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobControlOptionsList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExceptionReportType
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessSummary
(*args, **kwargs)[source]¶ WPS process definition.
-
class
weaver.wps_restapi.swagger_definitions.
ProcessSummaryList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessCollection
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessInfo
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Process
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDeployment
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessOutputDescriptionSchema
(*args, **kwargs)[source]¶ WPS process output definition.
-
class
weaver.wps_restapi.swagger_definitions.
JobStatusInfo
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobCollection
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedJobStatusSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedQuotedJobStatusSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetPagingJobsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobCategoryFilters
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
GroupedJobsCategorySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GroupedCategoryJobsSchema
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetGroupedJobsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
DismissedJobSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuoteProcessParametersSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AlternateQuotation
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AlternateQuotationList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DataEncodingAttributes
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Reference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyType
(*args, **kwargs)[source]¶ Permissive variants that we attempt to parse automatically.
-
class
weaver.wps_restapi.swagger_definitions.
Input
(*args, **kwargs)[source]¶ Default value to be looked for uses key ‘value’ to conform to OGC API standard. We still look for ‘href’, ‘data’ and ‘reference’ to remain back-compatible.
-
class
weaver.wps_restapi.swagger_definitions.
InputList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Execute
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
Quotation
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuoteProcessListSchema
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuoteSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuotationList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuotationListSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillListSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SupportedValues
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DefaultValues
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLClass
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
RequirementClass
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
DockerRequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
DockerRequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DockerRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
DockerGpuRequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
DockerGpuRequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DockerGpuRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
DirectoryListing
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
InitialWorkDirListing
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InitialWorkDirRequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
InitialWorkDirRequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InitialWorkDirRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
BuiltinRequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
BuiltinRequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BuiltinRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
ESGF_CWT_RequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
ESGF_CWT_RequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ESGF_CWT_RequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPS1RequirementSpecification
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
WPS1RequirementMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
WPS1RequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
UnknownRequirementClass
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLRequirementsMap
(*args, **kwargs)[source]¶ Allows specifying all mapping schemas that can be matched for an underlying schema definition. Corresponds to the
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that 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 ofAllOfKeywordSchema
to 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
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLRequirementsList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
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
anyOf
specifier of OpenAPI specification.Contrary to
OneOfKeywordSchema
that 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 ofAllOfKeywordSchema
to 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
OneOfKeywordSchema
AllOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLHintsItem
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition. Corresponds to the
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLHintsList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLArguments
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeString
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeSymbolValues
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition. Corresponds to the
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeSymbols
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeArray
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeEnum
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
AnyLiteralList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputObject
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLTypeStringList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputMap
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputItem
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLInputList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
OutputBinding
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputObject
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support 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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputMap
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputItem
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
CWLOutputList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLCommandParts
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
CWLVersion
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
CWL
(*args, **kwargs)[source]¶ Object schema that will allow any 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.
When doing schema deserialization to validate it, unknown keys would normally be removed without this class (default behaviour is to
ignore
them). With this schema, content under an unknown key ispreserved
as it was received without any validation. Other fields that are explicitly specified with sub-schema nodes will still be validated as per usual behaviour.Example:
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
unknown
keyword for convenience. Allcolander.MappingSchema
support this natively.
-
class
weaver.wps_restapi.swagger_definitions.
Unit
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessInputDefaultValues
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessInputSupportedValues
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessInputDescriptionSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessInputDescriptionList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessOutputDescriptionList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
UndeploymentResult
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeploymentResult
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDescriptionBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProvidersSchema
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessesSchema
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutputValue
(*args, **kwargs)[source]¶ Allows specifying multiple supported mapping schemas variants for an underlying schema definition. Corresponds to the
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutput
(*args, **kwargs)[source]¶ Allows specifying all the required partial mapping schemas for an underlying complete schema definition. Corresponds to the
allOf
specifier 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
OneOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutputList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultLiteral
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultLiteralList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ValueFormatted
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ValueFormattedList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultReference
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ResultReferenceList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
Result
(*args, **kwargs)[source]¶ Result outputs obtained from a successful process job execution.
-
class
weaver.wps_restapi.swagger_definitions.
JobInputsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobOutputsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobException
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobExceptionsSchema
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
JobLogsSchema
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FrontpageParameterSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FrontpageParameters
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
FrontpageSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SwaggerJSONSpecSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
SwaggerUISpecSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VersionsSpecSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VersionsList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
VersionsSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ConformanceList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ConformanceSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PackageBody
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
ExecutionUnitList
(*args, **kwargs)[source]¶ Combines
DefaultSequenceSchema
andDefaultSequenceSchema
extensions so thatdefault
keyword is used first to resolve a missing sequence duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
ExtendedSchemaNode
ExtendedMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessOfferingBase
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessOffering
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessDeploymentOffering
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
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
oneOf
specifier 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_of
variants’ 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
OneOfWithRequiredFields
in 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/allOf
is another class). ClassOneOfKeywordSchema
will actually simplify this by automatically making theallOf
definitions for you if it detects other schema nodes thanoneOf
specified in the class bases. You can still do the fulloneOf/allOf
classes expansion manually though, it will result into the same specification.Warning
When
oneOf/allOf
automatic 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_of
iterator (orvalidator
keyword). For example, having a variant with all fields defined as optional (ie: withmissing=drop
) inserted as first item in_one_of
will 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
type
defining the type of object), consider adding avalidator
to each sub-node with explicit values to solve the discrimination problem.As a shortcut, the OpenAPI keyword
discriminator
can 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 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
discriminator
supports 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_of
mapping.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
AllOfKeywordSchema
AnyOfKeywordSchema
NotKeywordSchema
-
class
weaver.wps_restapi.swagger_definitions.
Deploy
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProcessesEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProcessJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetJobsQueries
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetJobsRequest
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProcessJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProviderJobsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProcessJobEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
DeleteProcessJobEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillsEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BillEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessQuotesEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessQuoteEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetQuotesQueries
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuotesEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
QuoteEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProcessQuote
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostQuote
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProcessQuoteRequestEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProviders
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProvider
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProviderProcesses
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProviderProcess
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
PostProviderProcessJobRequest
(*args, **kwargs)[source]¶ Launching a new process request definition.
-
class
weaver.wps_restapi.swagger_definitions.
ErrorDetail
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OWSErrorCode
(*args, **kwargs)[source]¶ Combines all
colander.SchemaNode
extensions so thatdefault
keyword is used first to resolve a missing field value duringdeserialize()
call, and then removes the node completely if nodefault
was provided, and evaluate variables as needed.See also
ExtendedMappingSchema
ExtendedSequenceSchema
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
-
class
weaver.wps_restapi.swagger_definitions.
OWSExceptionResponse
(*args, **kwargs)[source]¶ Error content in XML format
-
class
weaver.wps_restapi.swagger_definitions.
ErrorJsonResponseBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ForbiddenProcessAccessResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ForbiddenProviderAccessResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
InternalServerErrorResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetFrontpageResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetSwaggerJSONResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetSwaggerUIResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetRedocUIResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetVersionsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetConformanceResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProvidersListResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProviderCapabilitiesSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NoContentDeleteProviderSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NotImplementedDeleteProviderResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProviderProcessesSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProcessesQuery
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
GetProcessesEndpoint
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessesListResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkPostProcessDeployBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkPostProcessesResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
BadRequestGetProcessInfoResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessInfoResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessPackageSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessPayloadSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ProcessVisibilityResponseBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessVisibilitySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkPutProcessVisibilitySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
ForbiddenVisibilityUpdateResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkDeleteProcessUndeployBodySchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkDeleteProcessResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProviderProcessDescriptionResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedPostProvider
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NotImplementedPostProviderResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedLaunchJobResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetProcessJobResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkDeleteProcessJobResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetQueriedJobsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkDismissJobResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobStatusResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
NotFoundJobResponseSchema
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobInputsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobOutputsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
RedirectResultResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobResultsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedQuoteExecuteResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
CreatedQuoteRequestResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetQuoteInfoResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetQuoteListResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetBillDetailResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetBillListResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobExceptionsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema
-
class
weaver.wps_restapi.swagger_definitions.
OkGetJobLogsResponse
(*args, **kwargs)[source]¶ Combines multiple extensions of
colander.MappingSchema
handle their corresponding keywords.Resolution is done so that
default
keyword is used first to resolve a missing object duringdeserialize()
call, and then removes the node completely if nodefault
was provided.See also
DefaultSchemaNode
DropableSchemaNode
VariableSchemaNode
ExtendedSchemaNode
ExtendedSequenceSchema
PermissiveMappingSchema