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

Clean up fields parameter choices in GET APIs #2962

Closed
sureshms opened this issue Feb 24, 2022 · 0 comments
Closed

Clean up fields parameter choices in GET APIs #2962

sureshms opened this issue Feb 24, 2022 · 0 comments
Assignees

Comments

@sureshms
Copy link
Contributor

sureshms commented Feb 24, 2022

Entities have two types of fields - attributes and relationships. The attributes are stored as part of the JSON document in the backend database for an entity. The relationship fields are not stored as part of the JSON document.

When an entity is retrieved in GET operation (either list entities or get a single entity):

  • Setting attributes in an entity does not require additional database lookup and incurs no extra cost other than making the response payload larger. Hence, the fields param used for controlling the payload size typically does not include attribute field names. The exception to this rule maybe some large attributes of the type array.
  • Setting relationships of an entity however requires a lookup into the entity_relationship table and hence has database lookup cost. Hence, the fields param typically includes relationship field names.

Following changes are proposed as part of this issue:

  1. For API documentation purposes, a list of field names that can be passed as queryParam field that is a subset of fields in an entity is defined in every entity.
  2. Any field name from an entity can be passed as a field name in queryParam. The default fields that are returned always in GET operations are ignored (and the entity will contain these fields). A field name that does not exist in an entity will result in an error indicating the field name is invalid.
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

No branches or pull requests

1 participant