-
-
Notifications
You must be signed in to change notification settings - Fork 27
Validate pytest-mypy-plugins
input file schema
#127
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
Conversation
8f3dc1c
to
ac26430
Compare
More details about the changes: The "main" schema is written in
The files can be generated, from the repo root: (
set -e
cd pytest_mypy_plugins
yq -o=json schema.yaml >| schema.json
jsonschema2md schema.json schema.md --examples-as-yaml
) I haven't seen any kind of "repo/release automation" setup, so I have avoided adding those commands. Also, two external tools are required for this, so ... some extra thinking might be needed. I'd recommend After that, you can do this: ... or, if you'd like more ✨ magic ✨ , then you can deploy it to SchemaStore (https://github.com/SchemaStore/schemastore/blob/2991ef67756c3bacfaa1bcb490c08922c13ca3f1/src/api/json/catalog.json#L1835-L1840) - but you'd have to "force-rename" the yml files to be picked-up automatically (e.g., |
ac26430
to
c88a161
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I generally support this feature, the only thing that bothers me is that we have 3 different schema files :)
Can we just use schema.json
for now? Or yaml
one?
Well ... we really have one.
Well ... yes 😢
The |
a9496b6
to
785fa6b
Compare
I think that This way we can at least try to have a single file for IDE-schema and validation. |
You can do that for https://github.com/typeddjango/pytest-mypy-plugins' validation. "IDE schema.json readers" fetch a JSON-file. I could've, instead, avoided the load here https://github.com/typeddjango/pytest-mypy-plugins/pull/127/files#diff-f3f061be87eac60afb6957b8b8ea08b948ca1a2b12b7584f99c7611adba6232aR33 and just give "directly" the JSON file. But then you'd have "two dependencies": |
@stdedos yes, I think that this is good thing to start with: just one |
c1a3a00
to
f37b562
Compare
Create a `schema.json` to: * Validate the input provided by the users * Offer in-editor validation and auto-completion * Easily keep the documentation of it up-to-date Use said schema to meta-test all test files for conformance. Additionally: * Fix `mypy_config` type to `str | None` * Update `jinja2.defaults.VARIABLE_START_STRING` to the more-correct `_rendering_env.variable_start_string`. * Update `.gitignore` This fixes the real issue behind typeddjango#124: The problem was not that `mypy_config` *MUST HAVE* `{{` when `parametrized` was set; It was passing a `list` (of `dict`s) - which that was not templatable. Signed-off-by: Stavros Ntentos <[email protected]>
f37b562
to
555d736
Compare
Ok 🤷 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! 👍
Very impressive work.
{ | ||
"case": "999" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
"case": "999" | |
}, | |
{ | |
"case": "999" | |
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub does not understand this for some reason :) |
If you start the
process, lemme know (and/or add it on your README.md) |
I am not sure that I understand what that is :) |
You can ask https://github.com/SchemaStore/schemastore/ to include your schema in their database, so that editors pick it up automagically. However, that means you'd have to suggest to people to name their files "more specifically", so that a glob pattern configures it automatically. They can always manually type the comment above, if they don't want to rename their tests. |
Create a `schema.json` to: * Validate the input provided by the users * Offer in-editor validation and auto-completion * Easily keep the documentation of it up-to-date Use said schema to meta-test all test files for conformance. Additionally: * Fix `mypy_config` type to `str | None` * Update `jinja2.defaults.VARIABLE_START_STRING` to the more-correct `_rendering_env.variable_start_string`. * Update `.gitignore` This fixes the real issue behind typeddjango#124: The problem was not that `mypy_config` *MUST HAVE* `{{` when `parametrized` was set; It was passing a `list` (of `dict`s) - which that was not templatable. Signed-off-by: Stavros Ntentos <[email protected]>
Create a
schema.yaml
to:Use said schema to meta-test all test files for conformance.
Additionally:
mypy_config
type tostr | None
jinja2.defaults.VARIABLE_START_STRING
to the more-correct_rendering_env.variable_start_string
..gitignore
This fixes the real issue behind #124: The problem was not that
mypy_config
MUST HAVE{{
whenparametrized
was set; It was passing alist
(ofdict
s) - which that was not templatable.Signed-off-by: Stavros Ntentos [email protected]