Where's the CRUD? Two Contracts Behind the Word "Delete"
A product owner asked where the CRUD was. The API had add and edit only, and the delete was hiding in a status flag all along.
TL;DR
A product owner's "where's the CRUD?" question made the author assume delete was missing, but the code revealed the module uses logical deletion via a Nonaktif status, keeping data recoverable. Adding physical delete would've introduced an unwanted contract and data-loss risk. The real fix was documentation: explicitly stating capabilities, the delete contract, and why permanent purging isn't provided.
One comment on the documentation page
The documentation review for the entity-attribute module stopped at one sentence from the product owner: "where's the CRUD?" I opened that page again and counted the capabilities written there myself. The result was two: add and edit. No delete route, no delete button, not even a note explaining why both were missing.
The question felt fair. Every CRUD demo I had seen showed four operations in sequence: create, read, update, delete. If only two appear on screen, the first impression is that the feature is unfinished.
My guess: the feature was incomplete
My first response was to prepare a forced-delete demo. The plan was simple: add a delete route in handler.go, show a delete button on the admin page, then rewrite the documentation. My assumption at the time was that the API had been deliberately trimmed so it could ship fast, with documentation left to catch up later.
I checked the code, and that assumption collapsed. The delete route had never existed in the first place; it did not vanish halfway through. handler.go only registers create and update. The UI page even carried the line "Delete - (not available in CMS)".
What was wrong was not the code. What was wrong was how I read the word "delete".
Two contracts for the word "delete"
In an API, the word "delete" can point to two different contracts. The first: physical delete, where the row is truly gone from the table. The second: logical delete, where the row is flagged through a flag or a status so it still exists in the database [6]. The second pattern is used precisely when the data must be recoverable, traceable, or referenced again by other data.
In CRUD terms, both contracts carry the letter "D", and both are valid [7]. The difference lies in what the operation promises to the data, not in whether an operation exists. A system that picks the second contract still runs a delete operation functionally; what changes is where the promise points, from "the data is gone" to "the data is deactivated".
The entity-attribute module I handle picks the second contract, through the Nonaktif status. There is no button named delete, but a deactivated entity stops appearing in lists, stops being usable, and stays recoverable. Behaviorally, that already satisfies the letter D in CRUD. Adding a physical delete route would mean adding a new contract nobody asked for, plus the risk of data lost with no way back.
There is one more layer that makes this choice sensible. Bulk deletion on my test data I run directly through SQL, taking advantage of ON DELETE CASCADE on the fields table. That means data cleanup is not an API job at all; it belongs to the data layer and the test layer. The API only has to handle the entity lifecycle the user sees.
Google's standard for lifecycle methods states a principle in the same direction: a delete that supports undelete must mark the resource as deleted instead of removing it entirely, and the API must document when that marked resource is finally purged [5]. That principle assumes a Delete method exists. Changing the status through Update is a documented lifecycle-state alternative too, with the caveat that it is an exception, not the default form.
Writing the capabilities as they are
The fix I made straightened out the promise, it did not add features. The documentation page now states its capabilities as they are: CRUD for add and edit, with the note "Delete not available". The Nonaktif status is explained as a functional delete, complete with its limits: the data does not disappear, it only stops being used, and it comes back once the status is restored.
The same boundary applies to the total-cleanup promise. If the API never promised to remove rows physically, do not let readers assume that promise exists [5]. I wrote an open sentence: the purge mechanism does not exist yet, and deactivated data still occupies the table. If a permanent-deletion obligation ever shows up for a certain category of data, such as personal data, that has to become a documented decision, not a reader's assumption.
At this point I stopped treating a button as proof of capability. What decides whether an API is honest is its capability document: which capabilities are actually invoked, which operations are deliberately not provided, and which contract is used for each letter in CRUD. Documentation that stays silent about an API's capabilities is just as false as documentation that claims capabilities that do not exist.
For readers writing similar API documentation, there is one criterion you can apply right away. Read your page again and ask: for each operation that is mentioned, is its contract explicit (physical delete or status flagging), and for each operation that is not mentioned, is the reason written down? If the answer is no, readers will guess on their own, and their guess is almost always looser than the reality of the code.
Sources
- [5] Google API Improvement Proposals, AIP-164: Soft delete — google.aip.dev
- [6] Database Refactoring, "Introduce Soft Delete" — databaserefactoring.com
- [7] MDN Web Docs, Glossary: CRUD — developer.mozilla.org