package goblint

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A simpler schema than http://json-schema.org

type jtype =
  1. | JBool
  2. | JInt
  3. | JNum
  4. | JNull
  5. | JString
  6. | JArray of jarray
  7. | JObj of jobj

type of a jvalue

and jschema = {
  1. sid : string option;
    (*

    identificator

    *)
  2. sdescr : string option;
    (*

    description

    *)
  3. stype : jtype option;
    (*

    a type with possibly extra information

    *)
  4. sdefault : Yojson.Safe.t option;
    (*

    the default value

    *)
  5. mutable saddenum : jschema list;
    (*

    additional schemata that were loaded separately

    *)
}

a schema for a jvalue

and jarray = {
  1. sitem : jschema;
    (*

    the schema for all array elements

    *)
}

extra schema information for an array jvalue

and jobj = {
  1. sprops : (string * jschema) list;
    (*

    properties

    *)
  2. spatternprops : (string * jschema) list;
    (*

    regular expression properties

    *)
  3. sadditionalprops : bool;
    (*

    are all properties acounted in the schema

    *)
  4. srequired : string list;
    (*

    list of required properties

    *)
}

extra schema information for an object jvalue

exception JsonSchemaMalformed of string

An exception that indicates that some jschema is was invalid.

exception JsonMalformed of string

An exception that indicates that some jvalue was not valid according to some jschema.

val collectIds : jschema -> string list

Collect all ids from the jschema.

val validate : jschema -> Yojson.Safe.t -> unit

Call to validate s v validates the jvalue v in the jschema s. Invalidness is communicated using the exception JsonMalformed.

val fromJson : Yojson.Safe.t -> jschema

Convert a jvalue to a jschema if possible. Raise JsonSchemaMalformed otherwise.

val addenum : jschema -> jschema -> unit

Call to addenum x y extends x with y at the id Option.get y.sid

OCaml

Innovation. Community. Security.