Repository navigation
feat!: name object types and separators, and check definitions early - #4
Merged
Merged
Conversation
Signed-off-by: Erik Nilsen <enilsen16@live.com>
Signed-off-by: Erik Nilsen <enilsen16@live.com>
Signed-off-by: Erik Nilsen <enilsen16@live.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
enilsen16
added this pull request to stack #9
October 22, 2026 14:17
Signed-off-by: Erik Nilsen <enilsen16@live.com>
…options Signed-off-by: Erik Nilsen <enilsen16@live.com>
…ition Signed-off-by: Erik Nilsen <enilsen16@live.com>
Signed-off-by: Erik Nilsen <enilsen16@live.com>
…options Signed-off-by: Erik Nilsen <enilsen16@live.com> # Conflicts: # objectid_test.go
…d-checks Signed-off-by: Erik Nilsen <enilsen16@live.com> # Conflicts: # objectid.go # objectidproto/objectidproto.go # objectidproto/objectidproto_test.go
…n errors Signed-off-by: Erik Nilsen <enilsen16@live.com>
Signed-off-by: Erik Nilsen <enilsen16@live.com>
…-options Signed-off-by: Erik Nilsen <enilsen16@live.com> # Conflicts: # objectid.go # objectid_test.go
…-options Signed-off-by: Erik Nilsen <enilsen16@live.com> # Conflicts: # objectid.go # objectid_test.go
…d-checks Signed-off-by: Erik Nilsen <enilsen16@live.com> # Conflicts: # objectid.go
…checks Signed-off-by: Erik Nilsen <enilsen16@live.com> # Conflicts: # objectid.go # objectid_test.go # objectidproto/objectidproto.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3.
Summary
ObjectType,SeparatorandPrefixare named string types, so an object type, a separator and a prefix cannot be swapped by mistake. Untyped string constants such asObjectType: "user"still compile.ValidationError.ObjectTypeslists the object types a value was checked against: one for an ID, every member's for a union.Bare()and the parse inputs staystring, because they are the wire and storage boundary.ObjectType.validatechecks this with a byte loop, and every constructor fails withErrInvalidDefinitionwhen the rule is broken. The Elixir package does not check this yet.Check[T]()andCheckUnion[U]()report a bad definition in a test orinit, including a generator whose values the type's own validation rejects. They are the Go form of the Elixir compile-time checks.*WrongPrefixError{Want []Prefix}, for single types and unions. It unwraps toErrInvalidFormat, soerrors.Ischecks keep working.This is a breaking change before v1:
ValidationError.ObjectTypeis replaced byObjectTypes, and the accessors return the named types.Tests
check_test.gocoversCheck,CheckUnion, and the prefix error for a wrong prefix, a missing prefix and a union.CI runs only on PRs to
main. Locally,go test -race,go vetand golangci-lint pass.