Repository navigation
Add validate command and release 1.0.0 - #11
Merged
Merged
Conversation
validate checks a list of records (or one object) for required dotted paths, value types, and unique keys, from flags or a JSON/YAML schema file. It exits 0 when valid, 1 when not, and 2 when the check cannot run, so it can gate a pipeline step. --coerce lets CSV strings satisfy integer, number, boolean, and null, and -t csv writes only the error rows. Also bumps the version to 1.0.0, adds a Stability section to the README, and adds a CI job that builds the sdist and wheel, installs the wheel in a clean venv, and smoke-tests the command.
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.
What
Adds a
validatecommand and releases 1.0.0.validate [file]checks a list of records (or a single object) before it moves further down a pipeline:-r, --require PATH— path must be present (nullcounts as present)--type PATH=TYPE[|TYPE...]—string,integer,number,boolean,object,array,null-u, --unique PATH— no repeated values across records (same labels asgroup-by/join)-s, --schema FILE— JSON or YAML withrequired,types,unique; flags are added on top--coerce— numeric,true/false, and empty strings satisfyinteger,number,boolean,null(for CSV)--max-errors N,-q, --quietThe report is
{"valid", "records", "error_count", "errors"}. With-t csvor-t ndjsononly the error rows are written, which works well as a CI artifact.Exit codes:
0valid,1invalid,2the check could not run.1.0.0
pyproject.tomland__version__.packageCI job: builds the sdist and wheel, installs the wheel in a clean venv, smoke-testsdata-transform(including the exit codes), and uploadsdist/.Tests
tests/test_validate.py(14 tests) covering required paths, type unions, coercion, uniqueness, object roots, non-object records, error caps, schema loading, and CLI exit codes 0 / 1 / 2.