Skip to content

Commit

Permalink
Remove "null" from type of JSONAPI prev/next
Browse files Browse the repository at this point in the history
SwaggerUI does not understand that type.
KronicDeth committed Nov 2, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0fc6e50 commit ef30dbc
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/phoenix_swagger/json_api.ex
Original file line number Diff line number Diff line change
@@ -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 {
@@ -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 ->
4 changes: 2 additions & 2 deletions test/json_api_test.exs
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit ef30dbc

Please sign in to comment.