[ENG-11256] Improve models structure#998
Conversation
| provider: response.embeds?.provider?.data.id, | ||
| provider: response.relationships?.provider?.data?.id, |
There was a problem hiding this comment.
If the OSF API still returns provider inside embeds (not relationships), this will silently return undefined at runtime without a type error. This is a behavioral change that needs explicit confirmation the API contract was updated, or a note about why this was safe to change.
There was a problem hiding this comment.
@omar-cos We only need the providerId to retrieve the subjects. That's why I used relationships and removed it from embed. This avoids unnecessary embedded data.
| interface MetadataEmbedsJsonApi { | ||
| identifiers: IdentifiersResponseJsonApi; | ||
| license: Embed<LicenseDataJsonApi>; | ||
| } |
There was a problem hiding this comment.
The old embed interface included affiliated_institutions: InstitutionsJsonApiResponse The new one only has identifiers and license. If any mapper or component reads embeds.affiliated_institutions, it will break silently. Worth searching for usages before merging.
There was a problem hiding this comment.
@omar-cos It wasn't being used in mapper or component, so I removed it.
| } | ||
|
|
||
| interface MetadataEmbedsJsonApi { | ||
| affiliated_institutions: InstitutionsJsonApiResponse; |
There was a problem hiding this comment.
affiliated_institutions has been removed from MetadataEmbedsJsonApi. The old interface included affiliated_institutions: InstitutionsJsonApiResponse. If any mapper or component reads embeds.affiliated_institutions anywhere, it will now break silently at runtime. Please confirm there are no remaining usages before merging.
There was a problem hiding this comment.
@omar-cos It wasn't being used in mapper or component, so I removed it.
Summary of Changes