Comments (9)
I tested the new regex and it works as expected, thank you very much for your effort in fixing this. 🚀
from check-jsonschema.
You can control the regex engine being used by passing --format-regex python
to use the Python re
engine for regex patterns. There's only support for Python re
and regress
(a Rust implementation of ECMAScript regexes) today, but I'd be fine with adding others if there are reliable libraries to use.
(By way of example: the Python regex
package may perform better than re
, and I might like to build in support for that.)
Under pre-commit, it's just a matter of adding args
. This should do the trick:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
hooks:
- id: check-gitlab-ci
args: ["--format-regex", "python"]
But definitely this is an issue with the GItLab schema. JSON Schema (the spec) declares that ECMA Script regex syntax or a strict subset of it -- compatible with most languages/engines -- should be used for regexes.
I'll leave this open until I can cross-link a relevant open ticket on GitLab's tracker.
from check-jsonschema.
I just checked the GitLab schema and found that the regex you cited is not the one I see in their schema (or in our vendored copy).
What version of check-jsonschema
are you using? The latest (0.28.0)?
from check-jsonschema.
Thanks for your quick reply!
I just checked the GitLab schema and found that the regex you cited is not the one I see in their schema (or in our vendored copy). What version of check-jsonschema are you using? The latest (0.28.0)?
I'm using version 0.28.0
of check-jsonschema. These are the lines in the gitlab-ci
json schema I'm talking about: https://gitlab.com/gitlab-org/gitlab/-/blob/50724a13fa9bbfdd358079094930e7026c5d48f2/app/assets/javascripts/editor/schema/ci.json?page=2#L1965-L1970
from check-jsonschema.
Under pre-commit, it's just a matter of adding args.
I missed that. Unfortunately, this doesn't work either. I will provide you with a minimal reproduction repo shortly!
from check-jsonschema.
I misunderstood the original issue -- sorry about this -- from reading the report too quickly.
I thought you were reporting that the gitlab-ci
schema contained the problematic regex. But actually, it contains a simple regex -- /.+/
-- which your regex must match.
And that regex comes from gitlab docs.
I'll file a GitLab issue to either correct the schema OR correct their example.
If I had to guess, I would bet they meant for it to be
/[Tt][Oo][Tt][Aa][Ll].*? (100(?:\\.0+)?\\%|[1-9]?\\d(?:\\.\\d+)?\\%)$/
from check-jsonschema.
I've filed a gitlab docs issue suggesting the above regex as a docs fix, to see what kind of response I'll get from GitLab:
https://gitlab.com/gitlab-org/gitlab-docs/-/issues/1763
Feel free to 👍 it to signal boost, or just try using that regex and seeing how it works.
from check-jsonschema.
@sirosen Thank you very much for opening the issue, you certainly have better insight to this!
from check-jsonschema.
GitLab has accepted my docs suggestion and their new documented value should validate fine. I've closed out the upstream gitlab bug and I think this is all set. let me know if you see any issues!
from check-jsonschema.
Related Issues (20)
- Update vendored bitbucket schema HOT 1
- Feature request: add file names to the ouptut even if validation is OK HOT 3
- "unexpected keyword argument 'registry'" when validating specific GitHub workflow HOT 4
- Bug: Globs work in my machine but fails on CI HOT 3
- AttributeError not parsing schema correctly. HOT 2
- Cannot validate date-time via the CLI tool HOT 4
- Distribute the check-jsonschema tool in a manner which does not assume a Python environment
- Validation passes for misspelled optional child properties in Google Cloud Build schema HOT 7
- Check yaml with check-metaschema option HOT 3
- Non-JSON files ignored despite --default-type being set HOT 4
- check-azure-pipelines: doesn't handle default value for boolean parameter properly HOT 2
- --schemafile from $schema HOT 1
- Cannot download schema using check-jsonschema HOT 3
- `src/check_jsonschema/builtin_schemas/vendor` file organization HOT 2
- Addition of CircleCI hook? HOT 1
- Release schemas update? HOT 2
- [BUG] RegEx not recognised HOT 5
- GitLab CI .artifacts.reports.annotations is not supported
- bitbucket schema weirdness HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from check-jsonschema.