Interface Schema

All Superinterfaces:
Prototype.Api
All Known Implementing Classes:
Schema.BuilderBase.SchemaImpl

public interface Schema extends Prototype.Api
Json schema object.
See Also:
  • Method Details

    • builder

      static Schema.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      static Schema.Builder builder(Schema instance)
      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • find

      static Optional<Schema> find(Class<?> clazz)
      Return a Schema related to the given class. This schema is obtained from the service registry via JsonSchemaProvider instance. One has to either put JsonSchema.Schema annotation on the requested type or implement JsonSchemaProvider class manually. If no schema was found for the given class, empty optional is returned.
      Parameters:
      clazz - schema class
      Returns:
      schema related to the provided class or empty
    • parse

      static Schema parse(String jsonSchema)
      Parse a schema object from the String format of the Json schema.
      Parameters:
      jsonSchema - source json schema
      Returns:
      parsed schema object
    • generate

      String generate()
      Generate the String representation of the schema.
      Returns:
      Json schema in a String format
    • generateNoKeywords

      String generateNoKeywords()
      Generate the String representation of the schema without schema keywords. Keywords like $schema or $id will not be included.
      Returns:
      Json schema in a String format
    • id

      Optional<URI> id()
      The base URI for resolving relative references.
      Returns:
      configured base URI
    • root

      SchemaItem root()
      Root schema.
      Returns:
      root json schema
    • rootObject

      Optional<SchemaObject> rootObject()
      Root of the schema should be validated as an object.
      Returns:
      object root schema
    • rootArray

      Optional<SchemaArray> rootArray()
      Root of the schema should be validated as an array.
      Returns:
      array root schema
    • rootNumber

      Optional<SchemaNumber> rootNumber()
      Root of the schema should be validated as a number.
      Returns:
      number root schema
    • rootInteger

      Optional<SchemaInteger> rootInteger()
      Root of the schema should be validated as an integer.
      Returns:
      integer root schema
    • rootString

      Optional<SchemaString> rootString()
      Root of the schema should be validated as a string.
      Returns:
      string root schema
    • rootBoolean

      Optional<SchemaBoolean> rootBoolean()
      Root of the schema should be validated as a boolean.
      Returns:
      boolean root schema
    • rootNull

      Optional<SchemaNull> rootNull()
      Root of the schema should be validated as a null.
      Returns:
      null root schema