Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add support for ULID as a well_known validation rule #90

Open
joldf opened this issue Sep 14, 2023 · 0 comments
Open
Labels
Feature New feature or request

Comments

@joldf
Copy link

joldf commented Sep 14, 2023

Feature description:

Support for ULID as a well_known validation rule.

Problem it solves or use case:

ULID aims to be a unique identifier that can be generated on independent machines, much like UUID. However, the first component is generated from the timestamp (and the second half is meant to be monotonic for a given timestamp on a given generator, although this is not often followed in practice). This has the effect that it is better suited to use cases where ordering helps with performance, particularly database indices.

https://github.com/ulid/spec

It is possible to use the existing regex validation facility, but doing this separately to ever ULID field is quite redundant and noisy. Additionally, marking a field as ULID carries some semantic information (e.g. for generated documentation). Basically: the standard arguments for adding something as a well-known type.

Proposed implementation or solution:

Add ULID to the well_known oneof, and its implementation could be the following regex or equivalent (this is Python syntax):

[0-7][0-9A-HJKMNP-TV-Z]{25}

Alternatively, for a case insensitive implementation (this is what the ULID spec recommends but is probably less useful in a data interchange format, especially to optimise use as a database index):

[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}

Contribution:

Unfortunately I can't contribute an implementation, but would be happy to help with testing.

Examples or references:

Similar request for old protoc-gen-validate (issue 278)

