Redocly CLI v2 introduces improved architecture and removes deprecated features to make the tool easier to maintain and extend. This guide covers the essential changes you need to make when upgrading from v1.x.
Node.js version: Update to Node.js 20.19.0+, 22.12.0+, or later.
The codebase has been rewritten from CommonJS to ES Modules. This affects plugins: update your plugin syntax to use ES Modules, or use the .cjs extension for CommonJS files.
The only default configuration file name is now redocly.yaml. If you still use the legacy .redocly.yaml, please rename it. You can still use a different file name, but you must explicitly specify it with the --config flag.
Several deprecated configuration options have been removed:
# ❌ Removed - use 'apis' instead
apiDefinitions:
- openapi.yaml
# ✅ Use this instead
apis:
main: openapi.yaml# ❌ Removed - use 'openapi' directly
features.openapi:
theme:
colors:
primary:
main: '#ff0000'
# ❌ Removed - use 'openapi' directly
theme:
openapi:
theme:
colors:
primary:
main: '#ff0000'
# ✅ Use this instead
openapi:
theme:
colors:
primary:
main: '#ff0000'# ❌ Removed - use 'rule/' prefix
rules:
assert/name: error
# ✅ Use this instead
rules:
rule/name: errorThe spec rule has been replaced with struct:
# ❌ Removed
rules:
spec: error
# ✅ Use this instead
rules:
struct: errorOr use the new spec ruleset for specification compliance:
extends:
- specRemoved rule path-excludes-patterns. Use a configurable rule instead. You may refer to this Cookbook recipe.
Removed rule info-license-url. Use info-license-strict which better complies with the new OpenAPI 3.1 specification.
The undefined assertion has been removed:
# ❌ Removed
rules:
rule/check-property:
subject:
type: Operation
property: summary
assertions:
undefined: false
# ✅ Use this instead
rules:
rule/check-property:
subject:
type: Operation
property: summary
assertions:
defined: true- Legacy Registry: Support for the legacy Redocly API Registry has been removed in favor of Reunite.
- Commands: The
preview-docscommand has been removed - usepreviewinstead. - Labels: The
labelsfield in theapissection has been removed.
A new spec ruleset is available that enforces OpenAPI specification compliance:
extends:
- specThe no-duplicated-tag-names rule checks for duplicate tag names in your API description.
Now Redocly CLI supports JSON schema formats:
openapi: 3.1.0
paths:
/users/{id}:
get:
responses:
200:
content:
application/json:
schema:
type: object
properties:
email:
type: string
format: email
examples:
Correct:
value:
email: correct@email.com
Incorrect:
value:
email: wrong-email # Will fail validation- Update Node.js to a supported version (20.19.0+, 22.12.0+, or 23+).
- Rename configuration file name to
redocly.yaml(if it differs). - Replace
specrule withstruct. - Update configurable rules to use
rule/prefix instead ofassert/. - Replace
undefinedassertions withdefined: true. - Update configuration structure:
- Replace
apiDefinitionswithapis - Move
features.openapi.*toopenapi.* - Remove
labelsfromapissection
- Replace
- Update plugins to ES Modules syntax or use
.cjsextension. - Test your configuration with
redocly check-config.
- Explore the changelog for detailed information about all changes.
- Check out the v2 documentation.