ModelProps

class aws_cdk.aws_apigateway.ModelProps(*, schema, content_type=None, description=None, model_name=None, rest_api)

Bases: ModelOptions

Parameters:
  • schema (Union[JsonSchema, Dict[str, Any]]) – The schema to use to transform data to one or more output formats. Specify null ({}) if you don’t want to specify a schema.

  • content_type (Optional[str]) – The content type for the model. You can also force a content type in the request or response model mapping. Default: ‘application/json’

  • description (Optional[str]) – A description that identifies this model. Default: None

  • model_name (Optional[str]) – A name for the model. Important If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name. Default: If you don’t specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the model name. For more information, see Name Type.

  • rest_api (IRestApi) – The rest API that this model is part of. The reason we need the RestApi object itself and not just the ID is because the model is being tracked by the top-level RestApi object for the purpose of calculating it’s hash to determine the ID of the deployment. This allows us to automatically update the deployment when the model of the REST API changes.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigateway as apigateway

# default_: Any
# enum_: Any
# json_schema_: apigateway.JsonSchema
# rest_api: apigateway.RestApi

model_props = apigateway.ModelProps(
    rest_api=rest_api,
    schema=apigateway.JsonSchema(
        additional_items=[json_schema_],
        additional_properties=False,
        all_of=[json_schema_],
        any_of=[json_schema_],
        contains=json_schema_,
        default=default_,
        definitions={
            "definitions_key": json_schema_
        },
        dependencies={
            "dependencies_key": ["dependencies"]
        },
        description="description",
        enum=[enum_],
        exclusive_maximum=False,
        exclusive_minimum=False,
        format="format",
        id="id",
        items=json_schema_,
        maximum=123,
        max_items=123,
        max_length=123,
        max_properties=123,
        minimum=123,
        min_items=123,
        min_length=123,
        min_properties=123,
        multiple_of=123,
        not=json_schema_,
        one_of=[json_schema_],
        pattern="pattern",
        pattern_properties={
            "pattern_properties_key": json_schema_
        },
        properties={
            "properties_key": json_schema_
        },
        property_names=json_schema_,
        ref="ref",
        required=["required"],
        schema=apigateway.JsonSchemaVersion.DRAFT4,
        title="title",
        type=apigateway.JsonSchemaType.NULL,
        unique_items=False
    ),

    # the properties below are optional
    content_type="contentType",
    description="description",
    model_name="modelName"
)

Attributes

content_type

The content type for the model.

You can also force a content type in the request or response model mapping.

Default:

‘application/json’

description

A description that identifies this model.

Default:

None

model_name

A name for the model.

Important If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.

Default:

If you don’t specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the model name. For more information, see Name Type.

rest_api

The rest API that this model is part of.

The reason we need the RestApi object itself and not just the ID is because the model is being tracked by the top-level RestApi object for the purpose of calculating it’s hash to determine the ID of the deployment. This allows us to automatically update the deployment when the model of the REST API changes.

schema

The schema to use to transform data to one or more output formats.

Specify null ({}) if you don’t want to specify a schema.