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

inspect doesn't write delimiting commas after nested containers #17

Closed
zslayton opened this issue Jan 10, 2022 · 1 comment · Fixed by #31
Closed

inspect doesn't write delimiting commas after nested containers #17

zslayton opened this issue Jan 10, 2022 · 1 comment · Fixed by #31

Comments

@zslayton
Copy link
Contributor

When stepping out of a container, ion beta inspect will print the appropriate closing delimiter. (] for lists, ) for s-expressions, } for structs.) However, if that container is nested, it should also print a delimiting , if the parent container is a list or struct.

This screenshot demonstrates the incorrect behavior:

image

Reproducing the command here for copy/pasting:

 echo '{foo:[{bar: a}, {bar: b}, {bar: c}]}' | ion dump --format binary | cargo run -- beta inspect

This isn't currently trivial to fix. Ideally, the reader would expose a method that allows applications to query for its current context. Something like:

fn parent_type(&self) -> Option<IonType>;

that would return None at the top level and Some(container_type) at any other depth. Absent such an API, the application would need to track the reader's traversal manually.

zslayton added a commit that referenced this issue Aug 10, 2022
* Upgrades dependency on `ion-rs` to v0.12.0
* Updates `ion-schema` to v0.4.0, which uses ion-rs v0.12.0
* Modifies the way encoding lengths are calculated following
  a change in the v0.12.0 binary reader API.
* Fixes issue #17; nested containers now have a trailing comma
  where necessary.
* Adds a `beta count` command that prints the number of top-level
  values in a given stream.
* Adds a `beta primitive` command that prints the decimal and
  hex representations of a value's primitive encoding
  (For example: the VarUInt encoding of 527.)
zslayton added a commit that referenced this issue Aug 10, 2022
* Upgrades ion-rs, adds beta 'count' and 'primitive' commands

* Upgrades dependency on `ion-rs` to v0.12.0
* Updates `ion-schema` to v0.4.0, which uses ion-rs v0.12.0
* Modifies the way encoding lengths are calculated following
  a change in the v0.12.0 binary reader API.
* Fixes issue #17; nested containers now have a trailing comma
  where necessary.
* Adds a `beta count` command that prints the number of top-level
  values in a given stream.
* Adds a `beta primitive` command that prints the decimal and
  hex representations of a value's primitive encoding
  (For example: the VarUInt encoding of 527.)
@zslayton
Copy link
Contributor Author

Fixed in PR #28.

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 a pull request may close this issue.

1 participant