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

[components] add cli command to generate schema for code location component types #27169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benpankow
Copy link
Member

Summary

Adds a dagster-components CLI command used to generate a schema for component files, which ORs all component types available in a given code location.

This schema can be used to type check all component files for a code location.

How I Tested These Changes

New unit test.

@benpankow
Copy link
Member Author

benpankow commented Jan 16, 2025

@list_cli.command(name="all-components-schema")
@click.pass_context
def generate_code_location_components_schema(ctx: click.Context) -> None:
"""Builds a JSON schema which ORs the schema for a component
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opted for this route rather than trying to assemble an ORed schema ourselves from the existing schema metadata, since this has pydantic do the heavy lifting of combining $defs, $ref remapping etc

Copy link
Collaborator

@smackesey smackesey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly unclear on what schema is being generated here and whether it's necessary to generate this in a separate command. Could this be constructed inside dagster-dg from constituent schemas on the individual component types? That would avoid needing to cache a separate piece of data upstack.

"""Builds a JSON schema which ORs the schema for a component
file for all component types available in the current code location.
"""
assert is_inside_code_location_project(Path.cwd())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: pls follow the style of check used in other commands (see cli/scaffold.py)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants