Discriminator validation issue#10655
Conversation
…t-body-validator Signed-off-by: Philip Noebauer <philip.noebauer@gmail.com>
Signed-off-by: Philip Noebauer <philip.noebauer@gmail.com>
|
Hi, @pnoebauer. Can you please uncomment the actual change we need to fix the issue? |
Signed-off-by: Philip Noebauer <philip.noebauer@gmail.com>
Hi, sure! I have just pushed another commit with the comments removed and a possible bug fix. |
Signed-off-by: Philip Noebauer <philip.noebauer@gmail.com>
dhmlau
left a comment
There was a problem hiding this comment.
@pnoebauer, thanks for the PR. Sorry about the delay. I have a few minor comments. Once it's addressed, it would be good to go. Thanks!
packages/cli/test/fixtures/copyright/single-package/src/application.ts
Outdated
Show resolved
Hide resolved
packages/cli/test/fixtures/copyright/single-package/lib/no-header.js
Outdated
Show resolved
Hide resolved
packages/cli/test/fixtures/copyright/single-package/src/application.ts
Outdated
Show resolved
Hide resolved
|
@pnoebauer, after you've incorporated the feedback, could you please merge the commits? Thanks. |
Signed-off-by: Philip Noebauer <philip.noebauer@gmail.com>
@dhmlau I made requested changes |
|
@pnoebauer, thanks again for your contribution. Your PR has landed! 🎉 |
High-Level Description
This pull request illustrates a bug in the LoopBack framework causing discriminators to not work. The issue is due to LoopBack-Rest invoking the openapi-schema-to-json-schema library function incorrectly under loopback-next/packages/rest/src/validation/request-body.validator.ts, which results in the removal of OpenAPI properties such as discriminator.
Changes Made
Bug Illustration:
The bug is located in loopback-next/packages/rest/src/validation/request-body.validator.ts#L87.
Added comments and TODO notes in the pr to highlight the issue.
Demonstrated the bug in the /examples/validation-app by adding a controller, models, and tests.
Code Changes:
In loopback-next/packages/rest/src/validation/request-body.validator.ts:
Example Application:
Created an example application under /examples/validation-app to reproduce the issue.
Added a controller and models to showcase the problem.
Included tests that demonstrate the expected error messages if discriminators worked correctly.