You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was attempting to use the property array decorator alongside the jsonschema definition to ensure at least one item existed in the array at request time via validation within @requestBody
However when using the @property.array decorator it seems to just drop all the jsonSchema fields and ignore them
Describe the bug
I was attempting to use the property array decorator alongside the jsonschema definition to ensure at least one item existed in the array at request time via validation within
@requestBody
However when using the
@property.array
decorator it seems to just drop all thejsonSchema
fields and ignore themI've made a repro here.
https://codesandbox.io/p/sandbox/infallible-scott-64xtwg?welcome=true
Run this request
This line here https://github.com/loopbackio/loopback-next/blob/master/packages/repository-json-schema/src/build-schema.ts#L269C46-L269C46 seems to be the culprit. If i change that to
result = Object.assign({}, meta.jsonSchema, { type: 'array', items: propDef })
it appears to work as expected (throw a 422 error)Logs
No response
Additional information
No response
Reproduction
https://codesandbox.io/p/sandbox/infallible-scott-64xtwg?welcome=true
The text was updated successfully, but these errors were encountered: