Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating test helpers doc #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions guides/test-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
PhoenixSwagger also includes a testing helper module `PhoenixSwagger.SchemaTest` to conveniently assert that responses
from Phoenix controller actions conform to your swagger schema.

In order to validate the swagger schema, the properties options must be required true in swagger definitions:

```elixir
properties do
id(:integer, "User ID")
name(:string, "User name", required: true)
email(:string, "Email address", format: :email, required: true)
inserted_at(:string, "Creation timestamp", format: :datetime)
updated_at(:string, "Update timestamp", format: :datetime)
end
```


In your controller test files add the `PhoenixSwagger.SchemaTest` mixin with the path to your swagger spec:

```elixir
Expand Down