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 smithy-build to use NodeMapper #305

Merged
merged 2 commits into from
Mar 9, 2020
Merged

Conversation

mtdowling
Copy link
Member

@mtdowling mtdowling commented Mar 7, 2020

  • Update smithy-build to use NodeMapper

    The NodeMapper is now used to load smithy-build.json configuration
    files, reducing the boilerplate needed to deserialize it (and the
    error-prone need to manually update the deserialization code as things
    are added to the POJOs). The #toNode methods and methods were removed
    from the build/model/* classes for the same reasons.
    
    An explicit POJO that defines the format of smithy-build-info.json files
    was added, and the NodeMapper is now used to serialize it. This should
    give the format a well-defined structure and allow other tools to
    properly deserialize it too.
    
    Finally, a ConfigurableSmithyBuildPlugin abstract class was added that
    makes it easier to add NodeMapper deserialization into a plugin specific
    configuration POJO. Most plugins will ultimately extend from this class
    and get deserialization for free.
    
  • Adds support for more build transform options

    This commit updates smithy-build so that model transformations accept
    an object of configuration values rather than just a list of strings.
    This makes transformers far more powerful and configurable. In order to
    maintain backward compatibility with existing smithy-build.json files,
    an array of strings provided for a transformer is automatically
    transformed into `{"__args": [X]}` where "X" is the original array of
    arguments.
    ```
    
    

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

@mtdowling mtdowling requested a review from kstich March 7, 2020 01:11
The NodeMapper is now used to load smithy-build.json configuration
files, reducing the boilerplate needed to deserialize it (and the
error-prone need to manually update the deserialization code as things
are added to the POJOs). The #toNode methods and methods were removed
from the build/model/* classes for the same reasons.

An explicit POJO that defines the format of smithy-build-info.json files
was added, and the NodeMapper is now used to serialize it. This should
give the format a well-defined structure and allow other tools to
properly deserialize it too.

Finally, a ConfigurableSmithyBuildPlugin abstract class was added that
makes it easier to add NodeMapper deserialization into a plugin specific
configuration POJO. Most plugins will ultimately extend from this class
and get deserialization for free.
@mtdowling mtdowling force-pushed the smithy-build-refactor branch from 9458ed0 to 5608d3a Compare March 7, 2020 06:45
This commit updates smithy-build so that model transformations accept
an object of configuration values rather than just a list of strings.
This makes transformers far more powerful and configurable. In order to
maintain backward compatibility with existing smithy-build.json files,
an array of strings provided for a transformer is automatically
transformed into `{"__args": [X]}` where "X" is the original array of
arguments.
if (arg.endsWith("#")) {
traitNamespaces.add(arg.substring(0, arg.length() - 1));
} else if (arg.equals(Prelude.NAMESPACE)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a pretty rare case to run in to, but calling out that we're removing this without having deprecated it in 0.9.x.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll add a PR to master to emit a warning.

@mtdowling mtdowling merged commit 7915e0d into 0.10 Mar 9, 2020
mtdowling added a commit that referenced this pull request Mar 9, 2020
mtdowling added a commit that referenced this pull request Mar 9, 2020
@mtdowling mtdowling deleted the smithy-build-refactor branch March 10, 2020 22:59
@kstich kstich mentioned this pull request Apr 23, 2020
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