JsonSchemaModel.java

  1. package net.morimekta.providence.jax.rs.schema;

  2. import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  3. import com.fasterxml.jackson.annotation.JsonInclude;
  4. import io.swagger.v3.oas.models.media.Schema;

  5. import java.util.Map;
  6. import java.util.TreeMap;

  7. @SuppressWarnings("unused,rawtypes")
  8. @JsonInclude(JsonInclude.Include.NON_NULL)
  9. @JsonIgnoreProperties(ignoreUnknown = true)
  10. public class JsonSchemaModel {
  11.     public static final String REF_PREFIX = "#/definitions/";

  12.     private String              $schema = "http://json-schema.org/schema#";
  13.     private String              $id;
  14.     private String              title;
  15.     private Map<String, Schema> definitions = new TreeMap<>();

  16.     public String get$schema() {
  17.         return $schema;
  18.     }

  19.     /**
  20.      * URL to the json-schema of the json-schema version used.
  21.      * @param $schema The new schema.
  22.      */
  23.     public void set$schema(String $schema) {
  24.         this.$schema = $schema;
  25.     }

  26.     public String get$id() {
  27.         return $id;
  28.     }

  29.     /**
  30.      * URL to this json-schema definition.
  31.      * @param $id The new ID.
  32.      */
  33.     public void set$id(String $id) {
  34.         this.$id = $id;
  35.     }

  36.     public String getTitle() {
  37.         return title;
  38.     }

  39.     public void setTitle(String title) {
  40.         this.title = title;
  41.     }

  42.     public Map<String, Schema> getDefinitions() {
  43.         return definitions;
  44.     }

  45.     public void setDefinitions(Map<String, Schema> definitions) {
  46.         this.definitions = definitions;
  47.     }
  48. }