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

Update IDL serializer to write metadata to a separate file #2464

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

hpmellema
Copy link
Contributor

@hpmellema hpmellema commented Nov 15, 2024

Description

Updates the SmithyIdlModelSerializer to write all metadata to a separate metadata.smithy file rather than duplicating the metadata within each generated file.

Generating a separate smithy metadata files avoids potentially duplicating array data.

Detail on issue

For example the following files

/// hello.smithy
$version: "2"

metadata hello = [1]
 
namespace test
 
structure Hello{}

and

/// world.smithy
$version: "2"

metadata hello = [2]
 
namespace test
 
structure World{}

Were previously re-written as:

/// hello.smithy
$version: "2"

metadata hello = [1, 2]
 
namespace test
 
structure Hello{}

and

/// world.smithy
$version: "2"

metadata hello = [1, 2]
 
namespace test
 
structure World{}

This created a problem where, when using these models in a new model, the resulting metadata for hello
would be an array containing [1,2,1,2] effectively duplicating all array data N times (N being number of smithy files generated).

Updated behavior

With this change the following files would now be written for the above example:

/// hello.smithy
$version: "2"
 
namespace test
 
structure Hello{}
/// world.smithy
$version: "2"
 
namespace test
 
structure World{}
/// metadata.smithy
$version: "2"

metadata hello = [1, 2]

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hpmellema hpmellema requested a review from a team as a code owner November 15, 2024 16:09
@JordonPhillips JordonPhillips merged commit bf32a87 into smithy-lang:main Nov 15, 2024
13 checks passed
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.

2 participants