json-schema-serializer 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +26 -0
- data/.prettierignore +2 -0
- data/.prettierrc +3 -0
- data/.rubocop.yml +21 -0
- data/.rubocop_airbnb.yml +2 -0
- data/Gemfile +1 -1
- data/README.md +3 -0
- data/Rakefile +3 -0
- data/bin/fmt +9 -0
- data/json-schema-serializer.gemspec +20 -15
- data/lib/json/schema/serializer/version.rb +1 -1
- data/lib/json/schema/serializer.rb +4 -7
- metadata +78 -3
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b3b3c8afb8d478db134ec5536930afed58f06dc36e062f6c31ae2282fc54c6a
|
4
|
+
data.tar.gz: 6e5470e5d869e5a268f1521d223d68f8596e4774594f4651b4b4c60f660eb508
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb17f472b57c9f7844c6558e8f9f7fe4fd14556a363707edbe1f263f05fe404f388fd09e720db81500db62ea7d6e6f33797857f4b99f145f4ae4c5d9728d5d3
|
7
|
+
data.tar.gz: c923a36cf9e887328b3d16ec62f4d0aef36a24e50679cfdc8e5b407c6780581990e7e5f6a26b3c3f8e05554ba5fbf111814cf39c0352821e5489959c85faef94
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v1
|
12
|
+
- name: Set up Ruby 2.6
|
13
|
+
uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6.x
|
16
|
+
- name: Cache bundle
|
17
|
+
uses: actions/cache@preview
|
18
|
+
with:
|
19
|
+
path: ${{ format('{0}{1}', github.workspace, '/vendor/bundle') }}
|
20
|
+
key: ${{ runner.os }}-${{ github.repository }}
|
21
|
+
restore-keys: ${{ runner.os }}-${{ github.repository }}
|
22
|
+
- name: Build and test with Rake
|
23
|
+
run: |
|
24
|
+
gem install bundler
|
25
|
+
bundle install --jobs 4 --retry 3 --path ${{ format('{0}{1}', github.workspace, '/vendor/bundle') }}
|
26
|
+
bundle exec rake
|
data/.prettierignore
ADDED
data/.prettierrc
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- .rubocop_airbnb.yml
|
3
|
+
inherit_gem:
|
4
|
+
rubocop-config-prettier: config/rubocop.yml
|
5
|
+
# prettier
|
6
|
+
Style/PercentLiteralDelimiters:
|
7
|
+
Description: Use `%`-literal delimiters consistently
|
8
|
+
StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-literal-braces
|
9
|
+
Enabled: false
|
10
|
+
PreferredDelimiters:
|
11
|
+
! '%': ()
|
12
|
+
! '%i': ()
|
13
|
+
! '%q': ()
|
14
|
+
! '%Q': ()
|
15
|
+
! '%r': ! '{}'
|
16
|
+
! '%s': ()
|
17
|
+
! '%w': ()
|
18
|
+
! '%W': ()
|
19
|
+
! '%x': ()
|
20
|
+
Airbnb/SimpleModifierConditional:
|
21
|
+
Enabled: false
|
data/.rubocop_airbnb.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Json::Schema::Serializer
|
2
2
|
|
3
|
+
[![Actions Status](https://github.com/Narazaka/json-schema-serializer/workflows/Ruby/badge.svg)](https://github.com/Narazaka/json-schema-serializer/actions)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/json-schema-serializer.svg)](https://badge.fury.io/rb/json-schema-serializer)
|
5
|
+
|
3
6
|
JSON Schema based serializer
|
4
7
|
|
5
8
|
## Installation
|
data/Rakefile
CHANGED
data/bin/fmt
ADDED
@@ -1,17 +1,16 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "json/schema/serializer/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.authors
|
10
|
-
spec.email
|
11
|
-
spec.licenses
|
6
|
+
spec.name = "json-schema-serializer"
|
7
|
+
spec.version = Json::Schema::Serializer::VERSION
|
8
|
+
spec.authors = %w[Narazaka]
|
9
|
+
spec.email = %w[info@narazaka.net]
|
10
|
+
spec.licenses = %w[Zlib]
|
12
11
|
|
13
|
-
spec.summary
|
14
|
-
spec.homepage
|
12
|
+
spec.summary = "JSON Schema based serializer"
|
13
|
+
spec.homepage = "https://github.com/Narazaka/json-schema-serializer"
|
15
14
|
|
16
15
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
16
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
@@ -21,21 +20,27 @@ Gem::Specification.new do |spec|
|
|
21
20
|
spec.metadata["changelog_uri"] = "https://github.com/Narazaka/json-schema-serializer/blob/master/CHANGELOG.md"
|
22
21
|
else
|
23
22
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
-
|
23
|
+
"public gem pushes."
|
25
24
|
end
|
26
25
|
|
27
26
|
# Specify which files should be added to the gem when it is released.
|
28
27
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
-
spec.files
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
spec.
|
34
|
-
spec.
|
28
|
+
spec.files =
|
29
|
+
Dir.chdir(File.expand_path("..", __FILE__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
|
+
end
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = %w[lib]
|
35
35
|
|
36
36
|
spec.add_development_dependency "bundler", "~> 2.0"
|
37
37
|
spec.add_development_dependency "rake", "~> 10.5"
|
38
38
|
spec.add_development_dependency "rspec", "~> 3.9"
|
39
39
|
spec.add_development_dependency "rspec-power_assert", "~> 1.1"
|
40
|
+
spec.add_development_dependency "rubocop", "~> 0.76"
|
41
|
+
spec.add_development_dependency "rubocop-airbnb", "~> 3"
|
42
|
+
spec.add_development_dependency "prettier", ">= 0.16"
|
43
|
+
spec.add_development_dependency "rubocop-config-prettier", "~> 0.1"
|
40
44
|
spec.add_development_dependency "pry-byebug", "~> 3.7"
|
45
|
+
spec.add_development_dependency "yard", "~> 0.9"
|
41
46
|
end
|
@@ -149,16 +149,13 @@ module JSON
|
|
149
149
|
obj == true
|
150
150
|
when "array"
|
151
151
|
items_schema = try_hash(schema, :items)
|
152
|
-
obj.nil? ? [] : obj.map {|item| walk(items_schema, item, true) }
|
152
|
+
obj.nil? ? [] : obj.map { |item| walk(items_schema, item, true) }
|
153
153
|
when "object"
|
154
154
|
properties_schema = try_hash(schema, :properties)
|
155
155
|
required_schema = Set.new(try_hash(schema, :required)&.map(&:to_s))
|
156
|
-
properties_schema.map
|
157
|
-
[
|
158
|
-
|
159
|
-
walk(property_schema, try_hash(obj, name), required_schema.include?(name.to_s)),
|
160
|
-
]
|
161
|
-
}.to_h
|
156
|
+
properties_schema.map do |name, property_schema|
|
157
|
+
[name.to_s, walk(property_schema, try_hash(obj, name), required_schema.include?(name.to_s))]
|
158
|
+
end.to_h
|
162
159
|
end
|
163
160
|
end
|
164
161
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-schema-serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Narazaka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,62 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.76'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.76'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-airbnb
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: prettier
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.16'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.16'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-config-prettier
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.1'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.1'
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: pry-byebug
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +136,20 @@ dependencies:
|
|
80
136
|
- - "~>"
|
81
137
|
- !ruby/object:Gem::Version
|
82
138
|
version: '3.7'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.9'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.9'
|
83
153
|
description:
|
84
154
|
email:
|
85
155
|
- info@narazaka.net
|
@@ -87,15 +157,20 @@ executables: []
|
|
87
157
|
extensions: []
|
88
158
|
extra_rdoc_files: []
|
89
159
|
files:
|
160
|
+
- ".github/workflows/ruby.yml"
|
90
161
|
- ".gitignore"
|
162
|
+
- ".prettierignore"
|
163
|
+
- ".prettierrc"
|
91
164
|
- ".rspec"
|
92
|
-
- ".
|
165
|
+
- ".rubocop.yml"
|
166
|
+
- ".rubocop_airbnb.yml"
|
93
167
|
- CHANGELOG.md
|
94
168
|
- Gemfile
|
95
169
|
- LICENSE
|
96
170
|
- README.md
|
97
171
|
- Rakefile
|
98
172
|
- bin/console
|
173
|
+
- bin/fmt
|
99
174
|
- bin/setup
|
100
175
|
- json-schema-serializer.gemspec
|
101
176
|
- lib/json/schema/serializer.rb
|