Conversation
If a dev doesn't use pk as 'id' it will be nullable (their risk to run, id is preferred pk)
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.
What's Changed
NestedItemsInput<RawItem>toNestedPartialso that the API's "Detailed"{ create, update, delete }object is supportedRelationPrimaryKey<Item>resolves the itemsidtype fordeleteentries with a fallback tostring | numberupdateentries switchid?: ...toid: ...whenidis a key ⭐ 1Tested Scenarios
createItem/createItems/updateItem/updateItems/updateItemsBatchfor theNestedPartialdescribe blocks.toEqualTypeOf()assertions to use.branded.toEqualTypeOf()since the intersection output was difficult to read. Vitest's Docs say to "This helper comes at a performance cost and can cause the TypeScript compiler to 'give up' if used with excessively deep types. Use it sparingly and only when necessary." When I checked the performance speed I found no discernible difference between branded and unbranded.{ id }objectsReview Notes / Questions / Concerns
idfor the primary key. I don't know how to protect them from themselves, so whatever they chose to be the pk is optional and up to them to pass it along.{ create, update, delete }object passes for JSON. So if a dev accidentally passes the CRUD object to a field that is not relational and is typed to receive JSON, they still get a code200as a response. The API does the same thing, just calling it out as a new place to make a mistake you can already make in the API.minorfelt right but I kept switching betweenpatchandminorin my head.Checklist
@directus/specs)@directus/sdk) updated to reflect the changes@directus/types) updated to reflect the changes@directus/system-data) updated for changes to system collections/fields/relationsFixes #25955