redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

Unexpected theme/htmlTemplate config warnings in v1.15.0

Open javierjulio opened this issue 1 month ago • 7 comments

Describe the bug

Since updating @redocly/cli from 1.14.0 to 1.15.0, when running npm test which in turn runs redocly lint, these 2 redocly.yaml warnings are reported unexpectedly:

> redocly lint

[1] redocly.yaml:16:5 at #/theme/openapi/htmlTemplate

Property `htmlTemplate` is not expected here.

14 | theme:
15 |   openapi:
16 |     htmlTemplate: redoc-web/index.html
17 |     theme:
18 |       spacing:

Warning was generated by the configuration spec rule.


[2] redocly.yaml:17:5 at #/theme/openapi/theme

Property `theme` is not expected here.

15 | openapi:
16 |   htmlTemplate: redoc-web/index.html
17 |   theme:
18 |     spacing:
19 |       unit: 5 # CE  # main spacing unit used in autocomputed theme values later

Warning was generated by the configuration spec rule.


⚠️ Your config has 2 warnings.

I don't know what is causing this since reviewing the openapi-starter, which I based the docs off years ago, it's a match. The keys are in the expected place and have valid values. Although if a value say in theme was invalid, I wouldn't expect that warning message.

We encounter the same reported warnings both in CI (GitHub Actions) and locally.

For what it's worth, I had issues previously with the config file reporting warnings when we it was using the features key and that took awhile to be resolved.

This change https://github.com/Redocly/redocly-cli/pull/1495 which was included v1.15.0 could be the cause.

This is my redocly.yaml file:

# See https://redoc.ly/docs/cli/configuration/ for more information.
apis:
  main@v1:
    root: openapi/openapi.yaml
extends:
  - recommended
rules:
  no-unused-components: warn
  info-license: off
  info-license-url: off
  no-invalid-media-type-examples:
    severity: warn
theme:
  openapi:
    htmlTemplate: redoc-web/index.html
    theme:
      spacing:
        unit: 5 # CE  # main spacing unit used in autocomputed theme values later
        sectionHorizontal: 30 # CE  # Horizontal section padding. COMPUTED: spacing.unit * 8
        sectionVertical: 30 # CE  # Horizontal section padding. COMPUTED: spacing.unit * 8
      colors:
        primary:
          main: "#1E88E5"
      typography:
        fontSize: '16px' # CE
        lineHeight: '1.5' # CE
        fontWeightRegular: '400' # CE
        fontWeightBold: '700' # CE
        fontWeightLight: '400' # CE
        fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif' # CE
        smoothing: 'antialiased' # CE
        optimizeSpeed: true # CE
        headings:
          fontFamily: 'Montserrat, sans-serif' # CE
          fontWeight: '400' # CE
          lineHeight: '1.6em' # CE
      logo:
        gutter: '20px' # logo image padding # CE
      rightPanel:
        # backgroundColor: '#263238' # CE
        width: '50%' # CE
        # textColor: '#ffffff' # CE

To Reproduce

This is reproducible with the openapi-starter library which generates the same warnings and an additional one.

  1. Download the openapi-starter https://github.com/Redocly/openapi-starter/archive/refs/heads/main.zip
  2. Update the redocly version in package.json to 1.15.0
  3. Run npm install
  4. Run npm test
  5. The theme/htmlTemplate warnings will be reported

Expected behavior

The two warnings should not be reported since the config is valid and those two keys are in the correct location where they should be defined.

Logs

OpenAPI description

Redocly Version(s)

v1.15.0

Node.js Version(s)

v20.10.0

Additional context

javierjulio avatar Jun 14 '24 14:06 javierjulio