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

Parse a JSON schema enum type:

{
  "type": "string",
  "enum": ["none", "green", "orange", "blue", "yellow", "red"]
}

Into an JsonSchema.Types.EnumType.

Link to this section Summary

Functions

Returns true if the json subschema represents an enum type.

Link to this section Functions

Link to this function

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

View Source

Parses a JSON schema enum type into an JsonSchema.Types.EnumType.

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

Returns true if the json subschema represents an enum type.

examples

Examples

iex> type?(%{}) false

iex> type?(%{"enum" => ["red", "yellow", "green"], "type" => "string"}) true