Amend typoes (#944)
* Amend some documentation specific typoes * Address some typoes in tests * Amend source typo * Fix typo in parameter call * Pencil in contribution line
This commit is contained in:
parent
fddae76f8c
commit
ecafd1f78f
|
@ -7,6 +7,7 @@
|
|||
#### Fixes
|
||||
|
||||
* [#943](https://github.com/ruby-grape/grape-swagger/pull/943): Fix route_param documentation and type - [@4ndv](https://github.com/4ndv)
|
||||
* [#944](https://github.com/ruby-grape/grape-swagger/pull/944): Amend a few typographic errors - [@pieterocp](https://github.com/pieterocp)
|
||||
* Your contribution here.
|
||||
|
||||
|
||||
|
|
|
@ -485,7 +485,7 @@ add_swagger_documentation \
|
|||
|
||||
#### Swagger Header Parameters <a name="headers"></a>
|
||||
|
||||
Swagger also supports the documentation of parameters passed in the header. Since grape's ```params[]``` doesn't return header parameters we can specify header parameters seperately in a block after the description.
|
||||
Swagger also supports the documentation of parameters passed in the header. Since grape's ```params[]``` doesn't return header parameters we can specify header parameters separately in a block after the description.
|
||||
|
||||
```ruby
|
||||
desc "Return super-secret information", {
|
||||
|
@ -955,7 +955,8 @@ The result is then something like following:
|
|||
|
||||
#### Changing default status codes <a name="change-status"></a>
|
||||
|
||||
The default status codes, one could be found (-> [status codes](lib/grape-swagger/doc_methods/status_codes.rb)) can be changed to your specific needs, to achive it, you have to change it for grape itself and for the documentation.
|
||||
|
||||
The default status codes, one could be found (-> [status codes](lib/grape-swagger/doc_methods/status_codes.rb)) can be changed to your specific needs, to achieve it, you have to change it for grape itself and for the documentation.
|
||||
|
||||
```ruby
|
||||
desc 'Get a list of stuff',
|
||||
|
@ -1678,7 +1679,7 @@ This is how to configure the grape_swagger documentation:
|
|||
The guard method should inject the Security Requirement Object into the endpoint's route settings (see Grape::DSL::Settings.route_setting method).
|
||||
|
||||
The 'oauth2 false' added to swagger_documentation is making the main Swagger endpoint protected with OAuth, i.e. the
|
||||
access_token is being retreiving from the HTTP request, but the 'false' scope is for skipping authorization and
|
||||
access_token is being retrieving from the HTTP request, but the 'false' scope is for skipping authorization and
|
||||
showing the UI for everyone. If the scope would be set to something else, like 'oauth2 admin', for example, than the UI
|
||||
wouldn't be displayed at all to unauthorized users.
|
||||
|
||||
|
@ -1786,7 +1787,7 @@ params:
|
|||
- store={ true | file_name.json } – save as JSON (optional)
|
||||
- resource=resource_name – get only for this one (optional)
|
||||
```
|
||||
For mutliversion API it creates several files with following naming: file_name_`API_VERSION`.json
|
||||
For multiversion API it creates several files with following naming: file_name_`API_VERSION`.json
|
||||
|
||||
#### OpenApi/Swagger Validation
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ module GrapeSwagger
|
|||
get url
|
||||
|
||||
@oapi = JSON.pretty_generate(
|
||||
JSON.parse(last_response.body, symolize_names: true)
|
||||
JSON.parse(last_response.body, symbolize_names: true)
|
||||
) + "\n"
|
||||
end
|
||||
# rubocop:enable Style/StringConcatenation
|
||||
|
|
|
@ -37,8 +37,8 @@ describe 'definition names' do
|
|||
end
|
||||
|
||||
class Class5
|
||||
class FithEntity < Class4::FourthEntity
|
||||
expose :fith_thing
|
||||
class FifthEntity < Class4::FourthEntity
|
||||
expose :fifth_thing
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -69,7 +69,7 @@ describe 'definition names' do
|
|||
DummyEntities::WithVeryLongName::AnotherGroupingModule::Class2::Entities,
|
||||
DummyEntities::WithVeryLongName::AnotherGroupingModule::Class3::Entity,
|
||||
DummyEntities::WithVeryLongName::AnotherGroupingModule::Class4::FourthEntity,
|
||||
DummyEntities::WithVeryLongName::AnotherGroupingModule::Class5::FithEntity,
|
||||
DummyEntities::WithVeryLongName::AnotherGroupingModule::Class5::FifthEntity,
|
||||
DummyEntities::WithVeryLongName::AnotherGroupingModule::Class6::SixthEntity,
|
||||
DummyEntities::WithVeryLongName::AnotherGroupingModule::Class7::SeventhEntity
|
||||
]
|
||||
|
@ -88,7 +88,7 @@ describe 'definition names' do
|
|||
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class2' }
|
||||
specify { expect(subject).to include 'FooKlass' }
|
||||
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class4_FourthEntity' }
|
||||
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class5_FithEntity' }
|
||||
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class5_FifthEntity' }
|
||||
specify { expect(subject).to include 'BarKlass' }
|
||||
specify { expect(subject).to include 'TestDefinition_DummyEntities_WithVeryLongName_AnotherGroupingModule_Class7_SeventhEntity' }
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ describe '#923 Body params for DELETE action' do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'retrieves the documentation for delete parameters as a schema defintion' do
|
||||
describe 'retrieves the documentation for delete parameters as a schema definition' do
|
||||
subject do
|
||||
get '/swagger_doc'
|
||||
JSON.parse(last_response.body)
|
||||
|
|
|
@ -165,7 +165,7 @@ RSpec.shared_context 'entity swagger example' do
|
|||
}
|
||||
end
|
||||
|
||||
let(:swagger_typed_defintion) do
|
||||
let(:swagger_typed_definition) do
|
||||
{
|
||||
'prop_boolean' => { 'description' => 'prop_boolean description', 'type' => 'boolean' },
|
||||
'prop_date' => { 'description' => 'prop_date description', 'type' => 'string', 'format' => 'date' },
|
||||
|
@ -239,7 +239,7 @@ RSpec.shared_context 'entity swagger example' do
|
|||
{ 'in' => 'formData', 'name' => 'text', 'description' => 'Content of something.', 'type' => 'string', 'required' => true },
|
||||
{ 'in' => 'formData', 'name' => 'links', 'type' => 'array', 'items' => { 'type' => 'string' }, 'required' => true }
|
||||
],
|
||||
'responses' => { '201' => { 'description' => 'This creates Thing.', 'schema' => { '$ref' => '#/definitions/Something' } }, '422' => { 'description' => 'Unprocessible Entity' } },
|
||||
'responses' => { '201' => { 'description' => 'This creates Thing.', 'schema' => { '$ref' => '#/definitions/Something' } }, '422' => { 'description' => 'Unprocessable Entity' } },
|
||||
'tags' => ['thing'],
|
||||
'operationId' => 'postThing'
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ RSpec.shared_context 'mock swagger example' do
|
|||
}
|
||||
end
|
||||
|
||||
let(:swagger_typed_defintion) do
|
||||
let(:swagger_typed_definition) do
|
||||
{
|
||||
'mock_data' => {
|
||||
'type' => 'string',
|
||||
|
@ -247,7 +247,7 @@ RSpec.shared_context 'mock swagger example' do
|
|||
{ 'in' => 'formData', 'name' => 'text', 'description' => 'Content of something.', 'type' => 'string', 'required' => true },
|
||||
{ 'in' => 'formData', 'name' => 'links', 'type' => 'array', 'items' => { 'type' => 'string' }, 'required' => true }
|
||||
],
|
||||
'responses' => { '201' => { 'description' => 'This creates Thing.', 'schema' => { '$ref' => '#/definitions/Something' } }, '422' => { 'description' => 'Unprocessible Entity' } },
|
||||
'responses' => { '201' => { 'description' => 'This creates Thing.', 'schema' => { '$ref' => '#/definitions/Something' } }, '422' => { 'description' => 'Unprocessable Entity' } },
|
||||
'tags' => ['thing'],
|
||||
'operationId' => 'postThing'
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ RSpec.shared_context 'representable swagger example' do
|
|||
}
|
||||
end
|
||||
|
||||
let(:swagger_typed_defintion) do
|
||||
let(:swagger_typed_definition) do
|
||||
{
|
||||
'prop_boolean' => { 'description' => 'prop_boolean description', 'type' => 'boolean' },
|
||||
'prop_date' => { 'description' => 'prop_date description', 'type' => 'string', 'format' => 'date' },
|
||||
|
@ -311,7 +311,7 @@ RSpec.shared_context 'representable swagger example' do
|
|||
{ 'in' => 'formData', 'name' => 'text', 'description' => 'Content of something.', 'type' => 'string', 'required' => true },
|
||||
{ 'in' => 'formData', 'name' => 'links', 'type' => 'array', 'items' => { 'type' => 'string' }, 'required' => true }
|
||||
],
|
||||
'responses' => { '201' => { 'description' => 'This creates Thing.', 'schema' => { '$ref' => '#/definitions/Something' } }, '422' => { 'description' => 'Unprocessible Entity' } },
|
||||
'responses' => { '201' => { 'description' => 'This creates Thing.', 'schema' => { '$ref' => '#/definitions/Something' } }, '422' => { 'description' => 'Unprocessable Entity' } },
|
||||
'tags' => ['thing'],
|
||||
'operationId' => 'postThing'
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ def details
|
|||
end
|
||||
|
||||
describe 'details' do
|
||||
describe 'take deatils as it is' do
|
||||
describe 'take details as it is' do
|
||||
include_context "#{MODEL_PARSER} swagger example"
|
||||
|
||||
before :all do
|
||||
|
|
|
@ -45,7 +45,7 @@ describe 'extensions' do
|
|||
|
||||
desc 'This returns something with extension on definition level',
|
||||
success: Entities::OtherItem
|
||||
get '/non_existend_status_definitions_extension' do
|
||||
get '/non_existent_status_definitions_extension' do
|
||||
{ 'declared_params' => declared(params) }
|
||||
end
|
||||
|
||||
|
@ -132,7 +132,7 @@ describe 'extensions' do
|
|||
|
||||
describe 'extension on definition level' do
|
||||
subject do
|
||||
get '/swagger_doc/non_existend_status_definitions_extension'
|
||||
get '/swagger_doc/non_existent_status_definitions_extension'
|
||||
JSON.parse(last_response.body)
|
||||
end
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ describe 'swagger spec v2.0' do
|
|||
requires :text, type: String, documentation: { type: 'string', desc: 'Content of something.' }
|
||||
requires :links, type: Array, documentation: { type: 'link', is_array: true }
|
||||
end
|
||||
post '/thing', http_codes: [{ code: 422, message: 'Unprocessible Entity' }] do
|
||||
post '/thing', http_codes: [{ code: 422, message: 'Unprocessable Entity' }] do
|
||||
something = OpenStruct.new text: 'something'
|
||||
present something, with: Entities::Something
|
||||
end
|
||||
|
|
|
@ -51,7 +51,7 @@ describe 'swagger spec v2.0' do
|
|||
requires :text, type: String, documentation: { type: 'string', desc: 'Content of something.' }
|
||||
requires :links, type: Array, documentation: { type: 'link', is_array: true }
|
||||
end
|
||||
post '/thing', http_codes: [{ code: 422, message: 'Unprocessible Entity' }] do
|
||||
post '/thing', http_codes: [{ code: 422, message: 'Unprocessable Entity' }] do
|
||||
something = OpenStruct.new text: 'something'
|
||||
present something, with: Entities::Something
|
||||
end
|
||||
|
|
|
@ -85,6 +85,6 @@ describe 'type format settings' do
|
|||
end
|
||||
|
||||
specify do
|
||||
expect(subject['definitions']['TypedDefinition']['properties']).to eql(swagger_typed_defintion)
|
||||
expect(subject['definitions']['TypedDefinition']['properties']).to eql(swagger_typed_definition)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue