pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

JSON match messages use terms that aren't applicable to all langauges #222

Open TimothyJones opened 1 year ago

TimothyJones commented 1 year ago

When a match on a JSON object fails, the rust core can generates error messages like:

Actual map is missing the following keys {...}

In some languages, this is confusing because there is no map type in JSON (and there may be a native Map type that isn't used at all for JSON, as is the case in JavaScript).

I don't think Pact should have an opinion on which language's terms for things are "correct" - and I certainly don't want to get into a discussion about preferences for terms. In this case, I think it would be best to use the terms from JSON specs instead - they're common, and it's hard to argue with what the format calls them. The JSON specs are RFC 8259 and ECMA-404) - these are summarised at json.org here.

Current error message:

Actual map is missing the following keys {...}

Proposed error message

Actual object is missing elements with the following keys {...}

(there may be other messages about other types that would benefit from a similar treatment)