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

fix: editorials and flexibility in response entries payloads #7

Merged
merged 7 commits into from
Dec 19, 2024

Conversation

peppelinux
Copy link
Member

This PRs aims to align some terms and also tries to introduce some flexibilities for implementers that would use the endpoint to provide any sort of matedata without necessarly include the entity statements (since this might causes huge weigth in the response)

Co-authored-by: Michael Fraser Raidiam <[email protected]>
| from_entity_id | OPTIONAL | Entity Identifier | If this parameter is present, the resulting list MUST be the subset of the overall ordered response starting from the index of the entity referenced with this paramter. The list's size MUST NOT exceed the server's chosen upper limit.<br><br>If the Entity Identifier that equals value of this parameter does not exist the HTTP status code 400 is returned and the content type `application/json` with the error code `entity_id_not_found`. TBD: Recommend client behavior on error. |
| limit | OPTIONAL | Positive Integer | Requested number of results included in the response.<br><br> If this parameter is present, the number of results in the returned list must not be greater than the minimum of the server's upper limit and the value of this parameter.<br><br>If this parameter is not present the server MUST fall back on the upper limit. |
| from_entity_id | OPTIONAL | Entity Identifier | If this parameter is present, the resulting list MUST be the subset of the overall ordered response starting from the index of the Entity referenced with this paramter. The list's size MUST NOT exceed the server's chosen upper limit.<br><br>If the Entity Identifier that equals value of this parameter does not exist the HTTP status code 400 is returned and the content type `application/json` with the error code `entity_id_not_found`. TBD: Recommend client behavior on error. |
| limit | OPTIONAL | Positive Integer | Requested number of results included in the response.<br><br> If this parameter is present, the number of results in the returned list SHOULD NOT be greater than the minimum of the server's upper limit and the value of this parameter.<br><br>If this parameter is not present the server MUST fall back on the upper limit. |
Copy link
Member

Choose a reason for hiding this comment

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

Why was this weakened from "must not" to "SHOULD NOT"? I would have expected "MUST NOT".

Copy link
Member Author

Choose a reason for hiding this comment

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

because there might situations where the server doesn't support the requested limit or differently it doesn't support this configuration, forcing in the response the limit it configures by default

Copy link
Member Author

Choose a reason for hiding this comment

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

other situation where the requestor doesn't know the server's limits

Copy link
Collaborator

Choose a reason for hiding this comment

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

@peppelinux I assume you are writing about an option where requested limit<server's upper limit e.g. there's a request with limit=1 and flood of API calls to fetch the entire set. It would be good to provide server with some control and/or let client discover what is supported. I recognize that we need to improve it, but I think that there are various ways to achieve it. Let me elaborate on it.

I see where you are going with that but I am afraid that this change may make it too open-ended i.e. with this wording if a client requests a limit=1 a server may return anything even beyond their upper limit or the requested limit.

If we reworded it to explicitly state that the upper limit (that is unknown to the client btw) is the absolute maximum then the server might return an arbitrary, yet not higher than upper limit, number of records to a client and would not be explicitly required to stay consistent between subsequent calls from a client intending to fetch the entire data set. Most the servers would be reasonable and consistent, but we would have to address it too.

Other potential problem is that the client in some drastic cases server might return more records than the client is able to process.

Having that said I think that we either:

  1. Improve it so it is more explicit that server can't return more than its upper limit in such cases and needs to be consistent across calls.
  2. Introduce the consistent lower limit that of records and exception that the server must return that many records when the requested limit is too low. We retain the original MUST NOT wording for the remaining cases.
  3. Introduce a requested limit not supported error response that would carry info on the supported range in the details. An upper and lower limit discovery option would be great too.

I would lean towards the 2 or 3. Any thoughts?

selfissued
selfissued previously approved these changes Dec 10, 2024
Copy link
Member

@selfissued selfissued left a comment

Choose a reason for hiding this comment

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

Approved, subject to resolving the questions raised.

selfissued
selfissued previously approved these changes Dec 11, 2024
Copy link
Collaborator

@MichaelFraser1999 MichaelFraser1999 left a comment

Choose a reason for hiding this comment

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

Happy with the responses to all comments

@MichaelFraser1999 MichaelFraser1999 dismissed stale reviews from selfissued and themself via 4346a96 December 19, 2024 08:51
@selfissued selfissued merged commit 250a80b into main Dec 19, 2024
1 check passed
@selfissued selfissued deleted the pplnx branch December 19, 2024 20:55
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.

4 participants