Redundant Information

Redundant InformationRedundant Information
eschuetze Staff asked 1 year ago
Why are properties already defined in the path variable repeatedly stated in the body of the response? Example: in /operations/{operationId}/recordedOperationPhases the operationId is part of the URL. Then why is it repeated in every element: “elements”: [ { “workplaceId”: “string”, “operationId”: “string”, “operationPhaseId”: “string”, “startDate”: “2019-07-06T09:43:58.798Z”, “endDate”: “2019-07-06T09:43:58.798Z” } Per page (with a page size of 100 elements) the same UUID is output here unnecessarily 100 times in the response.
1 Answers
victor Staff answered 10 months ago

The objection is justified in principle, but in resource design the question must always be asked whether a separate data structure must be defined for each resource or whether it does not make more sense to use existing data structures more than once. Otherwise, the number of defined data structures becomes unmanageably large at some point.

In this case, the decision was made to use the same data structure in the response of the following two resources:

/workplaces/{workplaceId}/recordedOperatingStates

and

/operations/{operationId}/recordedOperatingStates

As a consequence, however, workplaceId and operationId must be returned in the response of both resources.