Interface IJsonSchema
- Namespace
- Amazon.CDK.AWS.APIGateway
- Assembly
- Amazon.CDK.AWS.APIGateway.dll
Represents a JSON schema definition of the structure of a REST API model.
public interface IJsonSchema
Examples
RestApi api;
// We define the JSON Schema for the transformed valid response
var responseModel = api.AddModel("ResponseModel", new ModelOptions {
ContentType = "application/json",
ModelName = "ResponseModel",
Schema = new JsonSchema {
Schema = JsonSchemaVersion.DRAFT4,
Title = "pollResponse",
Type = JsonSchemaType.OBJECT,
Properties = new Dictionary<string, JsonSchema> {
{ "state", new JsonSchema { Type = JsonSchemaType.STRING } },
{ "greeting", new JsonSchema { Type = JsonSchemaType.STRING } }
}
}
});
// We define the JSON Schema for the transformed error response
var errorResponseModel = api.AddModel("ErrorResponseModel", new ModelOptions {
ContentType = "application/json",
ModelName = "ErrorResponseModel",
Schema = new JsonSchema {
Schema = JsonSchemaVersion.DRAFT4,
Title = "errorResponse",
Type = JsonSchemaType.OBJECT,
Properties = new Dictionary<string, JsonSchema> {
{ "state", new JsonSchema { Type = JsonSchemaType.STRING } },
{ "message", new JsonSchema { Type = JsonSchemaType.STRING } }
}
}
});
Remarks
Copied from npm module jsonschema.
See: https://github.com/tdegrunt/jsonschema
ExampleMetadata: infused
Properties
AdditionalItems
IJsonSchema[]? AdditionalItems { get; }
Property Value
AdditionalProperties
object? AdditionalProperties { get; }
Property Value
AllOf
IJsonSchema[]? AllOf { get; }
Property Value
AnyOf
IJsonSchema[]? AnyOf { get; }
Property Value
Contains
object? Contains { get; }
Property Value
Default
The default value if you use an enum.
object? Default { get; }
Property Value
Remarks
Default: - not set
Definitions
IDictionary<string, IJsonSchema>? Definitions { get; }
Property Value
Dependencies
IDictionary<string, object>? Dependencies { get; }
Property Value
Description
string? Description { get; }
Property Value
Enum
object[]? Enum { get; }
Property Value
- object[]
ExclusiveMaximum
bool? ExclusiveMaximum { get; }
Property Value
- bool?
ExclusiveMinimum
bool? ExclusiveMinimum { get; }
Property Value
- bool?
Format
string? Format { get; }
Property Value
Id
string? Id { get; }
Property Value
Items
object? Items { get; }
Property Value
MaxItems
double? MaxItems { get; }
Property Value
MaxLength
double? MaxLength { get; }
Property Value
MaxProperties
double? MaxProperties { get; }
Property Value
Maximum
double? Maximum { get; }
Property Value
MinItems
double? MinItems { get; }
Property Value
MinLength
double? MinLength { get; }
Property Value
MinProperties
double? MinProperties { get; }
Property Value
Minimum
double? Minimum { get; }
Property Value
MultipleOf
double? MultipleOf { get; }
Property Value
Not
IJsonSchema? Not { get; }
Property Value
OneOf
IJsonSchema[]? OneOf { get; }
Property Value
Pattern
string? Pattern { get; }
Property Value
PatternProperties
IDictionary<string, IJsonSchema>? PatternProperties { get; }
Property Value
Properties
IDictionary<string, IJsonSchema>? Properties { get; }
Property Value
PropertyNames
IJsonSchema? PropertyNames { get; }
Property Value
Ref
string? Ref { get; }
Property Value
Required
string[]? Required { get; }
Property Value
- string[]
Schema
JsonSchemaVersion? Schema { get; }
Property Value
Title
string? Title { get; }
Property Value
Type
object? Type { get; }
Property Value
UniqueItems
bool? UniqueItems { get; }
Property Value
- bool?