Reputation: 424
I am trying to integrate Redocly with GitHub Actions. For testing purposes I have created an openapi.yaml
file like this. I also have created a couple of sample schemas to use in this file.
openapi: 3.1.0
info:
version: 1.0.0
title: Example.com
termsOfService: 'https://example.com/terms/'
contact:
email: [email protected]
url: 'http://example.com/contact'
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
x-logo:
url: 'https://redocly.github.io/openapi-template/logo.png'
description:
$ref: ./info-description.md
tags:
- name: Echo
description: Example echo operations.
- name: User
description: Operations about users.
- name: Tag
description: This is a tag description.
- name: Test
description: This is a Test description.
servers:
- url: 'https://{tenant}/api/v1'
variables:
tenant:
default: www
description: Your tenant id
- url: 'https://example.com/api/v1'
paths:
/users/{username}:
$ref: 'paths/users_{username}.yaml'
/echo:
$ref: paths/echo.yaml
/pathItem:
$ref: paths/path-item.yaml
/pathItemWithExamples:
$ref: paths/path-item-with-examples.yaml
components:
securitySchemes:
main_auth:
type: oauth2
flows:
implicit:
authorizationUrl: 'http://example.com/api/oauth/dialog'
scopes:
'read:users': read users info
'write:users': modify or remove users
api_key:
type: apiKey
in: header
name: api_key
basic_auth:
type: http
scheme: basic
I also have created this redocly.yaml
file:
# See https://redocly.com/docs/cli/configuration/ for more information.
apis:
sample@v1:
root: openapi/openapi.yaml
extends:
- recommended
rules:
no-unused-components: error
features.openapi:
htmlTemplate: ./docs/index.html
theme:
colors:
primary:
main: "#32329f"
generateCodeSamples:
languages: # Array of language config objects; indicates in which languages to generate code samples.
- lang: curl
- lang: Node.js
- lang: JavaScript
- lang: PHP
- lang: Python
Then I am trying to create a manual GitHub Action flow on my repository to publish this documentation whenever I run the job manually.B ut when I try to run the redoc-cli build openapi.yaml
command in my script, I am getting the following error. (I also tried running this command on my terminal to see if I can get more error details, but I still get the same error.)
Found redocly.yaml and using features.openapi options
Prerendering docs
TypeError: this.description.search is not a function
at new Ur (C:\Users\XXX\AppData\Roaming\npm\node_modules\redoc-cli\node_modules\redoc\bundles\redoc.lib.js:41:54995)
at new To (C:\Users\XXX\AppData\Roaming\npm\node_modules\redoc-cli\node_modules\redoc\bundles\redoc.lib.js:41:81323)
at new rc (C:\Users\XXX\AppData\Roaming\npm\node_modules\redoc-cli\node_modules\redoc\bundles\redoc.lib.js:1318:3218)
at Module.<anonymous> (C:\Users\XXX\AppData\Roaming\npm\node_modules\redoc-cli\node_modules\redoc\bundles\redoc.lib.js:1318:2996)
at Generator.next (<anonymous>)
at i (C:\Users\XXX\AppData\Roaming\npm\node_modules\redoc-cli\node_modules\redoc\bundles\redoc.lib.js:1318:2750)
Can anyone help me understand why this is happening and what I am missing?
Upvotes: 1
Views: 1035
Reputation: 1986
The redoc-cli
command is deprecated, so you could try building with the newer redocly tool. The redocly build-docs
command is the one you want and should do what I think you expect here.
Upvotes: 0