Skip to content

Commit

Permalink
Amend typoes (#944)
Browse files Browse the repository at this point in the history
* Amend some documentation specific typoes

* Address some typoes in tests

* Amend source typo

* Fix typo in parameter call

* Pencil in contribution line
  • Loading branch information
pieterocp authored Oct 23, 2024
1 parent fddae76 commit ecafd1f
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/grape-swagger/rake/oapi_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def make_request(url)
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
Expand Down
8 changes: 4 additions & 4 deletions spec/issues/430_entity_definitions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class FourthEntity < Grape::Entity
end

class Class5
class FithEntity < Class4::FourthEntity
expose :fith_thing
class FifthEntity < Class4::FourthEntity
expose :fifth_thing
end
end

Expand Down Expand Up @@ -69,7 +69,7 @@ class NameApi < Grape::API
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
]
Expand All @@ -88,7 +88,7 @@ class NameApi < Grape::API
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
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)
Expand Down
4 changes: 2 additions & 2 deletions spec/support/model_parsers/entity_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class DocumentedHashAndArrayModel < Grape::Entity
}
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' },
Expand Down Expand Up @@ -239,7 +239,7 @@ class DocumentedHashAndArrayModel < Grape::Entity
{ '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'
}
Expand Down
4 changes: 2 additions & 2 deletions spec/support/model_parsers/mock_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ApiResponse < OpenStruct; end
}
end

let(:swagger_typed_defintion) do
let(:swagger_typed_definition) do
{
'mock_data' => {
'type' => 'string',
Expand Down Expand Up @@ -247,7 +247,7 @@ class ApiResponse < OpenStruct; end
{ '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'
}
Expand Down
4 changes: 2 additions & 2 deletions spec/support/model_parsers/representable_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class DocumentedHashAndArrayModel < Representable::Decorator
}
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' },
Expand Down Expand Up @@ -311,7 +311,7 @@ class DocumentedHashAndArrayModel < Representable::Decorator
{ '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'
}
Expand Down
2 changes: 1 addition & 1 deletion spec/swagger_v2/api_swagger_v2_detail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def do_good
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
Expand Down
4 changes: 2 additions & 2 deletions spec/swagger_v2/api_swagger_v2_extensions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ExtensionsApi < Grape::API

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

Expand Down Expand Up @@ -132,7 +132,7 @@ def app

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

Expand Down
2 changes: 1 addition & 1 deletion spec/swagger_v2/api_swagger_v2_mounted_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def app
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
Expand Down
2 changes: 1 addition & 1 deletion spec/swagger_v2/api_swagger_v2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def app
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
Expand Down
2 changes: 1 addition & 1 deletion spec/swagger_v2/api_swagger_v2_type-format_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ def app
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

0 comments on commit ecafd1f

Please sign in to comment.