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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa99cc9446a97fd7d69624a5618fa53c4cba390ef4b008073ee3aaa65e7a18f7
4
- data.tar.gz: bd775b351f47f8292ff70df162586d0822d814b9f3230ff7b7b7fe8caf9584c7
3
+ metadata.gz: 5b3b3c8afb8d478db134ec5536930afed58f06dc36e062f6c31ae2282fc54c6a
4
+ data.tar.gz: 6e5470e5d869e5a268f1521d223d68f8596e4774594f4651b4b4c60f660eb508
5
5
  SHA512:
6
- metadata.gz: e050ecaccb1a4de337b76a8c310c77b572c996e5689da63ea2008c899ace3d9cc1bc800e455349912d767f48d76d00fa09e2b4405ce49dc93707798a5d5ae350
7
- data.tar.gz: 825b13e2e6c0bc51fbc0b41e18ec9785c44168cd098819e07afdb79c7a41a2ab6775e237f377c736d6406b9e4a3b7c41420e10768af87983d1f543322645721c
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
@@ -0,0 +1,2 @@
1
+ # for power-assert
2
+ /spec
data/.prettierrc ADDED
@@ -0,0 +1,3 @@
1
+ printWidth: 120
2
+ addTrailingCommas: true
3
+ preferSingleQuotes: false
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
@@ -0,0 +1,2 @@
1
+ require:
2
+ - rubocop-airbnb
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in json-schema-serializer.gemspec
6
6
  gemspec
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
@@ -1,6 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require "yard"
4
+ require "yard/rake/yardoc_task"
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
7
+ YARD::Rake::YardocTask.new
5
8
 
6
9
  task :default => :spec
data/bin/fmt ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle exec rubocop -a
7
+ bundle exec rbprettier --write "**/*.rb" "**/*.rake" "**/*.gemspec"
8
+
9
+ # Do any other automated setup that you need to do here
@@ -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 = "json-schema-serializer"
8
- spec.version = Json::Schema::Serializer::VERSION
9
- spec.authors = ["Narazaka"]
10
- spec.email = ["info@narazaka.net"]
11
- spec.licenses = ['Zlib']
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 = %q{JSON Schema based serializer}
14
- spec.homepage = "https://github.com/Narazaka/json-schema-serializer"
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
- "public gem pushes."
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 = 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 = ["lib"]
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
@@ -1,7 +1,7 @@
1
1
  module Json
2
2
  module Schema
3
3
  module Serializer
4
- VERSION = "0.1.0"
4
+ VERSION = "1.0.0".freeze
5
5
  end
6
6
  end
7
7
  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 {|name, property_schema|
157
- [
158
- name.to_s,
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: 0.1.0
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-27 00:00:00.000000000 Z
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
- - ".travis.yml"
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
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.5
7
- before_install: gem install bundler -v 1.17.2