OpenAPIv3Validator (openapiv3_validator v0.1.0) View Source
Documentation for OpenAPIv3Validator
.
The OpenAPIv3Validator
provides functions to check whether or not a spec complies to the OpenAPIv3 specification.
The JSON schema for the specification was converted from JSON to a map internally, see OpenAPIv3Validator.Schemas.OpenAPI.V3
.
Originally extracted from Mimicry
, this can be used in place of running the open api validation through the swagger editor.
Link to this section Summary
Functions
tests an input whether or not it will comply to the JSON schema for OpenAPIv3
tests an input on whether it's compliant to the OpenAPIv3 spec, returning the errors, if any
Link to this section Functions
tests an input whether or not it will comply to the JSON schema for OpenAPIv3
Examples
iex> %{} |> OpenAPIv3Validator.valid?
false
iex> spec =%{
iex> "openapi" => "3.0.0",
iex> "paths" => %{},
iex> "info" => %{"title" => "Valid OpenAPIv3 spec", "version" => "1.0.0"}
iex> }
iex> spec |> OpenAPIv3Validator.valid?
true
tests an input on whether it's compliant to the OpenAPIv3 spec, returning the errors, if any
Examples
iex> %{} |> OpenAPIv3Validator.validate()
{:error, [{"Required properties openapi, info, paths were not present.", "#"}]}
iex> spec =%{
iex> "openapi" => "3.0.0",
iex> "paths" => %{},
iex> "info" => %{"title" => "Valid OpenAPIv3 spec", "version" => "1.0.0"}
iex> }
iex> spec |> OpenAPIv3Validator.validate()
:ok