json_schema v0.3.0 JsonSchema.Parser.ConstParser View Source
Parse a JSON schema const type:
{
"type": "string",
"const": "This is a constant"
}
Into an JsonSchema.Types.ConstType
.
Link to this section Summary
Functions
Parses a JSON schema const type into an JsonSchema.Types.ConstType
.
Returns true if the json subschema represents an const type.
Link to this section Functions
Link to this function
parse(schema_node, parent_id, id, path, name)
View Sourceparse( JsonSchema.Types.schemaNode(), URI.t(), URI.t() | nil, URI.t(), String.t() ) :: JsonSchema.Parser.ParserResult.t()
Parses a JSON schema const type into an JsonSchema.Types.ConstType
.
Returns true if the json subschema represents an const type.
Examples
iex> type?(%{}) false
iex> type?(%{"const" => nil}) true
iex> type?(%{"const" => false}) true
iex> type?(%{"const" => "23.4"}) true
iex> type?(%{"const" => "This is a constant"}) true
iex> type?(%{"const" => %{"foo" => 42}}) true