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

Support include-prelude in smithy ast #2500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,26 @@ private static final class Options implements ArgumentReceiver {
static final String FLATTEN_OPTION = "--flatten";
private boolean flatten = false;

static final String INCLUDE_PRELUDE_OPTION = "--include-prelude";
private boolean includePrelude = false;

@Override
public boolean testOption(String name) {
if (FLATTEN_OPTION.equals(name)) {
flatten = true;
return true;
}
if (INCLUDE_PRELUDE_OPTION.equals(name)) {
includePrelude = true;
return true;
}
return false;
}

@Override
public void registerHelp(HelpPrinter printer) {
printer.option(FLATTEN_OPTION, null, "Flattens and removes mixins from the model.");
printer.option(INCLUDE_PRELUDE_OPTION, null, "Includes the prelude shapes in the model.");
}
}

Expand All @@ -80,8 +88,8 @@ private int runWithClassLoader(SmithyBuildConfig config, Arguments arguments, En
.defaultSeverity(Severity.DANGER)
.build();

ModelSerializer serializer = ModelSerializer.builder().build();
Options options = arguments.getReceiver(Options.class);
ModelSerializer serializer = ModelSerializer.builder().includePrelude(options.includePrelude).build();
if (options.flatten) {
model = ModelTransformer.create().flattenAndRemoveMixins(model);
}
Expand Down
Loading