View Source OpenApiSpex.TestAssertions (open_api_spex v3.16.0)

Defines helpers for testing API responses and examples against API spec schemas.

Link to this section Summary

Functions

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.

Link to this section Functions

Link to this function

assert_request_schema(value, schema_title, api_spec)

View Source
@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.

Link to this function

assert_response_schema(value, schema_title, api_spec)

View Source
@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.

Link to this function

assert_schema(cast_context)

View Source
@spec assert_schema(OpenApiSpex.Cast.t()) :: term()

Asserts that value conforms to the schema in the given %Cast{} context.

Link to this function

assert_schema(value, schema_title, api_spec, read_write_scope \\ nil)

View Source

Asserts that value conforms to the schema with title schema_title in api_spec.