You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swagger_files: %{
"priv/static/swagger.json" => [
router: MyAppWeb.Router, # phoenix routes will be converted to swagger paths
endpoint: MyAppWeb.Endpoint # (optional) endpoint config used to set host, port and https schemes.
]
}
What if I needed to create Swagger docs for only a part of all the routes in my router.ex?
Or if I had multiple APIs in it? private one, public one, something else
In other words, how will phoenix_swagger know which scope it must generate API docs for? I might name my api route-scope /my_super_route rather than /api.
Or does it use priv/static/swagger.json only and doesn't care what's in router.ex?
The text was updated successfully, but these errors were encountered:
The outline of the swagger document should be returned from a swagger_info/0 function defined in your phoenix Router.ex module.
defmoduleMyApp.RouterdouseMyApp.Web,:routerpipeline:apidoplug:accepts,["json"]endscope"/api",MyAppdopipe_through:apiresources"/users",UserControllerenddefswagger_infodo%{info: %{version: "1.0",title: "My App"}}endend
The version and title are mandatory fields. By default the version will be 0.0.1 and the title will be <enter your title> if you do not provide swagger_info/0 function.
See the Swagger Object specification for details of other information that can be included. basePath is optional but may need to be specified if your API routes do not reside at the root location /. You can also set the description of tags here, for example:
%{basePath: "/api",info: %{..},tags: [%{name: "Users",description: "Operations about Users"}]}
I haven't tested this, but have you tried setting the basePath in your swagger_info function to "/my_super_route" or whatever scope you do want to generate swagger documentation for?
There's the "router" argument
What if I needed to create Swagger docs for only a part of all the routes in my
router.ex
?Or if I had multiple APIs in it? private one, public one, something else
In other words, how will
phoenix_swagger
know which scope it must generate API docs for? I might name my api route-scope/my_super_route
rather than/api
.Or does it use
priv/static/swagger.json
only and doesn't care what's in router.ex?The text was updated successfully, but these errors were encountered: