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

Simplify checking for incorrect extractor and loader blocks #505

Merged
merged 5 commits into from
Jan 16, 2024

Conversation

georg-schwarz
Copy link
Member

@georg-schwarz georg-schwarz commented Jan 16, 2024

In the process of fixing #497, I'd like to simplify some validations.
I plan to refactor all validations in validateBlockDefinition because they should rather be located in validatePipelineDefinition and validateCompositeBlockTypeDefinition.
In this attempt, I noticed that we can simplify the validation whether a loader is connected via its output port, and whether an extractor is connected via its input port.

Improved the validation messages along the way..

Before

Screenshot from 2024-01-16 10-32-03

After

image

I think the error message is clear enough to cover this edge case as well.

@georg-schwarz georg-schwarz changed the title Simplify checking for incorrect extractor and loader blocks WIP: Simplify checking for incorrect extractor and loader blocks Jan 16, 2024
Copy link
Contributor

@joluj joluj left a comment

Choose a reason for hiding this comment

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

The error message better but not very good imo. Why does it say SQLiteLoader if the block is a CarsLoader?

Maybe change it to

The output type "None" of CarsLoader (as an SQLiteLoader) is incompatible with the input type "TextFile" of CarsCSVInterpreter (as a CSVInterpreter)

or simpler (preferred):

The output type "None" of CarsLoader is incompatible with the input type "TextFile" of CarsCSVInterpreter

@georg-schwarz georg-schwarz force-pushed the simplify-validation-incorrect-extractor-loader branch from e9e9fca to 8e68450 Compare January 16, 2024 09:53
@georg-schwarz georg-schwarz force-pushed the simplify-validation-incorrect-extractor-loader branch from 8e68450 to 35e5247 Compare January 16, 2024 09:57
Copy link
Contributor

@joluj joluj left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -81,9 +61,18 @@ function checkPipesOfBlock(
isCompositeBlocktypeDefinition(block.$container) &&
block.$container.blocks.at(0)?.name === block.name;

const isExtractorBlock = !blockType.hasInput() && whatToCheck === 'input';
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming is somewhat confusing since it may be an ExtractorBlock even if we don't check for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will be refactored in a future PR.

@georg-schwarz georg-schwarz changed the title WIP: Simplify checking for incorrect extractor and loader blocks Simplify checking for incorrect extractor and loader blocks Jan 16, 2024
@georg-schwarz georg-schwarz merged commit cd9af89 into main Jan 16, 2024
3 checks passed
@georg-schwarz georg-schwarz deleted the simplify-validation-incorrect-extractor-loader branch January 16, 2024 13:06
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants