pb33f / wiretap

The world's coolest API Validation and compliance tool. Validate APIs against OpenAPI specifications and much more
https://pb33f.io/wiretap/
Other
125 stars 18 forks source link

nullable (3.1.0) is not being acknowledged by Wiretap #136

Closed Samuel-Morgan-Tyghe closed 2 months ago

Samuel-Morgan-Tyghe commented 2 months ago
image
    ErrorResponse:
      type: object
      nullable: true
      properties:
        errorCode:
          type: integer
          format: int64
          example: 4001
        statusCode:
          "$ref": "#/components/schemas/HttpStatusCode"
        message:
          type: string
          example: "Bad Request"
      example:
        errorCode: 4001
        statusCode:
          error: true
          is4xxClientError: true
          is5xxServerError: false
          is1xxInformational: false
          is2xxSuccessful: false
          is3xxRedirection: false
        message: "Bad Request"

the following works though

    ErrorResponse:
      oneOf:
        - type: object
        - type: "null"
      properties:
        errorCode:
          type: integer
          format: int64
          example: 4001
        statusCode:
          "$ref": "#/components/schemas/HttpStatusCode"
        message:
          type: string
          example: "Bad Request"
      example:
        errorCode: 4001
        statusCode:
          error: true
          is4xxClientError: true
          is5xxServerError: false
          is1xxInformational: false
          is2xxSuccessful: false
          is3xxRedirection: false
        message: "Bad Request"
collin-rogers commented 2 months ago

I also saw this on my 3.1.0 schema and commented on #97

LasneF commented 2 months ago

@collin-rogers , @Samuel-Morgan-Tyghe your request is not legitimate , as nullable is not a supported keyword neither by OAS 3.1.0 cf https://spec.openapis.org/oas/latest.html

neither by Json schema ,

nullable was part of 3.0.0 and has been abandonned as a breaking change by OAS, so i would advise to upgrade your schema to comply with OAS 3.1.0

Samuel-Morgan-Tyghe commented 2 months ago

@LasneF Thank you for informing me, I thought it was the other way around and a new feature of OAS :)