Add proper support of "x-nullable"

Issue #84 resolved
Viktar Patotski created an issue

I have the following swagger schema:

name: body
          in: body
          required: true
          schema:
            type: object
            required:
              - myfield
            properties:
              myfield:
                type: string
                format: uuid
                x-nullable: true

Which actually means that I expect "myfield" to be uuid or null, but it's required to pass this field. However, within this configuration when I send 'myfield: "null"' I recieve: {"error":{"id":"8b6e8fc9-013e-4e02-91c3-3bb8054b3214","message":"Object has missing required properties (["myfield"])"}}

I believe that this is wrong and should be fixed. Validator should accept this in this case.

Comments (3)

  1. James Navin

    I have tested and confirmed that this is working in v2.0.0-rc3 (the swagger-parser maps x-nullable into the new OpenAPI v3 nullable, which is supported on the v2.0 branch).

  2. Log in to comment