Support for OpenAPI 3.0 nullable field

Issue #80 new
Mariusz Sondecki created an issue

Hi,

Right now based on documentation there is no support for nullable field to specify nullability.

When validation is invoked:
swagger-mock-validator /path/to/openapi.yaml /path/to/pact.json

for open api spec:

Name:  
  type: string  
  nullable: true

a mock value fails like below:

 { code: 'request.body.incompatible',
       message:
        'Request body is incompatible with the request body schema in the spec file: should be string',
       mockDetails:
        { interactionDescription: 'A POST to /some-endpoint',
          interactionState: '[none]',
          location: '[root].interactions[0].request.body.name',
          mockFile: '/path/to/pact.json',
          value: null },
       source: 'spec-mock-validation',
       specDetails:
        { location:
           '[root].paths./some-endpoint.post.requestBody.content.application/json.schema.properties.name.type',
          pathMethod: 'post',
          pathName: '/some-endpoint',
          specFile: '/path/to/openapi.yaml',
          value: undefined },
       type: 'error' } ] }

It would be great to have possibility to use null constraint for validation pact with open api 3.0.

Regards,
Mariusz

Comments (0)

  1. Log in to comment