protovalidate 0.1.0__tar.gz

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.
Files changed (85) hide show
  1. protovalidate-0.1.0/.env +1 -0
  2. protovalidate-0.1.0/.github/CODE_OF_CONDUCT.md +132 -0
  3. protovalidate-0.1.0/.github/CONTRIBUTING.md +176 -0
  4. protovalidate-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +48 -0
  5. protovalidate-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +26 -0
  6. protovalidate-0.1.0/.github/buf-logo.svg +1 -0
  7. protovalidate-0.1.0/.github/dependabot.yml +10 -0
  8. protovalidate-0.1.0/.github/workflows/ci.yaml +38 -0
  9. protovalidate-0.1.0/.github/workflows/conformance.yaml +32 -0
  10. protovalidate-0.1.0/.github/workflows/emergency-review-bypass.yaml +13 -0
  11. protovalidate-0.1.0/.github/workflows/notify-approval-bypass.yaml +14 -0
  12. protovalidate-0.1.0/.github/workflows/pr-hygiene.yaml +32 -0
  13. protovalidate-0.1.0/.github/workflows/release.yaml +62 -0
  14. protovalidate-0.1.0/.gitignore +162 -0
  15. protovalidate-0.1.0/LICENSE +201 -0
  16. protovalidate-0.1.0/Makefile +86 -0
  17. protovalidate-0.1.0/PKG-INFO +324 -0
  18. protovalidate-0.1.0/Pipfile +18 -0
  19. protovalidate-0.1.0/Pipfile.lock +413 -0
  20. protovalidate-0.1.0/README.md +106 -0
  21. protovalidate-0.1.0/buf.gen.yaml +6 -0
  22. protovalidate-0.1.0/gen/buf/validate/conformance/cases/bool_pb2.py +49 -0
  23. protovalidate-0.1.0/gen/buf/validate/conformance/cases/bool_pb2.pyi +38 -0
  24. protovalidate-0.1.0/gen/buf/validate/conformance/cases/bytes_pb2.py +105 -0
  25. protovalidate-0.1.0/gen/buf/validate/conformance/cases/bytes_pb2.pyi +122 -0
  26. protovalidate-0.1.0/gen/buf/validate/conformance/cases/custom_constraints/custom_constraints_pb2.py +81 -0
  27. protovalidate-0.1.0/gen/buf/validate/conformance/cases/custom_constraints/custom_constraints_pb2.pyi +101 -0
  28. protovalidate-0.1.0/gen/buf/validate/conformance/cases/enums_pb2.py +123 -0
  29. protovalidate-0.1.0/gen/buf/validate/conformance/cases/enums_pb2.pyi +168 -0
  30. protovalidate-0.1.0/gen/buf/validate/conformance/cases/filename_with_dash_pb2.py +39 -0
  31. protovalidate-0.1.0/gen/buf/validate/conformance/cases/filename_with_dash_pb2.pyi +19 -0
  32. protovalidate-0.1.0/gen/buf/validate/conformance/cases/kitchen_sink_pb2.py +81 -0
  33. protovalidate-0.1.0/gen/buf/validate/conformance/cases/kitchen_sink_pb2.pyi +86 -0
  34. protovalidate-0.1.0/gen/buf/validate/conformance/cases/maps_pb2.py +147 -0
  35. protovalidate-0.1.0/gen/buf/validate/conformance/cases/maps_pb2.pyi +200 -0
  36. protovalidate-0.1.0/gen/buf/validate/conformance/cases/messages_pb2.py +78 -0
  37. protovalidate-0.1.0/gen/buf/validate/conformance/cases/messages_pb2.pyi +84 -0
  38. protovalidate-0.1.0/gen/buf/validate/conformance/cases/numbers_pb2.py +691 -0
  39. protovalidate-0.1.0/gen/buf/validate/conformance/cases/numbers_pb2.pyi +1034 -0
  40. protovalidate-0.1.0/gen/buf/validate/conformance/cases/oneofs_pb2.py +63 -0
  41. protovalidate-0.1.0/gen/buf/validate/conformance/cases/oneofs_pb2.pyi +66 -0
  42. protovalidate-0.1.0/gen/buf/validate/conformance/cases/other_package/embed_pb2.py +49 -0
  43. protovalidate-0.1.0/gen/buf/validate/conformance/cases/other_package/embed_pb2.pyi +42 -0
  44. protovalidate-0.1.0/gen/buf/validate/conformance/cases/repeated_pb2.py +138 -0
  45. protovalidate-0.1.0/gen/buf/validate/conformance/cases/repeated_pb2.pyi +194 -0
  46. protovalidate-0.1.0/gen/buf/validate/conformance/cases/strings_pb2.py +177 -0
  47. protovalidate-0.1.0/gen/buf/validate/conformance/cases/strings_pb2.pyi +230 -0
  48. protovalidate-0.1.0/gen/buf/validate/conformance/cases/subdirectory/in_subdirectory_pb2.py +39 -0
  49. protovalidate-0.1.0/gen/buf/validate/conformance/cases/subdirectory/in_subdirectory_pb2.pyi +19 -0
  50. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_any_pb2.py +54 -0
  51. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_any_pb2.pyi +45 -0
  52. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_duration_pb2.py +96 -0
  53. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_duration_pb2.pyi +107 -0
  54. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_nested_pb2.py +51 -0
  55. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_nested_pb2.pyi +36 -0
  56. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_timestamp_pb2.py +102 -0
  57. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_timestamp_pb2.pyi +117 -0
  58. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_wrappers_pb2.py +94 -0
  59. protovalidate-0.1.0/gen/buf/validate/conformance/cases/wkt_wrappers_pb2.pyi +105 -0
  60. protovalidate-0.1.0/gen/buf/validate/conformance/cases/yet_another_package/embed2_pb2.py +45 -0
  61. protovalidate-0.1.0/gen/buf/validate/conformance/cases/yet_another_package/embed2_pb2.pyi +33 -0
  62. protovalidate-0.1.0/gen/buf/validate/conformance/harness/harness_pb2.py +55 -0
  63. protovalidate-0.1.0/gen/buf/validate/conformance/harness/harness_pb2.pyi +65 -0
  64. protovalidate-0.1.0/gen/buf/validate/conformance/harness/results_pb2.py +49 -0
  65. protovalidate-0.1.0/gen/buf/validate/conformance/harness/results_pb2.pyi +85 -0
  66. protovalidate-0.1.0/gen/buf/validate/expression_pb2.py +45 -0
  67. protovalidate-0.1.0/gen/buf/validate/expression_pb2.pyi +46 -0
  68. protovalidate-0.1.0/gen/buf/validate/priv/private_pb2.py +45 -0
  69. protovalidate-0.1.0/gen/buf/validate/priv/private_pb2.pyi +39 -0
  70. protovalidate-0.1.0/gen/buf/validate/validate_pb2.py +387 -0
  71. protovalidate-0.1.0/gen/buf/validate/validate_pb2.pyi +480 -0
  72. protovalidate-0.1.0/protovalidate/__init__.py +26 -0
  73. protovalidate-0.1.0/protovalidate/internal/__init__.py +13 -0
  74. protovalidate-0.1.0/protovalidate/internal/constraints.py +795 -0
  75. protovalidate-0.1.0/protovalidate/internal/extra_func.py +128 -0
  76. protovalidate-0.1.0/protovalidate/internal/string_format.py +173 -0
  77. protovalidate-0.1.0/protovalidate/validator.py +108 -0
  78. protovalidate-0.1.0/pyproject.toml +84 -0
  79. protovalidate-0.1.0/tests/__init__.py +13 -0
  80. protovalidate-0.1.0/tests/conformance/__init__.py +13 -0
  81. protovalidate-0.1.0/tests/conformance/nonconforming.yaml +8 -0
  82. protovalidate-0.1.0/tests/conformance/runner.py +98 -0
  83. protovalidate-0.1.0/tests/oneof.binpb +0 -0
  84. protovalidate-0.1.0/tests/runner_test.py +30 -0
  85. protovalidate-0.1.0/tests/validate_test.py +68 -0
