Class JsonSchema
- 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 class JsonSchema : IJsonSchema
- Inheritance
-
JsonSchema
- Implements
- Inherited Members
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
Constructors
JsonSchema()
public JsonSchema()
Properties
AdditionalItems
public IJsonSchema[]? AdditionalItems { get; set; }
Property Value
AdditionalProperties
public object? AdditionalProperties { get; set; }
Property Value
AllOf
public IJsonSchema[]? AllOf { get; set; }
Property Value
AnyOf
public IJsonSchema[]? AnyOf { get; set; }
Property Value
Contains
public object? Contains { get; set; }
Property Value
Default
The default value if you use an enum.
public object? Default { get; set; }
Property Value
Remarks
Default: - not set
Definitions
public IDictionary<string, IJsonSchema>? Definitions { get; set; }
Property Value
Dependencies
public IDictionary<string, object>? Dependencies { get; set; }
Property Value
Description
public string? Description { get; set; }
Property Value
Enum
public object[]? Enum { get; set; }
Property Value
- object[]
ExclusiveMaximum
public bool? ExclusiveMaximum { get; set; }
Property Value
- bool?
ExclusiveMinimum
public bool? ExclusiveMinimum { get; set; }
Property Value
- bool?
Format
public string? Format { get; set; }
Property Value
Id
public string? Id { get; set; }
Property Value
Items
public object? Items { get; set; }
Property Value
MaxItems
public double? MaxItems { get; set; }
Property Value
MaxLength
public double? MaxLength { get; set; }
Property Value
MaxProperties
public double? MaxProperties { get; set; }
Property Value
Maximum
public double? Maximum { get; set; }
Property Value
MinItems
public double? MinItems { get; set; }
Property Value
MinLength
public double? MinLength { get; set; }
Property Value
MinProperties
public double? MinProperties { get; set; }
Property Value
Minimum
public double? Minimum { get; set; }
Property Value
MultipleOf
public double? MultipleOf { get; set; }
Property Value
Not
public IJsonSchema? Not { get; set; }
Property Value
OneOf
public IJsonSchema[]? OneOf { get; set; }
Property Value
Pattern
public string? Pattern { get; set; }
Property Value
PatternProperties
public IDictionary<string, IJsonSchema>? PatternProperties { get; set; }
Property Value
Properties
public IDictionary<string, IJsonSchema>? Properties { get; set; }
Property Value
PropertyNames
public IJsonSchema? PropertyNames { get; set; }
Property Value
Ref
public string? Ref { get; set; }
Property Value
Required
public string[]? Required { get; set; }
Property Value
- string[]
Schema
public JsonSchemaVersion? Schema { get; set; }
Property Value
Title
public string? Title { get; set; }
Property Value
Type
public object? Type { get; set; }
Property Value
UniqueItems
public bool? UniqueItems { get; set; }
Property Value
- bool?