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

Consider adding an ion schema test command #191

Open
popematt opened this issue Jan 14, 2025 · 0 comments
Open

Consider adding an ion schema test command #191

popematt opened this issue Jan 14, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@popematt
Copy link
Contributor

popematt commented Jan 14, 2025

This could solve amazon-ion/ion-schema#37.

One possible API design would be something like this. (Most of these options are copied from ion schema validate since this is basically just a different interface around the same validation logic.)

ion schema test [OPTIONS] <type>

Options:
  -L                      Interpret each line as a separate input.
  -T                      Interpret each top level value as a separate input.
  -o, --output <output>   Output file [default: STDOUT]
  -h, --help              Print help
  -V, --version           Print version

Test Cases:
--valid             One or more files containing test values that should be valid for the type being tested
--invalid           One or more files containing test values that should be invalid for the type being tested

Selecting a schema:
      --empty <version>            An empty schema document for the specified Ion Schema version. [default: 2.0] [possible values: 1.0,
                                   2.0]
  -f, --schema-file <schema-file>  A schema file
      --schema-text <schema-text>  The Ion text contents of a schema document.
      --id <schema-id>             The ID of a schema to load from one of the configured authorities.
  -A, --authority <directory>      The root(s) of the file system authority(s). Authorities are only required if your schema needs to
                                   import a type from another schema or if you are loading a schema using the --id option.

Alternately, an implementation could accept a test suite using the same or similar DSL as ion-schema-tests.

Dependency note—to provide a useful test report, we need Element to expose its location in the serialized data.

@popematt popematt added the enhancement New feature or request label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant