aws-cdk-lib.aws_apigateway.ModelProps

interface ModelProps

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.ModelProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#ModelProps
Javasoftware.amazon.awscdk.services.apigateway.ModelProps
Pythonaws_cdk.aws_apigateway.ModelProps
TypeScript (source)aws-cdk-lib » aws_apigateway » ModelProps

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigateway as apigateway } from 'aws-cdk-lib';

declare const default_: any;
declare const enum_: any;
declare const jsonSchema_: apigateway.JsonSchema;
declare const restApi: apigateway.RestApi;
const modelProps: apigateway.ModelProps = {
  restApi: restApi,
  schema: {
    additionalItems: [jsonSchema_],
    additionalProperties: false,
    allOf: [jsonSchema_],
    anyOf: [jsonSchema_],
    contains: jsonSchema_,
    default: default_,
    definitions: {
      definitionsKey: jsonSchema_,
    },
    dependencies: {
      dependenciesKey: ['dependencies'],
    },
    description: 'description',
    enum: [enum_],
    exclusiveMaximum: false,
    exclusiveMinimum: false,
    format: 'format',
    id: 'id',
    items: jsonSchema_,
    maximum: 123,
    maxItems: 123,
    maxLength: 123,
    maxProperties: 123,
    minimum: 123,
    minItems: 123,
    minLength: 123,
    minProperties: 123,
    multipleOf: 123,
    not: jsonSchema_,
    oneOf: [jsonSchema_],
    pattern: 'pattern',
    patternProperties: {
      patternPropertiesKey: jsonSchema_,
    },
    properties: {
      propertiesKey: jsonSchema_,
    },
    propertyNames: jsonSchema_,
    ref: 'ref',
    required: ['required'],
    schema: apigateway.JsonSchemaVersion.DRAFT4,
    title: 'title',
    type: apigateway.JsonSchemaType.NULL,
    uniqueItems: false,
  },

  // the properties below are optional
  contentType: 'contentType',
  description: 'description',
  modelName: 'modelName',
};

Properties

NameTypeDescription
restApiIRestApiThe rest API that this model is part of.
schemaJsonSchemaThe schema to use to transform data to one or more output formats.
contentType?stringThe content type for the model.
description?stringA description that identifies this model.
modelName?stringA name for the model.

restApi

Type: 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.


schema

Type: JsonSchema

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

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


contentType?

Type: string (optional, default: 'application/json')

The content type for the model.

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


description?

Type: string (optional, default: None)

A description that identifies this model.


modelName?

Type: string (optional, 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.)

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.