grpc_required_annotator 0.1.0 → 0.1.1

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: 76cdac5d59e300226c0e230d88a88e96aba1a5c741940616b006800f4adf1639
4
- data.tar.gz: 38dfc65e2d704d5ead47ac807f7cb28310e399d8066a545f07c9ab3963250a48
3
+ metadata.gz: 1137b3d27d1b455478c786c6df2da4a33b513afdfe7d78840fec1e04a94ebc6c
4
+ data.tar.gz: d7cdc0d1040b518741bc9dc05093b8451f4f3edfc44bb81f0f0d61748d178653
5
5
  SHA512:
6
- metadata.gz: 3eebd09822f7e5ec7695422912f250c2941365aff7af6e89e15ba8fd23b067c55353ad86aed442b9ac5c89e4b8a4d8c5da4bb3b8663a4d2ce520c76f305fe18d
7
- data.tar.gz: 49a22ca40afb25ae3be9b6b85f7615fe6ec7937d65c5bfc7e5363cfb9e4c5583c3f1c2f729b26ef3f8237da78235b47e612a393f3b78a81936316a9c78a8f46e
6
+ metadata.gz: bc0d9bc0b179d0c211b36d09aec429bb80e8bbc9e6cd1e480bfd582a7173d462b895327dfb39788d430b689a6cc7f5d183268a976d7263776889a8c1d1e8edc3
7
+ data.tar.gz: 3e4ba2ff99650cf8ff003c9ac5c278919d9fe6834943fced118abf428bc8d755110b1777b5213a655d3523b180e66233a3f35b82c5e90260b2250dc08ba61789
data/.gitignore CHANGED
@@ -11,3 +11,6 @@
11
11
  .rspec_status
12
12
 
13
13
  Gemfile.lock
14
+
15
+ # codecov
16
+ /coverage/
data/.travis.yml CHANGED
@@ -2,6 +2,10 @@
2
2
  sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
+ env:
6
+ global:
7
+ # CODECOV_TOKEN
8
+ - secure: "P2TGqdOBYoDwwI/WxfwNOt9ITRVx0/nx6BBq3TX+oJ4I7L7FLj4CDp96OnrqpvyRScEAnWIW6K9vr4yv2wvXGsCRAVvauFJz2nLi3ZMCR8vHMLh64jINhfqIbJ1tRvtNy7DvyXNJDYQqUAWjo5ZbcuM+oYq9f8mfzquee5YzYLWhf96r3xsWEbJ3YVJyVNQoA7m35Mhqned9pESjIm2P0nZRF9C+6/lAPbsphEnnpBakz9k3wy7ALJ9wGfKpoUJ6DjtraoCRxPrWmg0pCOzVbATOVFWaKT7xcqJIeYSE7Q6aaLakrccfbPMumWUqU1sie5cT0WOhRdsiEEoS7xelRSmfnkmtz9EYB7xCRNB7X/AeqeH+YXUsWMoFiqs/oLUezay6AINBUgpSRACn14xx6lmbo4JKRYOLMW3/DcrV0aZzkSh5ARZA4VrmaGVxaR6a/jeZtpVvqfUHI5grkiM5wfVT/QoeWfYGH15AUp+g5l521BRfV+mf4mJVv2ShYgcrRX714D6p280xmcASy7TzxSftDXo47rZaFeHUm83HtGkBnSZphyjtizR5PXdb54MZHedjqiOeo9HH7MA4cSYZRN7dqSl2LbDjmnVEESREIou/YyR9WbmxGkod/JHMEcamNCInwcby/Pi/2hgVaLwFgMgQbWQpUYv+Ofs16t/IMk4="
5
9
  rvm:
6
10
  - 2.6.3
7
11
  before_install: gem install bundler -v 2.0.2
data/CHANGELOG.md CHANGED
@@ -0,0 +1,8 @@
1
+ ## 0.1.1
2
+
3
+ - update README
4
+
5
+ ## 0.1.0
6
+
7
+ - setup gem
8
+ - update README
data/README.md CHANGED
@@ -1,8 +1,19 @@
1
- # GrpcRequiredAnnotator
1
+ # GrpcRequiredAnnotator [![Gem Version](https://badge.fury.io/rb/grpc_required_annotator.svg)](https://badge.fury.io/rb/grpc_required_annotator) [![Build Status](https://travis-ci.com/euglena1215/grpc_required_annotator.svg?branch=master)](https://travis-ci.com/euglena1215/grpc_required_annotator) [![codecov](https://codecov.io/gh/euglena1215/grpc_required_annotator/branch/master/graph/badge.svg)](https://codecov.io/gh/euglena1215/grpc_required_annotator)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/grpc_required_annotator`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ GrpcRequiredAnnotator is a annotator for null validation of gRPC requests using `required`.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ### Supported Types
6
+
7
+ - Integer (int64, int32, etc...)
8
+ - String (string)
9
+ - Google::Protobuf::FieldMask (field_mask)
10
+ - Array (repeated fields)
11
+ - Symbol (enum)
12
+
13
+ ### Unsupported Types
14
+
15
+ - oneof
16
+ - embedded messages
6
17
 
7
18
  ## Installation
8
19
 
@@ -22,7 +33,56 @@ Or install it yourself as:
22
33
 
23
34
  ## Usage
24
35
 
25
- TODO: Write usage instructions here
36
+ ```proto
37
+ syntax = "proto3";
38
+ package sample;
39
+
40
+ option ruby_package = "SamplePb";
41
+
42
+ service Sample {
43
+ rpc Foo (FooRequest) returns (FooResponse);
44
+ }
45
+
46
+ message FooRequest {
47
+ int64 a = 1;
48
+ string b = 2;
49
+ }
50
+
51
+ message FooResponse {
52
+ int64 a = 1;
53
+ string b = 2;
54
+ }
55
+ ```
56
+
57
+ ```rb
58
+ class SampleService < SamplePb::Sample::Service
59
+ include GrpcRequiredAnnotator
60
+
61
+ # If a or b are null, raises GRPC::InvalidArgument
62
+ required :a, :b
63
+ def foo(request, call)
64
+ ## `required :a, :b` is equivalent to the following:
65
+ # raise GRPC::InvalidArgument.new("`a` is required") if req.a == 0
66
+ # raise GRPC::InvalidArgument.new("`b` is required") if req.b == ""
67
+ FooResponse.new(a: req.a, b: req.b)
68
+ end
69
+ end
70
+ ```
71
+
72
+ ### Testing by rspec
73
+
74
+ ```rb
75
+ RSpec.describe SampleService do
76
+ describe "#foo" do
77
+ describe "required" do
78
+ it "a and b are required" do
79
+ expect(described_class.required_fields(:foo)).to eq [:a, :b]
80
+ end
81
+ end
82
+ end
83
+ end
84
+
85
+ ```
26
86
 
27
87
  ## Development
28
88
 
data/codedov.yml ADDED
@@ -0,0 +1,6 @@
1
+ coverage:
2
+ status:
3
+ project:
4
+ default:
5
+ threshold: 5%
6
+ patch: off
@@ -35,4 +35,6 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "rake", "~> 10.0"
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
37
  spec.add_development_dependency "pry-byebug"
38
+ spec.add_development_dependency "simplecov"
39
+ spec.add_development_dependency "codecov"
38
40
  end
@@ -1,3 +1,3 @@
1
1
  module GrpcRequiredAnnotator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc_required_annotator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shintani Teppei
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-09 00:00:00.000000000 Z
11
+ date: 2019-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: codecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description: Annotator for null validation of gRPC requests using `required`
98
126
  email:
99
127
  - teppest1215@gmail.com
@@ -113,6 +141,7 @@ files:
113
141
  - Rakefile
114
142
  - bin/console
115
143
  - bin/setup
144
+ - codedov.yml
116
145
  - grpc_required_annotator.gemspec
117
146
  - lib/grpc_required_annotator.rb
118
147
  - lib/grpc_required_annotator/required.rb