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

Smithy-cli: ability to resolve fully a given shape by id #2385

Open
ghostbuster91 opened this issue Aug 28, 2024 · 1 comment
Open

Smithy-cli: ability to resolve fully a given shape by id #2385

ghostbuster91 opened this issue Aug 28, 2024 · 1 comment
Labels
feature-request A feature should be added or improved.

Comments

@ghostbuster91
Copy link
Contributor

Hi,

This is a feature request.

Use case

Sometimes shapes created in smithy are quite complex and it is not obvious at first glance how given shape looks like in the end without navigating to every mixin in the hierarchy.

Proposed solution

It would be if smithy-cli could resolve a given shape given its ID.
This could be similar to what smithy-cli ast --flatten is doing but limited to only given shape id.

Another way to approach this would be to extend select command with an ability to return entire shapes not just IDs.

At first, this could return the json representation of the smithy model but ideally there would be an option to present it in a more user-friendly way. E.g. as a smithy shape.

Example:
given:

@mixin
structure MyTrait {
   name: String
}

structure MyStruct with [MyTrait] {
    age: Int
}

would print:

structure MyStruct {
    name: String
    age: Int
}
@JordonPhillips JordonPhillips added the feature-request A feature should be added or improved. label Oct 7, 2024
@JordonPhillips
Copy link
Contributor

JordonPhillips commented Oct 7, 2024

Having Smithy CLI be able to print out the whole shape in IDL format would be really cool. It certainly would have been useful in some of my investigations of very large models.

We already have a --show param to select. We can always add more values to it. Like smithy select --show shape / smithy select --show flattened-shape. It might be a bit much to have multiple permutations if we want to do idl and ast though, so maybe a second format parameter would be needed.

Something you can do now is compose the ast command with jq or similar tools. It's a tad clunky since it writes out to a file though. You have to sandwich cat or something in between. It'd also be nice for ast to be able to just write to stdout instead so it composes better with tools like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants