Blog

Where I would keep a C# model

The Data Model Is an Intent File, Part 5 of 5

The invoice extractor can take a new customer's shape without adding a C# class. The accounts payable system on the other side may still need a stable command such as CreateInvoice, with a vendor ID, a currency, a total and an authorization decision. I would not hand that write operation whichever JSON shape the model happened to return.

I would split the workflow where its responsibilities change:

  1. Extract under the customer's intent. Read the result against that customer's approved fields, types and checks.
  2. Review and verify. Compare the output with the invoice and with authoritative vendor or purchase-order data where the business requires it. Route unresolved items to a person.
  3. Map approved data into the posting command. Keep a stable contract for the system that will perform the write. Let the application enforce the permissions and approvals for that action.

This is where the two approaches fit together. The changing extraction shape can stay in an intent file. The stable posting shape can stay in C#. If the business only displays or exports the extracted JSON, it may never need an intermediate C# model at all. If business code makes decisions on named fields, strong types may be the clearer choice.

Think about the next consumer before changing a field

Suppose the original Globex output has invoiceNumber. An agent proposes renaming it to invoiceId because that's what a new integration calls it. The edit may load and the schema may validate. But a review screen that reads invoiceNumber won't magically start reading invoiceId.

When a field is shared, preserve the old field while consumers migrate, or introduce a separately named version of the contract and switch consumers deliberately. The version number on an intent helps identify what changed. It does not, by itself, make the change compatible. Test a few real consumer expectations before activation. Keep the earlier definition available in case you need to revert.

The same principle applies to primitive types. It might be safe to change an urgency scale from one set of ranges to another when the result only appears on a screen. It might be unsafe if a shipping rule interprets 5 as permission to dispatch immediately. The type and rules are data, but they still affect the business.

Start with one operation

Pick an extraction or classification call whose output already goes to a review queue, a report, or a JSON consumer. Move its contract into an intent file. Write examples that cover the usual case, a missing fact, and a reply that breaks a rule. Run those cases with scripted replies. Then try adding one field for one customer and see which parts of the application actually need to change.

The advantage is concrete: the team can change what the model is asked to return without rebuilding a class whose only job was to describe the answer. A coding agent can read the contract, propose a revision, and point a reviewer to the exact field and rule it touched. The application keeps its say over what happens next.

Start with the IntentSharp quick start, then try the two invoice files in Part 2. IntentSharp is commercial software from C2Consultants LLC; see pricing and evaluation terms before using it in a business project.