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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 684cd18461ad682ef182cf8d2c6408c7a1bc2b7bf9ffaafddfbd17e2bb1fb2cc
4
- data.tar.gz: cc0ec2b04b37b844ad53bab5320a7dcf76253c948ee509885dcc582aca23f2ea
3
+ metadata.gz: 4019d4c71037dd5a121688f86360f0118434a11f134e284da52d861598f1aa55
4
+ data.tar.gz: 6fbc6806b2d8ab850781561fb9938e11b1a406276faa089f573a2777116430a1
5
5
  SHA512:
6
- metadata.gz: 95abddf165facc04ba809711137759fd201e2f9c1f75b9c49962866d0e2e3047a8a28008fd4c363d3ebdc9df55b79f315df5ba8ebd1824cf385a0eaf8e08b67f
7
- data.tar.gz: e49c01747fcaea115cda8d4492724213c5e3e6cedebb75335e92639afaf4583b3082175158fbde6d5b63e33f00b6d875f0a49b71d65015dadd280cb733923b5d
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 link['rel']
338
- when 'create'
337
+ code = case true
338
+ when link['code'] == 200
339
+ '200 OK'
340
+ when link['code'] == 201
339
341
  '201 Created'
340
- when 'empty'
342
+ when link['code'] == 202
341
343
  '202 Accepted'
342
- when 'no_content'
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
- if response_example || link['rel'] != 'empty'
352
- if response_example
353
- response_example['body']
354
- else
355
- if link['rel'] == 'empty'
356
- elsif link.has_key?('targetSchema')
357
- pretty_json(@schema.schema_example(link['targetSchema']))
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
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module JsonSchemaDocs
3
- VERSION = '0.2.4'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
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.2.4
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 00:00:00.000000000 Z
11
+ date: 2019-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prmd