json-schema-docs 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json-schema-docs/parser.rb +20 -19
- data/lib/json-schema-docs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4019d4c71037dd5a121688f86360f0118434a11f134e284da52d861598f1aa55
|
4
|
+
data.tar.gz: 6fbc6806b2d8ab850781561fb9938e11b1a406276faa089f573a2777116430a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 767adbf626fc89f13958b7c93f554a8f7da8f5d2576f98691b96de45c98665c912822ea8afff48c630b2827f326a78315a84d1b527a197d0c5a8165eec16d0a8
|
7
|
+
data.tar.gz: 7968f9aa70dc48f2569a5350d2a40fe0948010657e3f702809e67a6a3760f56677fced6402e35fbbf9d8a5ee358f2cbbca45ecd0157f89d38765a36bb692e6d4
|
@@ -331,15 +331,21 @@ module JsonSchemaDocs
|
|
331
331
|
end
|
332
332
|
|
333
333
|
def generate_response_header(response_example, link)
|
334
|
-
return response_example['head'] if response_example
|
334
|
+
return response_example['head'] if response_example && response_example['head']
|
335
335
|
|
336
336
|
header = 'HTTP/1.1'
|
337
|
-
code = case
|
338
|
-
when '
|
337
|
+
code = case true
|
338
|
+
when link['code'] == 200
|
339
|
+
'200 OK'
|
340
|
+
when link['code'] == 201
|
339
341
|
'201 Created'
|
340
|
-
when '
|
342
|
+
when link['code'] == 202
|
341
343
|
'202 Accepted'
|
342
|
-
when '
|
344
|
+
when link['code'] == 204
|
345
|
+
'204 No Content'
|
346
|
+
when link['rel'] == 'create'
|
347
|
+
'201 Created'
|
348
|
+
when link['rel'] == 'destroy'
|
343
349
|
'204 No Content'
|
344
350
|
else
|
345
351
|
'200 OK'
|
@@ -348,21 +354,16 @@ module JsonSchemaDocs
|
|
348
354
|
end
|
349
355
|
|
350
356
|
def generate_response_example(response_example, link, resource)
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
elsif link['rel'] == 'instances'
|
359
|
-
pretty_json([@schema.schemata_example(resource)])
|
360
|
-
else
|
361
|
-
pretty_json(@schema.schemata_example(resource))
|
362
|
-
end
|
363
|
-
end
|
364
|
-
else
|
357
|
+
return response_example['body'] if response_example && response_example['body']
|
358
|
+
|
359
|
+
if link.has_key?('targetSchema')
|
360
|
+
pretty_json(@schema.schema_example(link['targetSchema']))
|
361
|
+
elsif link['rel'] == 'instances'
|
362
|
+
pretty_json([@schema.schemata_example(resource)])
|
363
|
+
elsif link['code'] == 204
|
365
364
|
nil
|
365
|
+
else
|
366
|
+
pretty_json(@schema.schemata_example(resource))
|
366
367
|
end
|
367
368
|
end
|
368
369
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-schema-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prmd
|