swagger_yard 1.0.1 → 1.0.2

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
- SHA1:
3
- metadata.gz: e69ba8fc51e7c39ca9291c1e2917f28b5ed794fe
4
- data.tar.gz: f00801cc7268c6faf6d1fdc22c8d9b14ccf55756
2
+ SHA256:
3
+ metadata.gz: 83e1c4a1e03bfda00de8186e1c4ff6295cd80cc48d1053cd50f7f334ffe328fb
4
+ data.tar.gz: f0c8fd6215987665d201f921ccc4421a4f623c4c527867b01328f3279147b123
5
5
  SHA512:
6
- metadata.gz: baa76a8eccd08176c057fb6d6969001899350d7f0ce8b5cf25ab00cd29d42bf81e554440e5517a1dd517c1bb4952f8deb6143127442e208f91c181825fec6faa
7
- data.tar.gz: 7ddf6347f3a340ab921f0f576146fcd3709f8adbcbe049319ab63137fc156779998369f68b1612b97138434fccf9ae8198dde34b19e6463bc713df9d6038d375
6
+ metadata.gz: 8589dd0a10c513d877c27efcae067cebc61fcc7855c2a12c0a85c84db42007e63860f284afce8b63e7afb3f3372a1c035c806eb98d004a3ac9284c32b07324ff
7
+ data.tar.gz: 3d9d1203cea5812416f6838207e3f114f009653d8e1f787baea890260180652d5f337ce2cf6dcadb213a58e0503a674098fad98c841b41ecf366db08b5bfb8eb
@@ -41,8 +41,12 @@ module SwaggerYard
41
41
  properties.detect {|prop| prop.name == key }
42
42
  end
43
43
 
44
+ TAG_ORDER = %w(model inherits discriminator property example)
45
+
44
46
  def parse_tags(tags)
45
- tags.each do |tag|
47
+ sorted_tags = tags.each_with_index.sort_by { |t,i|
48
+ [TAG_ORDER.index(t.tag_name), i] }.map(&:first)
49
+ sorted_tags.each do |tag|
46
50
  case tag.tag_name
47
51
  when "model"
48
52
  @has_model_tag = true
@@ -63,7 +67,7 @@ module SwaggerYard
63
67
  if (prop = property(tag.name))
64
68
  prop.example = tag.text
65
69
  else
66
- SwaggerYard.log.warn("no property '#{tag.name}' defined yet to which to attach example: #{value.inspect}")
70
+ SwaggerYard.log.warn("no property '#{tag.name}' defined yet to which to attach example: #{tag.text.inspect}")
67
71
  end
68
72
  else
69
73
  self.example = tag.text
@@ -58,9 +58,9 @@ module SwaggerYard
58
58
  rule(identifier: simple(:id)) do
59
59
  v = id.to_s
60
60
  case v
61
- when /array/i
61
+ when /^array$/i
62
62
  { 'type' => 'array', 'items' => { 'type' => 'string' } }
63
- when /object/i
63
+ when /^object$/i
64
64
  { 'type' => 'object' }
65
65
  when "float", "double"
66
66
  { 'type' => 'number', 'format' => v }
@@ -1,3 +1,3 @@
1
1
  module SwaggerYard
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagger_yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - chtrinh (Chris Trinh)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-24 00:00:00.000000000 Z
11
+ date: 2019-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubyforge_project:
231
- rubygems_version: 2.5.2.1
231
+ rubygems_version: 2.7.4
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: SwaggerYard API doc through YARD