apivore 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
MjNiMDNhZmRhOTE1Mzc3NTMxZDYwOTU4OThhODlmMTIxYzBjYTViYg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
MDFlZmRlZjMwOWI4ZWFkZGI3YmRmYzYxZWE1ZjdmZWUwNTY2MDFkOA==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MTNmOGNkNTYxYzUzZjUxMmY5MDZiZDI4ZDZlNmY5N2VlY2I3YWQwODFhMTkw
|
|
10
|
+
YzVmZjQ4ODljNTdlZjZiZTJkZmRjNjhiZDY0MGUxOGE0ZTZhNWU2MWI4NDI0
|
|
11
|
+
YzYyMWU3MGNhNWE1NWU3MDljMjliYzU4MzBhZDRkNDJkYWI2MmI=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
YTExN2IzN2Q0NWIyNDBhZjRlZjljOTI4Y2QxNWIwNWY5OWQxYTA1NDA1NzA1
|
|
14
|
+
ZGM0MDA5MjI4MzkxZjE4NzU3ZGMyZWVmNTIzNjI3N2RmNmY2MWEzNzBiMjIw
|
|
15
|
+
NjVlMmQ5MzY1ZDdkNWZiOWRmYzlkODNhZGUxY2ZjYTEyNGViNTI=
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Westfield API Standards",
|
|
3
|
+
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"definitions": {
|
|
7
|
+
"description": "All entities defined in the 'definitions' section must include an explicit 'type: object' attribute. This forces the entity to be validated.",
|
|
8
|
+
"type": "object",
|
|
9
|
+
"additionalProperties": {
|
|
10
|
+
"$ref": "#/definitions/schemaObject"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"definitions": {
|
|
15
|
+
"schemaObject": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"required": [ "type" ],
|
|
18
|
+
"properties": {
|
|
19
|
+
"type": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"enum": [ "object" ]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -27,9 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"host": {
|
|
29
29
|
"type": "string",
|
|
30
|
-
"format": "uri",
|
|
31
30
|
"pattern": "^[^{}/ :\\\\]+(?::\\d+)?$",
|
|
32
|
-
"description": "The
|
|
31
|
+
"description": "The host (name or ip) of the API. Example: 'swagger.io'"
|
|
33
32
|
},
|
|
34
33
|
"basePath": {
|
|
35
34
|
"type": "string",
|
|
@@ -101,7 +100,7 @@
|
|
|
101
100
|
},
|
|
102
101
|
"description": {
|
|
103
102
|
"type": "string",
|
|
104
|
-
"description": "A longer description of the API. Should be different from the title.
|
|
103
|
+
"description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."
|
|
105
104
|
},
|
|
106
105
|
"termsOfService": {
|
|
107
106
|
"type": "string",
|
|
@@ -134,6 +133,11 @@
|
|
|
134
133
|
"description": "The email address of the contact person/organization.",
|
|
135
134
|
"format": "email"
|
|
136
135
|
}
|
|
136
|
+
},
|
|
137
|
+
"patternProperties": {
|
|
138
|
+
"^x-": {
|
|
139
|
+
"$ref": "#/definitions/vendorExtension"
|
|
140
|
+
}
|
|
137
141
|
}
|
|
138
142
|
},
|
|
139
143
|
"license": {
|
|
@@ -152,6 +156,11 @@
|
|
|
152
156
|
"description": "The URL pointing to the license.",
|
|
153
157
|
"format": "uri"
|
|
154
158
|
}
|
|
159
|
+
},
|
|
160
|
+
"patternProperties": {
|
|
161
|
+
"^x-": {
|
|
162
|
+
"$ref": "#/definitions/vendorExtension"
|
|
163
|
+
}
|
|
155
164
|
}
|
|
156
165
|
},
|
|
157
166
|
"paths": {
|
|
@@ -203,14 +212,16 @@
|
|
|
203
212
|
"type": "string",
|
|
204
213
|
"format": "uri"
|
|
205
214
|
}
|
|
215
|
+
},
|
|
216
|
+
"patternProperties": {
|
|
217
|
+
"^x-": {
|
|
218
|
+
"$ref": "#/definitions/vendorExtension"
|
|
219
|
+
}
|
|
206
220
|
}
|
|
207
221
|
},
|
|
208
222
|
"examples": {
|
|
209
223
|
"type": "object",
|
|
210
|
-
"
|
|
211
|
-
"^[a-z0-9-]+/[a-z0-9\\-+]+$": {}
|
|
212
|
-
},
|
|
213
|
-
"additionalProperties": false
|
|
224
|
+
"additionalProperties": true
|
|
214
225
|
},
|
|
215
226
|
"mimeType": {
|
|
216
227
|
"type": "string",
|
|
@@ -241,14 +252,14 @@
|
|
|
241
252
|
},
|
|
242
253
|
"description": {
|
|
243
254
|
"type": "string",
|
|
244
|
-
"description": "A longer description of the operation,
|
|
255
|
+
"description": "A longer description of the operation, GitHub Flavored Markdown is allowed."
|
|
245
256
|
},
|
|
246
257
|
"externalDocs": {
|
|
247
258
|
"$ref": "#/definitions/externalDocs"
|
|
248
259
|
},
|
|
249
260
|
"operationId": {
|
|
250
261
|
"type": "string",
|
|
251
|
-
"description": "A
|
|
262
|
+
"description": "A unique identifier of the operation."
|
|
252
263
|
},
|
|
253
264
|
"produces": {
|
|
254
265
|
"description": "A list of MIME types the API can produce.",
|
|
@@ -357,7 +368,14 @@
|
|
|
357
368
|
"type": "string"
|
|
358
369
|
},
|
|
359
370
|
"schema": {
|
|
360
|
-
"
|
|
371
|
+
"oneOf": [
|
|
372
|
+
{
|
|
373
|
+
"$ref": "#/definitions/schema"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"$ref": "#/definitions/fileSchema"
|
|
377
|
+
}
|
|
378
|
+
]
|
|
361
379
|
},
|
|
362
380
|
"headers": {
|
|
363
381
|
"$ref": "#/definitions/headers"
|
|
@@ -366,7 +384,12 @@
|
|
|
366
384
|
"$ref": "#/definitions/examples"
|
|
367
385
|
}
|
|
368
386
|
},
|
|
369
|
-
"additionalProperties": false
|
|
387
|
+
"additionalProperties": false,
|
|
388
|
+
"patternProperties": {
|
|
389
|
+
"^x-": {
|
|
390
|
+
"$ref": "#/definitions/vendorExtension"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
370
393
|
},
|
|
371
394
|
"headers": {
|
|
372
395
|
"type": "object",
|
|
@@ -442,6 +465,11 @@
|
|
|
442
465
|
"description": {
|
|
443
466
|
"type": "string"
|
|
444
467
|
}
|
|
468
|
+
},
|
|
469
|
+
"patternProperties": {
|
|
470
|
+
"^x-": {
|
|
471
|
+
"$ref": "#/definitions/vendorExtension"
|
|
472
|
+
}
|
|
445
473
|
}
|
|
446
474
|
},
|
|
447
475
|
"vendorExtension": {
|
|
@@ -464,7 +492,7 @@
|
|
|
464
492
|
"properties": {
|
|
465
493
|
"description": {
|
|
466
494
|
"type": "string",
|
|
467
|
-
"description": "A brief description of the parameter. This could contain examples of use.
|
|
495
|
+
"description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
|
|
468
496
|
},
|
|
469
497
|
"name": {
|
|
470
498
|
"type": "string",
|
|
@@ -510,7 +538,7 @@
|
|
|
510
538
|
},
|
|
511
539
|
"description": {
|
|
512
540
|
"type": "string",
|
|
513
|
-
"description": "A brief description of the parameter. This could contain examples of use.
|
|
541
|
+
"description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
|
|
514
542
|
},
|
|
515
543
|
"name": {
|
|
516
544
|
"type": "string",
|
|
@@ -598,7 +626,7 @@
|
|
|
598
626
|
},
|
|
599
627
|
"description": {
|
|
600
628
|
"type": "string",
|
|
601
|
-
"description": "A brief description of the parameter. This could contain examples of use.
|
|
629
|
+
"description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
|
|
602
630
|
},
|
|
603
631
|
"name": {
|
|
604
632
|
"type": "string",
|
|
@@ -691,7 +719,7 @@
|
|
|
691
719
|
},
|
|
692
720
|
"description": {
|
|
693
721
|
"type": "string",
|
|
694
|
-
"description": "A brief description of the parameter. This could contain examples of use.
|
|
722
|
+
"description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
|
|
695
723
|
},
|
|
696
724
|
"name": {
|
|
697
725
|
"type": "string",
|
|
@@ -770,6 +798,9 @@
|
|
|
770
798
|
"$ref": "#/definitions/vendorExtension"
|
|
771
799
|
}
|
|
772
800
|
},
|
|
801
|
+
"required": [
|
|
802
|
+
"required"
|
|
803
|
+
],
|
|
773
804
|
"properties": {
|
|
774
805
|
"required": {
|
|
775
806
|
"type": "boolean",
|
|
@@ -787,7 +818,7 @@
|
|
|
787
818
|
},
|
|
788
819
|
"description": {
|
|
789
820
|
"type": "string",
|
|
790
|
-
"description": "A brief description of the parameter. This could contain examples of use.
|
|
821
|
+
"description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
|
|
791
822
|
},
|
|
792
823
|
"name": {
|
|
793
824
|
"type": "string",
|
|
@@ -955,7 +986,15 @@
|
|
|
955
986
|
"$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
|
|
956
987
|
},
|
|
957
988
|
"additionalProperties": {
|
|
958
|
-
"
|
|
989
|
+
"anyOf": [
|
|
990
|
+
{
|
|
991
|
+
"$ref": "#/definitions/schema"
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
"type": "boolean"
|
|
995
|
+
}
|
|
996
|
+
],
|
|
997
|
+
"default": {}
|
|
959
998
|
},
|
|
960
999
|
"type": {
|
|
961
1000
|
"$ref": "http://json-schema.org/draft-04/schema#/properties/type"
|
|
@@ -1006,6 +1045,47 @@
|
|
|
1006
1045
|
},
|
|
1007
1046
|
"additionalProperties": false
|
|
1008
1047
|
},
|
|
1048
|
+
"fileSchema": {
|
|
1049
|
+
"type": "object",
|
|
1050
|
+
"description": "A deterministic version of a JSON Schema object.",
|
|
1051
|
+
"patternProperties": {
|
|
1052
|
+
"^x-": {
|
|
1053
|
+
"$ref": "#/definitions/vendorExtension"
|
|
1054
|
+
}
|
|
1055
|
+
},
|
|
1056
|
+
"properties": {
|
|
1057
|
+
"format": {
|
|
1058
|
+
"type": "string"
|
|
1059
|
+
},
|
|
1060
|
+
"title": {
|
|
1061
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
|
|
1062
|
+
},
|
|
1063
|
+
"description": {
|
|
1064
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
|
|
1065
|
+
},
|
|
1066
|
+
"default": {
|
|
1067
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
|
|
1068
|
+
},
|
|
1069
|
+
"required": {
|
|
1070
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
|
|
1071
|
+
},
|
|
1072
|
+
"type": {
|
|
1073
|
+
"type": "string",
|
|
1074
|
+
"enum": [
|
|
1075
|
+
"file"
|
|
1076
|
+
]
|
|
1077
|
+
},
|
|
1078
|
+
"readOnly": {
|
|
1079
|
+
"type": "boolean",
|
|
1080
|
+
"default": false
|
|
1081
|
+
},
|
|
1082
|
+
"externalDocs": {
|
|
1083
|
+
"$ref": "#/definitions/externalDocs"
|
|
1084
|
+
},
|
|
1085
|
+
"example": {}
|
|
1086
|
+
},
|
|
1087
|
+
"additionalProperties": false
|
|
1088
|
+
},
|
|
1009
1089
|
"primitivesItems": {
|
|
1010
1090
|
"type": "object",
|
|
1011
1091
|
"additionalProperties": false,
|
|
@@ -1068,6 +1148,11 @@
|
|
|
1068
1148
|
"multipleOf": {
|
|
1069
1149
|
"$ref": "#/definitions/multipleOf"
|
|
1070
1150
|
}
|
|
1151
|
+
},
|
|
1152
|
+
"patternProperties": {
|
|
1153
|
+
"^x-": {
|
|
1154
|
+
"$ref": "#/definitions/vendorExtension"
|
|
1155
|
+
}
|
|
1071
1156
|
}
|
|
1072
1157
|
},
|
|
1073
1158
|
"security": {
|
|
@@ -1108,6 +1193,11 @@
|
|
|
1108
1193
|
"type": "boolean",
|
|
1109
1194
|
"default": false
|
|
1110
1195
|
}
|
|
1196
|
+
},
|
|
1197
|
+
"patternProperties": {
|
|
1198
|
+
"^x-": {
|
|
1199
|
+
"$ref": "#/definitions/vendorExtension"
|
|
1200
|
+
}
|
|
1111
1201
|
}
|
|
1112
1202
|
},
|
|
1113
1203
|
"tag": {
|
|
@@ -1484,6 +1574,9 @@
|
|
|
1484
1574
|
},
|
|
1485
1575
|
"jsonReference": {
|
|
1486
1576
|
"type": "object",
|
|
1577
|
+
"required": [
|
|
1578
|
+
"$ref"
|
|
1579
|
+
],
|
|
1487
1580
|
"additionalProperties": false,
|
|
1488
1581
|
"properties": {
|
|
1489
1582
|
"$ref": {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Apivore
|
|
2
|
+
class CustomSchemaValidator
|
|
3
|
+
# This constant is an example custom schema included with the gem
|
|
4
|
+
WF_SCHEMA = File.expand_path("../../data/custom_schemata/westfield_api_standards.json", File.dirname(__FILE__))
|
|
5
|
+
|
|
6
|
+
def initialize(custom_schema)
|
|
7
|
+
@schema = custom_schema
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def matches?(swagger_checker)
|
|
11
|
+
@results = JSON::Validator.fully_validate(@schema, swagger_checker.swagger)
|
|
12
|
+
@results.empty?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def description
|
|
16
|
+
"additionally conforms to #{@schema}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def failure_message
|
|
20
|
+
@results.join("\n")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'apivore/validator'
|
|
2
2
|
require 'apivore/all_routes_tested_validator'
|
|
3
|
+
require 'apivore/custom_schema_validator'
|
|
3
4
|
|
|
4
5
|
module Apivore
|
|
5
6
|
module RspecHelpers
|
|
@@ -7,6 +8,10 @@ module Apivore
|
|
|
7
8
|
Validator.new(method, path, response_code, params)
|
|
8
9
|
end
|
|
9
10
|
|
|
11
|
+
def conform_to(custom_schema)
|
|
12
|
+
CustomSchemaValidator.new(custom_schema)
|
|
13
|
+
end
|
|
14
|
+
|
|
10
15
|
def validate_all_paths
|
|
11
16
|
AllRoutesTestedValidator.new
|
|
12
17
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apivore
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Charles Horn
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-07-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: json-schema
|
|
@@ -157,10 +157,12 @@ executables: []
|
|
|
157
157
|
extensions: []
|
|
158
158
|
extra_rdoc_files: []
|
|
159
159
|
files:
|
|
160
|
+
- data/custom_schemata/westfield_api_standards.json
|
|
160
161
|
- data/draft04_schema.json
|
|
161
162
|
- data/swagger_2.0_schema.json
|
|
162
163
|
- lib/apivore.rb
|
|
163
164
|
- lib/apivore/all_routes_tested_validator.rb
|
|
165
|
+
- lib/apivore/custom_schema_validator.rb
|
|
164
166
|
- lib/apivore/fragment.rb
|
|
165
167
|
- lib/apivore/rspec_helpers.rb
|
|
166
168
|
- lib/apivore/rspec_matchers.rb
|