View Source OpenApiSpex.TestAssertions (open_api_spex v3.21.2)
Defines helpers for testing API responses and examples against API spec schemas.
Summary
Functions
Asserts that the response body conforms to the response schema for the operation with id operation_id
.
Asserts that value
conforms to the schema or reference definition.
Asserts that value
is a valid request schema with title schema_title
in api_spec
. In this case,
the presence of required readOnly
fields is not validated.
Asserts that value
is a valid response schema with title schema_title
in api_spec
. In this case,
the presence of required writeOnly
fields is not validated.
Asserts that value
conforms to the schema in the given %Cast{}
context.
Asserts that value
conforms to the schema with title schema_title
in api_spec
.
Functions
@spec assert_operation_response(Plug.Conn.t(), String.t() | nil) :: Plug.Conn.t()
Asserts that the response body conforms to the response schema for the operation with id operation_id
.
@spec assert_raw_schema( term(), OpenApiSpex.Schema.t() | OpenApiSpex.Reference.t(), OpenApiSpex.OpenApi.t() | %{} ) :: term() | no_return()
Asserts that value
conforms to the schema or reference definition.
@spec assert_request_schema(term(), String.t(), OpenApiSpex.OpenApi.t()) :: term() | no_return()
Asserts that value
is a valid request schema with title schema_title
in api_spec
. In this case,
the presence of required readOnly
fields is not validated.
@spec assert_response_schema(term(), String.t(), OpenApiSpex.OpenApi.t()) :: term() | no_return()
Asserts that value
is a valid response schema with title schema_title
in api_spec
. In this case,
the presence of required writeOnly
fields is not validated.
@spec assert_schema(OpenApiSpex.Cast.t()) :: term()
Asserts that value
conforms to the schema in the given %Cast{}
context.
assert_schema(value, schema_title, api_spec, read_write_scope \\ nil)
View Source@spec assert_schema( term(), String.t(), OpenApiSpex.OpenApi.t(), OpenApiSpex.Cast.read_write_scope() ) :: term() | no_return()
Asserts that value
conforms to the schema with title schema_title
in api_spec
.