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

fix: Renovate JSON schema allows invalid package rules #26484 #26560

Closed

Conversation

1999
Copy link

@1999 1999 commented Jan 9, 2024

Changes

JSON schema generated by tools/docs/schema.ts will now have additional additionalProperties: false for arrays items which will prevent arbitrary configuration objects like {"foo": "bar"}.

Context

This change is a follow-up to discussion in #26484

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

Neither of those. I ran pnpm release:prepare and used the generated JSON schema from tmp/docs/renovate-schema.json in JSON schema validator. I took most of the examples from Renovate configuration page and made sure the JSON examples are still valid.

@1999
Copy link
Author

1999 commented Jan 9, 2024

Can make it more specific for "packageRules" if that's required.

@1999 1999 changed the title Renovate JSON schema allows invalid package rules #26484 fix: Renovate JSON schema allows invalid package rules #26484 Jan 9, 2024
@rarkins
Copy link
Collaborator

rarkins commented Jan 9, 2024

When validating this repo's renovate.json I now get these errors:

image

@1999
Copy link
Author

1999 commented Jan 9, 2024

@rarkins yeah, that's what I don't quite understand. For instance, "versioning" is not listed in the "packageRules" in Renovate configuration page but it is used in renovate.json for this repo. Does it mean that "versioning" hasn't been documented yet or something else?

@rarkins
Copy link
Collaborator

rarkins commented Jan 9, 2024

versioning is documented at the root level. There are some options which should exist only within the root, only within packageRules, or either is ok (such as enabled, or semanticCommitType). Right now we don't have that classification though

@1999
Copy link
Author

1999 commented Jan 9, 2024

is it safe to assume that whenever an option has globalOnly: true it can only be used on a top level, and otherwise it can be used in both top-level and packageRules? I'm just trying to understand if it's feasible to update my PR to reflect this.

@rarkins
Copy link
Collaborator

rarkins commented Jan 9, 2024

globalOnly=true options cannot be used in repository config

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not merge - broken

@rarkins rarkins marked this pull request as draft January 9, 2024 14:15
@1999
Copy link
Author

1999 commented Jan 9, 2024

There are some options which should exist only within the root, only within packageRules, or either is ok

@rarkins is there a list of the options that can be used in both places or that can be used in only top-level?

@rarkins
Copy link
Collaborator

rarkins commented Jan 9, 2024

No

@1999
Copy link
Author

1999 commented Jan 9, 2024

Okies. It doesn't sound like you're interested in keeping public schema updated. I will close this PR and put the schema into our private repository so that we could use it instead of the public one. Should you need any help with the public schema, don't hesitate to at-mention me.

@1999 1999 closed this Jan 9, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants