protovalidate 0.1.0.beta2-arm-linux-gnu
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/.gitattributes +12 -0
- data/.yardopts +8 -0
- data/CHANGELOG.md +10 -0
- data/LICENSE.txt +201 -0
- data/NOTICE.md +30 -0
- data/README.md +96 -0
- data/Rakefile +37 -0
- data/lib/buf/validate/validate_pb.rb +55 -0
- data/lib/protovalidate/3.3/protovalidate_native.so +0 -0
- data/lib/protovalidate/3.4/protovalidate_native.so +0 -0
- data/lib/protovalidate/4.0/protovalidate_native.so +0 -0
- data/lib/protovalidate/errors.rb +32 -0
- data/lib/protovalidate/native.rb +30 -0
- data/lib/protovalidate/validator.rb +96 -0
- data/lib/protovalidate/version.rb +10 -0
- data/lib/protovalidate/violation.rb +115 -0
- data/lib/protovalidate.rb +48 -0
- data/licenses/abseil-cpp-LICENSE +203 -0
- data/licenses/antlr4-LICENSE.txt +28 -0
- data/licenses/cel-cpp-LICENSE +202 -0
- data/licenses/protobuf-LICENSE +32 -0
- data/licenses/protovalidate-cc-LICENSE +201 -0
- data/licenses/re2-LICENSE +27 -0
- data/sig/buf/validate/validate_pb.rbs +64 -0
- data/sig/protovalidate/native.rbs +14 -0
- data/sig/protovalidate.rbs +90 -0
- metadata +89 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) 2009 The RE2 Authors. All rights reserved.
|
|
2
|
+
//
|
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
|
4
|
+
// modification, are permitted provided that the following conditions are
|
|
5
|
+
// met:
|
|
6
|
+
//
|
|
7
|
+
// * Redistributions of source code must retain the above copyright
|
|
8
|
+
// notice, this list of conditions and the following disclaimer.
|
|
9
|
+
// * Redistributions in binary form must reproduce the above
|
|
10
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
// in the documentation and/or other materials provided with the
|
|
12
|
+
// distribution.
|
|
13
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
14
|
+
// contributors may be used to endorse or promote products derived from
|
|
15
|
+
// this software without specific prior written permission.
|
|
16
|
+
//
|
|
17
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Generated message classes of buf/validate/validate.proto that this gem exposes.
|
|
2
|
+
# Only the members used by the gem's public API are declared.
|
|
3
|
+
module Buf
|
|
4
|
+
module Validate
|
|
5
|
+
class Violations
|
|
6
|
+
include Google::Protobuf::MessageExts
|
|
7
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
|
8
|
+
|
|
9
|
+
def initialize: (?violations: Array[Violation]) -> void
|
|
10
|
+
|
|
11
|
+
def violations: () -> Google::Protobuf::RepeatedField[Violation]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Violation
|
|
15
|
+
include Google::Protobuf::MessageExts
|
|
16
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
|
17
|
+
|
|
18
|
+
def field: () -> FieldPath?
|
|
19
|
+
|
|
20
|
+
def rule: () -> FieldPath?
|
|
21
|
+
|
|
22
|
+
def rule_id: () -> String
|
|
23
|
+
|
|
24
|
+
def message: () -> String
|
|
25
|
+
|
|
26
|
+
def for_key: () -> bool
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class FieldPath
|
|
30
|
+
include Google::Protobuf::MessageExts
|
|
31
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
|
32
|
+
|
|
33
|
+
def elements: () -> Google::Protobuf::RepeatedField[FieldPathElement]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class FieldPathElement
|
|
37
|
+
include Google::Protobuf::MessageExts
|
|
38
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
|
39
|
+
|
|
40
|
+
def field_number: () -> Integer
|
|
41
|
+
|
|
42
|
+
def field_name: () -> String
|
|
43
|
+
|
|
44
|
+
def field_type: () -> Symbol
|
|
45
|
+
|
|
46
|
+
def key_type: () -> Symbol
|
|
47
|
+
|
|
48
|
+
def value_type: () -> Symbol
|
|
49
|
+
|
|
50
|
+
# Name of the populated subscript field, or nil.
|
|
51
|
+
def subscript: () -> (:index | :bool_key | :int_key | :uint_key | :string_key)?
|
|
52
|
+
|
|
53
|
+
def index: () -> Integer
|
|
54
|
+
|
|
55
|
+
def bool_key: () -> bool
|
|
56
|
+
|
|
57
|
+
def int_key: () -> Integer
|
|
58
|
+
|
|
59
|
+
def uint_key: () -> Integer
|
|
60
|
+
|
|
61
|
+
def string_key: () -> String
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Protovalidate
|
|
2
|
+
# Binding to protovalidate-cc, implemented by the native extension.
|
|
3
|
+
module Native
|
|
4
|
+
# A descriptor pool plus a rule cache. Bytes in, bytes out.
|
|
5
|
+
class Engine
|
|
6
|
+
# Adds a serialized google.protobuf.FileDescriptorProto to the pool.
|
|
7
|
+
def add_file: (String file) -> void
|
|
8
|
+
|
|
9
|
+
# Validates a serialized message of the named type; returns serialized
|
|
10
|
+
# buf.validate.Violations, or nil when the message is valid.
|
|
11
|
+
def validate: (String type_name, String payload, bool fail_fast) -> String?
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Validates Protobuf messages against the buf.validate rules declared in their schema.
|
|
2
|
+
module Protovalidate
|
|
3
|
+
VERSION: String
|
|
4
|
+
|
|
5
|
+
# Guards the lazy construction of the shared validator.
|
|
6
|
+
DEFAULT_VALIDATOR_LOCK: Mutex
|
|
7
|
+
|
|
8
|
+
# Version of the protovalidate specification this gem bundles.
|
|
9
|
+
PROTOVALIDATE_VERSION: String
|
|
10
|
+
|
|
11
|
+
# A Protobuf message instance produced by google-protobuf.
|
|
12
|
+
type message = Google::Protobuf::MessageExts
|
|
13
|
+
|
|
14
|
+
# The validator shared by the module-level functions.
|
|
15
|
+
def self.validator: () -> Validator
|
|
16
|
+
|
|
17
|
+
def self.validate: (message message, ?fail_fast: bool) -> void
|
|
18
|
+
|
|
19
|
+
def self.collect_violations: (message message, ?fail_fast: bool) -> Array[Violation]
|
|
20
|
+
|
|
21
|
+
class Error < StandardError
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class CompilationError < Error
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class EvaluationError < Error
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class ValidationError < Error
|
|
31
|
+
attr_reader violations: Array[Violation]
|
|
32
|
+
|
|
33
|
+
def initialize: (String message, Array[Violation] violations) -> void
|
|
34
|
+
|
|
35
|
+
def to_proto: () -> Buf::Validate::Violations
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class Validator
|
|
39
|
+
@descriptor_pool: Google::Protobuf::DescriptorPool
|
|
40
|
+
@engine: Native::Engine
|
|
41
|
+
@registered_files: Set[String]
|
|
42
|
+
@registered_types: Set[String]
|
|
43
|
+
@registration: Mutex
|
|
44
|
+
|
|
45
|
+
def initialize: (?descriptor_pool: Google::Protobuf::DescriptorPool) -> void
|
|
46
|
+
|
|
47
|
+
def validate: (message message, ?fail_fast: bool) -> void
|
|
48
|
+
|
|
49
|
+
def collect_violations: (message message, ?fail_fast: bool) -> Array[Violation]
|
|
50
|
+
|
|
51
|
+
private def descriptor_of: (message message) -> Google::Protobuf::Descriptor
|
|
52
|
+
|
|
53
|
+
private def register: (Google::Protobuf::Descriptor descriptor) -> void
|
|
54
|
+
|
|
55
|
+
private def register_file: (Google::Protobuf::FileDescriptor file) -> void
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class Violation
|
|
59
|
+
# Marker for a path element without a subscript.
|
|
60
|
+
NO_SUBSCRIPT: Object
|
|
61
|
+
|
|
62
|
+
@source: message?
|
|
63
|
+
|
|
64
|
+
attr_reader proto: Buf::Validate::Violation
|
|
65
|
+
|
|
66
|
+
def initialize: (Buf::Validate::Violation proto, ?message? source) -> void
|
|
67
|
+
|
|
68
|
+
def rule_id: () -> String
|
|
69
|
+
|
|
70
|
+
def message: () -> String
|
|
71
|
+
|
|
72
|
+
def for_key?: () -> bool
|
|
73
|
+
|
|
74
|
+
def field: () -> Buf::Validate::FieldPath?
|
|
75
|
+
|
|
76
|
+
def rule: () -> Buf::Validate::FieldPath?
|
|
77
|
+
|
|
78
|
+
def field_path: () -> String
|
|
79
|
+
|
|
80
|
+
def field_value: () -> untyped
|
|
81
|
+
|
|
82
|
+
def to_s: () -> String
|
|
83
|
+
|
|
84
|
+
def inspect: () -> String
|
|
85
|
+
|
|
86
|
+
private def subscript_of: (Buf::Validate::FieldPathElement element) -> untyped
|
|
87
|
+
|
|
88
|
+
private def render_element: (Buf::Validate::FieldPathElement element) -> String
|
|
89
|
+
end
|
|
90
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: protovalidate
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0.beta2
|
|
5
|
+
platform: arm-linux-gnu
|
|
6
|
+
authors:
|
|
7
|
+
- Sorah Fukumori
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: google-protobuf
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '4.31'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '4.31'
|
|
26
|
+
description: Ruby implementation of protovalidate. Validates Protobuf messages against
|
|
27
|
+
the buf.validate rules in their schema, evaluated with CEL by protovalidate-cc through
|
|
28
|
+
a native extension. Precompiled gems are published for Linux, macOS and Windows.
|
|
29
|
+
email:
|
|
30
|
+
- sorah@ivry.jp
|
|
31
|
+
executables: []
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- ".gitattributes"
|
|
36
|
+
- ".yardopts"
|
|
37
|
+
- CHANGELOG.md
|
|
38
|
+
- LICENSE.txt
|
|
39
|
+
- NOTICE.md
|
|
40
|
+
- README.md
|
|
41
|
+
- Rakefile
|
|
42
|
+
- lib/buf/validate/validate_pb.rb
|
|
43
|
+
- lib/protovalidate.rb
|
|
44
|
+
- lib/protovalidate/3.3/protovalidate_native.so
|
|
45
|
+
- lib/protovalidate/3.4/protovalidate_native.so
|
|
46
|
+
- lib/protovalidate/4.0/protovalidate_native.so
|
|
47
|
+
- lib/protovalidate/errors.rb
|
|
48
|
+
- lib/protovalidate/native.rb
|
|
49
|
+
- lib/protovalidate/validator.rb
|
|
50
|
+
- lib/protovalidate/version.rb
|
|
51
|
+
- lib/protovalidate/violation.rb
|
|
52
|
+
- licenses/abseil-cpp-LICENSE
|
|
53
|
+
- licenses/antlr4-LICENSE.txt
|
|
54
|
+
- licenses/cel-cpp-LICENSE
|
|
55
|
+
- licenses/protobuf-LICENSE
|
|
56
|
+
- licenses/protovalidate-cc-LICENSE
|
|
57
|
+
- licenses/re2-LICENSE
|
|
58
|
+
- sig/buf/validate/validate_pb.rbs
|
|
59
|
+
- sig/protovalidate.rbs
|
|
60
|
+
- sig/protovalidate/native.rbs
|
|
61
|
+
homepage: https://github.com/sorah/protovalidate-rb
|
|
62
|
+
licenses:
|
|
63
|
+
- Apache-2.0
|
|
64
|
+
metadata:
|
|
65
|
+
allowed_push_host: https://rubygems.org
|
|
66
|
+
homepage_uri: https://github.com/sorah/protovalidate-rb
|
|
67
|
+
source_code_uri: https://github.com/sorah/protovalidate-rb
|
|
68
|
+
changelog_uri: https://github.com/sorah/protovalidate-rb/blob/main/CHANGELOG.md
|
|
69
|
+
rdoc_options: []
|
|
70
|
+
require_paths:
|
|
71
|
+
- lib
|
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '3.3'
|
|
77
|
+
- - "<"
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: 4.1.dev
|
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
|
+
requirements:
|
|
82
|
+
- - ">="
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: '0'
|
|
85
|
+
requirements: []
|
|
86
|
+
rubygems_version: 4.0.20
|
|
87
|
+
specification_version: 4
|
|
88
|
+
summary: Protobuf message validation with protovalidate (buf.validate) rules
|
|
89
|
+
test_files: []
|