feat(api): partial schema insertion #1057
Open
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.
Problem Statement
As development teams regularly roll out new API endpoints, features each addition often necessitates corresponding updates to the schema. The current procedure, which requires comprehensive schema re-uploads for any modification, has proven to be inefficient and not conducive to rapid development cycles. There is an essential need for a more refined update mechanism that supports iterative and incremental schema modifications, allowing teams to make precise changes with minimal disruption.
Request Payload Structure
PATCH /v1/{tenant_id}/schemas/partial-write
Behavior Description
When the
schema_version
in the request metadata is left empty, the system will default to using the latest(head) schema version as the base for updates.name
(string): The name of the entity to be changed.write
(string array): Conditions to be added. If a relation or permission/action already exists, it should return an error.delete
(string array): Names (permissions/actions) to be deleted. If the relation/permission/action name does not exist, it should return an error. Note: specifying the name is enough as relation/permission/action names should be unique.update
(string array): Conditions to be updated.If
schema_version
is specified, the endpoint will perform the same update process on the given version and generate a new version thereafter.