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

[PLATFORM-543] Serialize route tags into OpenAPI 3.0 JSON #43

Merged
merged 1 commit into from
May 6, 2019
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
1 change: 1 addition & 0 deletions lib/rolodex/processors/swagger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ defmodule Rolodex.Processors.Swagger do
#
# TODO(bceskavich): we could support both?
summary: route.desc,
tags: route.tags,
parameters: process_params(route),
security: process_auth(route),
responses: process_responses(route, config)
Expand Down
5 changes: 5 additions & 0 deletions test/rolodex/processors/swagger_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ defmodule Rolodex.Processors.SwaggerTest do
"/foo" => %{
"get" => %{
"summary" => "It does a thing",
"tags" => [],
"security" => [
%{"JWTAuth" => []},
%{"OAuth" => ["user.read"]}
Expand Down Expand Up @@ -283,6 +284,7 @@ defmodule Rolodex.Processors.SwaggerTest do
"/foo" => %{
get: %{
summary: "It does a thing",
tags: [],
security: [%{JWTAuth: []}],
parameters: [
%{
Expand Down Expand Up @@ -367,6 +369,7 @@ defmodule Rolodex.Processors.SwaggerTest do
summary: "GET /foo",
security: [],
parameters: [],
tags: [],
responses: %{
200 => %{
"$ref" => "#/components/responses/UserResponse"
Expand All @@ -379,6 +382,7 @@ defmodule Rolodex.Processors.SwaggerTest do
summary: "GET /foo/{id}",
security: [],
parameters: [],
tags: [],
responses: %{
200 => %{
"$ref" => "#/components/responses/UserResponse"
Expand All @@ -389,6 +393,7 @@ defmodule Rolodex.Processors.SwaggerTest do
summary: "POST /foo/{id}",
security: [],
parameters: [],
tags: [],
responses: %{
200 => %{
"$ref" => "#/components/responses/UserResponse"
Expand Down
15 changes: 10 additions & 5 deletions test/rolodex_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ defmodule RolodexTest do
"$ref" => "#/components/responses/ErrorResponse"
}
},
"summary" => "It's a test!"
"summary" => "It's a test!",
"tags" => ["foo", "bar"]
}
},
"/api/demo/{id}" => %{
Expand All @@ -313,7 +314,8 @@ defmodule RolodexTest do
}
],
"responses" => %{},
"summary" => ""
"summary" => "",
"tags" => []
},
"put" => %{
"security" => [],
Expand Down Expand Up @@ -350,7 +352,8 @@ defmodule RolodexTest do
}
}
},
"summary" => ""
"summary" => "",
"tags" => []
}
},
"/api/multi" => %{
Expand All @@ -361,7 +364,8 @@ defmodule RolodexTest do
"404" => %{"$ref" => "#/components/responses/ErrorResponse"}
},
"security" => [%{"JWTAuth" => []}],
"summary" => "It's an action used for multiple routes"
"summary" => "It's an action used for multiple routes",
"tags" => []
}
},
"/api/nested/{nested_id}/multi" => %{
Expand All @@ -379,7 +383,8 @@ defmodule RolodexTest do
"404" => %{"$ref" => "#/components/responses/ErrorResponse"}
},
"security" => [%{"JWTAuth" => []}],
"summary" => "It's an action used for multiple routes"
"summary" => "It's an action used for multiple routes",
"tags" => []
}
}
}
Expand Down