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

Remove "null" from type of JSONAPI prev/next #134

Merged
merged 1 commit into from
Nov 2, 2017
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions lib/phoenix_swagger/json_api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ defmodule PhoenixSwagger.JsonApi do
description: "Link to this page of results"
},
prev: %Schema {
type: [:string, "null"],
type: :string,
description: "Link to the previous page of results"
},
next: %Schema {
type: [:string, "null"],
type: :string,
description: "Link to the next page of results"
},
last: %Schema {
Expand Down Expand Up @@ -186,7 +186,7 @@ defmodule PhoenixSwagger.JsonApi do
[do: {:__block__, _, attrs}] -> attrs
[do: attr] -> [attr]
end

attrs
|> Enum.map(fn {name, line, args} -> {:attribute, line, [name | args]} end)
|> Enum.reduce(model, fn next, pipeline ->
Expand Down
4 changes: 2 additions & 2 deletions test/json_api_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ defmodule PhoenixSwagger.JsonApiTest do
"properties" => %{
"first" => %{"description" => "Link to the first page of results", "type" => "string"},
"last" => %{"description" => "Link to the last page of results", "type" => "string"},
"next" => %{"description" => "Link to the next page of results", "type" => ["string", "null"]},
"prev" => %{"description" => "Link to the previous page of results", "type" => ["string", "null"]},
"next" => %{"description" => "Link to the next page of results", "type" => "string"},
"prev" => %{"description" => "Link to the previous page of results", "type" => "string"},
"self" => %{"description" => "Link to this page of results", "type" => "string"}
},
"type" => "object"
Expand Down