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

feat(api): partial schema insertion #1057

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

thegeekywanderer
Copy link
Contributor

@thegeekywanderer thegeekywanderer commented Feb 16, 2024

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

{
  "metadata": {
    "schema_version": ""
  },
  "entities": {
    "entity-name": {
        "write": [],
        "delete": [],
        "update": [],
    }
}

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.

Updated docker configs and added an air config for faster development. Air is a watches all the go files and rebuilds whenever there is any change in the code to reflect in the API immediately
@thegeekywanderer thegeekywanderer changed the title feature(api): partial schema insertion feat(api): partial schema insertion Feb 16, 2024
@thegeekywanderer thegeekywanderer self-assigned this Feb 16, 2024
@thegeekywanderer thegeekywanderer added the area/schema Issues related with modeling and schema. label Feb 16, 2024
@thegeekywanderer thegeekywanderer linked an issue Feb 19, 2024 that may be closed by this pull request
@lekhanhtoan37
Copy link

Any update?
I think usecase update schema is very important in real world.

@thegeekywanderer
Copy link
Contributor Author

Hi @lekhanhtoan37, We are working on this on priority. We realised that this approach was not the best and causing quite a few anti patterns hence its taking some time. Should be done by next week hopefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/schema Issues related with modeling and schema.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create an API which allows to update schema partially
2 participants