@@ -0,0 +1 @@
1
+ PYTHONPATH=gen
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ conduct@buf.build. All complaints will be reviewed and investigated promptly
64
+ and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
126
+ at [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,176 @@
1
+ # Contributing Guidelines
2
+
3
+ Firstly, we want to say thank you for considering contributing
4
+ to `protovalidate-python`. We genuinely appreciate your help. This document aims to
5
+ provide some guidelines to make your contribution process straightforward and
6
+ meaningful.
7
+
8
+ ## Code of Conduct
9
+
10
+ We pledge to maintain a welcoming and inclusive community. Please read
11
+ our [Code of Conduct][code-of-conduct] before participating.
12
+
13
+ ## How Can I Contribute?
14
+
15
+ First, clone the repository:
16
+
17
+ ```
18
+ git clone git@github.com:bufbuild/protovalidate-python.git
19
+ cd protovalidate-python
20
+ ```
21
+
22
+ Then, make any changes you'd like. We use a Makefile to test and lint our code,
23
+ so you'll need a few non-Python tools:
24
+
25
+ * GNU Make (to use the Makefile): part of the `build-essential` package on
26
+ Debian-derived Linux distributions (including Ubuntu), and part of
27
+ `xcode-select --install` on Macs.
28
+ * Go (for the conformance test runner): often available in your system package
29
+ manager (`apt`, `dnf`, `brew`, etc.), but most reliable when [installed
30
+ directly from upstream](https://go.dev/doc/install).
31
+
32
+ With Go and GNU Make installed, you can verify that your changes pass tests and
33
+ lint checks by running `make`. If your Python 3 interpreter isn't available as
34
+ `python3`, try `PYTHON=python make`. For a list of other useful commands, run
35
+ `make help`.
36
+
37
+ ### Reporting Bugs
38
+
39
+ Bugs are tracked as GitHub issues. If you discover a problem
40
+ with `protovalidate-python`, we want to hear about it. Here's how you can report a bug:
41
+
42
+ 1. __Ensure the bug was not already reported__: Before creating a new issue,
43
+ please do a search
44
+ in [issues][issues] to see if
45
+ the problem has already been reported. If it has and the issue is still open,
46
+ add a comment to the existing issue instead of opening a new one.
47
+
48
+ 2. __Check if the issue is fixed__: Try to reproduce the issue using the
49
+ latest `main` branch to see if the problem has already been fixed. If fixed,
50
+ that's great!
51
+
52
+ 3. __Open new issue__: If the issue has not been reported and has not been
53
+ fixed, then we encourage you to [open a new issue][file-bug].
54
+
55
+ Remember to detail the steps to reproduce the issue. This information is
56
+ invaluable in helping us fix the issue.
57
+
58
+ Once you've filled in the template, hit "Submit new issue", and we will take
59
+ care of the rest. We appreciate your contribution to making `protovalidate-python`
60
+ better!
61
+
62
+ ### Suggesting Enhancements
63
+
64
+ We welcome ideas for enhancements and new features to improve `protovalidate-python`.
65
+ If you have an idea you'd like to share, if you want to expand language
66
+ support,
67
+ please read [the section below](#language-support-requirements) first.
68
+
69
+ 1. __Check if the enhancement is already suggested__: Before creating a new
70
+ issue, please do a search
71
+ in [issues][issues] to see if
72
+ the idea or enhancement has already been suggested. If it has and the issue
73
+ is still open, add a comment to the existing issue instead of opening a new
74
+ one.
75
+
76
+ 2. __Open a new issue__: If your enhancement hasn't been suggested before,
77
+ please [create a new issue][file-feature-request].
78
+
79
+ 3. __Discussion__: Once you've submitted the issue, maintainers or other
80
+ community members might jump in to discuss the enhancement. Be prepared to
81
+ provide more context or insights about your suggestion.
82
+
83
+ Remember, the goal of suggesting an enhancement is to improve `protovalidate-python`
84
+ for everyone. Every suggestion is valued, and we thank you in advance for your
85
+ contribution.
86
+
87
+ ### Pull Requests
88
+
89
+ For changes, improvements, or fixes, please create a pull request. Make sure
90
+ your PR is up-to-date with the main branch. Please write clear and concise
91
+ commit messages to help us understand and review your PR.
92
+
93
+ ## Language Support Requirements
94
+
95
+ We aim for `protovalidate-python` to support multiple languages, including but not
96
+ limited to Go, Java, Python, C++, and Typescript. Here are the requirements for
97
+ adding a new language:
98
+
99
+ 1. __Conformance__: Make sure that your language addition passes the conformance
100
+ test suite. This ensures that your addition meets the project's standards and
101
+ behaves as expected.
102
+
103
+ 2. __CEL Interpreter__: Implement a Common Expression Language (CEL) interpreter
104
+ in your chosen language. CEL is a non-Turing complete language that makes it
105
+ easy to write simple expressions, and it's crucial to `protovalidate-python`.
106
+
107
+ 3. __Custom Function Equivalence__: Ensure that custom functions have equivalent
108
+ behavior across all languages. This uniformity is essential to maintain the
109
+ integrity and consistency of the project. Check out
110
+ the [Custom Functions][custom-funcs] for more
111
+
112
+ If you are interested in adding a new language to `protovalidate-python`, please open
113
+ an issue to discuss the details and requirements. We will be more than happy to
114
+ guide you through the process.
115
+
116
+ ### Minimizing Performance Regression
117
+
118
+ Performance and efficient resource management are critical aspects
119
+ of `protovalidate-python`. CEL, being non-Turing complete, provides production safety
120
+ controls to limit execution time, helping to prevent excessive resource
121
+ consumption during evaluation. Here are some guidelines for effectively managing
122
+ resource constraints and minimizing performance regressions:
123
+
124
+ 1. __Understanding Resource Constraints__: CEL has resource constraint features
125
+ which provide feedback about expression complexity. These are designed to
126
+ prevent CEL evaluation from consuming excessive resources. One key element is
127
+ the concept of a _cost unit_, an independent measure used for tracking CPU
128
+ utilization regardless of system load or hardware. The cost is deterministic,
129
+ meaning for any CEL expression and input data, the evaluation cost will
130
+ remain the same.
131
+ 2. __Cost Units and Operations__: Many of CEL's operations have fixed costs.
132
+ Simple operations, such as comparisons (e.g. `<`), have a cost of 1, while
133
+ some, like list literal declarations, have a higher fixed cost of 40 cost
134
+ units. Functions implemented in native code approximate cost based on time
135
+ complexity. For instance, regular expression operations like `match`
136
+ and `find` use an approximated cost
137
+ of `length(regexString)*length(inputString)`, reflecting the worst-case time
138
+ complexity of the operation.
139
+ 3. __Testing the Overall Cost__: You can use the CEL library to test the overall
140
+ cost of an expression. This can help predict the resources required to
141
+ evaluate an expression and prevent operations that would consume excessive
142
+ resources.
143
+ 4. __Benchmark and Profile__: Benchmark your changes against the current `main`
144
+ branch to evaluate the performance impact. If a performance regression is
145
+ suspected, profile the code to pinpoint the bottleneck.
146
+ 5. __Optimize__: Always look for ways to optimize your changes without
147
+ compromising readability, maintainability, or correctness of your code.
148
+ 6. __Discuss__: If your changes might cause a performance regression or resource
149
+ constraint, but you believe they're still beneficial, discuss this in the
150
+ pull request. Explain why you think the performance regression or resource
151
+ constraint might be acceptable.
152
+
153
+ By keeping performance and resource management in mind throughout the
154
+ development process, we can ensure `protovalidate-python` remains efficient and
155
+ responsive, even as we add new features and fix bugs.
156
+
157
+ ## Questions?
158
+
159
+ If you have any questions, please don't hesitate to create an issue, and we'll
160
+ answer as soon as possible. If your question is regarding a specific issue or
161
+ pull request, please link it in your comment.
162
+
163
+ ## Thank You
164
+
165
+ Again, we appreciate your help and time, and we are excited to see your
166
+ contributions!
167
+
168
+ Remember, you can reach out to us at any time, and we're looking forward to
169
+ working together to make `protovalidate-python` the best it can be.
170
+
171
+ [code-of-conduct]: https://github.com/bufbuild/protovalidate/tree/main/.github/CODE_OF_CONDUCT.md
172
+ [issues]: https://github.com/bufbuild/protovalidate-python/issues
173
+ [file-bug]: https://github.com/bufbuild/protovalidate-python/issues/new?assignees=&labels=Bug&template=bug_report.md&title=%5BBUG%5D
174
+ [custom-funcs]: https://github.com/bufbuild/protovalidate/tree/main/docs/cel.md#custom-library-in-protovalidate
175
+ [file-feature-request]: https://github.com/bufbuild/protovalidate-python/issues/new?assignees=&labels=Feature&template=feature_request.md&title=%5BFeature+Request%5D
176
+ [cel-spec]: https://github.com/google/cel-spec
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: "[BUG]"
5
+ labels: Bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ## Description
11
+ <!--Provide a clear and concise description of the bug. Be specific and include any relevant information about the issue, such as what you were trying to accomplish, what the expected behavior was, and how the actual behavior differed.-->
12
+
13
+ ## Steps to Reproduce
14
+ <!--
15
+ 1. First step to reproduce the bug
16
+ 2. Second step to reproduce the bug
17
+ 3. Third step to reproduce the bug
18
+ ... additional steps as needed
19
+ -->
20
+
21
+ ## Expected Behavior
22
+
23
+ <!--Describe what you expected to happen when following the steps to reproduce the bug.-->
24
+
25
+ ## Actual Behavior
26
+
27
+ <!--Describe what actually happened instead of the expected behavior.-->
28
+
29
+ ## Screenshots/Logs
30
+
31
+ <!--If applicable, add screenshots and/or log files to help explain the bug.-->
32
+
33
+ ## Environment
34
+
35
+ - **Operating System**: <!--[e.g., macOS, Windows, Linux]-->
36
+ - **Version**: <!--[e.g., macOS 10.15.7, Windows 10, Ubuntu 20.04]-->
37
+ - **Compiler/Toolchain**: <!--[e.g., GCC 9.3.0, Clang 10.0.0]-->
38
+ - **Protobuf Compiler & Version**: <!--[e.g. buf v1.17.0, protoc 3.17.3]-->
39
+ - **Protoc-gen-validate Version**: <!--[if applicable, e.g., v0.6.1]-->
40
+ - **Protovalidate Version**: <!--[if applicable, e.g., v1.0.2]-->
41
+
42
+ ## Possible Solution
43
+ <!--If you have any suggestions on how the bug could be fixed or have identified the source of the problem, please provide your insights here.-->
44
+
45
+ ## Additional Context
46
+ <!--Any other information, context, or relevant details that could be helpful for understanding and resolving the bug.-->
47
+
48
+ <!--Please make sure to provide as much information as possible to help the maintainers diagnose and fix the issue.-->
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: "[Feature Request]"
5
+ labels: Feature
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Feature description:**
11
+ <!-- A clear and concise description of the feature you would like to see implemented in protoc-gen-validate.-->
12
+
13
+ **Problem it solves or use case:**
14
+ <!-- Explain the problem this feature would solve or the use case it addresses, and how it would benefit users of protoc-gen-validate.-->
15
+
16
+ **Proposed implementation or solution:**
17
+ <!-- If you have a suggestion on how this feature can be implemented or any ideas on the solution, please describe them here.-->
18
+
19
+ **Contribution:**
20
+ <!--Describe how you would like to contribute this feature to the project. If you are willing to implement the feature yourself, please indicate that here. If you are not willing to implement it yourself, please indicate if you would be willing to help others implement it.-->
21
+
22
+ **Examples or references:**
23
+ <!-- If applicable, provide examples or references to similar features in other libraries or tools.-->
24
+
25
+ **Additional context:**
26
+ <!-- Add any other context or information about the feature request here.-->
@@ -0,0 +1 @@
1
+ <svg width="100" height="101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.144 78.583H0V.017h7.144v78.566ZM21.43 78.583h-7.143V.017h7.144v78.566ZM35.715 78.583H28.57V.017h7.144v78.566ZM50 78.583h-7.144V.017H50v78.566ZM64.286 78.583h-7.143V.017h7.143v78.566ZM78.576 78.583h-7.143V.017h7.143v78.566Z" fill="#77E1FF"/><path d="M28.576 100.018h-7.143V21.452h7.143v78.566ZM42.856 100.014h-7.143V21.448h7.143v78.566ZM57.142 100.018H50V21.452h7.144v78.566ZM71.433 100.014h-7.144V21.448h7.144v78.566ZM85.717 100.014h-7.144V21.448h7.144v78.566ZM99.999 100.018h-7.143V21.452h7.143v78.566Z" fill="#161EDE"/></svg>
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "pip"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,38 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ tags: ['v*']
6
+ pull_request:
7
+ branches: [main]
8
+ schedule:
9
+ - cron: '15 22 * * *'
10
+ workflow_dispatch: {} # support manual runs
11
+ permissions:
12
+ contents: read
13
+ jobs:
14
+ test:
15
+ name: Unit tests
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ python-version: ["3.11"]
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v3
23
+ with:
24
+ fetch-depth: 1
25
+ - name: Install Go
26
+ uses: actions/setup-go@v4
27
+ - name: Install Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v4
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ - name: Execute tests
32
+ run: make test
33
+ - name: Lint
34
+ run: make lint
35
+ - name: Format
36
+ run: make format
37
+ - name: Check generated
38
+ run: make checkgenerate
@@ -0,0 +1,32 @@
1
+ name: Conformance
2
+ on:
3
+ pull_request:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+ branches:
8
+ - 'main'
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ conformance:
15
+ name: Conformance Testing
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ python-version: ["3.11"]
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v3
23
+ with:
24
+ fetch-depth: 1
25
+ - name: Install Go
26
+ uses: actions/setup-go@v4
27
+ - name: Install Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v4
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ - name: Test conformance
32
+ run: make conformance
@@ -0,0 +1,13 @@
1
+ name: Emergency review bypass
2
+ on:
3
+ pull_request:
4
+ types:
5
+ - labeled
6
+ permissions:
7
+ pull-requests: write
8
+ jobs:
9
+ approve:
10
+ name: Approve
11
+ if: github.event.label.name == 'Emergency Bypass Review'
12
+ uses: bufbuild/base-workflows/.github/workflows/emergency-review-bypass.yaml@main
13
+ secrets: inherit
@@ -0,0 +1,14 @@
1
+ name: Approval bypass notifier
2
+ on:
3
+ pull_request:
4
+ types:
5
+ - closed
6
+ branches:
7
+ - main
8
+ permissions:
9
+ pull-requests: read
10
+ jobs:
11
+ notify:
12
+ name: Notify
13
+ uses: bufbuild/base-workflows/.github/workflows/notify-approval-bypass.yaml@main
14
+ secrets: inherit
@@ -0,0 +1,32 @@
1
+ name: PR Hygiene
2
+ # Prevent writing to the repository using the CI token.
3
+ # Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
4
+ permissions:
5
+ pull-requests: read
6
+ on:
7
+ workflow_call:
8
+ pull_request:
9
+ # By default, a workflow only runs when a pull_request's activity type is opened,
10
+ # synchronize, or reopened. We explicity override here so that PR titles are
11
+ # re-linted when the PR text content is edited.
12
+ types:
13
+ - opened
14
+ - edited
15
+ - reopened
16
+ - synchronize
17
+ jobs:
18
+ lint-title:
19
+ name: Lint title
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Lint title
23
+ uses: morrisoncole/pr-lint-action@v1.7.0
24
+ with:
25
+ repo-token: "${{ secrets.GITHUB_TOKEN }}"
26
+ # https://regex101.com/r/I6oK5v/1
27
+ title-regex: "^[A-Z].*[^.?!,\\-;:]$"
28
+ on-failed-regex-fail-action: true
29
+ on-failed-regex-create-review: false
30
+ on-failed-regex-request-changes: false
31
+ on-failed-regex-comment: "PR titles must start with a capital letter and not end with punctuation."
32
+ on-succeeded-regex-dismiss-review-comment: "Thanks for helping keep our PR titles consistent!"
@@ -0,0 +1,62 @@
1
+ name: Upload PyPi Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ env:
8
+ PYTHON_VERSION: '3.7.17'
9
+
10
+ jobs:
11
+ build:
12
+ name: Build package
13
+ runs-on: ubuntu-latest
14
+ environment:
15
+ name: release
16
+ strategy:
17
+ matrix:
18
+ python-version: [ "3.11" ]
19
+ steps:
20
+ - name: Checkout source
21
+ uses: actions/checkout@v2
22
+ with:
23
+ fetch-depth: 0
24
+ - name: Set VERSION variable from tag
25
+ run: |
26
+ VERSION=${{github.head_ref}}
27
+ echo "VERSION=${VERSION##*/}" >> $GITHUB_ENV
28
+ - name: Set up Python ${{ matrix.python-version }}
29
+ uses: actions/setup-python@v4
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+ - name: Install pypa/build
33
+ run: |
34
+ python -m pip install build
35
+ python -m build
36
+ - uses: actions/upload-artifact@v3
37
+ with:
38
+ name: package
39
+ path: dist/
40
+
41
+ publish:
42
+ name: Publish on TestPyPi
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: release
46
+ needs: build
47
+ steps:
48
+ - name: Checkout source
49
+ uses: actions/checkout@v2
50
+ with:
51
+ fetch-depth: 0
52
+
53
+ - name: Download built artifact
54
+ uses: actions/download-artifact@v2
55
+ with:
56
+ name: package
57
+ path: dist
58
+
59
+ - name: Publish on PyPi
60
+ uses: pypa/gh-action-pypi-publish@release/v1
61
+ with:
62
+ password: ${{ secrets.PYPI_API_TOKEN }}