Skip to content

Multiple Swagger files #424

Answered by mbuhot
LuizFerK asked this question in Q&A
Feb 22, 2022 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

Yes I think it should be possible.

If you define multiple top level API Definition modules https://github.com/open-api-spex/open_api_spex/blob/master/lib/open_api_spex/open_api.ex#L54-L69, then you can serve them at different paths and use them for validation/casting in your different router scopes.

pipeline :private_api do
  plug OpenApiSpex.Plug.PutApiSpec, module: MyAppWeb.PrivateApiSpec
  ... other plugs ...
end

pipeline :public_api do
  plug OpenApiSpex.Plug.PutApiSpec, module: MyAppWeb.PublicApiSpec
  ... other plugs ...
end
scope "/public/api" do
  pipe_through :public_api
  resources "/users", MyAppWeb.UserController, only: [:create, :index, :show]
  get "/openapi", OpenApiSpex.P…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@LuizFerK
Comment options

Answer selected by LuizFerK
Comment options

You must be logged in to vote
3 replies
@LuizFerK
Comment options

@axelson
Comment options

@axelson
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #423 on February 23, 2022 02:18.