Class SpecToJsonSchema

java.lang.Object
jsonvalues.spec.SpecToJsonSchema

public final class SpecToJsonSchema extends Object
This class is designed for converting JSON specifications into JSON schemas represented by a JsObj. It adheres to the structure defined in the draft at .... It is important to note that not all keywords from the draft are supported, but rather only those that are pertinent to json-spec. However, these supported keywords are comprehensive enough to effectively convey the structure of the JSON. Unlike JSON schema, json-spec allows for the definition of arbitrary validations, as predicates can be used to validate data.
  • Method Details

    • convert

      public static JsObj convert(JsObjSpec jsObjSpec)
      Converts a JsObjSpec to a JSON schema.
      Parameters:
      jsObjSpec - The JsObjSpec to be converted.
      Returns:
      The resulting JSON schema as a JsObj.
    • convert

      public static JsObj convert(JsSpec spec)
      Converts a spec to a JSON schema.
      Parameters:
      spec - The spec to be converted.
      Returns:
      The resulting JSON schema as a JsObj.
    • convert

      public static JsObj convert(JsArraySpec jsArraySpec)
      Converts a JsArraySpec to a JSON schema (JsObj).
      Parameters:
      jsArraySpec - The JsArraySpec to be converted.
      Returns:
      The resulting JSON schema as a JsObj.