Last active
August 28, 2025 09:45
-
-
Save ybiquitous/65f7e5491f8b40c384561c4f96dd58cb to your computer and use it in GitHub Desktop.
redocly-cli v2.0.7 bug reproduction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| openapi: '3.1.0' | |
| info: | |
| title: Example API | |
| version: '1.0.0' | |
| license: | |
| name: MIT | |
| servers: | |
| - url: https://api.example.com/v1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| openapi: '3.1.0' | |
| paths: | |
| /items: | |
| get: | |
| summary: Retrieve a list of items | |
| responses: | |
| '200': | |
| description: A list of items | |
| content: | |
| application/json: | |
| schema: | |
| type: array | |
| items: | |
| type: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "type": "module", | |
| "dependencies": { | |
| "@redocly/cli": "2.0.7" | |
| }, | |
| "scripts": { | |
| "join": "redocly join --without-x-tag-groups a.yml b.yml -o tmp.yml", | |
| "bundle": "redocly bundle tmp.yml -o openapi.yml", | |
| "postbundle": "rm -f tmp.yml", | |
| "lint": "redocly lint openapi.yml --skip-rule security-defined", | |
| "test": "npm run join && npm run bundle && npm run lint" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function plugin() { | |
| return { | |
| id: "my-plugin", | |
| decorators: { | |
| oas3: { | |
| "add-servers": addServers, | |
| }, | |
| }, | |
| }; | |
| } | |
| const addServers = () => ({ | |
| Root: { | |
| leave: (root) => { | |
| root.servers = [ | |
| { | |
| url: "https://api.example.com/v1", | |
| }, | |
| ]; | |
| }, | |
| }, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| decorators: | |
| my-plugin/add-servers: on | |
| plugins: | |
| - plugin.js | |
| extends: | |
| - recommended |
Author
Author
Author
Adding a customer decorator and running redocly bundle can work around the problem. Note that servers in a.yml is ignored.
Run:
$ npm it
...
Woohoo! Your API description is valid. ๐
You have 5 warnings.Output openapi.yml:
openapi: 3.1.0
info:
title: Example API
version: 1.0.0
license:
name: MIT
servers:
- url: https://api.example.com/v1
tags:
- name: b_other
x-displayName: other
paths:
/items:
servers: []
get:
summary: Retrieve a list of items
responses:
'200':
description: A list of items
content:
application/json:
schema:
type: array
items:
type: string
tags:
- b_other
components: {}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run:
It errored due to the
no-empty-serversrule violation.On the other hand, it has no problem with v2.0.4:
There is a difference with a generated
openapi.ymlbetween the versions:version: 1.0.0 license: name: MIT +servers: + - url: https://api.example.com/v1 tags: - name: b_other x-displayName: other paths: /items: - servers: [] get: summary: Retrieve a list of items responses: