Class Schema


  • public abstract class Schema
    extends Object
    Class that represents the Schema type in API descriptor.
    • Method Detail

      • getReference

        public abstract Reference getReference()
        Getter for reference. May be null if the schema is specified here.
        Returns:
        The reference.
      • getSchema

        public abstract JsonValue getSchema()
        Obtain the schema definition if it is not a reference.
        Returns:
        The schema.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • newBuilder

        public static Schema.Builder newBuilder()
        Create a new Builder for Schema.
        Returns:
        The builder.
      • schema

        public static Schema.Builder schema()
        Create a new Builder for Schema. A synonym for newBuilder() that is useful for static imports.
        Returns:
        The builder.
      • fromAnnotation

        public static Schema fromAnnotation​(Schema schema,
                                            ApiDescription descriptor,
                                            Class<?> relativeType)
        Builds Schema object from the data in the annotation parameter. If the schema has an id defined, or if the type being used for the schema definition has an id defined, the schema will be defined in the top-level descriptor, and a reference to that definition will be returned.
        Parameters:
        schema - The annotation that holds the data
        descriptor - The root descriptor to add definitions to.
        relativeType - The type relative to which schema resources should be resolved.
        Returns:
        Schema instance