easy_talk 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/easy_talk.gemspec +1 -0
- data/lib/easy_talk/model.rb +6 -1
- data/lib/easy_talk/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64c3d125d05981a0e2d01d1ccaa62a235f4d032ca95f3ee0b54667c13952850b
|
4
|
+
data.tar.gz: 0e24c433ee18e83cf979d9702af4e85091963f308feffcce09ed3d1b80fd94ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96a1eab7a194cce4067680550269cd277aa7f75ccfdf710d0f34b5a5381505067896a8cb1cdff9c82b866684dac0f78515fbb0a258628c94991358babfcc26a0
|
7
|
+
data.tar.gz: fad9245949080abdb1f72581d924c5b7df17529f8d94fab6ede4a4fc9bb46d013cd6b3d9cee787b4953c9947931bfb40d963494b968f681dad2e90f038708c53
|
data/easy_talk.gemspec
CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.require_paths = ['lib']
|
33
33
|
|
34
34
|
spec.add_dependency 'activesupport', '~> 6.0'
|
35
|
+
spec.add_dependency 'json-schema', '~> 2.8'
|
35
36
|
spec.add_dependency 'sorbet-runtime'
|
36
37
|
spec.add_development_dependency 'pry-byebug', '>= 3.10.1'
|
37
38
|
spec.add_development_dependency 'rake', '~> 13.1'
|
data/lib/easy_talk/model.rb
CHANGED
@@ -6,6 +6,7 @@ require 'active_support/core_ext'
|
|
6
6
|
require 'active_support/time'
|
7
7
|
require 'active_support/concern'
|
8
8
|
require 'active_support/json'
|
9
|
+
require 'json-schema'
|
9
10
|
require_relative 'builder'
|
10
11
|
require_relative 'schema_definition'
|
11
12
|
|
@@ -81,11 +82,15 @@ module EasyTalk
|
|
81
82
|
"#/$defs/#{name}"
|
82
83
|
end
|
83
84
|
|
85
|
+
def validate_json(json)
|
86
|
+
JSON::Validator.validate(json_schema, json)
|
87
|
+
end
|
88
|
+
|
84
89
|
# Returns the JSON schema for the model.
|
85
90
|
def json_schema
|
86
91
|
@json_schema ||= begin
|
87
92
|
schema = Builder.new(schema_definition).schema
|
88
|
-
schema.
|
93
|
+
schema.as_json
|
89
94
|
end
|
90
95
|
end
|
91
96
|
|
data/lib/easy_talk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_talk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Bayona
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json-schema
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.8'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: sorbet-runtime
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|