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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 454bc510ff919928f3dc4f6fd685d1db8f5855f0c134d05c3b8ec55f5d210673
4
- data.tar.gz: d3401cecda7647960ac6316da49e7cc34be973966098adf55f5155844488d261
3
+ metadata.gz: 64c3d125d05981a0e2d01d1ccaa62a235f4d032ca95f3ee0b54667c13952850b
4
+ data.tar.gz: 0e24c433ee18e83cf979d9702af4e85091963f308feffcce09ed3d1b80fd94ce
5
5
  SHA512:
6
- metadata.gz: 1427e9cecc84caae79125c6f9115733599bb604803a523df589820599acf4b26dfe83425b08f8a59043b5c8b615c1b4865d4ec5e16a8b3a176be3c7fa0d89eaa
7
- data.tar.gz: eb2e590b7f569ad49ec907185086050f7068aba378d99852e32fd133c1b0cd6e16e6452ae0d8e90e1560130a3240d58ee5f0c80c18da0cd9587d0d91b0801680
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'
@@ -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.to_json
93
+ schema.as_json
89
94
  end
90
95
  end
91
96
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyTalk
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
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.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-10 00:00:00.000000000 Z
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