Pravda v0.6.0 Pravda.Core View Source

Documentation for Pravda core.

Link to this section Summary

Functions

Compile Paths is the function used to take a list of spec files and compile them into a list of routes we can validate with.

phoenix_route_to_schema takes a connections current path location and method and outputs a url that will match an openapi schema base definition it uses the router to correctly resolve the name and order of path arguments

validate_body is used to validate the input body for a spec, for a specific method, path.

validate params takes in and validates headers, path, and query parameters against the spec

validate_response is used to validate the responses section for a spec, for a specific method, path, and status.

Link to this section Functions

Link to this function

compile_paths(raw_specs)

View Source
compile_paths(list()) :: map()

Compile Paths is the function used to take a list of spec files and compile them into a list of routes we can validate with.

Link to this function

deref_if_possible(result, schema)

View Source
Link to this function

phoenix_route_to_schema(conn, router)

View Source
phoenix_route_to_schema(Plug.Conn.t(), module()) ::
  {String.t(), String.t()} | {nil, nil}

phoenix_route_to_schema takes a connections current path location and method and outputs a url that will match an openapi schema base definition it uses the router to correctly resolve the name and order of path arguments

Link to this function

validate_body(arg, spec, body_params)

View Source
validate_body({String.t(), String.t()}, map(), map()) ::
  true | {false, map()}

validate_body is used to validate the input body for a spec, for a specific method, path.

Link to this function

validate_params(arg, spec, headers, path_params, query_params)

View Source
validate_params({String.t(), String.t()}, map(), map(), map(), map()) ::
  true | {false, map()}

validate params takes in and validates headers, path, and query parameters against the spec

Link to this function

validate_response(arg, spec, status, resp_body)

View Source
validate_response(
  {String.t(), String.t()},
  map(),
  String.t() | integer(),
  String.t()
) :: true | {false, map()}

validate_response is used to validate the responses section for a spec, for a specific method, path, and status.