interface ModelProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.APIGateway.ModelProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#ModelProps |
![]() | software.amazon.awscdk.services.apigateway.ModelProps |
![]() | aws_cdk.aws_apigateway.ModelProps |
![]() | 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
Name | Type | Description |
---|---|---|
rest | IRest | The rest API that this model is part of. |
schema | Json | The schema to use to transform data to one or more output formats. |
content | string | The content type for the model. |
description? | string | A description that identifies this model. |
model | string | A name for the model. |
restApi
Type:
IRest
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:
Json
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:
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.