README.md in rspec-rails-api-0.6.2 vs README.md in rspec-rails-api-0.6.3

- old
+ new

@@ -449,24 +449,42 @@ ##### `path_params(fields: nil, defined: nil)` Defines the path parameters that are used in the URL. +Any field that is not referenced in the URL will end in querystring parameters. + ```ruby -on_get '/api/users/:id/posts/:post_slug?full=:full_post' do +on_get '/api/users/:id/posts/:post_slug' do path_params fields: { + # "path" parameters id: { type: :integer, description: 'The user ID' }, post_slug: { type: :string, description: 'The post slug' }, - full_post: { type: :boolean, required: false, description: 'Returns the full post if `true`, or only an excerpt' } } + # "query" parameters + full_post: { type: :boolean, required: false, description: 'Returns the full post if `true`, or only an excerpt' }, + } + # ... +end +``` +If the querystring parameters are visible in the URL for some reason, they will still be treated as `query` parameters: + +```ruby +on_get '/api/users/:id?full_bio=:full_bio_flag' do + path_params fields: { + # "path" parameters + id: { type: :integer, description: 'The user ID' }, + # "query" parameters + full_bio_flag: { type: :boolean, required: false, description: 'Returns the full biography' }, + } # ... end ``` - `type` is the field type (check _entity definition_ for a list). - `description` should be some valid [CommonMark](https://commonmark.org/) -- `required` is optional an defaults to `true`. +- `required` is optional and defaults to `true`. Alternative with defined parameters: ```ruby parameters :users_post_path_params,