Skip to content

Commit 13b7cd3

Browse files
committed
.
1 parent 2f2f6b6 commit 13b7cd3

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

README.md

+23
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ serve a SwaggerUI interface. The `path:` plug option must be supplied to give th
283283

284284
All JavaScript and CSS assets are sourced from cdnjs.cloudflare.com, rather than vendoring into this package.
285285

286+
287+
286288
```elixir
287289
scope "/" do
288290
pipe_through :browser # Use the default browser stack
@@ -299,6 +301,27 @@ All JavaScript and CSS assets are sourced from cdnjs.cloudflare.com, rather than
299301
end
300302
```
301303

304+
## Assets can be installed into the local application
305+
306+
```shell
307+
mix openapi.spec.install 'install_path'
308+
```
309+
```elixir
310+
scope "/" do
311+
pipe_through :browser # Use the default browser stack
312+
313+
get "/", MyAppWeb.PageController, :index
314+
get "/swaggerui", OpenApiSpex.Plug.SwaggerUI.Local, path: "/api/openapi"
315+
end
316+
317+
scope "/api" do
318+
pipe_through :api
319+
320+
resources "/users", MyAppWeb.UserController, only: [:create, :index, :show]
321+
get "/openapi", OpenApiSpex.Plug.RenderSpec, []
322+
end
323+
```
324+
302325
## Importing an existing schema file
303326

304327
> :warning: This functionality currently converts Strings into Atoms, which makes it potentially [vulnerable to DoS attacks](https://til.hashrocket.com/posts/gkwwfy9xvw-converting-strings-to-atoms-safely). We recommend that you load Open API Schemas from _known files_ during application startup and _not dynamically from external sources at runtime_.

lib/mix/tasks/install.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule Mix.Tasks.Openapi.Install do
1+
defmodule Mix.Tasks.Openapi.Spec.Install do
22
@moduledoc """
33
Fetch and install the resources locally for the interface.
44

0 commit comments

Comments
 (0)