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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fab416f868a74ddb07866e0e7d17913c7c56f4697b1a35bb363f1c591641a42c
4
- data.tar.gz: 5f0b5cfe8472d44f3e6d300f57f6c47cab1202a52ad9d8911e33ed969652ba04
3
+ metadata.gz: 8c7c05a5783d583a175dce72a50e2b20ee2bc267f0061607d1d27138c7796240
4
+ data.tar.gz: 2cdf8135cdb8db72ced74d6ca6d07a7feec63cf5d2ed6b338f6fd0a823d496ff
5
5
  SHA512:
6
- metadata.gz: 44cba9fa46feace13862d58a5ba9062e2cdfae62fdc9012c1cde31eea31b87052b11a3154dea737027f4d8a9b452a88a521d562fd32ec4b5de5582d0b1c7af5f
7
- data.tar.gz: 2c4c594c94e8e7539d9f8299b8be2bdd53626970607ef049aed6cfb905705714157f1785a747b45e41d81420d8e0f955995e12bb6010285b38099e71dad6c9c9
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.
@@ -1,5 +1,5 @@
1
1
  module RspecApiDocumentation
2
2
  module OpenApi
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -221,39 +221,8 @@ module RspecApiDocumentation
221
221
  def swagger
222
222
  @swagger ||= {
223
223
  "openapi" => "3.0.0",
224
- "info" => {
225
- "version" => "1.0.0",
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_api_documentation-open_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaditya Taparia