Reject create/update requests when data contains navigational properties #3439
Labels
feature
Relations
Model relations (has many, etc.)
Repository
Issues related to @loopback/repository package
Milestone
Suggestion
When the client attempts to create or update a model and related models in a single call, then we should reject such requests with a helpful error message explaining the problem.
Acceptance criteria
Step 1:
DefaultCrudRepository.fromEntity
.fromEntity
whenever we need to convert LB4 Entity into data to be passed to juggler's PersistedModel.toEntity
method and provides functionality similar to LB3 Operation Hookpersist
.Step 2:
fromEntity
to detect navigational properties in data and throw a helpful error.See #3387 and 5beb7b9 in particular.
IMPORTANT In the spike,
fromEntity
is accepting options allowing the caller to decide how to treat navigational properties (relations?: true | false | 'throw'
). Based on the discussion we had, this is not what we want to implement. Instead, we wantfromEntity
to ALWAYS REJECT navigational properties.The text was updated successfully, but these errors were encountered: