JsonSchema¶
-
class
aws_cdk.aws_apigateway.
JsonSchema
(*, additional_items=None, additional_properties=None, all_of=None, any_of=None, contains=None, default=None, definitions=None, dependencies=None, description=None, enum=None, exclusive_maximum=None, exclusive_minimum=None, format=None, id=None, items=None, maximum=None, max_items=None, max_length=None, max_properties=None, minimum=None, min_items=None, min_length=None, min_properties=None, multiple_of=None, not_=None, one_of=None, pattern=None, pattern_properties=None, properties=None, property_names=None, ref=None, required=None, schema=None, title=None, type=None, unique_items=None)¶ Bases:
object
Represents a JSON schema definition of the structure of a REST API model.
Copied from npm module jsonschema.
- Parameters
additional_items (
Optional
[Sequence
[JsonSchema
]]) –additional_properties (
Union
[bool
,JsonSchema
,None
]) –all_of (
Optional
[Sequence
[JsonSchema
]]) –any_of (
Optional
[Sequence
[JsonSchema
]]) –contains (
Union
[JsonSchema
,Sequence
[JsonSchema
],None
]) –default (
Optional
[Any
]) – The default value if you use an enum. Default: - not setdefinitions (
Optional
[Mapping
[str
,JsonSchema
]]) –dependencies (
Optional
[Mapping
[str
,Union
[Sequence
[str
],JsonSchema
]]]) –description (
Optional
[str
]) –enum (
Optional
[Sequence
[Any
]]) –exclusive_maximum (
Optional
[bool
]) –exclusive_minimum (
Optional
[bool
]) –format (
Optional
[str
]) –id (
Optional
[str
]) –items (
Union
[JsonSchema
,Sequence
[JsonSchema
],None
]) –maximum (
Union
[int
,float
,None
]) –max_items (
Union
[int
,float
,None
]) –max_length (
Union
[int
,float
,None
]) –max_properties (
Union
[int
,float
,None
]) –minimum (
Union
[int
,float
,None
]) –min_items (
Union
[int
,float
,None
]) –min_length (
Union
[int
,float
,None
]) –min_properties (
Union
[int
,float
,None
]) –multiple_of (
Union
[int
,float
,None
]) –not –
one_of (
Optional
[Sequence
[JsonSchema
]]) –pattern (
Optional
[str
]) –pattern_properties (
Optional
[Mapping
[str
,JsonSchema
]]) –properties (
Optional
[Mapping
[str
,JsonSchema
]]) –property_names (
Optional
[JsonSchema
]) –ref (
Optional
[str
]) –required (
Optional
[Sequence
[str
]]) –schema (
Optional
[JsonSchemaVersion
]) –title (
Optional
[str
]) –type (
Union
[JsonSchemaType
,Sequence
[JsonSchemaType
],None
]) –unique_items (
Optional
[bool
]) –
- See
- ExampleMetadata
infused
Example:
# api: apigateway.RestApi # We define the JSON Schema for the transformed valid response response_model = api.add_model("ResponseModel", content_type="application/json", model_name="ResponseModel", schema=apigateway.JsonSchema( schema=apigateway.JsonSchemaVersion.DRAFT4, title="pollResponse", type=apigateway.JsonSchemaType.OBJECT, properties={ "state": apigateway.JsonSchema(type=apigateway.JsonSchemaType.STRING), "greeting": apigateway.JsonSchema(type=apigateway.JsonSchemaType.STRING) } ) ) # We define the JSON Schema for the transformed error response error_response_model = api.add_model("ErrorResponseModel", content_type="application/json", model_name="ErrorResponseModel", schema=apigateway.JsonSchema( schema=apigateway.JsonSchemaVersion.DRAFT4, title="errorResponse", type=apigateway.JsonSchemaType.OBJECT, properties={ "state": apigateway.JsonSchema(type=apigateway.JsonSchemaType.STRING), "message": apigateway.JsonSchema(type=apigateway.JsonSchemaType.STRING) } ) )
Attributes
-
additional_items
¶ - Return type
Optional
[List
[JsonSchema
]]
-
additional_properties
¶ - Return type
Union
[bool
,JsonSchema
,None
]
-
all_of
¶ - Return type
Optional
[List
[JsonSchema
]]
-
any_of
¶ - Return type
Optional
[List
[JsonSchema
]]
-
contains
¶ - Return type
Union
[JsonSchema
,List
[JsonSchema
],None
]
-
default
¶ The default value if you use an enum.
- Default
not set
- Return type
Any
-
definitions
¶ - Return type
Optional
[Mapping
[str
,JsonSchema
]]
-
dependencies
¶ - Return type
Optional
[Mapping
[str
,Union
[List
[str
],JsonSchema
]]]
-
description
¶ - Return type
Optional
[str
]
-
enum
¶ - Return type
Optional
[List
[Any
]]
-
exclusive_maximum
¶ - Return type
Optional
[bool
]
-
exclusive_minimum
¶ - Return type
Optional
[bool
]
-
format
¶ - Return type
Optional
[str
]
-
id
¶ - Return type
Optional
[str
]
-
items
¶ - Return type
Union
[JsonSchema
,List
[JsonSchema
],None
]
-
max_items
¶ - Return type
Union
[int
,float
,None
]
-
max_length
¶ - Return type
Union
[int
,float
,None
]
-
max_properties
¶ - Return type
Union
[int
,float
,None
]
-
maximum
¶ - Return type
Union
[int
,float
,None
]
-
min_items
¶ - Return type
Union
[int
,float
,None
]
-
min_length
¶ - Return type
Union
[int
,float
,None
]
-
min_properties
¶ - Return type
Union
[int
,float
,None
]
-
minimum
¶ - Return type
Union
[int
,float
,None
]
-
multiple_of
¶ - Return type
Union
[int
,float
,None
]
-
not_
¶ - Return type
Optional
[JsonSchema
]
-
one_of
¶ - Return type
Optional
[List
[JsonSchema
]]
-
pattern
¶ - Return type
Optional
[str
]
-
pattern_properties
¶ - Return type
Optional
[Mapping
[str
,JsonSchema
]]
-
properties
¶ - Return type
Optional
[Mapping
[str
,JsonSchema
]]
-
property_names
¶ - Return type
Optional
[JsonSchema
]
-
ref
¶ - Return type
Optional
[str
]
-
required
¶ - Return type
Optional
[List
[str
]]
-
schema
¶ - Return type
Optional
[JsonSchemaVersion
]
-
title
¶ - Return type
Optional
[str
]
-
type
¶ - Return type
Union
[JsonSchemaType
,List
[JsonSchemaType
],None
]
-
unique_items
¶ - Return type
Optional
[bool
]