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

Fail to validate Renovate.json file #450

Closed
pzelnip opened this issue Jun 26, 2024 · 2 comments
Closed

Fail to validate Renovate.json file #450

pzelnip opened this issue Jun 26, 2024 · 2 comments
Labels
question Further information is requested

Comments

@pzelnip
Copy link

pzelnip commented Jun 26, 2024

With this renovate.json file:

{
    "$schema": "https://docs.renovatebot.com/renovate-schema.json",
    "packageRules": [
        {
            "groupName": "all non-major dependencies",
            "groupSlug": "all-minor-patch",
            "matchPackagePatterns": ["*"],
            "matchUpdateTypes": ["minor", "patch"]
        }
    ]
}

which Renovate happily accepts, I get validation errors when running check-jsonschema against it:

$ check-jsonschema --builtin-schema=vendor.renovate renovate.json 
Schema validation errors were encountered.
  .gitlab/renovate.json::$.packageRules[0].matchPackagePatterns: ['*'] is not valid under any of the given schemas
  Underlying errors caused this.

  Best Match:
    $.packageRules[0].matchPackagePatterns: ['*'] is not of type 'string'
  Best Deep Match:
    $.packageRules[0].matchPackagePatterns[0]: '*' is not a 'regex'
@sirosen sirosen added the upstream-schema-issue An issue with a schema or schema provider label Jun 26, 2024
@sirosen
Copy link
Member

sirosen commented Jun 26, 2024

My first thought is that the renovate schema (provided upstream) may not be accurate. I'm checking this now.

@sirosen sirosen removed the upstream-schema-issue An issue with a schema or schema provider label Jun 26, 2024
@sirosen
Copy link
Member

sirosen commented Jun 26, 2024

Scratch that -- I removed the label -- their schema is fine.
This seems like a simple case and I over-indexed on the Best Match. It's nice to see Best Deep Match providing value:
'*' is, as it says, not a 'regex'.

Switching to ".*" for your pattern resolves it. Renovate may be lenient if the input pattern doesn't parse as a regex (e.g., they may failover to a globbing behavior), but I don't see a straightforward way for check-jsonschema to permit this.

If * is working to match on things, that would be a little interesting. If .* doesn't match, then I think that would make this into an upstream doc/schema issue -- it would mean that this field is not a regex.

@sirosen sirosen added the question Further information is requested label Jun 26, 2024
@sirosen sirosen closed this as completed Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants