Skip to content

Commit

Permalink
Add smithy-build trait namespace use warning
Browse files Browse the repository at this point in the history
Relates to #305
  • Loading branch information
mtdowling committed Mar 9, 2020
1 parent 0923886 commit 1268070
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
import software.amazon.smithy.build.ProjectionTransformer;
import software.amazon.smithy.model.loader.Prelude;
import software.amazon.smithy.model.shapes.Shape;
Expand All @@ -26,6 +27,9 @@
import software.amazon.smithy.utils.Pair;

abstract class AbstractTraitRemoval implements ProjectionTransformer {

private static final Logger LOGGER = Logger.getLogger(AbstractTraitRemoval.class.getName());

Pair<Set<ShapeId>, Set<String>> parseTraits(List<String> arguments) {
Set<ShapeId> traitNames = new HashSet<>();
Set<String> traitNamespaces = new HashSet<>();
Expand All @@ -36,6 +40,9 @@ Pair<Set<ShapeId>, Set<String>> parseTraits(List<String> arguments) {
} else if (arg.equals(Prelude.NAMESPACE)) {
// For backwards compatibility, support "smithy.api" instead
// of "smithy.api#".
LOGGER.warning("Deprecation warning in " + getName() + ": Support for `smithy.api` as a trait name "
+ "is deprecated and will be removed in future releases. Update this value to "
+ "`smithy.api#`.");
traitNamespaces.add(arg);
} else {
traitNames.add(ShapeId.from(Trait.makeAbsoluteName(arg)));
Expand Down

0 comments on commit 1268070

Please sign in to comment.