json_schema v0.2.0 JsonSchema.Types.AnyOfType View Source

Represents a custom anyOf type definition in a JSON schema.

JSON Schema:

The following example schema has the path "#/definitions/fancyCircle"

{
  "allOf": [
    {
      "type": "object",
      "properties": {
        "color": {
          "$ref": "#/definitions/color"
        },
        "description": {
          "type": "string"
        }
      },
      "required": [ "color" ]
    },
    {
      "$ref": "#/definitions/circle"
    }
  ]
}

where "#/definitions/color" resolves to:

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

and "#/definitions/circle" resolves to:

{
   "type": "object",
   "properties": {
     "radius": {
       "type": "number"
     }
   },
   "required": [ "radius" ]
}

Resulting in the Elixir representation:

%AnyOfType{name: "fancyCircle",
           path: URI.parse("#/definitions/fancyCircle"),
           types: [URI.parse("#/definitions/fancyCircle/allOf/0"),
                   URI.parse("#/definitions/fancyCircle/allOf/1")]}

Link to this section Summary

Link to this section Types

Link to this type t() View Source
t() :: %JsonSchema.Types.AnyOfType{
  name: String.t(),
  path: URI.t(),
  types: [URI.t()]
}

Link to this section Functions

Link to this function new(name, path, types) View Source
new(String.t(), URI.t(), [URI.t()]) :: t()