Skip to content

Incorrect data-type errors for valid response examples #429

@mmcmasterd3

Description

@mmcmasterd3

Errors are thrown if a response example is given for a string property defined in a schema that also happens to parse as a number.

The following produces the error Data and type mismatch found. [#/paths/~1test/get/responses/200/content/application~1json/example/BrokenProperty]

openapi: 3.0.1
info:
  title: BrokenFunction
  description: This will not parse 
  version: '1.0'
paths:
  '/test':
    get:
      summary: GetTest
      operationId: getTest
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Example'
              example:
                BrokenProperty: '1234'

components:
  schemas:
    Example:
      type: object
      properties:
        BrokenProperty:
          type: string
          description: Customer Identifier

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions