Interface JsonSchema
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
JsonSchema.Jsii$Proxy
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:44.986Z")
@Stability(Stable)
public interface JsonSchema
extends software.amazon.jsii.JsiiSerializable
Represents a JSON schema definition of the structure of a REST API model.
Copied from npm module jsonschema.
Example:
RestApi api;
// We define the JSON Schema for the transformed valid response
Model responseModel = api.addModel("ResponseModel", ModelOptions.builder()
.contentType("application/json")
.modelName("ResponseModel")
.schema(JsonSchema.builder()
.schema(JsonSchemaVersion.DRAFT4)
.title("pollResponse")
.type(JsonSchemaType.OBJECT)
.properties(Map.of(
"state", JsonSchema.builder().type(JsonSchemaType.STRING).build(),
"greeting", JsonSchema.builder().type(JsonSchemaType.STRING).build()))
.build())
.build());
// We define the JSON Schema for the transformed error response
Model errorResponseModel = api.addModel("ErrorResponseModel", ModelOptions.builder()
.contentType("application/json")
.modelName("ErrorResponseModel")
.schema(JsonSchema.builder()
.schema(JsonSchemaVersion.DRAFT4)
.title("errorResponse")
.type(JsonSchemaType.OBJECT)
.properties(Map.of(
"state", JsonSchema.builder().type(JsonSchemaType.STRING).build(),
"message", JsonSchema.builder().type(JsonSchemaType.STRING).build()))
.build())
.build());
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forJsonSchemastatic final classAn implementation forJsonSchema -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonSchema.Builderbuilder()default List<JsonSchema>default Objectdefault List<JsonSchema>getAllOf()default List<JsonSchema>getAnyOf()default Objectdefault ObjectThe default value if you use an enum.default Map<String,JsonSchema> default Stringdefault Booleandefault Booleandefault Stringdefault StringgetId()default ObjectgetItems()default Numberdefault Numberdefault Numberdefault Numberdefault Numberdefault Numberdefault Numberdefault Numberdefault Numberdefault JsonSchemagetNot()default List<JsonSchema>getOneOf()default Stringdefault Map<String,JsonSchema> default Map<String,JsonSchema> default JsonSchemadefault StringgetRef()default JsonSchemaVersiondefault StringgetTitle()default ObjectgetType()default BooleanMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getAdditionalItems
-
getAdditionalProperties
-
getAllOf
-
getAnyOf
-
getContains
-
getDefaultValue
The default value if you use an enum.Default: - not set
-
getDefinitions
-
getDependencies
-
getDescription
-
getEnumValue
-
getExclusiveMaximum
-
getExclusiveMinimum
-
getFormat
-
getId
-
getItems
-
getMaximum
-
getMaxItems
-
getMaxLength
-
getMaxProperties
-
getMinimum
-
getMinItems
-
getMinLength
-
getMinProperties
-
getMultipleOf
-
getNot
-
getOneOf
-
getPattern
-
getPatternProperties
-
getProperties
-
getPropertyNames
-
getRef
-
getRequired
-
getSchema
-
getTitle
-
getType
-
getUniqueItems
-
builder
- Returns:
- a
JsonSchema.BuilderofJsonSchema
-