Skip to content

file shoud be an accepted primitive data type in swagger 2.0 spec #540

Closed

Description

@thejan2009

Describe the bug
See https://swagger.io/specification/v2/#specification, Section Data types.

An additional primitive data type "file" is used by the Parameter Object and the Response Object to set the parameter type or the response as being a file.

It seems this file data type exception is not accounted for Response object.

To Reproduce
Steps to reproduce the behavior:
openapi lint --format stylish spec.yml

Expected behavior
No spec error should be raised.

Logs

spec.yml:
  28:19  error    spec                    `type` can be one of the following only: "object", "array", "string", "number", "integer", "boolean", "null".
  3:1    warning  info-license            Info object should contain `license` field.
  20:5   warning  operation-operationId   Operation object should contain `operationId` field.
  24:7   warning  operation-4xx-response  Operation must have at least one `4xx` response.

OpenAPI definition

swagger: "2.0"

info:
  title: API
  version: 0.0.1
  description: |
    API

host: swagger.petstore
schemes:
  - https
basePath: /api/v1
consumes:
  - application/json
produces:
  - application/json; charset=utf-8

paths:
  /foo:
    get:
      summary: foo
      produces:
        - application/octet-stream
      responses:
        200:
          description: txt file
          schema:
            type: file

openapi-cli Version(s)
redocly/openapi-cli:v1.0.0-beta.80 container

Node.js Version(s)
See above.

Activity

  1. amakhrov commented on Aug 1, 2023

    @amakhrov

    this is basically a blocker for using it with our OAS 2.0 spec

  2. added and removed on Aug 2, 2023
  3. RomanHotsiy commented on Aug 2, 2023

    @RomanHotsiy
    Member

    I raised priority. Thanks.

  4. added
    governanceIssues relating to problems with or requests for API governance/linting/decorating
    on Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't workinggovernanceIssues relating to problems with or requests for API governance/linting/decoratingp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions