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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bba3bbf47e79d2183d7056bb43cb3be10280b5c30676a54976d2619169a3a695
4
+ data.tar.gz: b0a02415845fab6edd65f92e9fe49bb46bc42521f4a279d2284c80411dca0f73
5
+ SHA512:
6
+ metadata.gz: 4716e9a649711e1cc300a86ed1081e031020db4c1ee4e49d7f81622fa1627227f54657a5ef74d48709daff6663e13ab27ddc5364db7c3ecb2b0dbafe063ada4b
7
+ data.tar.gz: 4a54940168ff4602c9b0c9261820d802bdba8809208de244452989f42af31d97bf387cbf93bb81be5ebcb48a1a331b821e7d207b98a1576a1cc362472490b067
data/.gitattributes ADDED
@@ -0,0 +1,12 @@
1
+ ext/protovalidate/sys/third_party/** linguist-vendored
2
+
3
+ # script/extract-native-sources
4
+ ext/protovalidate/sys/gen/** linguist-generated
5
+ ext/protovalidate/sys/filelists/*.txt linguist-generated
6
+
7
+ # rake proto:generate
8
+ lib/buf/validate/validate_pb.rb linguist-generated
9
+ spec/gen/** linguist-generated
10
+
11
+ # Compiled descriptor set of spec/proto
12
+ spec/fixtures/spec_messages.fdset linguist-generated
data/.yardopts ADDED
@@ -0,0 +1,8 @@
1
+ --markup markdown
2
+ --no-private
3
+ --exclude ^lib/buf/
4
+ lib/**/*.rb
5
+ -
6
+ README.md
7
+ NOTICE.md
8
+ LICENSE.txt
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0.beta2 (2026-09-21)
4
+
5
+ - Precompiled gems for `x86_64-linux-musl`, `aarch64-linux-musl`, `arm-linux-gnu` and `x64-mingw-ucrt`.
6
+ - Precompiled Linux glibc gems now require glibc 2.34 or newer (was 2.28); older hosts fall back to the source gem.
7
+
8
+ ## 0.1.0.beta1 (2026-09-20)
9
+
10
+ - Initial release: `Protovalidate.validate` / `collect_violations` backed by protovalidate-cc 1.2.0 (protovalidate 1.2.2).
data/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Sorah Fukumori
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/NOTICE.md ADDED
@@ -0,0 +1,30 @@
1
+ # Notices
2
+
3
+ protovalidate (the `protovalidate` Ruby gem) is licensed under the Apache
4
+ License, Version 2.0 (see LICENSE.txt). It bundles, compiles, or derives from
5
+ the following third-party software.
6
+
7
+ ## Bundled and compiled into the native extension
8
+
9
+ | Project | License | Source |
10
+ |---|---|---|
11
+ | protovalidate-cc | Apache-2.0 | https://github.com/bufbuild/protovalidate-cc |
12
+ | protovalidate (buf.validate protos) | Apache-2.0 | https://github.com/bufbuild/protovalidate |
13
+ | CEL C++ (cel-cpp) and cel-spec | Apache-2.0 | https://github.com/cel-expr/cel-cpp |
14
+ | Abseil C++ | Apache-2.0 | https://github.com/abseil/abseil-cpp |
15
+ | Protocol Buffers (C++ runtime, utf8_range) | BSD-3-Clause | https://github.com/protocolbuffers/protobuf |
16
+ | RE2 | BSD-3-Clause | https://github.com/google/re2 |
17
+ | ANTLR 4 C++ runtime | BSD-3-Clause | https://github.com/antlr/antlr4 |
18
+ | googleapis (rpc/expr protos) | Apache-2.0 | https://github.com/googleapis/googleapis |
19
+
20
+ The license text of each project is shipped alongside its sources under
21
+ `ext/protovalidate/sys/third_party/*/LICENSE*` in the source gem, and in
22
+ `licenses/` of precompiled gems.
23
+
24
+ ## Derived from protovalidate-py
25
+
26
+ `ext/protovalidate/sys/shim/pv_shim.{h,cc}`, `ext/protovalidate/sys/src/lib.rs`,
27
+ `ext/protovalidate/sys/build.rs` and `script/extract-native-sources` are adapted
28
+ from protovalidate-py (https://github.com/bufbuild/protovalidate-py),
29
+ Copyright 2023-2026 Buf Technologies, Inc., licensed under the Apache License,
30
+ Version 2.0.
data/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # protovalidate
2
+
3
+ Ruby implementation of [protovalidate](https://github.com/bufbuild/protovalidate): validates Protobuf messages against the `buf.validate` rules declared in their schema, with rules written in [CEL](https://cel.dev).
4
+
5
+ Validation is performed by [protovalidate-cc](https://github.com/bufbuild/protovalidate-cc), compiled into a native extension together with cel-cpp and its dependencies. The gem passes the upstream conformance suite for protovalidate 1.2.2.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ bundle add protovalidate
11
+ ```
12
+
13
+ Precompiled gems are published for:
14
+
15
+ | Platform | Requirements |
16
+ |---|---|
17
+ | `x86_64-linux-gnu`, `aarch64-linux-gnu` | glibc 2.34 or newer |
18
+ | `arm-linux-gnu` (ARMv7, hard float) | glibc 2.31 or newer |
19
+ | `x86_64-linux-musl`, `aarch64-linux-musl` | musl libc, e.g. Alpine Linux |
20
+ | `arm64-darwin` | macOS 11 or newer |
21
+ | `x64-mingw-ucrt` | RubyInstaller (UCRT) Ruby |
22
+
23
+ Each covers Ruby 3.3, 3.4 and 4.0. On other platforms or Ruby versions the source gem is built at install time, which needs a Rust toolchain (1.85+), a C++17 compiler and a few minutes: it compiles protovalidate-cc, cel-cpp, abseil, protobuf, re2 and the ANTLR runtime.
24
+
25
+ Messages must come from [google-protobuf](https://rubygems.org/gems/google-protobuf) 4.31 or newer.
26
+
27
+ ## Usage
28
+
29
+ Annotate your schema with `buf.validate` rules ([reference](https://buf.build/docs/protovalidate/)), generate Ruby code as usual, then:
30
+
31
+ ```ruby
32
+ require "protovalidate"
33
+
34
+ user = Example::User.new(name: "", email: "not an email")
35
+
36
+ begin
37
+ Protovalidate.validate(user)
38
+ rescue Protovalidate::ValidationError => e
39
+ e.violations.each { |violation| puts violation }
40
+ # name: value length must be at least 1 characters [string.min_len]
41
+ # email: value must be a valid email address [string.email]
42
+ end
43
+
44
+ Protovalidate.collect_violations(user) # => [#<Protovalidate::Violation ...>, ...]
45
+ Protovalidate.validate(user, fail_fast: true)
46
+ ```
47
+
48
+ `Protovalidate.validate` and `Protovalidate.collect_violations` share one process-wide `Protovalidate::Validator`. Build your own when messages come from a `Google::Protobuf::DescriptorPool` other than the generated pool:
49
+
50
+ ```ruby
51
+ validator = Protovalidate::Validator.new(descriptor_pool: pool)
52
+ validator.collect_violations(message)
53
+ ```
54
+
55
+ ### Violations
56
+
57
+ Each `Protovalidate::Violation` exposes the `buf.validate.Violation` message as `#proto`, plus:
58
+
59
+ - `#rule_id`, `#message`, `#for_key?`
60
+ - `#field` and `#rule` (`Buf::Validate::FieldPath`), `#field_path` rendered as `items[2].name`
61
+ - `#field_value`, the offending value resolved from the validated message
62
+
63
+ `Protovalidate::ValidationError#to_proto` returns the `Buf::Validate::Violations` message, for example to return it in an API response. The generated `buf/validate/validate_pb.rb` is bundled at its canonical require path.
64
+
65
+ ### Errors
66
+
67
+ | Error | Meaning |
68
+ |---|---|
69
+ | `Protovalidate::ValidationError` | the message is invalid; `#violations` |
70
+ | `Protovalidate::CompilationError` | the rules of the message type do not compile (bad CEL) |
71
+ | `Protovalidate::EvaluationError` | a rule failed while being evaluated |
72
+ | `ArgumentError` | descriptor problems, such as an import missing from the pool |
73
+
74
+ All inherit from `Protovalidate::Error` except `ArgumentError`.
75
+
76
+ ### Threads
77
+
78
+ A `Validator` compiles the rules of each message type once and caches them, so reuse one instance. Validating from several threads at once is supported and releases the GVL while protovalidate-cc runs. Ractors are not supported.
79
+
80
+ ## Development
81
+
82
+ ```bash
83
+ bin/setup # submodules, bundle, rbs collection, hk hooks
84
+ bundle exec rake compile # builds the extension (RB_SYS_CARGO_PROFILE=dev for faster iteration)
85
+ bundle exec rake spec
86
+ bundle exec rake conformance # needs Go; installs the harness into tmp/bin
87
+ bundle exec rake steep yard:check rubocop
88
+ ```
89
+
90
+ The native code lives in `ext/protovalidate`: `src/lib.rs` binds `Protovalidate::Native::Engine` with [magnus](https://github.com/matsadler/magnus), and `sys/` compiles protovalidate-cc and its dependencies from git submodules using file lists derived from protovalidate-cc's Bazel build. To move to a new protovalidate-cc release, edit `ext/protovalidate/sys/versions.json`, run `script/extract-native-sources` (needs Bazel), update `PROTOVALIDATE_VERSION` in `lib/protovalidate/version.rb` if the specification version moved, and run `bundle exec rake proto:generate`.
91
+
92
+ Precompiled gems are assembled by `.github/workflows/native.yml`: glibc Linux builds run inside manylinux_2_34 containers, macOS builds on macos-15 and Windows builds on windows-2025. musl and 32-bit ARM builds are cross-compiled with `rake cross compile` inside [rb-sys-dock](https://github.com/oxidize-rb/rb-sys) images, with newer cross compilers swapped in. `rake 'gem:native[PLATFORM]'` packages one gem per platform.
93
+
94
+ ## License
95
+
96
+ Apache License 2.0, see LICENSE.txt. Third-party components compiled into the extension are listed in NOTICE.md.
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "rake/extensiontask"
6
+
7
+ require_relative "lib/protovalidate/version"
8
+
9
+ GEMSPEC = Bundler.load_gemspec("protovalidate.gemspec")
10
+
11
+ # No gemspec: precompiled gems are assembled by rakelib/native.rake, and the
12
+ # source pattern stays narrow so rake does not walk the vendored submodules.
13
+ Rake::ExtensionTask.new("protovalidate_native") do |ext|
14
+ ext.ext_dir = "ext/protovalidate"
15
+ ext.lib_dir = "lib/protovalidate"
16
+ ext.source_pattern = "{Cargo.toml,Cargo.lock,build.rs,src/**/*.rs,sys/Cargo.toml,sys/build.rs,sys/src/**/*.rs,sys/shim/*,sys/filelists/*.txt}"
17
+ # Platforms without a native CI runner are cross-compiled inside rb-sys-dock
18
+ # images (see .github/workflows/native.yml). Given several RUBY_CC_VERSIONs,
19
+ # `rake cross compile` stages each under tmp/<platform>/stage/lib/protovalidate/<X.Y>/.
20
+ ext.cross_compile = true
21
+ ext.cross_platform = %w[x86_64-linux-musl aarch64-linux-musl arm-linux-gnueabihf]
22
+ end
23
+
24
+ RSpec::Core::RakeTask.new(:spec)
25
+ task spec: :compile
26
+
27
+ desc "Typecheck lib/ against sig/ with steep"
28
+ task :steep do
29
+ sh "bundle exec steep check"
30
+ end
31
+
32
+ desc "Lint with RuboCop"
33
+ task :rubocop do
34
+ sh "bundle exec rubocop"
35
+ end
36
+
37
+ task default: :spec