Auto-generate JSON Schema for Pyrefly config using schemars (#2448 Task 2)#2473
Open
Prathamesh-tech-eng wants to merge 10 commits intofacebook:mainfrom
Open
Auto-generate JSON Schema for Pyrefly config using schemars (#2448 Task 2)#2473Prathamesh-tech-eng wants to merge 10 commits intofacebook:mainfrom
Prathamesh-tech-eng wants to merge 10 commits intofacebook:mainfrom
Conversation
- Extract configBase into reusable subschema - Flatten configBase properties into top-level schema - Reuse configBase in sub-config via - Fix build-system: move repo_root to all types, add not conditions - Simplify pyproject-tool-pyrefly.json to reference pyrefly.json - All tests passing
…ow additionalProperties, make python-platform non-exhaustive
- errors: accept both boolean and severity strings (ignore/info/warn/error) - Add missing configBase fields: tensor-shapes, recursion-depth-limit, recursion-overflow-handler - Add 'ty' to enabled-ignores enum - Fix project-includes default to include **/*.ipynb - Add baseline field (top-level) - Remove non-existent repo_root from build-system - Add ignore-if-build-system-missing and search-path-prefix to build-system - Fix pyproject-tool-pyrefly.json to use relative path - Update test files to exercise new fields and severity strings
…#2448 Task 2) Add schemars 0.8 as an optional dependency behind a `jsonschema` feature flag to pyrefly_util, pyrefly_python, pyrefly_build, and pyrefly_config. Add JsonSchema implementations for all config-related types: - Derive-based: Tool, Severity, ErrorKind, UntypedDefBehavior, RecursionOverflowHandler, BxlArgs, BuildSystemArgs, BuildSystem - Manual impls (custom serde / external types): Glob, Globs, PythonVersion, PythonPlatform, CustomQueryArgs, ErrorDisplayConfig, ModuleWildcard, ConfigOrigin<T>, ExtraConfigs, ConfigBase, PythonEnvironment, Interpreters, SubConfig, ConfigFile Add generate_schema binary that outputs Draft-07 JSON Schema to stdout: cargo run -p pyrefly_config --features jsonschema --bin generate_schema All schema code is gated with #[cfg(feature = \"jsonschema\")] for zero impact on normal builds."
Contributor
Author
|
@connernilsen This implements Task 2 from #2448. I had few doubts:
|
Contributor
|
@Prathamesh-tech-eng sorry for the delay.
I think it would be alright to replace them directly. Is there any specific reason you're thinking of to have them coexist?
Yes! This would be amazing!
The Thanks for working on this, and sorry again for the delay |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Task 2 from #2448: auto-generate the Pyrefly JSON Schema from Rust config types using the
schemarscrate, replacing the need to manually maintain schemas/pyrefly.json.Changes
Usage
cargo run -p pyrefly_config --features jsonschema --bin generate_schema > schemas/pyrefly.json