Skip to content

Commit

Permalink
Inline keys support. Optional blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Jedrychowski committed Jan 29, 2016
1 parent 5228074 commit 6bbe7c5
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 163 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,34 @@ The `key` block simply takes the value you give and puts it directly into the fi
key :foo, {some_complex: {nested_object: true}}
```

#### Inline keys

It is possible to condensed syntax to omit numerous `key` calls using hash argument.

All three calls are equal:

```ruby
parameter do
key :paramType, :path
key :name, :petId
key :description, 'ID of pet that needs to be fetched'
key :type, :string
end
```

```ruby
parameter paramType: :path, name: :petId do
key :description, 'ID of pet that needs to be fetched'
key :type, :string
end
```

```ruby
parameter paramType: :path, name: :petId,
description: 'ID of pet that needs to be fetched',
type: :string
```

#### Writing JSON to a file

If you are not serving the JSON directly and need to write it to a file for some reason, you can easily use `build_root_json` for that as well:
Expand Down
Loading

0 comments on commit 6bbe7c5

Please sign in to comment.