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

A module containing utility functions for JSON schema parsers.

Link to this section Summary

Functions

Adds a child to the fragment of a URI.

Creates a new type dictionary based on the given type definition and an optional ID.

Returns a list of type paths when given a type dictionary.

Parse a list of JSON schema objects that have a child relation to another schema object with the specified parent_id.

Link to this section Types

Link to this section Functions

Link to this function

add_fragment_child(uri, child)

View Source
@spec add_fragment_child(URI.t(), String.t() | :anonymous) :: URI.t()

Adds a child to the fragment of a URI.

examples

Examples

iex> add_fragment_child(%URI{
...> authority: nil,
...> fragment: "/definitions/foo",
...> host: nil,
...> path: nil,
...> port: nil,
...> query: nil,
...> scheme: nil,
...> userinfo: nil
...> }, "bar")
%URI{
  authority: nil,
  fragment: "/definitions/foo/bar",
  host: nil,
  path: nil,
  port: nil,
  query: nil,
  scheme: nil,
  userinfo: nil
}
Link to this function

create_type_dict(type_def, path, id)

View Source
@spec create_type_dict(JsonSchema.Types.typeDefinition(), URI.t(), URI.t() | nil) ::
  JsonSchema.Types.typeDictionary()

Creates a new type dictionary based on the given type definition and an optional ID.

Link to this function

create_types_list(type_dict, path)

View Source
@spec create_types_list(JsonSchema.Types.typeDictionary(), URI.t()) :: [URI.t()]

Returns a list of type paths when given a type dictionary.

Link to this function

parse_child_types(child_nodes, parent_id, path)

View Source

Parse a list of JSON schema objects that have a child relation to another schema object with the specified parent_id.

Link to this function

parse_type(schema_node, parent_id, path, name, name_is_regex \\ false)

View Source
@spec parse_type(
  JsonSchema.Types.schemaNode(),
  URI.t(),
  URI.t(),
  String.t() | :anonymous,
  boolean()
) :: JsonSchema.Parser.ParserResult.t()

Parses a node type.