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:
  • Method Details

    • getAdditionalItems

      @Stability(Stable) @Nullable default List<JsonSchema> getAdditionalItems()
    • getAdditionalProperties

      @Stability(Stable) @Nullable default Object getAdditionalProperties()
    • getAllOf

      @Stability(Stable) @Nullable default List<JsonSchema> getAllOf()
    • getAnyOf

      @Stability(Stable) @Nullable default List<JsonSchema> getAnyOf()
    • getContains

      @Stability(Stable) @Nullable default Object getContains()
    • getDefaultValue

      @Stability(Stable) @Nullable default Object getDefaultValue()
      The default value if you use an enum.

      Default: - not set

    • getDefinitions

      @Stability(Stable) @Nullable default Map<String,JsonSchema> getDefinitions()
    • getDependencies

      @Stability(Stable) @Nullable default Map<String,Object> getDependencies()
    • getDescription

      @Stability(Stable) @Nullable default String getDescription()
    • getEnumValue

      @Stability(Stable) @Nullable default List<Object> getEnumValue()
    • getExclusiveMaximum

      @Stability(Stable) @Nullable default Boolean getExclusiveMaximum()
    • getExclusiveMinimum

      @Stability(Stable) @Nullable default Boolean getExclusiveMinimum()
    • getFormat

      @Stability(Stable) @Nullable default String getFormat()
    • getId

      @Stability(Stable) @Nullable default String getId()
    • getItems

      @Stability(Stable) @Nullable default Object getItems()
    • getMaximum

      @Stability(Stable) @Nullable default Number getMaximum()
    • getMaxItems

      @Stability(Stable) @Nullable default Number getMaxItems()
    • getMaxLength

      @Stability(Stable) @Nullable default Number getMaxLength()
    • getMaxProperties

      @Stability(Stable) @Nullable default Number getMaxProperties()
    • getMinimum

      @Stability(Stable) @Nullable default Number getMinimum()
    • getMinItems

      @Stability(Stable) @Nullable default Number getMinItems()
    • getMinLength

      @Stability(Stable) @Nullable default Number getMinLength()
    • getMinProperties

      @Stability(Stable) @Nullable default Number getMinProperties()
    • getMultipleOf

      @Stability(Stable) @Nullable default Number getMultipleOf()
    • getNot

      @Stability(Stable) @Nullable default JsonSchema getNot()
    • getOneOf

      @Stability(Stable) @Nullable default List<JsonSchema> getOneOf()
    • getPattern

      @Stability(Stable) @Nullable default String getPattern()
    • getPatternProperties

      @Stability(Stable) @Nullable default Map<String,JsonSchema> getPatternProperties()
    • getProperties

      @Stability(Stable) @Nullable default Map<String,JsonSchema> getProperties()
    • getPropertyNames

      @Stability(Stable) @Nullable default JsonSchema getPropertyNames()
    • getRef

      @Stability(Stable) @Nullable default String getRef()
    • getRequired

      @Stability(Stable) @Nullable default List<String> getRequired()
    • getSchema

      @Stability(Stable) @Nullable default JsonSchemaVersion getSchema()
    • getTitle

      @Stability(Stable) @Nullable default String getTitle()
    • getType

      @Stability(Stable) @Nullable default Object getType()
    • getUniqueItems

      @Stability(Stable) @Nullable default Boolean getUniqueItems()
    • builder

      @Stability(Stable) static JsonSchema.Builder builder()
      Returns:
      a JsonSchema.Builder of JsonSchema