Verify relation type in resolve{Relation}Metadata
#3440
Labels
feature
Relations
Model relations (has many, etc.)
Repository
Issues related to @loopback/repository package
Milestone
Improve helper functions
resolveHasManyMetadata
,resolveBelongsToMetadata
,resolveHasOneMetadata
to assert that the provided metadata has the right relation type.This is important because in some places we are casting generic
RelationMetadata
to a more specific variant, thus bypassing compiler checks.See #3387 for more details, here is an example implementation for
belongsTo
: https://github.com/strongloop/loopback-next/pull/3387/files#diff-ec9fc2ab14e201fb6c5ddb370ba094faR27-R31Acceptance criteria
For each of the existing relation type, modify
resolve{Relation}Metadata
to assert thatmetadata.type
is the expected relation type. Include a test to verify.The text was updated successfully, but these errors were encountered: