apivore 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/data/draft04_schema.json +150 -0
- data/data/swagger_2.0_schema.json +52 -70
- data/lib/apivore.rb +7 -1
- data/lib/apivore/rspec_matchers.rb +0 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGUwZWJjMDJkNzY1ODI3Yjk2NzQxYzkwNjJmYmU5NDhlNzlhZmJjMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWRkYTg2Nzg0MjFhMjA3MmFmNjVhNTU0OTVkYzVjYTBmMjQwYjc0NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDg2ZGJjODZlODM4NDE1OGViMGUwZGYxMDYyNzU3ZGM4MzQ5NmVkYzRhZjkz
|
10
|
+
NWE4M2EzYjhkNWU0ZmQwZmZhNjZhY2FmNzBkMzQ2MjQ1YjI1ZjI4NDRlODk2
|
11
|
+
ZjE3ZmQ0MDg0MTg4NzIxZGUxNWRhNDNmNWJlMDJiZDQyNjgzYjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjJlMWRmMGMwNjdkNThiYzk4NWUyOTQyZjY3NjI0M2EzMjE4OThiMmE3Y2Vm
|
14
|
+
YzJmOTg5Y2JjMGY5MDU5ODg4MTNlMzg0ZTQ4OTQwMTIwYTliYTRiNjJkYjEx
|
15
|
+
YTVkN2NhMGRlMmRiNDIwMjMzOTAxZDdlOTU3NTBiMGM2OTBlMzg=
|
@@ -0,0 +1,150 @@
|
|
1
|
+
{
|
2
|
+
"id": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
4
|
+
"description": "Core schema meta-schema",
|
5
|
+
"definitions": {
|
6
|
+
"schemaArray": {
|
7
|
+
"type": "array",
|
8
|
+
"minItems": 1,
|
9
|
+
"items": { "$ref": "#" }
|
10
|
+
},
|
11
|
+
"positiveInteger": {
|
12
|
+
"type": "integer",
|
13
|
+
"minimum": 0
|
14
|
+
},
|
15
|
+
"positiveIntegerDefault0": {
|
16
|
+
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
|
17
|
+
},
|
18
|
+
"simpleTypes": {
|
19
|
+
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
|
20
|
+
},
|
21
|
+
"stringArray": {
|
22
|
+
"type": "array",
|
23
|
+
"items": { "type": "string" },
|
24
|
+
"minItems": 1,
|
25
|
+
"uniqueItems": true
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"type": "object",
|
29
|
+
"properties": {
|
30
|
+
"id": {
|
31
|
+
"type": "string",
|
32
|
+
"format": "uri"
|
33
|
+
},
|
34
|
+
"$schema": {
|
35
|
+
"type": "string",
|
36
|
+
"format": "uri"
|
37
|
+
},
|
38
|
+
"title": {
|
39
|
+
"type": "string"
|
40
|
+
},
|
41
|
+
"description": {
|
42
|
+
"type": "string"
|
43
|
+
},
|
44
|
+
"default": {},
|
45
|
+
"multipleOf": {
|
46
|
+
"type": "number",
|
47
|
+
"minimum": 0,
|
48
|
+
"exclusiveMinimum": true
|
49
|
+
},
|
50
|
+
"maximum": {
|
51
|
+
"type": "number"
|
52
|
+
},
|
53
|
+
"exclusiveMaximum": {
|
54
|
+
"type": "boolean",
|
55
|
+
"default": false
|
56
|
+
},
|
57
|
+
"minimum": {
|
58
|
+
"type": "number"
|
59
|
+
},
|
60
|
+
"exclusiveMinimum": {
|
61
|
+
"type": "boolean",
|
62
|
+
"default": false
|
63
|
+
},
|
64
|
+
"maxLength": { "$ref": "#/definitions/positiveInteger" },
|
65
|
+
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
66
|
+
"pattern": {
|
67
|
+
"type": "string",
|
68
|
+
"format": "regex"
|
69
|
+
},
|
70
|
+
"additionalItems": {
|
71
|
+
"anyOf": [
|
72
|
+
{ "type": "boolean" },
|
73
|
+
{ "$ref": "#" }
|
74
|
+
],
|
75
|
+
"default": {}
|
76
|
+
},
|
77
|
+
"items": {
|
78
|
+
"anyOf": [
|
79
|
+
{ "$ref": "#" },
|
80
|
+
{ "$ref": "#/definitions/schemaArray" }
|
81
|
+
],
|
82
|
+
"default": {}
|
83
|
+
},
|
84
|
+
"maxItems": { "$ref": "#/definitions/positiveInteger" },
|
85
|
+
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
86
|
+
"uniqueItems": {
|
87
|
+
"type": "boolean",
|
88
|
+
"default": false
|
89
|
+
},
|
90
|
+
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
|
91
|
+
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
|
92
|
+
"required": { "$ref": "#/definitions/stringArray" },
|
93
|
+
"additionalProperties": {
|
94
|
+
"anyOf": [
|
95
|
+
{ "type": "boolean" },
|
96
|
+
{ "$ref": "#" }
|
97
|
+
],
|
98
|
+
"default": {}
|
99
|
+
},
|
100
|
+
"definitions": {
|
101
|
+
"type": "object",
|
102
|
+
"additionalProperties": { "$ref": "#" },
|
103
|
+
"default": {}
|
104
|
+
},
|
105
|
+
"properties": {
|
106
|
+
"type": "object",
|
107
|
+
"additionalProperties": { "$ref": "#" },
|
108
|
+
"default": {}
|
109
|
+
},
|
110
|
+
"patternProperties": {
|
111
|
+
"type": "object",
|
112
|
+
"additionalProperties": { "$ref": "#" },
|
113
|
+
"default": {}
|
114
|
+
},
|
115
|
+
"dependencies": {
|
116
|
+
"type": "object",
|
117
|
+
"additionalProperties": {
|
118
|
+
"anyOf": [
|
119
|
+
{ "$ref": "#" },
|
120
|
+
{ "$ref": "#/definitions/stringArray" }
|
121
|
+
]
|
122
|
+
}
|
123
|
+
},
|
124
|
+
"enum": {
|
125
|
+
"type": "array",
|
126
|
+
"minItems": 1,
|
127
|
+
"uniqueItems": true
|
128
|
+
},
|
129
|
+
"type": {
|
130
|
+
"anyOf": [
|
131
|
+
{ "$ref": "#/definitions/simpleTypes" },
|
132
|
+
{
|
133
|
+
"type": "array",
|
134
|
+
"items": { "$ref": "#/definitions/simpleTypes" },
|
135
|
+
"minItems": 1,
|
136
|
+
"uniqueItems": true
|
137
|
+
}
|
138
|
+
]
|
139
|
+
},
|
140
|
+
"allOf": { "$ref": "#/definitions/schemaArray" },
|
141
|
+
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
142
|
+
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
143
|
+
"not": { "$ref": "#" }
|
144
|
+
},
|
145
|
+
"dependencies": {
|
146
|
+
"exclusiveMaximum": [ "maximum" ],
|
147
|
+
"exclusiveMinimum": [ "minimum" ]
|
148
|
+
},
|
149
|
+
"default": {}
|
150
|
+
}
|
@@ -214,7 +214,6 @@
|
|
214
214
|
},
|
215
215
|
"mimeType": {
|
216
216
|
"type": "string",
|
217
|
-
"pattern": "^[\\sa-z0-9\\-+;\\.=\\/]+$",
|
218
217
|
"description": "The MIME type of the HTTP message."
|
219
218
|
},
|
220
219
|
"operation": {
|
@@ -605,6 +604,11 @@
|
|
605
604
|
"type": "string",
|
606
605
|
"description": "The name of the parameter."
|
607
606
|
},
|
607
|
+
"allowEmptyValue": {
|
608
|
+
"type": "boolean",
|
609
|
+
"default": false,
|
610
|
+
"description": "allows sending a parameter by name only or with an empty value."
|
611
|
+
},
|
608
612
|
"type": {
|
609
613
|
"type": "string",
|
610
614
|
"enum": [
|
@@ -693,6 +697,11 @@
|
|
693
697
|
"type": "string",
|
694
698
|
"description": "The name of the parameter."
|
695
699
|
},
|
700
|
+
"allowEmptyValue": {
|
701
|
+
"type": "boolean",
|
702
|
+
"default": false,
|
703
|
+
"description": "allows sending a parameter by name only or with an empty value."
|
704
|
+
},
|
696
705
|
"type": {
|
697
706
|
"type": "string",
|
698
707
|
"enum": [
|
@@ -892,69 +901,64 @@
|
|
892
901
|
"type": "string"
|
893
902
|
},
|
894
903
|
"title": {
|
895
|
-
"$ref": "#/
|
904
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
|
896
905
|
},
|
897
906
|
"description": {
|
898
|
-
"$ref": "#/
|
907
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
|
899
908
|
},
|
900
909
|
"default": {
|
901
|
-
"$ref": "#/
|
910
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
|
902
911
|
},
|
903
912
|
"multipleOf": {
|
904
|
-
"$ref": "#/
|
913
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
|
905
914
|
},
|
906
915
|
"maximum": {
|
907
|
-
"$ref": "#/
|
916
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
|
908
917
|
},
|
909
918
|
"exclusiveMaximum": {
|
910
|
-
"$ref": "#/
|
919
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
|
911
920
|
},
|
912
921
|
"minimum": {
|
913
|
-
"$ref": "#/
|
922
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
|
914
923
|
},
|
915
924
|
"exclusiveMinimum": {
|
916
|
-
"$ref": "#/
|
925
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
|
917
926
|
},
|
918
927
|
"maxLength": {
|
919
|
-
"$ref": "#/definitions/
|
928
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
|
920
929
|
},
|
921
930
|
"minLength": {
|
922
|
-
"$ref": "#/definitions/
|
931
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
|
923
932
|
},
|
924
933
|
"pattern": {
|
925
|
-
"$ref": "#/
|
934
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
|
926
935
|
},
|
927
936
|
"maxItems": {
|
928
|
-
"$ref": "#/definitions/
|
937
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
|
929
938
|
},
|
930
939
|
"minItems": {
|
931
|
-
"$ref": "#/definitions/
|
940
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
|
932
941
|
},
|
933
942
|
"uniqueItems": {
|
934
|
-
"$ref": "#/
|
943
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
|
935
944
|
},
|
936
945
|
"maxProperties": {
|
937
|
-
"$ref": "#/definitions/positiveInteger"
|
946
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
|
938
947
|
},
|
939
948
|
"minProperties": {
|
940
|
-
"$ref": "#/definitions/positiveIntegerDefault0"
|
949
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
|
941
950
|
},
|
942
951
|
"required": {
|
943
|
-
"$ref": "#/definitions/stringArray"
|
952
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
|
944
953
|
},
|
945
954
|
"enum": {
|
946
|
-
"$ref": "#/
|
955
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
|
956
|
+
},
|
957
|
+
"additionalProperties": {
|
958
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/additionalProperties"
|
947
959
|
},
|
948
960
|
"type": {
|
949
|
-
"
|
950
|
-
{ "$ref": "#/definitions/simpleTypes" },
|
951
|
-
{
|
952
|
-
"type": "array",
|
953
|
-
"items": { "$ref": "#/definitions/simpleTypes" },
|
954
|
-
"minItems": 1,
|
955
|
-
"uniqueItems": true
|
956
|
-
}
|
957
|
-
]
|
961
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/type"
|
958
962
|
},
|
959
963
|
"items": {
|
960
964
|
"anyOf": [
|
@@ -999,7 +1003,8 @@
|
|
999
1003
|
"$ref": "#/definitions/externalDocs"
|
1000
1004
|
},
|
1001
1005
|
"example": {}
|
1002
|
-
}
|
1006
|
+
},
|
1007
|
+
"additionalProperties": false
|
1003
1008
|
},
|
1004
1009
|
"primitivesItems": {
|
1005
1010
|
"type": "object",
|
@@ -1384,7 +1389,6 @@
|
|
1384
1389
|
"parametersList": {
|
1385
1390
|
"type": "array",
|
1386
1391
|
"description": "The parameters needed to send a valid API call.",
|
1387
|
-
"minItems": 1,
|
1388
1392
|
"additionalItems": false,
|
1389
1393
|
"items": {
|
1390
1394
|
"oneOf": [
|
@@ -1434,55 +1438,49 @@
|
|
1434
1438
|
"default": "csv"
|
1435
1439
|
},
|
1436
1440
|
"title": {
|
1437
|
-
"
|
1441
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
|
1438
1442
|
},
|
1439
1443
|
"description": {
|
1440
|
-
"
|
1444
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/description"
|
1445
|
+
},
|
1446
|
+
"default": {
|
1447
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/default"
|
1441
1448
|
},
|
1442
|
-
"default": { },
|
1443
1449
|
"multipleOf": {
|
1444
|
-
|
1445
|
-
"minimum": 0,
|
1446
|
-
"exclusiveMinimum": true
|
1450
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
|
1447
1451
|
},
|
1448
1452
|
"maximum": {
|
1449
|
-
"
|
1453
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
|
1450
1454
|
},
|
1451
1455
|
"exclusiveMaximum": {
|
1452
|
-
"
|
1453
|
-
"default": false
|
1456
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
|
1454
1457
|
},
|
1455
1458
|
"minimum": {
|
1456
|
-
"
|
1459
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
|
1457
1460
|
},
|
1458
1461
|
"exclusiveMinimum": {
|
1459
|
-
"
|
1460
|
-
"default": false
|
1462
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
|
1461
1463
|
},
|
1462
1464
|
"maxLength": {
|
1463
|
-
"$ref": "#/definitions/positiveInteger"
|
1465
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
|
1464
1466
|
},
|
1465
1467
|
"minLength": {
|
1466
|
-
"$ref": "#/definitions/positiveIntegerDefault0"
|
1468
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
|
1467
1469
|
},
|
1468
1470
|
"pattern": {
|
1469
|
-
"
|
1470
|
-
"format": "regex"
|
1471
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
|
1471
1472
|
},
|
1472
1473
|
"maxItems": {
|
1473
|
-
"$ref": "#/definitions/positiveInteger"
|
1474
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
|
1474
1475
|
},
|
1475
1476
|
"minItems": {
|
1476
|
-
"$ref": "#/definitions/positiveIntegerDefault0"
|
1477
|
+
"$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
|
1477
1478
|
},
|
1478
1479
|
"uniqueItems": {
|
1479
|
-
"
|
1480
|
-
"default": false
|
1480
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
|
1481
1481
|
},
|
1482
1482
|
"enum": {
|
1483
|
-
"
|
1484
|
-
"minItems": 1,
|
1485
|
-
"uniqueItems": true
|
1483
|
+
"$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
|
1486
1484
|
},
|
1487
1485
|
"jsonReference": {
|
1488
1486
|
"type": "object",
|
@@ -1492,22 +1490,6 @@
|
|
1492
1490
|
"type": "string"
|
1493
1491
|
}
|
1494
1492
|
}
|
1495
|
-
},
|
1496
|
-
"simpleTypes": {
|
1497
|
-
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
|
1498
|
-
},
|
1499
|
-
"stringArray": {
|
1500
|
-
"type": "array",
|
1501
|
-
"items": { "type": "string" },
|
1502
|
-
"minItems": 1,
|
1503
|
-
"uniqueItems": true
|
1504
|
-
},
|
1505
|
-
"positiveInteger": {
|
1506
|
-
"type": "integer"
|
1507
|
-
},
|
1508
|
-
"positiveIntegerDefault0": {
|
1509
|
-
"type": "integer",
|
1510
|
-
"default": 0
|
1511
1493
|
}
|
1512
1494
|
}
|
1513
|
-
}
|
1495
|
+
}
|
data/lib/apivore.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
+
require 'json-schema'
|
2
|
+
require 'rspec'
|
1
3
|
require 'apivore/rspec_matchers'
|
2
4
|
require 'apivore/rspec_helpers'
|
3
5
|
require 'apivore/swagger_checker'
|
4
6
|
require 'apivore/swagger'
|
5
|
-
require 'rspec'
|
6
7
|
|
7
8
|
RSpec.configure do |config|
|
8
9
|
config.include Apivore::RspecMatchers, type: :apivore
|
9
10
|
config.include Apivore::RspecHelpers, type: :apivore
|
10
11
|
end
|
12
|
+
|
13
|
+
# Load and register a local copy of the draft04 JSON schema to prevent network calls when resolving $refs from the swagger 2.0 schema
|
14
|
+
draft04 = JSON.parse(File.read(File.expand_path("../../data/draft04_schema.json", __FILE__)))
|
15
|
+
draft04_schema = JSON::Schema.new(draft04, Addressable::URI.parse('http://json-schema.org/draft-04/schema#'))
|
16
|
+
JSON::Validator.add_schema(draft04_schema)
|
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.1.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:
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|
@@ -157,6 +157,7 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
+
- data/draft04_schema.json
|
160
161
|
- data/swagger_2.0_schema.json
|
161
162
|
- lib/apivore.rb
|
162
163
|
- lib/apivore/all_routes_tested_validator.rb
|