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

model bucketing: special case for smithy.api#Unit #714

Merged
merged 2 commits into from
Mar 8, 2023

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Mar 8, 2023

In an edge case, the only model assigned to the last bucket may be smithy.api#Unit.

This causes the code generator to think that models_N exists, but in fact only models_(N-1) exists because Unit does not generate anything. This causes a compilation error in the generated models index.

// smithy-typescript generated code
export * from "./models_0";
export * from "./models_1"; // file doesn't exist

This proposed fix is to ignore smithy.api#Unit when incrementing the bucketing counter.

testing

tested code generation against the edge case unreleased feature

@kuhe kuhe requested review from a team as code owners March 8, 2023 16:46
bucketCount++;
currentBucketSize = 0;
String path;
if (shape.getId().toString().equals("smithy.api#Unit")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use .getId().equals(UnitTypeTrait.UNIT) instead.

@kuhe kuhe requested a review from kstich March 8, 2023 19:32
@kuhe kuhe merged commit d39d36e into smithy-lang:main Mar 8, 2023
@kuhe kuhe deleted the fix/model-bucket branch March 8, 2023 20:10
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
* model bucketing: special case for smithy.api#Unit

* update UnitTypeTrait equality check
@jhecking
Copy link
Contributor

jhecking commented Jul 6, 2023

We are still running into this problem even after updating to 0.15.0 which includes this fix. The problem just happens later. With 0.14.0, the problem happens as soon as we add one more structure to our models. With 0.15.0, it only happens when we add two more structures to our model. Could there be some other shape type that should also default to bucket 0 – same as Unit shapes?

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 this pull request may close these issues.

4 participants