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

Add Overrides support for DataModel #7

Open
Kimi-Arthur opened this issue Jun 24, 2022 · 1 comment
Open

Add Overrides support for DataModel #7

Kimi-Arthur opened this issue Jun 24, 2022 · 1 comment

Comments

@Kimi-Arthur
Copy link
Owner

Generally, our data is from some data source. It's supposed to be able to refresh and get the same result back (controlled via Fill method).

However, we may need to override the data if we cannot directly modify the source. For example, we may not want the way a TV episode's name is rendered. In this case, we have two options, one is for general conversion that we add the logic to run every time for every item. The other one would be for individual items that we record how we want to modify the data and apply it whenever it's reFilled.

Say we have a data object like

{
  "id": "Merlin",
  "overview": "An epic story about a warlock.",
  "seasons": [
    {
      "id": "1",
      "title": "First Season"
    }
  ]
}

And we want to override the title to Season one. For that, we should be able to call an override API like, PUT /tv_shows/<id>, with a Dictionary<string, object>:

{
  "overview": "new overview",
  "seasons/0/title": "new title"
}

The stored data should look like,

{
  "$metadata": {
    "overview": "new overview",
    "seasons/0/title": "new title"
  },
  "id": "Merlin",
  "overview": "new overview",
  "seasons": [
    {
      "id": "1",
      "title": "new title"
    }
  ]
}

And no matter how the data changes, the specified fields will be overridden afterwards.

This can potentially be merged with PATCH, but no details are thought through.

@Kimi-Arthur
Copy link
Owner Author

Not planned yet. Seems low priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant