Skip to content

Commit 57ece91

Browse files
authored
Merge pull request #420 from aadityataparia/aadi/remove_defaults
Remove unneeded default values
2 parents 93b7a2e + 50c4330 commit 57ece91

File tree

11 files changed

+13
-58
lines changed

11 files changed

+13
-58
lines changed

features/open_api.feature

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -342,19 +342,16 @@ Feature: Generate Open API Specification from test examples
342342
"200": {
343343
"description": "List all instructions",
344344
"schema": {
345-
"description": "",
346345
"type": "object",
347346
"properties": {
348347
}
349348
},
350349
"headers": {
351350
"Content-Type": {
352-
"description": "",
353351
"type": "string",
354352
"x-example-value": "text/html;charset=utf-8"
355353
},
356354
"Content-Length": {
357-
"description": "",
358355
"type": "string",
359356
"x-example-value": "57"
360357
}
@@ -463,19 +460,16 @@ Feature: Generate Open API Specification from test examples
463460
"200": {
464461
"description": "Getting a list of orders",
465462
"schema": {
466-
"description": "",
467463
"type": "object",
468464
"properties": {
469465
}
470466
},
471467
"headers": {
472468
"Content-Type": {
473-
"description": "",
474469
"type": "string",
475470
"x-example-value": "application/vnd.api+json"
476471
},
477472
"Content-Length": {
478-
"description": "",
479473
"type": "string",
480474
"x-example-value": "137"
481475
}
@@ -523,7 +517,6 @@ Feature: Generate Open API Specification from test examples
523517
"description": "",
524518
"required": false,
525519
"schema": {
526-
"description": "",
527520
"type": "object",
528521
"properties": {
529522
"data": {
@@ -574,19 +567,16 @@ Feature: Generate Open API Specification from test examples
574567
"201": {
575568
"description": "Creating an order",
576569
"schema": {
577-
"description": "",
578570
"type": "object",
579571
"properties": {
580572
}
581573
},
582574
"headers": {
583575
"Content-Type": {
584-
"description": "",
585576
"type": "string",
586577
"x-example-value": "application/json"
587578
},
588579
"Content-Length": {
589-
"description": "",
590580
"type": "string",
591581
"x-example-value": "73"
592582
}
@@ -625,7 +615,6 @@ Feature: Generate Open API Specification from test examples
625615
{
626616
"name": "id",
627617
"in": "path",
628-
"description": "",
629618
"required": true,
630619
"type": "integer"
631620
}
@@ -634,19 +623,16 @@ Feature: Generate Open API Specification from test examples
634623
"200": {
635624
"description": "Getting a specific order",
636625
"schema": {
637-
"description": "",
638626
"type": "object",
639627
"properties": {
640628
}
641629
},
642630
"headers": {
643631
"Content-Type": {
644-
"description": "",
645632
"type": "string",
646633
"x-example-value": "application/json"
647634
},
648635
"Content-Length": {
649-
"description": "",
650636
"type": "string",
651637
"x-example-value": "73"
652638
}
@@ -683,7 +669,6 @@ Feature: Generate Open API Specification from test examples
683669
{
684670
"name": "id",
685671
"in": "path",
686-
"description": "",
687672
"required": true,
688673
"type": "integer"
689674
},
@@ -693,7 +678,6 @@ Feature: Generate Open API Specification from test examples
693678
"description": "",
694679
"required": false,
695680
"schema": {
696-
"description": "",
697681
"type": "object",
698682
"properties": {
699683
"data": {
@@ -727,19 +711,16 @@ Feature: Generate Open API Specification from test examples
727711
"200": {
728712
"description": "Update an order",
729713
"schema": {
730-
"description": "",
731714
"type": "object",
732715
"properties": {
733716
}
734717
},
735718
"headers": {
736719
"Content-Type": {
737-
"description": "",
738720
"type": "string",
739721
"x-example-value": "application/json"
740722
},
741723
"Content-Length": {
742-
"description": "",
743724
"type": "string",
744725
"x-example-value": "63"
745726
}
@@ -750,19 +731,16 @@ Feature: Generate Open API Specification from test examples
750731
"400": {
751732
"description": "Invalid request",
752733
"schema": {
753-
"description": "",
754734
"type": "object",
755735
"properties": {
756736
}
757737
},
758738
"headers": {
759739
"Content-Type": {
760-
"description": "",
761740
"type": "string",
762741
"x-example-value": "application/json"
763742
},
764743
"Content-Length": {
765-
"description": "",
766744
"type": "string",
767745
"x-example-value": "0"
768746
}
@@ -792,7 +770,6 @@ Feature: Generate Open API Specification from test examples
792770
{
793771
"name": "id",
794772
"in": "path",
795-
"description": "",
796773
"required": true,
797774
"type": "integer"
798775
}
@@ -801,19 +778,16 @@ Feature: Generate Open API Specification from test examples
801778
"200": {
802779
"description": "Deleting an order",
803780
"schema": {
804-
"description": "",
805781
"type": "object",
806782
"properties": {
807783
}
808784
},
809785
"headers": {
810786
"Content-Type": {
811-
"description": "",
812787
"type": "string",
813788
"x-example-value": "text/html;charset=utf-8"
814789
},
815790
"Content-Length": {
816-
"description": "",
817791
"type": "string",
818792
"x-example-value": "0"
819793
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module RspecApiDocumentation
22
module OpenApi
33
class Contact < Node
4-
add_setting :name, :default => 'API Support'
5-
add_setting :url, :default => 'http://www.open-api.io/support'
6-
add_setting :email, :default => 'support@open-api.io'
4+
add_setting :name
5+
add_setting :url
6+
add_setting :email
77
end
88
end
99
end

lib/rspec_api_documentation/open_api/header.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module RspecApiDocumentation
22
module OpenApi
33
class Header < Node
4-
add_setting :description, :default => ''
4+
add_setting :description
55
add_setting :type, :required => true, :default => lambda { |header|
66
Helper.extract_type(header.public_send('x-example-value'))
77
}

lib/rspec_api_documentation/open_api/info.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ module RspecApiDocumentation
22
module OpenApi
33
class Info < Node
44
add_setting :title, :default => 'OpenAPI Specification', :required => true
5-
add_setting :description, :default => 'This is a sample server Petstore server.'
6-
add_setting :termsOfService, :default => 'http://open-api.io/terms/'
7-
add_setting :contact, :default => Contact.new, :schema => Contact
8-
add_setting :license, :default => License.new, :schema => License
5+
add_setting :description
6+
add_setting :termsOfService
7+
add_setting :contact, :schema => Contact
8+
add_setting :license, :schema => License
99
add_setting :version, :default => '1.0.0', :required => true
1010
end
1111
end

lib/rspec_api_documentation/open_api/operation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module OpenApi
33
class Operation < Node
44
add_setting :tags, :default => []
55
add_setting :summary
6-
add_setting :description, :default => ''
6+
add_setting :description
77
add_setting :externalDocs
88
add_setting :operationId
99
add_setting :consumes

lib/rspec_api_documentation/open_api/parameter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Parameter < Node
77

88
add_setting :name, :required => true
99
add_setting :in, :required => true
10-
add_setting :description, :default => ''
10+
add_setting :description
1111
add_setting :required, :default => lambda { |parameter| parameter.in.to_s == 'path' ? true : false }
1212
add_setting :schema
1313
add_setting :type

lib/rspec_api_documentation/open_api/schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module OpenApi
33
class Schema < Node
44
add_setting :format
55
add_setting :title
6-
add_setting :description, :default => ''
6+
add_setting :description
77
add_setting :required
88
add_setting :enum
99
add_setting :type

lib/rspec_api_documentation/open_api/security_schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module RspecApiDocumentation
22
module OpenApi
33
class SecuritySchema < Node
44
add_setting :type, :required => true
5-
add_setting :description, :default => ''
5+
add_setting :description
66
add_setting :name
77
add_setting :in
88
add_setting :flow

lib/rspec_api_documentation/open_api/tag.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module RspecApiDocumentation
22
module OpenApi
33
class Tag < Node
44
add_setting :name, :required => true
5-
add_setting :description, :default => ''
5+
add_setting :description
66
add_setting :externalDocs
77
end
88
end

spec/open_api/contact_spec.rb

Lines changed: 0 additions & 12 deletions
This file was deleted.

spec/open_api/info_spec.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@
55
subject { node }
66

77
describe "default settings" do
8-
class RspecApiDocumentation::OpenApi::Contact; end
9-
class RspecApiDocumentation::OpenApi::License; end
10-
118
its(:title) { should == 'OpenAPI Specification' }
12-
its(:description) { should == 'This is a sample server Petstore server.' }
13-
its(:termsOfService) { should == 'http://open-api.io/terms/' }
14-
its(:contact) { should be_a(RspecApiDocumentation::OpenApi::Contact) }
15-
its(:license) { should be_a(RspecApiDocumentation::OpenApi::License) }
169
its(:version) { should == '1.0.0' }
1710
end
1811
end

0 commit comments

Comments
 (0)