@joldf joldf added the Feature New feature or request label Sep 14, 2023
igor-tsiglyar pushed a commit to igor-tsiglyar/protovalidate that referenced this issue Apr 16, 2024
Bumps the go group with 1 update:
[github.com/envoyproxy/protoc-gen-validate](https://github.com/envoyproxy/protoc-gen-validate).

Updates `github.com/envoyproxy/protoc-gen-validate` from 1.0.2 to 1.0.3
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/envoyproxy/protoc-gen-validate/releases">github.com/envoyproxy/protoc-gen-validate's
releases</a>.</em></p>
<blockquote>
<h2>v1.0.3</h2>
<h2>What's Changed</h2>
<ul>
<li>Handle github-actions and pip dependencies by <a
href="https://github.com/mmorel-35"><code>@​mmorel-35</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/908">bufbuild/protoc-gen-validate#908</a></li>
<li>Update README.md to include new protovalidate releases by <a
href="https://github.com/elliotmjackson"><code>@​elliotmjackson</code></a>
in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/922">bufbuild/protoc-gen-validate#922</a></li>
<li>Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/906">bufbuild/protoc-gen-validate#906</a></li>
<li>Bump golang.org/x/tools from 0.10.0 to 0.12.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/939">bufbuild/protoc-gen-validate#939</a></li>
<li>Bump golang.org/x/net from 0.11.0 to 0.14.0 in /tests by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/932">bufbuild/protoc-gen-validate#932</a></li>
<li>Trim the readme down by <a
href="https://github.com/elliotmjackson"><code>@​elliotmjackson</code></a>
in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/938">bufbuild/protoc-gen-validate#938</a></li>
<li>Update tibdex/github-app-token by <a
href="https://github.com/rubensf"><code>@​rubensf</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/968">bufbuild/protoc-gen-validate#968</a></li>
<li>Bump actions/checkout from 3 to 4 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/959">bufbuild/protoc-gen-validate#959</a></li>
<li>Bump google.protobuf.version from 3.23.3 to 3.24.3 in /java by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/955">bufbuild/protoc-gen-validate#955</a></li>
<li>Update Go+GHA deps by <a
href="https://github.com/rodaine"><code>@​rodaine</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/984">bufbuild/protoc-gen-validate#984</a></li>
<li>Bump java deps by <a
href="https://github.com/rodaine"><code>@​rodaine</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/985">bufbuild/protoc-gen-validate#985</a></li>
<li>Setup golangci-lint by <a
href="https://github.com/mmorel-35"><code>@​mmorel-35</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/987">bufbuild/protoc-gen-validate#987</a></li>
<li>Move PGV documentation back into the root README by <a
href="https://github.com/nicksnyder"><code>@​nicksnyder</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1012">bufbuild/protoc-gen-validate#1012</a></li>
<li>Group dependabot version updates by <a
href="https://github.com/rodaine"><code>@​rodaine</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1024">bufbuild/protoc-gen-validate#1024</a></li>
<li>Fix dependabot by <a
href="https://github.com/rodaine"><code>@​rodaine</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1025">bufbuild/protoc-gen-validate#1025</a></li>
<li>Bump the go-tests group in /tests with 1 update by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1030">bufbuild/protoc-gen-validate#1030</a></li>
<li>Bump the java group in /java with 9 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1028">bufbuild/protoc-gen-validate#1028</a></li>
<li>Bump the github-actions group with 2 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1027">bufbuild/protoc-gen-validate#1027</a></li>
<li>Bump the go group with 1 update by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1026">bufbuild/protoc-gen-validate#1026</a></li>
<li>Bump the java group in /java with 1 update by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1032">bufbuild/protoc-gen-validate#1032</a></li>
<li>Enable gocritic linter by <a
href="https://github.com/mmorel-35"><code>@​mmorel-35</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1000">bufbuild/protoc-gen-validate#1000</a></li>
<li>Fix typos in proto comments by <a
href="https://github.com/WineChord"><code>@​WineChord</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/999">bufbuild/protoc-gen-validate#999</a></li>
<li>Enable unused linter by <a
href="https://github.com/mmorel-35"><code>@​mmorel-35</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/988">bufbuild/protoc-gen-validate#988</a></li>
<li>Bump the go group with 1 update by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1033">bufbuild/protoc-gen-validate#1033</a></li>
<li>Bump the go-tests group in /tests with 1 update by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1036">bufbuild/protoc-gen-validate#1036</a></li>
<li>Bump the java group in /java with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1035">bufbuild/protoc-gen-validate#1035</a></li>
<li>Bump the github-actions group with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1038">bufbuild/protoc-gen-validate#1038</a></li>
<li>Bump the java group in /java with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1040">bufbuild/protoc-gen-validate#1040</a></li>
<li>Bump the github-actions group with 1 update by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1041">bufbuild/protoc-gen-validate#1041</a></li>
<li>Bump the java group in /java with 3 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1047">bufbuild/protoc-gen-validate#1047</a></li>
<li>Bump the go group with 1 update by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1045">bufbuild/protoc-gen-validate#1045</a></li>
<li>Bump the go-tests group in /tests with 1 update by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1046">bufbuild/protoc-gen-validate#1046</a></li>
<li>Bump the java group in /java with 2 updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1049">bufbuild/protoc-gen-validate#1049</a></li>
<li>Statically build all releases by <a
href="https://github.com/rodaine"><code>@​rodaine</code></a> in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1052">bufbuild/protoc-gen-validate#1052</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/mmorel-35"><code>@​mmorel-35</code></a>
made their first contribution in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/908">bufbuild/protoc-gen-validate#908</a></li>
<li><a
href="https://github.com/nicksnyder"><code>@​nicksnyder</code></a> made
their first contribution in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/1012">bufbuild/protoc-gen-validate#1012</a></li>
<li><a href="https://github.com/WineChord"><code>@​WineChord</code></a>
made their first contribution in <a
href="https://redirect.github.com/bufbuild/protoc-gen-validate/pull/999">bufbuild/protoc-gen-validate#999</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/bufbuild/protoc-gen-validate/compare/v1.0.2...v1.0.3">https://github.com/bufbuild/protoc-gen-validate/compare/v1.0.2...v1.0.3</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/d61d4ec0b28cbf516d4d08c1550702f729a717d0"><code>d61d4ec</code></a>
Statically build all releases (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1052">#1052</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/d9e9842d204762847c0dcf1a4fe6912084401ab0"><code>d9e9842</code></a>
Bump the java group in /java with 2 updates (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1049">#1049</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/6dfcd591f688c70eef7220695e93345fcd56d996"><code>6dfcd59</code></a>
Bump the go-tests group in /tests with 1 update (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1046">#1046</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/4507e91344d888ffb8c25a58a1bcd3cfa1ddab1b"><code>4507e91</code></a>
Bump the go group with 1 update (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1045">#1045</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/d17db51f5dea639290af2ec43c3d30a33f3d26b4"><code>d17db51</code></a>
Bump the java group in /java with 3 updates (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1047">#1047</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/87c1d2acd1404293838d7e8b7c483b4b7828ba4f"><code>87c1d2a</code></a>
Bump the github-actions group with 1 update (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1041">#1041</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/64e2ed4f103f3cd97df154aa72e8d4084a95b0ab"><code>64e2ed4</code></a>
Bump the java group in /java with 3 updates (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1040">#1040</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/09e4ca508946437c093b11ea81aa72ec2af21a2c"><code>09e4ca5</code></a>
Bump the github-actions group with 3 updates (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1038">#1038</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/97f9e1f52d72da6523818314e8e13576d46b1ae8"><code>97f9e1f</code></a>
Bump the java group in /java with 3 updates (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1035">#1035</a>)</li>
<li><a
href="https://github.com/bufbuild/protoc-gen-validate/commit/ca6725ea1c7b5b996b933396516ef174fde224d6"><code>ca6725e</code></a>
Bump the go-tests group in /tests with 1 update (<a
href="https://redirect.github.com/envoyproxy/protoc-gen-validate/issues/1036">#1036</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/envoyproxy/protoc-gen-validate/compare/v1.0.2...v1.0.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/envoyproxy/protoc-gen-validate&package-manager=go_modules&previous-version=1.0.2&new-version=1.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Roche <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant