easy_talk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/easy_talk/property.rb +5 -5
- data/lib/easy_talk/schema_definition.rb +5 -4
- data/lib/easy_talk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4956da04f8ac9e83e12f4ad476e4e340f44b7b9d6c2fb021bbe1afc0b93ef0f2
|
4
|
+
data.tar.gz: 2c64f966e265f5815db6e00bd38412dbef4262344feb270b75e269e71b81df55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c1b91b2c67cd7d3b458f83bf1da9e483ba5ec67ff346242239e39b9fc88d7ce6eab78eef5ba942db85a8df78431ba1886111e1927c5edf2fdb35f70b22ecd8f
|
7
|
+
data.tar.gz: 915aa38e52e371d38eaa2a9175d4a0e92a34e999963dae8f9654a6117fb66ed514926063a49fcd6564ecba192a01e7310f6707d670be5245a49993264e3be5a9
|
data/CHANGELOG.md
CHANGED
data/lib/easy_talk/property.rb
CHANGED
@@ -76,15 +76,15 @@ module EasyTalk
|
|
76
76
|
#
|
77
77
|
# @return [Object] The built property.
|
78
78
|
def build
|
79
|
-
# return type.respond_to?(:schema) ? type.schema : 'object' unless builder
|
80
|
-
|
81
|
-
# args = builder.collection_type? ? [name, type, constraints] : [name, constraints]
|
82
|
-
# builder.new(*args).build
|
83
79
|
if builder
|
84
80
|
args = builder.collection_type? ? [name, type, constraints] : [name, constraints]
|
85
81
|
builder.new(*args).build
|
82
|
+
elsif type.respond_to?(:schema)
|
83
|
+
# merge the top-level constraints from *this* property
|
84
|
+
# e.g. :title, :description, :default, etc
|
85
|
+
type.schema.merge!(constraints)
|
86
86
|
else
|
87
|
-
|
87
|
+
'object'
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -4,13 +4,13 @@ require_relative 'keywords'
|
|
4
4
|
|
5
5
|
module EasyTalk
|
6
6
|
class InvalidPropertyNameError < StandardError; end
|
7
|
+
|
7
8
|
#
|
8
9
|
#= EasyTalk \SchemaDefinition
|
9
10
|
# SchemaDefinition provides the methods for defining a schema within the define_schema block.
|
10
11
|
# The @schema is a hash that contains the unvalidated schema definition for the model.
|
11
12
|
# A SchemaDefinition instanace is the passed to the Builder.build_schema method to validate and compile the schema.
|
12
13
|
class SchemaDefinition
|
13
|
-
|
14
14
|
extend T::Sig
|
15
15
|
extend T::AnyOf
|
16
16
|
extend T::OneOf
|
@@ -56,9 +56,10 @@ module EasyTalk
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def validate_property_name(name)
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
return if name.to_s.match?(/^[A-Za-z_][A-Za-z0-9_]*$/)
|
60
|
+
|
61
|
+
raise InvalidPropertyNameError,
|
62
|
+
"Invalid property name '#{name}'. Must start with letter/underscore and contain only letters, numbers, underscores"
|
62
63
|
end
|
63
64
|
|
64
65
|
def optional?
|
data/lib/easy_talk/version.rb
CHANGED