AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::ApiGateway::Model

CfnModel

The `AWS::ApiGateway::Model` resource defines the structure of a request or response payload for an API method.

Import

import { CfnModel } from 'aws-cdk-lib/aws-apigateway';

Or use the module namespace:

import * as apigateway from 'aws-cdk-lib/aws-apigateway';
// apigateway.CfnModel

Properties

Configuration passed to the constructor as CfnModelProps.

restApiIdRequired
string | IRestApiRef

The string identifier of the associated RestApi.

contentTypeOptional
string

The content-type for the model.

descriptionOptional
string

The description of the model.

nameOptional
string

A name for the model. If you don't specify a name, CloudFormation generates a unique physical ID and uses that ID for the model name. For more information, see [Name Type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html) . > 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.

schemaOptional
any

The schema for the model. For `application/json` models, this should be JSON schema draft 4 model. Do not include "\* /" characters in the description of any properties because such "\* /" characters may be interpreted as the closing marker for comments in some languages, such as Java or JavaScript, causing the installation of your API's SDK generated by API Gateway to fail.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Get the Amazon API Gateway Cheat Sheet

Everything you need to know about Amazon API Gateway on one page. HD quality, print-friendly.

Download Free Infographic