api_schema 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: ee3334a6b84fcdea073dd676ab06b21546851d4b
4
- data.tar.gz: 1fb668c1353c45e69df045e5b2ad5c6e2ce3efec
3
+ metadata.gz: f57c171f374e7457aa20f56cfa8f62a0b91110ce
4
+ data.tar.gz: d0533b1c70ea503dc795c9cfe8f2754edf8be545
5
5
  SHA512:
6
- metadata.gz: d093ee56e095d80380455875dcf29bc0e6ba52a464274ad800ef78d4231e34e1b47262e5205d14826e300976214a0f354ea91f4c62cdd4bdb96edd5b722f7602
7
- data.tar.gz: c69ec8ced324c26e66e3a9f19b0d6bc09a2a6f2e65438b2672b2a1106cf6c6040465e80c568631279fd304eac28f56d27401054795a866a8abf4efa35d3c75b5
6
+ metadata.gz: 4dfbe06022ab3f80f1b6ea177bb805b3b1d561c0854a38e0b14d47f299730066a66ab28b05eb892b6062a363e141d40006b0600e7c68e31b6c896677752c0120
7
+ data.tar.gz: 90ca9cee0ffe27b68c572f1574eca928d79f2003297b5ed83101debef056b40a61ae18f5838923a470f5263df811842cfb4afb5065cabf41e65161ae21267b7a
@@ -1,7 +1,7 @@
1
1
  module ApiSchema
2
2
  class Field
3
3
 
4
- attr_accessor :type, :name, :format, :required, :description
4
+ attr_accessor :type, :name, :format, :required, :description, :allowed_values
5
5
 
6
6
  def initialize(type, name, options = {})
7
7
  @type = type
@@ -9,6 +9,7 @@ module ApiSchema
9
9
  @format = options.fetch(:format, nil)
10
10
  @required = options.fetch(:required, false)
11
11
  @description = options.fetch(:desc, '')
12
+ @allowed_values = [*options.fetch(:allowed_values, nil)]
12
13
  end
13
14
 
14
15
  def required?
@@ -16,6 +16,7 @@ module Swagger
16
16
  key :type, f.type
17
17
  key :format, f.format if f.format
18
18
  key :description, f.description
19
+ key :enum, f.allowed_values unless f.allowed_values.empty?
19
20
  end
20
21
  end
21
22
  serializer.references.each do |r|
@@ -21,6 +21,7 @@ module Swagger
21
21
  key :type, f.type
22
22
  key :format, f.format if f.format
23
23
  key :description, f.description
24
+ key :enum, f.allowed_values unless f.allowed_values.empty?
24
25
  end
25
26
  end
26
27
  serializer.references.each do |r|
@@ -36,6 +37,7 @@ module Swagger
36
37
  key :type, f.type
37
38
  key :format, f.format if f.format
38
39
  key :description, f.description
40
+ key :enum, f.allowed_values unless f.allowed_values.empty?
39
41
  end
40
42
  end
41
43
  serializer.references.each do |r|
@@ -53,6 +55,7 @@ module Swagger
53
55
  key :type, f.type
54
56
  key :format, f.format if f.format
55
57
  key :description, f.description
58
+ key :enum, f.allowed_values unless f.allowed_values.empty?
56
59
  end
57
60
  end
58
61
  serializer.references.each do |r|
@@ -1,3 +1,3 @@
1
1
  module ApiSchema
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Chopey