json_schema v0.3.0 JsonSchema.Parser.ObjectParser View Source

Parses a JSON schema object type:

{
  "type": "object",
  "properties": {
    "color": {
      "$ref": "#/color"
    },
    "title": {
      "type": "string"
    },
    "radius": {
      "type": "number"
    }
  },
  "required": [ "color", "radius" ]
}

Into an JsonSchema.Types.ObjectType

Link to this section Summary

Functions

Creates a property dictionary based on a type dictionary and a type path.

Returns true if the json subschema represents an allOf type.

Link to this section Functions

Link to this function

create_property_dict(type_dict, path, id)

View Source

Creates a property dictionary based on a type dictionary and a type path.

Examples

iex> type_dict = %{}
...> path = URI.parse("#")
...> id = "http://www.example.com/root.json"
...> JsonSchema.Parser.ObjectParser.create_property_dict(type_dict, path, id)
%{}
Link to this function

parse(schema_node, parent_id, id, path, name)

View Source

Parses a JSON schema object type into an JsonSchema.Types.ObjectType.

Link to this function

type?(schema_node)

View Source
type?(map()) :: boolean()

Returns true if the json subschema represents an allOf type.

Examples

iex> type?(%{}) false

iex> an_object = %{"properties" => %{"name" => %{"type" => "string"}}} iex> type?(an_object) true