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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f57c171f374e7457aa20f56cfa8f62a0b91110ce
|
4
|
+
data.tar.gz: d0533b1c70ea503dc795c9cfe8f2754edf8be545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dfbe06022ab3f80f1b6ea177bb805b3b1d561c0854a38e0b14d47f299730066a66ab28b05eb892b6062a363e141d40006b0600e7c68e31b6c896677752c0120
|
7
|
+
data.tar.gz: 90ca9cee0ffe27b68c572f1574eca928d79f2003297b5ed83101debef056b40a61ae18f5838923a470f5263df811842cfb4afb5065cabf41e65161ae21267b7a
|
data/lib/api_schema/field.rb
CHANGED
@@ -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?
|
@@ -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|
|
data/lib/api_schema/version.rb
CHANGED