IBM/openapi-validator

Version 0.46.3 is not accepting schema type array

Closed this issue · 3 comments

Recently we have upgraded ibm-openapi-validator package from version 0.24.0 to 0.46.3 and the openapi.yaml that passed validation via lint-openapi command now throws error wherever request body schema is of type array.

This seems to be a breaking change .

Error message says : All request bodies must be structured as an object.

Is there a way to get past this issue?

Hello @ShilpaJalaja. With each feature release of the tool, we add new validations to better enforce our API requirements and guidelines. This means that an API that passes validation with one set of rules might not be compliant with an expanded set of rules. I understand that this could break your build, it is the nature of the tool to continually add validations. Our guidelines require that request bodies are structured as an object, hence the addition of this rule.

If this is not a rule you want to enforce, you can turn it off by configuring the tool. Use a .spectral.yaml file and set request-body-object to off. See this documentation for more information.

This is intentional behavior, so I'm going to close the issue, but feel free to respond here if you have questions about configuring the tool.

@dpopp07 Thank you for the quick response. I have set the rule on .spectral.yaml file as below:
image

Wanted to confirm whether all the other (except for request-body-object) default enabled rules would be intact as set by the validator .

Great! All other default rules will still be intact