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

Verify relation type in resolve{Relation}Metadata #3440

Closed
3 tasks
bajtos opened this issue Jul 26, 2019 · 0 comments · Fixed by #4046
Closed
3 tasks

Verify relation type in resolve{Relation}Metadata #3440

bajtos opened this issue Jul 26, 2019 · 0 comments · Fixed by #4046
Assignees
Labels
feature Relations Model relations (has many, etc.) Repository Issues related to @loopback/repository package

Comments

@bajtos
Copy link
Member

bajtos commented Jul 26, 2019

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-R31

Acceptance criteria

For each of the existing relation type, modify resolve{Relation}Metadata to assert that metadata.type is the expected relation type. Include a test to verify.

  • BelongsTo
  • HasMany
  • HasOne
@bajtos bajtos added p2 feature Relations Model relations (has many, etc.) Repository Issues related to @loopback/repository package labels Jul 26, 2019
@dhmlau dhmlau added 2019Q4 and removed 2019Q3 labels Aug 15, 2019
@bajtos bajtos added p2 and removed p2 labels Sep 12, 2019
@dhmlau dhmlau added this to the Nov 2019 milestone milestone Nov 1, 2019
@nabdelgadir nabdelgadir self-assigned this Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Relations Model relations (has many, etc.) Repository Issues related to @loopback/repository package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants