Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected theme/htmlTemplate config warnings in v1.15.0 #1589

Open
javierjulio opened this issue Jun 14, 2024 · 7 comments
Open

Unexpected theme/htmlTemplate config warnings in v1.15.0 #1589

javierjulio opened this issue Jun 14, 2024 · 7 comments
Labels
Type: Bug Something isn't working

Comments

@javierjulio
Copy link

javierjulio commented Jun 14, 2024

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 #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 javierjulio added the Type: Bug Something isn't working label Jun 14, 2024
@javierjulio
Copy link
Author

Looks like it's related to this change #1495 that was introduced in v1.15.0

@javierjulio javierjulio changed the title Valid redocly.yaml reports unexpected theme/htmlTemplate warnings in v1.15.0 Unexpected theme/htmlTemplate config warnings in v1.15.0 Jun 14, 2024
@jmacelroy
Copy link

Hello, I came here to report the same issue just now. It also seems to impact generatedCodeSamples which I get in addition to those stated above. I am using a fairly standard redocly.yaml which is from the starter project example.

Let me know if there's info I can add that may help.

@tatomyr
Copy link
Contributor

tatomyr commented Jun 14, 2024

Hi guys!
Sorry for the inconvenience. We're modifying the default configuration format, but you can still safely use your current configuration. You either stay on the v1.14.0 or move the theme/openapi section under features.openapi like the following to avoid warnings:

features.openapi:
  htmlTemplate: redoc-web/index.html
  theme:
    spacing:
      unit: 5 # CE  # main spacing unit used in autocomputed theme values later
      ...

Please let me know if you need any other assistance.

@javierjulio
Copy link
Author

@tatomyr no worries and thank you. Sorry, at the time I tried reproducing with openapi-starter but I didn't update the @redocly/cli version. I tried that again with it using the 1.15.0 version and the warnings are reproducible. I wasn't sure based on your message if the team was aware of that or not so just wanted to follow up. I updated the description with the reproduction steps I took. We'll remain on 1.14.0 for now.

@dutchgecko
Copy link

features.openapi:
  htmlTemplate: redoc-web/index.html
  theme:
    spacing:
      unit: 5 # CE  # main spacing unit used in autocomputed theme values later
      ...

This configuration gives me a deprecation warning:

The 'features.openapi' field is deprecated. Use theme.openapi instead. Read more about this change: https://redocly.com/docs/api-registry/guides/migration-guide-config-file/#changed-properties

The linked document however says that this is what I should be migrating to, and the alternative config offered by the warning doesn't even work. I'm using v1.16.0

I'm brand new to redocly and at the moment I have no idea what I should or shouldn't be using for forward compatibility.

@lornajane
Copy link
Collaborator

@dutchgecko thanks for chiming in. Unless you're in our early adopters program, then I suggest you use a 1.14.x version of the CLI tool for now, which should validate correctly for our existing products. If that doesn't help, share your config and I'll take a look?

@dutchgecko
Copy link

@lornajane Thanks, I'll roll back for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants