interface JsonSchema
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.APIGateway.JsonSchema |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#JsonSchema |
Java | software.amazon.awscdk.services.apigateway.JsonSchema |
Python | aws_cdk.aws_apigateway.JsonSchema |
TypeScript (source) | aws-cdk-lib » aws_apigateway » JsonSchema |
Represents a JSON schema definition of the structure of a REST API model.
Copied from npm module jsonschema.
See also: https://github.com/tdegrunt/jsonschema
Example
declare const api: apigateway.RestApi;
// We define the JSON Schema for the transformed valid response
const responseModel = api.addModel('ResponseModel', {
contentType: 'application/json',
modelName: 'ResponseModel',
schema: {
schema: apigateway.JsonSchemaVersion.DRAFT4,
title: 'pollResponse',
type: apigateway.JsonSchemaType.OBJECT,
properties: {
state: { type: apigateway.JsonSchemaType.STRING },
greeting: { type: apigateway.JsonSchemaType.STRING }
}
}
});
// We define the JSON Schema for the transformed error response
const errorResponseModel = api.addModel('ErrorResponseModel', {
contentType: 'application/json',
modelName: 'ErrorResponseModel',
schema: {
schema: apigateway.JsonSchemaVersion.DRAFT4,
title: 'errorResponse',
type: apigateway.JsonSchemaType.OBJECT,
properties: {
state: { type: apigateway.JsonSchemaType.STRING },
message: { type: apigateway.JsonSchemaType.STRING }
}
}
});
Properties
| Name | Type | Description |
|---|---|---|
| additional | boolean | Json | |
| additional | boolean | Json | |
| all | Json[] | |
| any | Json[] | |
| contains? | Json | Json[] | |
| default? | any | The default value if you use an enum. |
| definitions? | { [string]: Json } | |
| dependencies? | { [string]: string[] | Json } | |
| description? | string | |
| enum? | any[] | |
| exclusive | boolean | |
| exclusive | boolean | |
| format? | string | |
| id? | string | |
| items? | Json | Json[] | |
| max | number | |
| max | number | |
| max | number | |
| maximum? | number | |
| min | number | |
| min | number | |
| min | number | |
| minimum? | number | |
| multiple | number | |
| not? | Json | |
| one | Json[] | |
| pattern? | string | |
| pattern | { [string]: Json } | |
| properties? | { [string]: Json } | |
| property | Json | |
| ref? | string | |
| required? | string[] | |
| schema? | Json | |
| title? | string | |
| type? | Json | Json[] | |
| unique | boolean |
additionalItems?
Type:
boolean | Json
(optional)
additionalProperties?
Type:
boolean | Json
(optional)
allOf?
Type:
Json[]
(optional)
anyOf?
Type:
Json[]
(optional)
contains?
Type:
Json | Json[]
(optional)
default?
Type:
any
(optional, default: not set)
The default value if you use an enum.
definitions?
Type:
{ [string]: Json }
(optional)
dependencies?
Type:
{ [string]: string[] | Json }
(optional)
description?
Type:
string
(optional)
enum?
Type:
any[]
(optional)
exclusiveMaximum?
Type:
boolean
(optional)
exclusiveMinimum?
Type:
boolean
(optional)
format?
Type:
string
(optional)
id?
Type:
string
(optional)
items?
Type:
Json | Json[]
(optional)
maxItems?
Type:
number
(optional)
maxLength?
Type:
number
(optional)
maxProperties?
Type:
number
(optional)
maximum?
Type:
number
(optional)
minItems?
Type:
number
(optional)
minLength?
Type:
number
(optional)
minProperties?
Type:
number
(optional)
minimum?
Type:
number
(optional)
multipleOf?
Type:
number
(optional)
not?
Type:
Json
(optional)
oneOf?
Type:
Json[]
(optional)
pattern?
Type:
string
(optional)
patternProperties?
Type:
{ [string]: Json }
(optional)
properties?
Type:
{ [string]: Json }
(optional)
propertyNames?
Type:
Json
(optional)
ref?
Type:
string
(optional)
required?
Type:
string[]
(optional)
schema?
Type:
Json
(optional)
title?
Type:
string
(optional)
type?
Type:
Json | Json[]
(optional)
uniqueItems?
Type:
boolean
(optional)

.NET
Go
Java
Python
TypeScript (