-
Notifications
You must be signed in to change notification settings - Fork 35
feat(cli): add driver configuration schema discovery #1071
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
Open
kirkbrauer
wants to merge
2
commits into
main
Choose a base branch
from
cli-driver-schema-review
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,44 @@ | ||
| # Jumpstarter Driver CLI | ||
|
|
||
| ## Driver configuration schemas | ||
|
|
||
| `jmp driver schema` describes the configuration accepted by drivers installed | ||
| in the local Python environment. Editors can use it for exporter YAML | ||
| completion and validation without maintaining a hard-coded driver catalog. | ||
| It is distinct from inspecting driver clients in a running lease. | ||
|
|
||
| ```console | ||
| jmp driver schema | ||
| jmp driver schema -o json | ||
| jmp driver schema TcpNetwork -o yaml | ||
| jmp driver schema jumpstarter_driver_network.driver.TcpNetwork -o json | ||
| ``` | ||
|
|
||
| Names filter by entry-point name or full dotted driver type. An unknown name | ||
| fails before any driver is loaded, including when other names match. Output | ||
| supports tables (default), JSON, YAML, and `-o name`. | ||
|
|
||
| JSON and YAML return a `drivers` list. Each entry contains: | ||
|
|
||
| - `name`, `type`, `package`, and `version`: installed driver identity. | ||
| - `client`: the client class path used by client-config `drivers.allow` patterns, | ||
| when it can be discovered. | ||
| - `description`: the first line of the driver class docstring. | ||
| - `properties` and `required`: JSON Schema fragments for the exporter's | ||
| driver-specific `config:` block; common Driver fields and non-constructor | ||
| fields are excluded. | ||
| - `defs`: definitions referenced as `#/$defs/...` inside those fragments. | ||
| Consumers combining driver schemas must preserve and namespace these references. | ||
| - `error`: an import/schema-generation error, or `null` on success. Schema | ||
| generation failures retain best-effort dataclass field names and required | ||
| keys, without claiming complete type information. | ||
|
|
||
| A broken driver does not hide the other results. Inspect each entry's `error`; | ||
| exit status zero does not mean every driver produced a complete schema. | ||
| An empty environment produces `{"drivers": []}` in JSON/YAML output. | ||
|
|
||
| Discovery imports driver packages and invokes their metadata/schema hooks. | ||
| It does not instantiate drivers or open a lease itself, but imports/hooks run | ||
| arbitrary local Python code: only use it with trusted installed packages. | ||
| Python-level discovery output is redirected to stderr to keep structured stdout | ||
| parseable. This command is not a sandbox or live hardware validation. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
so it seems that it would fail generating for qemu, becasue it has a TemporaryDirectory field
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.
Oh yeah, that might be an issue...I will take a look, when testing, it did seem to work OK for most drivers, but I wasn't able to try them all, maybe I can make an audit script