SANJIESAN WORLDJOURNAL / COLLECTIONS / SANJIESAN
SANJIESANTOOLS

SANJIESAN TOOLS / Import contracts

Make a required JSON field explicit

A schema can describe a field without requiring it to appear. Before trusting a resource import, choose one essential identifier and check the missing-field case deliberately. Keep the exercise on local or mock data so an incomplete record cannot quietly become a real published resource or an external action.

State what the importer cannot work without

For a fictional resource manifest, identify a field such as resourceId and explain why its absence prevents a reliable association. JSON Schema’s object reference distinguishes properties from required properties. Keep that documented distinction visible in the contract used by the importer. Do not infer required status from a field appearing in an example record or from a label printed in a spreadsheet template. The rule needs to be part of the actual agreed validation behaviour.

Prepare a present and absent pair

Make one harmless record with the identifier and another that omits it while leaving other fields unchanged. Write the expected acceptance and rejection before checking the validator. Inspect the error’s field path and whether the record is kept out of the accepted set. A successful JSON parse is not this check. Keep syntax validity, contract compliance and source verification separate, because none of them automatically proves the other two.

Deliver the rule with its example

Keep the tiny pair with the contract version and the person responsible for the field mapping. If the identifier is renamed, update the rule, sample and importer together. Give a clear review route to a record that lacks the required source identifier rather than inventing a replacement that looks official. The exercise supplies an acceptance question; no live import, supplier API or publication was executed for this article.

Sources & further reading

LET’S MAKE WHAT COMES NEXT

Have a product, a resource or an idea?

For suppliers, creators and brands. Tell us what you have in mind and where you work.

Start a conversation ↗