Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Mandatory element missing is not throwing error #153

Closed
bachi317 opened this issue Nov 2, 2020 · 3 comments
Closed

Mandatory element missing is not throwing error #153

bachi317 opened this issue Nov 2, 2020 · 3 comments
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@bachi317
Copy link

bachi317 commented Nov 2, 2020

Version
1.0.4

Describe the bug
We have an api which has two elements in the POST. one is "createMetadata" that has few fields under it and the other "createInstruction" which is a oneOf type element with 4 objects under it. If I won't supply "createInstruction" in the payload the framework is not throwing a validation error that the element is missing.

Expected behavior
A validation error with "createInstruction" element missing should be sent back.

Additional context
N/A

To Reproduce
Steps to reproduce the behavior:

  1. Attached the swagger that we are using for the createAPI. Import that onto your local eclipse or equivalent environment.
  2. Pass the below payload to the framework along with the above swagger.
    {
    "createMetadata": {
    "initiatorReferenceId": "123",
    "type": "directCreate",
    "authNumber": "123456",
    "createDate": "2020-11-01",
    "individual": false,
    "createCount": 3,
    "numberOfSignatories": 1,
    "hashTotal": "345678"
    }
    }
  3. You should notice validation successful instead of a validation failure message.

Let me know if you need any further details.

Reproducer
N/A
CreateAPI.yaml.zip

@bachi317 bachi317 added the bug Something isn't working label Nov 2, 2020
@llfbandit
Copy link
Contributor

I can't reproduce the issue. With the given input every thing is fine on my side.

@bachi317
Copy link
Author

bachi317 commented Nov 2, 2020

Greetings,

It is working fine as I was checking the validation results size to be greater than 0. Apologies.  But for types of payloads under createInstruction, validationResults is giving the below error "body.createInstruction: More than 1 schema is valid."

is that how it supposed to work? and do I need to ignore that message each time with oneOff scenario? Thanks.

@llfbandit
Copy link
Contributor

OneOf keyword stands for 'only one schema must be valid'. If you have multiple valid schemas, use AnyOf instead.
Closing the issue since this is not related to the tool.

@llfbandit llfbandit added the invalid This doesn't seem right label Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants