ModelProps Struct
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: false,
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
contentTypestringcontent_typestrcontentTypeStringContentTypestringContentType*string= 'application/json'#You can also force a content type in the request or response model mapping.
modelNamestringmodel_namestrmodelNameStringModelNamestringModelName*string= <auto> If you don't specify a na…#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
Default: <auto> 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.
notes
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 its hash to determine the ID of the deployment. This allows us to automatically update the deployment when the model of the REST API changes.
Specify null ({}) if you don't want to specify a schema.