JsonSchema.Parser.OneOfParser (json_schema v0.6.0)

Copy Markdown View Source

Parses a JSON schema oneOf type:

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

Into an JsonSchema.Types.OneOfType.

Summary

Functions

Returns true if the json subschema represents an oneOf type.

Functions

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

Parses a JSON schema oneOf type into an JsonSchema.Types.OneOfType.

type?(arg1)

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

Returns true if the json subschema represents an oneOf type.

Examples

iex> type?(%{}) false

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

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