Skip to content

Consider adding an ion schema test command #191

@popematt

Description

@popematt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions