Redocly / redocly-cli

⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.
https://redocly.com/docs/cli/
MIT License
952 stars 149 forks source link

External ref in Open api spec causes error ref.split is not a function or its return value is not iterable (only in version 1.25.5 and above) #1765

Closed yurisasuke closed 1 month ago

yurisasuke commented 1 month ago

Describe the bug Redocly cli version 1.25.5 seems to have introduced a bug that causes the validation to fail if you have an external ref in your Open api specs. With version below 1.25.5 this error is not there

This is the error i get:

validating swagger.yml...
Something went wrong when processing swagger.yml:

  - ref.split is not a function or its return value is not iterable

To Reproduce Steps to reproduce the behavior:

  1. Given this redocly.yaml file
    rules:
    no-unresolved-refs: error
    no-unused-components: warn
  2. And this OpenAPI file(s)
    
    openapi: 3.0.0
    info:
    title: Example API
    description: A simple API with a single GET endpoint.
    version: 1.0.0

paths: /example: get: summary: Get Example description: This endpoint returns an example response. responses: '200': description: Successful response content: application/json: schema: $ref: "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json"


3. Run this command with these arguments... `redocly ...`

Running the command :
` npx redocly lint swagger.yml --config=redocly.yml`
4. See error (Error produced)

Something went wrong when processing swagger.yml:

Expected behavior

Logs

OpenAPI description

Redocly Version(s) 1.25.5

Node.js Version(s) v22.8.0

OS, environment

MACOS sonoma version Version 14.6.1 Additional context

Front logo Front conversations

tatomyr commented 1 month ago

Looking into it. Thanks for letting us know.

tatomyr commented 1 month ago

~Just in case, the reason it fails is that the format of externalValue is incorrect in https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json~ Not really. But it seems to be related.

tatomyr commented 1 month ago

Should be fixed in v1.25.8. FYI @Keithwachira

yurisasuke commented 1 month ago

Should be fixed in v1.25.8. FYI @Keithwachira

Thank you