Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrongly declared array not caught as error #2595

Open
benjamin-mogensen opened this issue Mar 8, 2024 · 0 comments
Open

Wrongly declared array not caught as error #2595

benjamin-mogensen opened this issue Mar 8, 2024 · 0 comments
Labels
p/medium t/bug Something isn't working

Comments

@benjamin-mogensen
Copy link

Describe the bug
The OAS file below has a wrongly declared array in the response. It states type: array and last line, and is missing an items key. Spectral does not catch this as an error. However, deploying such OAS in Apigee will not work as Apigeee uses Swagger parser which catches this error.

openapi: 3.0.3
info:
  title: Wrong array
  description: Wrong array
  version: 1.0.0
  contact:
    name: IDA Support Team
    email: ida_team@maersk.com
    url: https://www.maersk.com/contactus
  license:
    url: https://terms.maersk.com/api-license-terms
    name: Maersk 1.0
servers:
  - url: https://api-stage.net
paths:
  /translatetoen:
    post:
      operationId: post-translation-request
      description: Sent a text for translation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                inputText:
                  type: string
              required:
                - inputText
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  highestPrecendenceLanguage:
                    type: string
                  translatedText:
                    type: string
                  allIdentifiedLanguages:
                    type: array
                    items:
                      type: array

To Reproduce

  1. Use above OAS, create file oas-array-wrong.yaml
  2. Run CLI spectral lint oas-array-wrong.yaml
  3. Output is No results with a severity of 'error' found!

Expected behavior
The wrongly declared array should be treated as an error as you cannot have an array declared without stating what type the items are.

Screenshots
NA

Environment (remove any that are not applicable):

  • Library version: 6.11.0
  • OS: MacOS
  • Browser: NA
@mnaumanali94 mnaumanali94 added t/bug Something isn't working p/medium labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/medium t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants