Skip to content

Fix input argument metadata for updateAttributes #2313

Description

@bajtos

Consider the following model:

{
  "name": "Person",
  "properties": {
    "name": { "type": "string", "required": true },
    "age": { "type": "number" }
  }
}

When loaded in LoopBack API Explorer, the endpoint PUT /people/{id} shows the following model for the request body:

Person {
  name (string),
  age (number, optional),
  id (number, optional)
}

Notice that the name property is marked as required, even though the method updateAttributes accepts a partial data (i.e. any subset of model properties).

We should fix the metadata for updateAttributes, updateOrCreate and corresponding relation methods to build a new type for the input argument, where all properties are optional.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions