From ef30dbc5cc692b49b135f22fc8e3d77d97b05c51 Mon Sep 17 00:00:00 2001 From: Luke Imhoff Date: Tue, 31 Oct 2017 14:08:54 -0500 Subject: [PATCH] Remove "null" from type of JSONAPI prev/next SwaggerUI does not understand that type. --- lib/phoenix_swagger/json_api.ex | 6 +++--- test/json_api_test.exs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/phoenix_swagger/json_api.ex b/lib/phoenix_swagger/json_api.ex index 23317a3..581f0d6 100644 --- a/lib/phoenix_swagger/json_api.ex +++ b/lib/phoenix_swagger/json_api.ex @@ -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 -> diff --git a/test/json_api_test.exs b/test/json_api_test.exs index 77db619..9d4d731 100644 --- a/test/json_api_test.exs +++ b/test/json_api_test.exs @@ -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"