juspay / juspay/superposition

Context Create-Or-Update Contract Refactor

Open
#417 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
429
Forks
49
Avg merge
2d 3h
Merged PRs (30d)
10

Description

We have an API for creating or updating a context-override. In that API, since we support both creating & updating, we've left description as optional, for cases where the user just wants to add new overrides w/o changing the description. To support this, in case the description is left as optional, we're querying it from the database & then inserting it w/ the rest of the data.

Technically we can refactor the API to run an update instead of an insert if the description is not present, but I feel like the contract should be more explicit in what is the action which is supposed to be run. For instance if a user wants to explicitly update an existing override, w/ our current contract we'll end up creating a new entry if it's not already present, as we're doing an insert. So I think the right course of action is to split it into 2, one for a create API & another for updating.

Maybe the current contract can become a create API, & we can expose an update at `/context/` & the payload can contain overrides w/ an option to update the description as well.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.