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

Extend response_fields to support field exclusion #181

Closed
merkys opened this issue Aug 26, 2019 · 3 comments · Fixed by #210
Closed

Extend response_fields to support field exclusion #181

merkys opened this issue Aug 26, 2019 · 3 comments · Fixed by #210
Labels
status/has-concrete-suggestion This issue has one or more concrete suggestions spelled out that can be brought up for consensus. topic/response-format Issue discussing changes and improvements to the API response format type/proposal Proposal for addition/removal of features. May need broad discussion to reach consensus.

Comments

@merkys
Copy link
Member

merkys commented Aug 26, 2019

Currently response_fields query parameter allows the user to explicitly enumerate fields to be included in the response. I suggest a mechanism to explicitly exclude particular field(s) using the same response_fields query parameter.

Now response_fields=a,b,c means that the user requests response with only a, b and c fields. As field names cannot have - sign, response_fields=-a could be defined to stand for all fields excluding a, and response_fields=-a,b,c - all fields excluding a, b and c etc.

An alternative proposition is to introduce response_fields_exclude query parameter. However, such introduction would also require description of how response_fields and response_fields_exclude interact.

@merkys merkys added the type/proposal Proposal for addition/removal of features. May need broad discussion to reach consensus. label Aug 26, 2019
@rartino
Copy link
Contributor

rartino commented Aug 30, 2019

Can you give a scenario where this would be useful?

My thought process is that this feature would just cater to bad habits. Sure, we all like to write less (give me -c instead of a,b,d,e). But, if you are trying to save bandwidth (and what other reasons would you have to use response_fields?) and you start saying "everything except c" you are going to get, e.g., database-specific fields, or fields from newer version of the standard that you are anyway going to throw away.

Regarding response_fields_exclude, well, also in your proposal you need to describe how multiple (+) and - entries interact. Is it an error for the same property to appear more than once? Or does the last (or first) take precedence?

@merkys
Copy link
Member Author

merkys commented Aug 30, 2019

Can you give a scenario where this would be useful?

My thought process is that this feature would just cater to bad habits. Sure, we all like to write less (give me -c instead of a,b,d,e). But, if you are trying to save bandwidth (and what other reasons would you have to use response_fields?) and you start saying "everything except c" you are going to get, e.g., database-specific fields, or fields from newer version of the standard that you are anyway going to throw away.

The reason I came up with this proposal is usually huge amounts of data returned in cartesian_site_positions. In cases when I am sure I won't need the coordinates, it is convenient to ask for everything except that.

Regarding response_fields_exclude, well, also in your proposal you need to describe how multiple (+) and - entries interact. Is it an error for the same property to appear more than once? Or does the last (or first) take precedence?

The alternative proposition of response_fields_exclude should serve only as a motivation for my primary proposal. That is, it just showcases the problems arising when using yet another query parameter instead of response_fields.

@merkys merkys added status/has-concrete-suggestion This issue has one or more concrete suggestions spelled out that can be brought up for consensus. topic/response-format Issue discussing changes and improvements to the API response format labels Sep 30, 2019
@merkys
Copy link
Member Author

merkys commented Sep 30, 2019

This issue should be offset by solving #184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/has-concrete-suggestion This issue has one or more concrete suggestions spelled out that can be brought up for consensus. topic/response-format Issue discussing changes and improvements to the API response format type/proposal Proposal for addition/removal of features. May need broad discussion to reach consensus.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants