-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Custom ID support (string, UUID, etc) and misc bug fixes #81
Merged
Conversation
This file contains 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
fix: ensure that AllowClientIDs actually has an impact on CREATE input parameters Signed-off-by: Liam Stanley <liam@liam.sh>
ensures that when using UUID packages (for example), the wrong one isn't imported Signed-off-by: Liam Stanley <liam@liam.sh>
… & AllowClientIDs Signed-off-by: Liam Stanley <liam@liam.sh>
Signed-off-by: Liam Stanley <liam@liam.sh>
- also includes a few fixes where it was using the wrong ent graph field for determining the ID field type. - switched some schemas in kitchensink, and testdata to use uuid and string-based ID fields. - supports almost every potential ID usecase that Ent supports (effectively anything that supports string, int, texts unmarshaller, json unmarshaller, or binary unmarshaller). Signed-off-by: Liam Stanley <liam@liam.sh>
Signed-off-by: Liam Stanley <liam@liam.sh>
Signed-off-by: Liam Stanley <liam@liam.sh>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #81 +/- ##
==========================================
+ Coverage 68.38% 68.85% +0.46%
==========================================
Files 10 10
Lines 2442 2456 +14
==========================================
+ Hits 1670 1691 +21
+ Misses 657 651 -6
+ Partials 115 114 -1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Liam Stanley <liam@liam.sh>
Signed-off-by: Liam Stanley <liam@liam.sh>
Signed-off-by: Liam Stanley <liam@liam.sh>
This was referenced Dec 31, 2024
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.
🚀 Changes proposed by this PR
Config.AllowClientUUIDs
toConfig.AllowClientIDs
to indicate that it's not specific to UUIDs, but rather any scenario where you want to allow the client to provide their own ID for theCREATE
request.Config.AllowClientIDs
actually has an impact. Previously, it only added it to the spec, but didn't add it to the server request handling logic. It's now correctly added to the spec, and the server knows how to handle when a custom ID is provided.WithAllowClientIDs
can now be used to toggle this feature on/off on a per-schema basis.string
,int
, and any other custom type that implements the following interfaces:encoding.TextUnmarshaler
,json.Unmarshaler
, andencoding.BinaryUnmarshaler
(in that order of priority).uuid.UUID{}
could import Google's library, or some other random one that you happen to have locally).id
field in the spec, when IDs can be generated on behalf of theCREATE
request, when usingAllowClientIDs
.format
field. For example,id.in
on/users
now is an array ofuuid
format type.?pretty=true
.🔗 Related bug reports/feature requests
🧰 Type of change