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

Feature request: SmithyBuildConfig -> Model utility #2292

Open
kubukoz opened this issue May 17, 2024 · 2 comments
Open

Feature request: SmithyBuildConfig -> Model utility #2292

kubukoz opened this issue May 17, 2024 · 2 comments
Labels
feature-request A feature should be added or improved.

Comments

@kubukoz
Copy link
Contributor

kubukoz commented May 17, 2024

There are a lot of tools that could be built on top of Smithy, which would use smithy-build.json as the source of information about a model.

Currently, in order to do so they would have to either:

  • shell out to the CLI (which is costly, including but not only because of having to start another JVM), or
  • duplicate some of its logic: this is what the LSP seems to be doing at the moment, just like smithy4s / smithy-playground (OSS projects I'm involved with), and some projects I'm involved in at work.

I think it would be beneficial for the ecosystem to have more out-of-the-box support for loading a build config into a model. Presumably, this would have to be part of smithy-build.

@sugmanue sugmanue added the feature-request A feature should be added or improved. label May 23, 2024
@kstich
Copy link
Contributor

kstich commented Jun 4, 2024

Are you looking for more than what's exposed in the SmithyBuildConfig class? If so, can you elaborate on what differences you're looking for?

@kubukoz
Copy link
Contributor Author

kubukoz commented Jun 5, 2024

yes, I looked at the class, and it's useful as a way of reading the build files, but one still has to implement the loading of such a build config into a model - that's the missing part (as far as I can tell).

so, in pseudocode:

Path file = ...;
SmithyBuildConfig bc = SmithyBuildConfig.load(file);

// we don't have this
Model model = Model.fromBuildConfig(bc).assemble().unwrap();
// alternative syntax
Model model = bc.load().assemble().unwrap();
// another one
Model model = SmithyBuildConfig.load(bc).assemble().unwrap()
// also, the methods currently are shown to return ModelAssembler, but maybe it makes sense to return a ValidatedResult<Model> instead.

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

3 participants