fluent-json-schema 0.1.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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +13 -0
- data/README.md +178 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fluent-json-schema.gemspec +32 -0
- data/lib/fluent/json/schema.rb +18 -0
- data/lib/fluent/json/schema/lexicon.rb +47 -0
- data/lib/fluent/json/schema/terms.rb +9 -0
- data/lib/fluent/json/schema/terms/bool.rb +9 -0
- data/lib/fluent/json/schema/terms/date.rb +14 -0
- data/lib/fluent/json/schema/terms/field.rb +46 -0
- data/lib/fluent/json/schema/terms/fk.rb +9 -0
- data/lib/fluent/json/schema/terms/int.rb +9 -0
- data/lib/fluent/json/schema/terms/num.rb +35 -0
- data/lib/fluent/json/schema/terms/obj.rb +95 -0
- data/lib/fluent/json/schema/terms/reflect.rb +37 -0
- data/lib/fluent/json/schema/terms/str.rb +37 -0
- data/lib/fluent/json/schema/version.rb +7 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a122c3fe665ecb302dcd67b23de5d242ce770250
|
4
|
+
data.tar.gz: ed099de46423b3ba3863b8c51d8a8f1aeb239a1e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aada2447b24bf48763e98d789b0fe032084f91e582e51acc62a735cfbe25b9ced88a4737d9a350bcb034df1e47c72465f9912c7383229fe3f79adc26432a2813
|
7
|
+
data.tar.gz: 24a37bf30e536f2f2e25319059a17a9762b4d1ff084f2eb2f8da7f196322641064fd7619547700b22c1b9a4137da14d76930947f017a826bb8be02baac68d1b7
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
# Fluent::Json::Schema
|
2
|
+
|
3
|
+
Build [json schemas](https://json-schema.org/) fluently.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'fluent-json-schema', git: 'https://github.com/rcpedro/fluent-json-schema.git'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install fluent-json-schema
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Basic Usage
|
24
|
+
|
25
|
+
Given:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
basic = Fluent::Json::Schema::Terms::Obj.new(:user)
|
29
|
+
basic
|
30
|
+
.req
|
31
|
+
.strs(:first_name, :last_name, :username, :contact_no, :email, status: { enum: ["active", "inactive"]})
|
32
|
+
.bools(:super)
|
33
|
+
.dates(:created_at, :updated_at)
|
34
|
+
.opt
|
35
|
+
.strs(:created_by, :updated_by)
|
36
|
+
```
|
37
|
+
|
38
|
+
Calling `as_json` would give the following result:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
{
|
42
|
+
type: :object,
|
43
|
+
additionalProperties: false,
|
44
|
+
required: [
|
45
|
+
:first_name, :last_name, :username, :contact_no, :email,
|
46
|
+
:status, :super, :created_at, :updated_at
|
47
|
+
],
|
48
|
+
properties: {
|
49
|
+
first_name: { type: :string },
|
50
|
+
last_name: { type: :string },
|
51
|
+
email: { type: :string },
|
52
|
+
username: { type: :string },
|
53
|
+
contact_no: { type: :string },
|
54
|
+
status: { type: :string, enum: ["active", "inactive"] },
|
55
|
+
super: { type: :boolean },
|
56
|
+
created_at: { type: :string, format: 'date-time' },
|
57
|
+
updated_at: { type: :string, format: 'date-time' },
|
58
|
+
created_by: { type: :string },
|
59
|
+
updated_by: { type: :string }
|
60
|
+
}
|
61
|
+
}
|
62
|
+
```
|
63
|
+
|
64
|
+
### Nested Objects
|
65
|
+
|
66
|
+
Given:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
home = Fluent::Json::Schema::Terms::Obj.new(:home)
|
70
|
+
|
71
|
+
home
|
72
|
+
.req
|
73
|
+
.obj(:address) { |address|
|
74
|
+
address
|
75
|
+
.req.strs(:city, :country)
|
76
|
+
.opt.strs(:name, :street)
|
77
|
+
}
|
78
|
+
.obj(:owner) { |owner|
|
79
|
+
owner
|
80
|
+
.req.str(:first_name, :last_name, email: { fmt: :email })
|
81
|
+
.opt.strs(:title, :contact_no)
|
82
|
+
}
|
83
|
+
.opt
|
84
|
+
.date(:date_built)
|
85
|
+
```
|
86
|
+
|
87
|
+
Calling `as_json` would give the following result:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
{
|
91
|
+
type: :object,
|
92
|
+
additionalProperties: false,
|
93
|
+
required: [
|
94
|
+
:address, :owner
|
95
|
+
],
|
96
|
+
properties: {
|
97
|
+
address: {
|
98
|
+
type: :object,
|
99
|
+
additionalProperties: false,
|
100
|
+
required: [:city, :country],
|
101
|
+
properties: {
|
102
|
+
city: { type: :string },
|
103
|
+
country: { type: :string },
|
104
|
+
name: { type: :string },
|
105
|
+
street: { type: :string }
|
106
|
+
}
|
107
|
+
},
|
108
|
+
owner: {
|
109
|
+
type: :object,
|
110
|
+
additionalProperties: false,
|
111
|
+
required: [:first_name, :last_name, :email],
|
112
|
+
properties: {
|
113
|
+
email: { type: :string, format: :email },
|
114
|
+
title: { type: :string },
|
115
|
+
first_name: { type: :string },
|
116
|
+
last_name: { type: :string },
|
117
|
+
contact_no: { type: :string }
|
118
|
+
}
|
119
|
+
},
|
120
|
+
date_built: {
|
121
|
+
type: :string,
|
122
|
+
format: :'date-time'
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
```
|
127
|
+
|
128
|
+
### With Active Record
|
129
|
+
|
130
|
+
Given:
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
user = Fluent::Json::Schema::Terms::Obj.new(:user)
|
134
|
+
user.lookup(User)
|
135
|
+
.reflect(
|
136
|
+
:first_name, :last_name, :email, :username, :contact_no,
|
137
|
+
:super, :status, :created_by, :updated_by, :created_at,
|
138
|
+
:updated_at
|
139
|
+
)
|
140
|
+
```
|
141
|
+
|
142
|
+
Calling `as_json` would give the following result:
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
{
|
146
|
+
type: :object,
|
147
|
+
additionalProperties: false,
|
148
|
+
required: [
|
149
|
+
:first_name, :last_name, :email, :username, :super, :status,
|
150
|
+
:created_by, :updated_by, :created_at, :updated_at
|
151
|
+
],
|
152
|
+
|
153
|
+
properties: {
|
154
|
+
first_name: { type: :string },
|
155
|
+
last_name: { type: :string },
|
156
|
+
email: { type: :string },
|
157
|
+
username: { type: :string },
|
158
|
+
contact_no: { type: :string },
|
159
|
+
super: { type: :boolean },
|
160
|
+
status: { type: :string, enum: ["active", "inactive"] },
|
161
|
+
created_by: { type: :string },
|
162
|
+
updated_by: { type: :string },
|
163
|
+
created_at: { type: :string, format: 'date-time' },
|
164
|
+
updated_at: { type: :string, format: 'date-time' }
|
165
|
+
}
|
166
|
+
}
|
167
|
+
```
|
168
|
+
|
169
|
+
## Development
|
170
|
+
|
171
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
172
|
+
|
173
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
174
|
+
|
175
|
+
## Contributing
|
176
|
+
|
177
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fluent-json-schema.
|
178
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fluent/json/schema"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fluent/json/schema/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fluent-json-schema"
|
8
|
+
spec.version = Fluent::Json::Schema::VERSION
|
9
|
+
spec.authors = ["Rodette Pedro"]
|
10
|
+
spec.email = ["rodettecpedro@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = 'Build JSON Schemas Fluently'
|
13
|
+
spec.description = 'Build JSON Schemas using a fluent API.'
|
14
|
+
spec.homepage = 'https://github.com/rcpedro/fluent-json-schema'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'fluent'
|
2
|
+
require 'fluent/json/schema/version'
|
3
|
+
require 'fluent/json/schema/terms/bool'
|
4
|
+
require 'fluent/json/schema/terms/date'
|
5
|
+
require 'fluent/json/schema/terms/field'
|
6
|
+
require 'fluent/json/schema/terms/fk'
|
7
|
+
require 'fluent/json/schema/terms/int'
|
8
|
+
require 'fluent/json/schema/terms/num'
|
9
|
+
require 'fluent/json/schema/terms/reflect'
|
10
|
+
require 'fluent/json/schema/terms/obj'
|
11
|
+
|
12
|
+
module Fluent
|
13
|
+
module Json
|
14
|
+
module Schema
|
15
|
+
# Your code goes here...
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
|
4
|
+
module Fluent
|
5
|
+
module Json
|
6
|
+
module Schema
|
7
|
+
class Lexicon
|
8
|
+
include Singleton
|
9
|
+
|
10
|
+
def dictionary
|
11
|
+
Fluent::Lexicon.reflect(Fluent::Json::Schema::Terms)
|
12
|
+
end
|
13
|
+
|
14
|
+
def translator
|
15
|
+
lambda do |term|
|
16
|
+
term.to_s.singularize.to_sym
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def combiner
|
21
|
+
named = lambda do |definition, name|
|
22
|
+
definition.new(name)
|
23
|
+
end
|
24
|
+
|
25
|
+
optioned = lambda do |definition, name, options|
|
26
|
+
definition.new(name, options)
|
27
|
+
end
|
28
|
+
|
29
|
+
lambda do |api, term, definition, args, block|
|
30
|
+
if definition.class.name.demodulize.downcase.to_sym == term
|
31
|
+
return api.add(definition.new(*args))
|
32
|
+
end
|
33
|
+
|
34
|
+
results = Fluent::Lexicon.collect(
|
35
|
+
named.curry.(definition),
|
36
|
+
optioned.curry.(definition)
|
37
|
+
).call(*args)
|
38
|
+
|
39
|
+
block.call(*results) if block.present?
|
40
|
+
return api.add(*results)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'fluent/json/schema/terms'
|
2
|
+
|
3
|
+
|
4
|
+
class Fluent::Json::Schema::Terms::Field
|
5
|
+
|
6
|
+
attr_reader :version, :name, :required, :enum, :default, :constraints
|
7
|
+
|
8
|
+
def initialize(name, options={})
|
9
|
+
@name = name
|
10
|
+
@required = options[:required]
|
11
|
+
@constraints = []
|
12
|
+
|
13
|
+
self.set(options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def mandate
|
17
|
+
@required = true
|
18
|
+
return self
|
19
|
+
end
|
20
|
+
|
21
|
+
def optionalise
|
22
|
+
@required = false
|
23
|
+
return self
|
24
|
+
end
|
25
|
+
|
26
|
+
def set(options={})
|
27
|
+
@enum = options[:enum]
|
28
|
+
@default = options[:default]
|
29
|
+
end
|
30
|
+
|
31
|
+
def as_json(options={})
|
32
|
+
return options.merge(self.as_json_fragment(:default, :enum))
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
def as_json_fragment(*names)
|
37
|
+
result = {}
|
38
|
+
|
39
|
+
names.each do |name|
|
40
|
+
value = self.send(name)
|
41
|
+
result[name] = value if value.present?
|
42
|
+
end
|
43
|
+
|
44
|
+
return result
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'fluent/json/schema/terms/field'
|
2
|
+
|
3
|
+
|
4
|
+
class Fluent::Json::Schema::Terms::Num < Fluent::Json::Schema::Terms::Field
|
5
|
+
|
6
|
+
attr_reader :type, :minimum, :maximum, :exclusive_minimum, :exclusive_maximum, :multiple_of
|
7
|
+
|
8
|
+
def initialize(name, type=:number)
|
9
|
+
super(name)
|
10
|
+
@type = type
|
11
|
+
end
|
12
|
+
|
13
|
+
def set(options={})
|
14
|
+
super(options)
|
15
|
+
@minimum ||= options[:min]
|
16
|
+
@maximum ||= options[:max]
|
17
|
+
|
18
|
+
if not options[:exclusive].nil?
|
19
|
+
@exclusive_minimum = options[:exclusive].include?(:min)
|
20
|
+
@exclusive_maximum = options[:exclusive].include?(:max)
|
21
|
+
end
|
22
|
+
|
23
|
+
@multiple_of ||= options[:mult]
|
24
|
+
return self
|
25
|
+
end
|
26
|
+
|
27
|
+
def as_json
|
28
|
+
super({ type: @type }).merge!(
|
29
|
+
self.as_json_fragment(
|
30
|
+
:minimum, :minimum, :maximum, :exclusive_minimum,
|
31
|
+
:exclusive_maximum, :multiple_of
|
32
|
+
)
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'fluent/json/schema/terms'
|
2
|
+
require 'fluent/json/schema/lexicon'
|
3
|
+
require 'fluent/json/schema/terms/field'
|
4
|
+
|
5
|
+
|
6
|
+
class Fluent::Json::Schema::Terms::Obj < Fluent::Json::Schema::Terms::Field
|
7
|
+
include Fluent
|
8
|
+
|
9
|
+
lexicon Fluent::Json::Schema::Lexicon.instance
|
10
|
+
|
11
|
+
attr_reader :name, :fields, :klass, :additional
|
12
|
+
|
13
|
+
def initialize(name, options={})
|
14
|
+
super(name, options)
|
15
|
+
@fields = {}
|
16
|
+
@additional ||= false
|
17
|
+
@mode = :optional
|
18
|
+
end
|
19
|
+
|
20
|
+
def req
|
21
|
+
@mode = :req
|
22
|
+
return self
|
23
|
+
end
|
24
|
+
|
25
|
+
def opt
|
26
|
+
@mode = :opt
|
27
|
+
return self
|
28
|
+
end
|
29
|
+
|
30
|
+
def add(*fields)
|
31
|
+
fields.each do |field|
|
32
|
+
@fields[field.name] = self.prepare(field)
|
33
|
+
end
|
34
|
+
return self
|
35
|
+
end
|
36
|
+
|
37
|
+
def [](prop)
|
38
|
+
return @fields[prop]
|
39
|
+
end
|
40
|
+
|
41
|
+
def open(allowed=nil)
|
42
|
+
@additional = allowed if allowed.present?
|
43
|
+
@additional ||= true
|
44
|
+
return self
|
45
|
+
end
|
46
|
+
|
47
|
+
def strict
|
48
|
+
@additional = false
|
49
|
+
return self
|
50
|
+
end
|
51
|
+
|
52
|
+
def lookup(klass)
|
53
|
+
@name ||= klass.table_name.to_sym
|
54
|
+
@klass = klass
|
55
|
+
return self
|
56
|
+
end
|
57
|
+
|
58
|
+
def reflect(*props)
|
59
|
+
raise 'No lookup defined' if @klass.nil?
|
60
|
+
|
61
|
+
@mode = nil
|
62
|
+
props.each { |prop| @fields[prop] = Fluent::Json::Schema::Terms::Reflect.new(prop, @klass) }
|
63
|
+
return self
|
64
|
+
end
|
65
|
+
|
66
|
+
def requirements
|
67
|
+
return @fields.map { |k, field| field if field.required }.compact
|
68
|
+
return []
|
69
|
+
end
|
70
|
+
|
71
|
+
def as_json
|
72
|
+
fragment = super.merge!({
|
73
|
+
type: :object,
|
74
|
+
additionalProperties: @additional,
|
75
|
+
required: self.requirements.map { |r| r.name },
|
76
|
+
properties: {}
|
77
|
+
})
|
78
|
+
|
79
|
+
@fields.map { |k, v| fragment[:properties][k] = v.as_json }
|
80
|
+
|
81
|
+
return fragment
|
82
|
+
end
|
83
|
+
|
84
|
+
protected
|
85
|
+
def prepare(field)
|
86
|
+
case @mode
|
87
|
+
when :req
|
88
|
+
return field.mandate
|
89
|
+
when :opt
|
90
|
+
return field.optionalise
|
91
|
+
end
|
92
|
+
|
93
|
+
return field
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'fluent/json/schema/terms'
|
2
|
+
|
3
|
+
|
4
|
+
class Fluent::Json::Schema::Terms::Reflect < SimpleDelegator
|
5
|
+
|
6
|
+
MAPPINGS = {
|
7
|
+
string: Fluent::Json::Schema::Terms::Str,
|
8
|
+
datetime: Fluent::Json::Schema::Terms::Date,
|
9
|
+
date: Fluent::Json::Schema::Terms::Date,
|
10
|
+
time: Fluent::Json::Schema::Terms::Date,
|
11
|
+
integer: Fluent::Json::Schema::Terms::Int,
|
12
|
+
decimal: Fluent::Json::Schema::Terms::Num,
|
13
|
+
boolean: Fluent::Json::Schema::Terms::Bool
|
14
|
+
}
|
15
|
+
|
16
|
+
attr_reader :klass, :instance
|
17
|
+
|
18
|
+
def initialize(name, klass)
|
19
|
+
@klass = klass
|
20
|
+
# TODO, fk
|
21
|
+
|
22
|
+
column = klass.columns_hash[name.to_s]
|
23
|
+
raise "Column with name '#{name}' not found in '#{klass.name}'" if column.nil?
|
24
|
+
|
25
|
+
enum = klass.defined_enums[name.to_s]
|
26
|
+
instance_klass = MAPPINGS[column.type.to_sym]
|
27
|
+
instance_klass = MAPPINGS[:string] if enum.present? and enum.keys[0].is_a?(String)
|
28
|
+
|
29
|
+
raise "Unsupported type '#{column.type}' for '#{name}'" if instance_klass.nil?
|
30
|
+
|
31
|
+
@instance = instance_klass.new(name)
|
32
|
+
@instance.set(enum: enum.keys) if enum.present?
|
33
|
+
@instance.mandate if not column.null
|
34
|
+
|
35
|
+
super(@instance)
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'fluent/json/schema/terms/field'
|
2
|
+
|
3
|
+
|
4
|
+
class Fluent::Json::Schema::Terms::Str < Fluent::Json::Schema::Terms::Field
|
5
|
+
attr_reader :format, :pattern, :min_length, :max_length
|
6
|
+
|
7
|
+
def initialize(name, options={})
|
8
|
+
super(name, options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def set(options={})
|
12
|
+
super(options)
|
13
|
+
@min_length ||= options[:min]
|
14
|
+
@max_length ||= options[:max]
|
15
|
+
@format ||= options[:fmt]
|
16
|
+
@pattern ||= options[:pattern]
|
17
|
+
return self
|
18
|
+
end
|
19
|
+
|
20
|
+
def datetime
|
21
|
+
@format = :'date-time'
|
22
|
+
end
|
23
|
+
|
24
|
+
def email
|
25
|
+
@format = :email
|
26
|
+
end
|
27
|
+
|
28
|
+
def uri
|
29
|
+
@format = :uri
|
30
|
+
end
|
31
|
+
|
32
|
+
def as_json
|
33
|
+
super({ type: :string }).merge!(
|
34
|
+
self.as_json_fragment(:min_length, :max_length, :format, :pattern)
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-json-schema
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rodette Pedro
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Build JSON Schemas using a fluent API.
|
56
|
+
email:
|
57
|
+
- rodettecpedro@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- fluent-json-schema.gemspec
|
71
|
+
- lib/fluent/json/schema.rb
|
72
|
+
- lib/fluent/json/schema/lexicon.rb
|
73
|
+
- lib/fluent/json/schema/terms.rb
|
74
|
+
- lib/fluent/json/schema/terms/bool.rb
|
75
|
+
- lib/fluent/json/schema/terms/date.rb
|
76
|
+
- lib/fluent/json/schema/terms/field.rb
|
77
|
+
- lib/fluent/json/schema/terms/fk.rb
|
78
|
+
- lib/fluent/json/schema/terms/int.rb
|
79
|
+
- lib/fluent/json/schema/terms/num.rb
|
80
|
+
- lib/fluent/json/schema/terms/obj.rb
|
81
|
+
- lib/fluent/json/schema/terms/reflect.rb
|
82
|
+
- lib/fluent/json/schema/terms/str.rb
|
83
|
+
- lib/fluent/json/schema/version.rb
|
84
|
+
homepage: https://github.com/rcpedro/fluent-json-schema
|
85
|
+
licenses: []
|
86
|
+
metadata:
|
87
|
+
allowed_push_host: https://rubygems.org
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.4.5
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Build JSON Schemas Fluently
|
108
|
+
test_files: []
|