strong_json 0.8.0 → 0.9.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: 2ddde917e3030412ba154b0b99ea307e2c50af8ff9ca7b45ba9730e96d6dfff0
4
- data.tar.gz: a0fbfc9b8245dae4683236e1c6d5b92c97b5ce30ad4eef628e54bde56539f47c
3
+ metadata.gz: 34cb280b80e097153297adf6032193ce6479c3facb6aabf8f8bf0794a83030e0
4
+ data.tar.gz: 12e64c35a8376a275d6cf0e4819c2820d5f5db4fa94b1b294ecba2ccd133fd42
5
5
  SHA512:
6
- metadata.gz: a2051a77f37d08d171ad355ae97fdd0b46bf42fbaaa771824f3cff3be4e0498e1a3844881036e6877981ae44852eee89347894768e86b28d49a44d73c9c8867c
7
- data.tar.gz: 460f595197f2772851bcf4e400ca08bd7410a797cc2161dc39e7f35526211f508b0940ee2733b5ba07d661b43a5ccbd535599debd722e0f5115eaf795c53a5f9
6
+ metadata.gz: 3258f86f9fe623a016658fc19a8f333a60fb99a9af4a9d55c23087e4bcf3edb137723083921d4f55ed5764dd659e964a0b4afbbf36cf4e9294247bf5a377fdbb
7
+ data.tar.gz: f52cfe275312e777495d5d5d7d2822aeec61fb5cedcc01573c630ce34c204861072e996bd4ee9c621121cb97a83aed27642ec2bc035df4e4c87d551d35acc449
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.9.0 (2019-3-20)
6
+
7
+ * [#12](https://github.com/soutaro/strong_json/pull/12): Fix type signature
8
+
5
9
  ## 0.8.0 (2018-10-29)
6
10
 
7
11
  * Add steep typechecking
data/example/example.rb CHANGED
@@ -3,7 +3,7 @@ Schema = _ = StrongJSON.new do
3
3
 
4
4
  let :address, object(address: string, country: symbol?)
5
5
  let :email, object(email: string)
6
- let :contact, enum(address, email)
6
+ let :contact, enum?(address, email)
7
7
  let :person, object(name: string, contacts: array(contact))
8
8
  end
9
9
 
data/example/example.rbi CHANGED
@@ -2,10 +2,10 @@ type address = { address: String, country: Symbol? }
2
2
  type email = { email: String }
3
3
 
4
4
  class AddressSchema < StrongJSON
5
- def address: -> StrongJSON::_Schema<address>
6
- def email: -> StrongJSON::_Schema<email>
7
- def contact: -> StrongJSON::_Schema<email | address>
8
- def person: -> StrongJSON::_Schema<{ name: String, contacts: Array<email | address> }>
5
+ def address: -> StrongJSON::Type::Object<address>
6
+ def email: -> StrongJSON::Type::Object<email>
7
+ def contact: -> StrongJSON::Type::Object<email | address>
8
+ def person: -> StrongJSON::Type::Object<{ name: String, contacts: Array<email | address> }>
9
9
  end
10
10
 
11
11
  Schema: AddressSchema
@@ -1,16 +1,16 @@
1
1
  class StrongJSON
2
2
  module Types
3
- # @type method object: (?Hash<Symbol, ty>) -> _Schema<any>
3
+ # @type method object: (?Hash<Symbol, ty>) -> Type::Object<any>
4
4
  def object(fields = {})
5
5
  Type::Object.new(fields)
6
6
  end
7
7
 
8
- # @type method array: (?ty) -> _Schema<any>
8
+ # @type method array: (?ty) -> Type::Array<any>
9
9
  def array(type = any)
10
10
  Type::Array.new(type)
11
11
  end
12
12
 
13
- # @type method optional: (?ty) -> _Schema<any>
13
+ # @type method optional: (?ty) -> Type::Optional<any>
14
14
  def optional(type = any)
15
15
  Type::Optional.new(type)
16
16
  end
@@ -1,5 +1,5 @@
1
1
  class StrongJSON
2
2
  # @dynamic initialize, let
3
3
 
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
data/sig/strong_json.rbi CHANGED
@@ -16,29 +16,29 @@ end
16
16
  type StrongJSON::ty = _Schema<any>
17
17
 
18
18
  module StrongJSON::Types
19
- def object: <'x> (Hash<Symbol, ty>) -> _Schema<'x>
20
- | () -> _Schema<Hash<Symbol, any>>
21
- def object?: <'x> (Hash<Symbol, ty>) -> _Schema<'x | nil>
22
- def any: () -> _Schema<any>
23
- def optional: <'x> (?_Schema<'x>) -> _Schema<'x | nil>
24
- | () -> _Schema<any>
25
- def string: () -> _Schema<String>
26
- def string?: () -> _Schema<String?>
27
- def number: () -> _Schema<Numeric>
28
- def number?: () -> _Schema<Numeric?>
29
- def numeric: () -> _Schema<Numeric>
30
- def numeric?: () -> _Schema<Numeric?>
31
- def boolean: () -> _Schema<bool>
32
- def boolean?: () -> _Schema<bool?>
33
- def symbol: () -> _Schema<Symbol>
34
- def symbol?: () -> _Schema<Symbol?>
35
- def array: <'x> (_Schema<'x>) -> _Schema<Array<'x>>
36
- | () -> _Schema<Array<any>>
37
- def array?: <'x> (_Schema<'x>) -> _Schema<Array<'x>?>
38
- def literal: <'x> ('x) -> _Schema<'x>
39
- def literal?: <'x> ('x) -> _Schema<'x?>
40
- def enum: <'x> (*_Schema<any>) -> _Schema<'x>
41
- def enum?: <'x> (*_Schema<any>) -> _Schema<'x?>
19
+ def object: <'x> (Hash<Symbol, ty>) -> Type::Object<'x>
20
+ | () -> Type::Object<Hash<Symbol, any>>
21
+ def object?: <'x> (Hash<Symbol, ty>) -> Type::Optional<'x>
22
+ def any: () -> Type::Base<any>
23
+ def optional: <'x> (_Schema<'x>) -> Type::Optional<'x>
24
+ | () -> Type::Optional<any>
25
+ def string: () -> Type::Base<String>
26
+ def string?: () -> Type::Optional<String>
27
+ def number: () -> Type::Base<Numeric>
28
+ def number?: () -> Type::Optional<Numeric>
29
+ def numeric: () -> Type::Base<Numeric>
30
+ def numeric?: () -> Type::Optional<Numeric>
31
+ def boolean: () -> Type::Base<bool>
32
+ def boolean?: () -> Type::Optional<bool>
33
+ def symbol: () -> Type::Base<Symbol>
34
+ def symbol?: () -> Type::Optional<Symbol>
35
+ def array: <'x> (_Schema<'x>) -> Type::Array<'x>
36
+ | () -> Type::Array<any>
37
+ def array?: <'x> (_Schema<'x>) -> Type::Optional<::Array<'x>>
38
+ def literal: <'x> ('x) -> Type::Literal<'x>
39
+ def literal?: <'x> ('x) -> Type::Optional<'x>
40
+ def enum: <'x> (*_Schema<any>) -> Type::Enum<'x>
41
+ def enum?: <'x> (*_Schema<any>) -> Type::Optional<'x>
42
42
  def ignored: () -> _Schema<nil>
43
43
  def prohibited: () -> _Schema<nil>
44
44
  end
data/strong_json.gemspec CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
  spec.metadata = { "steep_types" => "sig" }
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "bundler", ">= 1.6"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  spec.add_development_dependency "rspec", "~> 3.0"
25
- spec.add_development_dependency "steep", "~> 0.8"
25
+ spec.add_development_dependency "steep", "~> 0.10"
26
26
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strong_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2019-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.8'
61
+ version: '0.10'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.8'
68
+ version: '0.10'
69
69
  description: Type check JSON objects
70
70
  email:
71
71
  - matsumoto@soutaro.com