rspec_api_documentation-open_api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -0
- data/lib/rspec_api_documentation/open_api/version.rb +1 -1
- data/lib/rspec_api_documentation/writers/open_api_writer.rb +27 -33
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c7c05a5783d583a175dce72a50e2b20ee2bc267f0061607d1d27138c7796240
|
4
|
+
data.tar.gz: 2cdf8135cdb8db72ced74d6ca6d07a7feec63cf5d2ed6b338f6fd0a823d496ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7eb930e06a697d4e9de7ca97edbc0a632782c76bfe562a80693f82c4ce77f0bf16ebe7ac61465e9190578c79139fa755509043b5d4999d9d9e4f290f446e87a
|
7
|
+
data.tar.gz: 38d23559d1035da50fd4ea9c9c3c75d3eff2d1044cb0ec0c4e6506a9e8d373d4e9678a2da4e71a8fa4793cc4c6e068121a1173fe667a592eed0079f2db2ac5c1
|
data/README.md
CHANGED
@@ -35,6 +35,33 @@ RspecApiDocumentation.configure do |config|
|
|
35
35
|
end
|
36
36
|
```
|
37
37
|
|
38
|
+
Change default host and servers spec using
|
39
|
+
```
|
40
|
+
RspecApiDocumentation.configure do |config| # These are defaults
|
41
|
+
config.open_api = {
|
42
|
+
"host": {
|
43
|
+
"version" => "1.0.0",
|
44
|
+
"title" => "Open API",
|
45
|
+
"description" => "Open API",
|
46
|
+
"contact" => {
|
47
|
+
"name" => "OpenAPI"
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"servers": [
|
51
|
+
{
|
52
|
+
"url" => "http://localhost:{port}",
|
53
|
+
"description" => "Development server",
|
54
|
+
"variables" => {
|
55
|
+
"port" => {
|
56
|
+
"default" => "3000"
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
]
|
61
|
+
}
|
62
|
+
end
|
63
|
+
```
|
64
|
+
|
38
65
|
## Development
|
39
66
|
|
40
67
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -221,39 +221,8 @@ module RspecApiDocumentation
|
|
221
221
|
def swagger
|
222
222
|
@swagger ||= {
|
223
223
|
"openapi" => "3.0.0",
|
224
|
-
"info" =>
|
225
|
-
|
226
|
-
"title" => "Cookpad Global Web API",
|
227
|
-
"description" => "Cookpad's global web API",
|
228
|
-
"contact" => {
|
229
|
-
"name" => "Aaditya Taparia",
|
230
|
-
"email" => "aaditya-taparia@gmail.com",
|
231
|
-
"url" => "https://github.com/aadityataparia"
|
232
|
-
}
|
233
|
-
},
|
234
|
-
"servers" => [
|
235
|
-
{
|
236
|
-
"url" => "http://localhost:{port}/{version}",
|
237
|
-
"description" => "Development server",
|
238
|
-
"variables" => {
|
239
|
-
"version" => {
|
240
|
-
"default" => "v4"
|
241
|
-
},
|
242
|
-
"port" => {
|
243
|
-
"default" => "3000"
|
244
|
-
}
|
245
|
-
}
|
246
|
-
},
|
247
|
-
{
|
248
|
-
"url" => "https://global-search-api-staging.ckpd.co/{version}",
|
249
|
-
"description" => "Staging server",
|
250
|
-
"variables" => {
|
251
|
-
"version" => {
|
252
|
-
"default" => "v4"
|
253
|
-
}
|
254
|
-
}
|
255
|
-
}
|
256
|
-
],
|
224
|
+
"info" => info,
|
225
|
+
"servers" => servers,
|
257
226
|
"paths" => {},
|
258
227
|
"components" => {
|
259
228
|
"securitySchemes" => {
|
@@ -270,6 +239,31 @@ module RspecApiDocumentation
|
|
270
239
|
}
|
271
240
|
}
|
272
241
|
end
|
242
|
+
|
243
|
+
def info
|
244
|
+
RspecApiDocumentation.configuration.open_api&["host"] || {
|
245
|
+
"version" => "1.0.0",
|
246
|
+
"title" => "Open API",
|
247
|
+
"description" => "Open API",
|
248
|
+
"contact" => {
|
249
|
+
"name" => "OpenAPI"
|
250
|
+
}
|
251
|
+
}
|
252
|
+
end
|
253
|
+
|
254
|
+
def servers
|
255
|
+
RspecApiDocumentation.configuration.open_api&["server"] || [
|
256
|
+
{
|
257
|
+
"url" => "http://localhost:{port}",
|
258
|
+
"description" => "Development server",
|
259
|
+
"variables" => {
|
260
|
+
"port" => {
|
261
|
+
"default" => "3000"
|
262
|
+
}
|
263
|
+
}
|
264
|
+
}
|
265
|
+
]
|
266
|
+
end
|
273
267
|
end
|
274
268
|
end
|
275
269
|
end
|