Skip to content

Commit

Permalink
Added documentation regarding controller paths and error with no swag…
Browse files Browse the repository at this point in the history
…ger_root (#94)
  • Loading branch information
davemcg3 authored and fotinakis committed Jul 4, 2017
1 parent 6ffeeb5 commit 2f7f68c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,17 @@ render json: Swagger::Blocks.build_root_json(SWAGGERED_CLASSES)

That is the only line necessary to build the full [root Swagger object](https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#schema) JSON and all definitions underneath it. You simply pass in a list of all the "swaggered" classes in your app.

If you want to include controllers outside the standard path just use the full class path including module names, like:

```Ruby
SWAGGERED_CLASSES = [
Api::V1::PetsController,
self,
]
```

If you are receiving a "swagger_root must be declared" error make sure you are including "self" in your SWAGGERED_CLASSES definition, as shown above.

Now, simply point Swagger UI at `/apidocs` and everything should Just Work™. If you change any of the Swagger block definitions, you can simply refresh Swagger UI to see the changes.

### Security handling
Expand Down

0 comments on commit 2f7f68c

Please sign in to comment.