mockserver
mockserver copied to clipboard
`openAPIDefinition` is not recognized as valid attribute of an Expectation
Describe the issue
The file validator reports openAPIDefinition as invalid attribute in my initialization config.
What you are trying to do I was trying to load expectations from my OAS definition using initialization file. If #1307 is implemented I would use that approach instead.
MockServer version 5.13.2
To Reproduce Steps to reproduce the issue:
- How you are running MockServer (i.e maven plugin, docker, etc)
docker run -it --rm -v ${pwd}:/tmp -e MOCKSERVER_INITIALIZATION_JSON_PATH=/tmp/mock-server/config.json -p 8000:1080 mockserver/mockserver
- Code you used to create expectations init file
{
"httpError": {},
"openAPIDefinition": {
"specUrlOrPayload": "file:/tmp/petstore-bundled.yaml"
}
}
I have used httpError only because oneOf requirement
- What error you saw
java.lang.IllegalArgumentException: incorrect expectation json format for:
{
"httpError" : { },
"openAPIDefinition" : {
"specUrlOrPayload" : "file:/tmp/petstore-bundled.yaml"
}
}
schema validation errors:
1 error:
- $.openAPIDefinition: is not defined in the schema and the schema does not allow additional properties
OpenAPI Specification: https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x
Expected behaviour
OAS file is onboarded from init file
This attribute is available according to OAS documentation for Expectation at https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.13.x .
This issue should be somehow resolved as to me information in OAS and documentation is inconsistent.