-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(aws-apigateway): expand RestApi support to models, parameters an…
…d validators (#2960) Fixes #905: "apigateway: "methodResponses" is missing from MethodOptions" Fixes #1695: apigateway: missing support for models Fixes #727: API Gateway: improve API for request parameters and responses Fixes #723: API Gateway: missing features Fixes #2957: RestApi to use logical id as a name for APIs instead of name of current construct Adds support for JsonSchema in Model Aligns Model to the PhysicalName convention. No breaking change, documentation updated
- Loading branch information
1 parent
b84caab
commit 12e6380
Showing
13 changed files
with
926 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
export enum JsonSchemaVersion { | ||
/** | ||
* In API Gateway models are defined using the JSON schema draft 4. | ||
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04 | ||
*/ | ||
DRAFT4 = 'http://json-schema.org/draft-04/schema#', | ||
DRAFT7 = 'http://json-schema.org/draft-07/schema#' | ||
} | ||
|
||
export enum JsonSchemaType { | ||
NULL = "null", | ||
BOOLEAN = "boolean", | ||
OBJECT = "object", | ||
ARRAY = "array", | ||
NUMBER = "number", | ||
INTEGER = "integer", | ||
STRING = "string" | ||
} | ||
|
||
/** | ||
* Represents a JSON schema definition of the structure of a | ||
* REST API model. Copied from npm module jsonschema. | ||
* | ||
* @see http://json-schema.org/ | ||
* @see https://github.com/tdegrunt/jsonschema | ||
*/ | ||
export interface JsonSchema { | ||
// Special keywords | ||
readonly schema?: JsonSchemaVersion; | ||
readonly id?: string; | ||
readonly ref?: string; | ||
|
||
// Common properties | ||
readonly type?: JsonSchemaType | JsonSchemaType[]; | ||
readonly title?: string; | ||
readonly description?: string; | ||
readonly 'enum'?: any[]; | ||
readonly format?: string; | ||
readonly definitions?: { [name: string]: JsonSchema }; | ||
|
||
// Number or Integer | ||
readonly multipleOf?: number; | ||
readonly maximum?: number; | ||
readonly exclusiveMaximum?: boolean; | ||
readonly minimum?: number; | ||
readonly exclusiveMinimum?: boolean; | ||
|
||
// String | ||
readonly maxLength?: number; | ||
readonly minLength?: number; | ||
readonly pattern?: string; | ||
|
||
// Array | ||
readonly items?: JsonSchema | JsonSchema[]; | ||
readonly additionalItems?: JsonSchema[]; | ||
readonly maxItems?: number; | ||
readonly minItems?: number; | ||
readonly uniqueItems?: boolean; | ||
readonly contains?: JsonSchema | JsonSchema[]; | ||
|
||
// Object | ||
readonly maxProperties?: number; | ||
readonly minProperties?: number; | ||
readonly required?: string[]; | ||
readonly properties?: { [name: string]: JsonSchema }; | ||
readonly additionalProperties?: JsonSchema; | ||
readonly patternProperties?: { [name: string]: JsonSchema }; | ||
readonly dependencies?: { [name: string]: JsonSchema | string[] }; | ||
readonly propertyNames?: JsonSchema; | ||
|
||
// Conditional | ||
readonly allOf?: JsonSchema[]; | ||
readonly anyOf?: JsonSchema[]; | ||
readonly oneOf?: JsonSchema[]; | ||
readonly not?: JsonSchema; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.