View Source JsonSchema.Parser.AnyOfParser (json_schema v0.4.0)

Parses a JSON schema anyOf type:

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

Into an JsonSchema.Types.AnyOfType.

Link to this section Summary

Functions

Returns true if the json subschema represents an anyOf type.

Link to this section Functions

Link to this function

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

View Source

Parses a JSON schema anyOf type into an JsonSchema.Types.AnyOfType.

@spec type?(JsonSchema.Types.schemaNode()) :: boolean()

Returns true if the json subschema represents an anyOf type.

examples

Examples

iex> type?(%{}) false

iex> type?(%{"anyOf" => []}) false

iex> type?(%{"anyOf" => [%{"$ref" => "#foo"}]}) true