Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the format of reconciliation queries, responses and data extension responses #92

Merged
merged 4 commits into from
Nov 10, 2022

Conversation

wetneb
Copy link
Member

@wetneb wetneb commented Jul 27, 2022

Closes #33. Part of #84.

This removes the use of arbitrary keys in JSON objects.
As a result we are no longer using "patternProperties" in our own JSON schemas.
This is obviously a big breaking change, which I intend to bundle with other breaking changes related to #84 (such as #91).

I made some choices in the process, and they are debatable:

  • for reconciliation queries and responses, I propose to just have an array of queries and an array of responses, with order being preserved. One could keep the use of unique ids to identify queries and responses, but I feel like this is a bit heavy and not needed.
  • for data extension responses, I went for a slightly heavier format, where the identifiers of the entities and properties are explicitly included. One could have also have relied on the order in the original query, but it felt a bit harder to read and generate in this context. But that is really a matter of aesthetics.

…sion responses.

This removes the use of arbitrary keys in JSON objects.
As a result we are no longer using "patternProperties" in our own JSON schemas.
Closes #33.
@wetneb wetneb requested review from fsteeg and osma July 27, 2022 08:25
@osma
Copy link
Contributor

osma commented Aug 1, 2022

This looks like a good step in roughly the right direction. What I dislike is the use of top level arrays in JSON, instead of objects. The main argument against this is the lack of extensibility - you cannot easily add more fields later (see e.g. this blog post and this SO discussion).

For the queries, instead of [ query1, query2, query3... ], I suggest this:

{
  "queries": [ query1, query2, query3... ]
}

and similarly for the responses:

{
  "responses": [ response1, response2, response3... ]
}

This would allow adding new fields later (e.g. related to count of results or paging) if that becomes necessary.

@wetneb
Copy link
Member Author

wetneb commented Aug 1, 2022

That makes a lot of sense! I have just fixed that following your suggestion. Let me know if you can think of anything else.

Copy link
Member

@fsteeg fsteeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Just one minor suggestion: I find having results contain result, but that again being an array slightly confusing. Maybe we could rename result to candidates?

("A reconciliation result is a set of reconciliation candidates. It is serialized in JSON as an object containing in the field candidates an array of such reconciliation candidate objects")

@wetneb wetneb merged commit 6e65e1a into master Nov 10, 2022
fsteeg pushed a commit that referenced this pull request Jul 13, 2023
…sion responses (#92)

* Change the format of reconciliation queries, responses and data extension responses.

This removes the use of arbitrary keys in JSON objects.
As a result we are no longer using "patternProperties" in our own JSON schemas.
Closes #33.

* Reformat wront-properties.json

* Avoid JSON responses with a root array: wrap them in an object

* Rename 'result' field to 'candidates' in reconciliation response
@wetneb wetneb deleted the 33-avoid-arbitrary-json-keys branch April 6, 2024 14:57
@fsteeg fsteeg mentioned this pull request Sep 11, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid arbitrary keys in query and result batches
3 participants