Skip to content

Redocly lint fails with an error 'Expected type object,null but got object.' #2104

@ZyzychO

Description

@ZyzychO

Describe the bug

With the following schema in openapi: 3.1.1

    pet:
      title: petapi
      type: object
      description: this is pet api
      properties:
        constructor:
          title: petapi
          type:
            - object
            - 'null'

Redocly CLI lint command fails with an error message: 'Expected type object,null but got object.' If you change the 'type' into 'types', lint is passing.

To Reproduce
Steps to reproduce the behavior:

  1. Use the following openapi.yaml file:
openapi: 3.1.1
info:
  title: Pet API
  version: 1.0.0
  description: A simple API for pet-related contracts.

paths:
  /pets:
    get:
      summary: Get pet contract information
      operationId: getPet
      responses:
        '200':
          description: Successful response with pet contract
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pet'

components:
  schemas:
    pet:
      title: petapi
      type: object
      description: this is pet api
      properties:
        constructor:
          title: petapi
          type:
            - object
            - 'null'
  1. Execute Redocly lint command
  2. See error

Expected behavior

Lint should pass

Logs

OpenAPI description

Configuration in redocly.yaml file:

extends:
  - minimal

Redocly Version(s)

1.33.0

Front logo Front conversations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions