From eeea998889cd48ad45680d6636c4173826236a3e Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Sun, 3 May 2020 22:43:30 -0700 Subject: [PATCH] Lock down APIs with final, unstable, and internal --- .../openapi/AddDefaultConfigSettings.java | 2 +- .../apigateway/traits/AuthorizerIndex.java | 2 +- .../traits/AuthorizersTraitValidator.java | 4 ++- .../traits/IntegrationTraitIndex.java | 2 +- .../iam/traits/ConditionKeysValidator.java | 4 ++- .../aws/traits/ArnTemplateValidator.java | 2 ++ .../aws/traits/SdkServiceIdValidator.java | 2 ++ .../CleanClientDiscoveryTraitTransformer.java | 4 ++- .../ClientEndpointDiscoveryValidator.java | 4 ++- .../traits/protocols/Ec2QueryNameTrait.java | 2 +- .../protocols/ProtocolHttpValidator.java | 2 ++ .../amazon/smithy/build/transforms/Apply.java | 2 +- .../software/amazon/smithy/cli/Arguments.java | 2 ++ .../java/software/amazon/smithy/cli/Cli.java | 2 ++ .../software/amazon/smithy/cli/Colors.java | 3 +++ .../software/amazon/smithy/cli/Command.java | 3 +++ .../software/amazon/smithy/cli/Parser.java | 2 ++ .../smithy/cli/commands/BuildCommand.java | 2 ++ .../smithy/cli/commands/DiffCommand.java | 2 ++ .../smithy/cli/commands/ValidateCommand.java | 2 ++ .../codegen/core/ReservedWordsBuilder.java | 2 +- .../diff/evaluators/AddedEntityBinding.java | 2 +- .../smithy/diff/evaluators/AddedMetadata.java | 2 +- .../diff/evaluators/AddedOperationError.java | 2 +- .../evaluators/AddedOperationInputOutput.java | 2 +- .../smithy/diff/evaluators/AddedShape.java | 2 +- .../diff/evaluators/AddedTraitDefinition.java | 2 +- .../diff/evaluators/ChangedEnumTrait.java | 2 +- .../diff/evaluators/ChangedLengthTrait.java | 2 +- .../diff/evaluators/ChangedMemberTarget.java | 2 +- .../diff/evaluators/ChangedMetadata.java | 2 +- .../evaluators/ChangedOperationInput.java | 2 +- .../evaluators/ChangedOperationOutput.java | 2 +- .../diff/evaluators/ChangedRangeTrait.java | 2 +- .../ChangedResourceIdentifiers.java | 2 +- .../diff/evaluators/ChangedShapeType.java | 2 +- .../smithy/diff/evaluators/ModifiedTrait.java | 2 +- .../RemovedAuthenticationScheme.java | 2 +- .../diff/evaluators/RemovedEntityBinding.java | 2 +- .../diff/evaluators/RemovedMetadata.java | 2 +- .../evaluators/RemovedOperationError.java | 2 +- .../evaluators/RemovedOperationInput.java | 2 +- .../evaluators/RemovedOperationOutput.java | 2 +- .../smithy/diff/evaluators/RemovedShape.java | 2 +- .../evaluators/RemovedTraitDefinition.java | 2 +- .../InputOutputStructureReuseValidator.java | 2 +- .../smithy/model/pattern/SmithyPattern.java | 8 +++--- .../smithy/model/traits/DynamicTrait.java | 2 +- .../model/traits/XmlFlattenedTrait.java | 2 +- .../node/CollectionLengthPlugin.java | 2 +- .../validators/AuthTraitValidator.java | 2 +- .../validators/EnumTraitValidator.java | 2 +- .../EventPayloadTraitValidator.java | 2 +- ...xclusiveStructureMemberTraitValidator.java | 2 +- .../validators/HostLabelTraitValidator.java | 2 +- .../validators/LengthTraitValidator.java | 2 +- .../validators/RangeTraitValidator.java | 2 +- .../validators/ServiceValidator.java | 2 +- .../validators/ShapeIdConflictValidator.java | 2 +- .../validators/ShapeRecursionValidator.java | 2 +- .../SingleOperationBindingValidator.java | 2 +- .../SingleResourceBindingValidator.java | 2 +- .../validators/StreamingTraitValidator.java | 2 +- .../validators/TargetValidator.java | 2 +- .../XmlNamespaceTraitValidator.java | 2 +- .../validation/validators/package-info.java | 26 +++++++++++++++++++ .../smithy/mqtt/traits/TopicBinding.java | 2 +- .../validators/MqttPublishInputValidator.java | 4 ++- .../MqttSubscribeInputValidator.java | 2 ++ .../MqttSubscribeOutputValidator.java | 2 ++ .../MqttTopicConflictValidator.java | 2 ++ .../validators/MqttTopicLabelValidator.java | 2 ++ .../MqttUnsupportedErrorsValidator.java | 2 ++ .../fromsmithy/OpenApiJsonSchemaMapper.java | 2 +- .../mappers/CheckForGreedyLabels.java | 2 ++ .../mappers/CheckForPrefixHeaders.java | 2 ++ .../fromsmithy/mappers/OpenApiJsonAdd.java | 2 ++ .../mappers/OpenApiJsonSubstitutions.java | 2 ++ .../mappers/RemoveEmptyComponents.java | 4 ++- .../mappers/RemoveUnusedComponents.java | 4 ++- .../fromsmithy/mappers/UnsupportedTraits.java | 2 ++ .../fromsmithy/security/AwsV4Converter.java | 2 ++ .../security/HttpApiKeyAuthConverter.java | 2 ++ .../security/HttpBasicConverter.java | 2 ++ .../security/HttpBearerConverter.java | 2 ++ .../security/HttpDigestConverter.java | 2 ++ .../HttpRequestTestsInputValidator.java | 2 ++ .../HttpResponseTestsErrorValidator.java | 2 ++ .../HttpResponseTestsOutputValidator.java | 2 ++ .../UniqueProtocolTestCaseIdValidator.java | 2 ++ 90 files changed, 164 insertions(+), 62 deletions(-) create mode 100644 smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/package-info.java diff --git a/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddDefaultConfigSettings.java b/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddDefaultConfigSettings.java index 15e44399c1b..79f5fb7d117 100644 --- a/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddDefaultConfigSettings.java +++ b/smithy-aws-apigateway-openapi/src/main/java/software/amazon/smithy/aws/apigateway/openapi/AddDefaultConfigSettings.java @@ -21,7 +21,7 @@ /** * API Gateway does not allow characters like "_". */ -public final class AddDefaultConfigSettings implements ApiGatewayMapper { +final class AddDefaultConfigSettings implements ApiGatewayMapper { @Override public List getApiTypes() { return null; diff --git a/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/AuthorizerIndex.java b/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/AuthorizerIndex.java index 870cf9d9c1b..8d29ad1be1b 100644 --- a/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/AuthorizerIndex.java +++ b/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/AuthorizerIndex.java @@ -35,7 +35,7 @@ * operation has the authorizer trait, then the resource an operation * is bound to, then the service. */ -public class AuthorizerIndex implements KnowledgeIndex { +public final class AuthorizerIndex implements KnowledgeIndex { private static final Selector SELECTOR = Selector.parse("operation"); diff --git a/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/AuthorizersTraitValidator.java b/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/AuthorizersTraitValidator.java index cc3717dc607..20250f7dde1 100644 --- a/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/AuthorizersTraitValidator.java +++ b/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/AuthorizersTraitValidator.java @@ -28,12 +28,14 @@ import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.model.validation.ValidationUtils; import software.amazon.smithy.utils.OptionalUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Each authorizer resolved within a service must use a scheme that * matches one of the schemes of the protocols of the service. */ -public class AuthorizersTraitValidator extends AbstractValidator { +@SmithyInternalApi +public final class AuthorizersTraitValidator extends AbstractValidator { @Override public List validate(Model model) { return model.shapes(ServiceShape.class) diff --git a/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/IntegrationTraitIndex.java b/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/IntegrationTraitIndex.java index 3ecdd7fae6c..f051ffaf078 100644 --- a/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/IntegrationTraitIndex.java +++ b/smithy-aws-apigateway-traits/src/main/java/software/amazon/smithy/aws/apigateway/traits/IntegrationTraitIndex.java @@ -32,7 +32,7 @@ * Computes the API Gateway integration for each operation, * resource, and service shape in a model. */ -public class IntegrationTraitIndex implements KnowledgeIndex { +public final class IntegrationTraitIndex implements KnowledgeIndex { private Map> traits = new HashMap<>(); public IntegrationTraitIndex(Model model) { diff --git a/smithy-aws-iam-traits/src/main/java/software/amazon/smithy/aws/iam/traits/ConditionKeysValidator.java b/smithy-aws-iam-traits/src/main/java/software/amazon/smithy/aws/iam/traits/ConditionKeysValidator.java index 5eb0cd3ace3..427f701816a 100644 --- a/smithy-aws-iam-traits/src/main/java/software/amazon/smithy/aws/iam/traits/ConditionKeysValidator.java +++ b/smithy-aws-iam-traits/src/main/java/software/amazon/smithy/aws/iam/traits/ConditionKeysValidator.java @@ -27,6 +27,7 @@ import software.amazon.smithy.model.validation.AbstractValidator; import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.model.validation.ValidationUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Ensures that condition keys referenced by operations bound within the @@ -37,7 +38,8 @@ *

Condition keys that refer to global "aws:*" keys are allowed to not * be defined on the service. */ -public class ConditionKeysValidator extends AbstractValidator { +@SmithyInternalApi +public final class ConditionKeysValidator extends AbstractValidator { @Override public List validate(Model model) { ConditionKeysIndex conditionIndex = model.getKnowledge(ConditionKeysIndex.class); diff --git a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/ArnTemplateValidator.java b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/ArnTemplateValidator.java index 75284b12374..a1778ef2031 100644 --- a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/ArnTemplateValidator.java +++ b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/ArnTemplateValidator.java @@ -34,11 +34,13 @@ import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.utils.OptionalUtils; import software.amazon.smithy.utils.Pair; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Ensures that all arn traits for a service are valid and that their templates * only reference valid resource identifiers. */ +@SmithyInternalApi public final class ArnTemplateValidator extends AbstractValidator { private static final Pattern EXPRESSION_PATTERN = Pattern.compile("^[!|+]?[a-zA-Z_][a-zA-Z0-9_]*$"); diff --git a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/SdkServiceIdValidator.java b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/SdkServiceIdValidator.java index ca71a169a31..eb8fa3d3284 100644 --- a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/SdkServiceIdValidator.java +++ b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/SdkServiceIdValidator.java @@ -31,6 +31,7 @@ import software.amazon.smithy.model.validation.ValidationUtils; import software.amazon.smithy.utils.OptionalUtils; import software.amazon.smithy.utils.SetUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates that SDK service IDs are correct and do not match any @@ -42,6 +43,7 @@ *

  • Must not case-insensitively end with "Service", "Client", or "API".
  • * */ +@SmithyInternalApi public final class SdkServiceIdValidator extends AbstractValidator { private static final Set COMPANY_NAMES = SetUtils.of("AWS", "Aws", "Amazon"); private static final Set DISALLOWED_ENDINGS = SetUtils.of("service", "client", "api"); diff --git a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/clientendpointdiscovery/CleanClientDiscoveryTraitTransformer.java b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/clientendpointdiscovery/CleanClientDiscoveryTraitTransformer.java index ef43b45701c..2c27119b67d 100644 --- a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/clientendpointdiscovery/CleanClientDiscoveryTraitTransformer.java +++ b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/clientendpointdiscovery/CleanClientDiscoveryTraitTransformer.java @@ -30,11 +30,13 @@ import software.amazon.smithy.model.traits.Trait; import software.amazon.smithy.model.transform.ModelTransformer; import software.amazon.smithy.model.transform.ModelTransformerPlugin; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Removes the endpoint discovery trait from a service if the referenced operation or error are removed. */ -public class CleanClientDiscoveryTraitTransformer implements ModelTransformerPlugin { +@SmithyInternalApi +public final class CleanClientDiscoveryTraitTransformer implements ModelTransformerPlugin { @Override public Model onRemove(ModelTransformer transformer, Collection shapes, Model model) { Set removedOperations = shapes.stream() diff --git a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/clientendpointdiscovery/ClientEndpointDiscoveryValidator.java b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/clientendpointdiscovery/ClientEndpointDiscoveryValidator.java index 979feff7dc5..971ded11e8e 100644 --- a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/clientendpointdiscovery/ClientEndpointDiscoveryValidator.java +++ b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/clientendpointdiscovery/ClientEndpointDiscoveryValidator.java @@ -36,8 +36,10 @@ import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.utils.Pair; import software.amazon.smithy.utils.SetUtils; +import software.amazon.smithy.utils.SmithyInternalApi; -public class ClientEndpointDiscoveryValidator extends AbstractValidator { +@SmithyInternalApi +public final class ClientEndpointDiscoveryValidator extends AbstractValidator { private static final Set VALID_INPUT_MEMBERS = SetUtils.of("Operation", "Identifiers"); @Override diff --git a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/protocols/Ec2QueryNameTrait.java b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/protocols/Ec2QueryNameTrait.java index fe7ff4a0294..4da891af1e2 100644 --- a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/protocols/Ec2QueryNameTrait.java +++ b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/protocols/Ec2QueryNameTrait.java @@ -23,7 +23,7 @@ * Indicates the serialized name of a structure member when that structure is * serialized for the input of an EC2 operation. */ -public class Ec2QueryNameTrait extends StringTrait { +public final class Ec2QueryNameTrait extends StringTrait { public static final ShapeId ID = ShapeId.from("aws.protocols#ec2QueryName"); public Ec2QueryNameTrait(String value, SourceLocation sourceLocation) { diff --git a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/protocols/ProtocolHttpValidator.java b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/protocols/ProtocolHttpValidator.java index 347696def1e..7a249f2dfba 100644 --- a/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/protocols/ProtocolHttpValidator.java +++ b/smithy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/protocols/ProtocolHttpValidator.java @@ -24,11 +24,13 @@ import software.amazon.smithy.model.traits.Trait; import software.amazon.smithy.model.validation.AbstractValidator; import software.amazon.smithy.model.validation.ValidationEvent; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Ensures that every entry in {@code eventStreamHttp} also appears in * the {@code http} property of a protocol trait. */ +@SmithyInternalApi public final class ProtocolHttpValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-build/src/main/java/software/amazon/smithy/build/transforms/Apply.java b/smithy-build/src/main/java/software/amazon/smithy/build/transforms/Apply.java index 655458eb668..74d5861f0d3 100644 --- a/smithy-build/src/main/java/software/amazon/smithy/build/transforms/Apply.java +++ b/smithy-build/src/main/java/software/amazon/smithy/build/transforms/Apply.java @@ -29,7 +29,7 @@ * transform needs this functionality. We could *maybe* address * this later if we really care that much. */ -public class Apply extends BackwardCompatHelper { +public final class Apply extends BackwardCompatHelper { /** * {@code apply} configuration. diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/Arguments.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/Arguments.java index 5245e4c9d28..4882df7a173 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/Arguments.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/Arguments.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import software.amazon.smithy.utils.SmithyUnstableApi; /** * Container for parsed command line arguments meant to be queried by Commands. @@ -28,6 +29,7 @@ * with a short name of "-h" and a long name of "--help" would be made * available in an {@code Arguments} instance as "--help" and not "-h". */ +@SmithyUnstableApi public final class Arguments { private final Map> arguments; private final List positionalArguments; diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/Cli.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/Cli.java index 98a1693b465..a6ac12d7f6e 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/Cli.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/Cli.java @@ -30,6 +30,7 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import java.util.logging.SimpleFormatter; +import software.amazon.smithy.utils.SmithyUnstableApi; /** * This class provides a very basic CLI abstraction. @@ -54,6 +55,7 @@ * CLI features are supported in case we want to migrate to a library or * event a different language. */ +@SmithyUnstableApi public final class Cli { public static final String HELP = "--help"; public static final String NO_COLOR = "--no-color"; diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/Colors.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/Colors.java index 591fd51b2c3..fd7295459a0 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/Colors.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/Colors.java @@ -15,9 +15,12 @@ package software.amazon.smithy.cli; +import software.amazon.smithy.utils.SmithyUnstableApi; + /** * Provides an abstraction for printing with ANSI colors if it is supported. */ +@SmithyUnstableApi public enum Colors { BLACK(30), RED(31), diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/Command.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/Command.java index 2eace40b766..22cd437361a 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/Command.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/Command.java @@ -15,9 +15,12 @@ package software.amazon.smithy.cli; +import software.amazon.smithy.utils.SmithyUnstableApi; + /** * Represents a CLI command. */ +@SmithyUnstableApi public interface Command { /** * Gets the name of the command. diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/Parser.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/Parser.java index d8545a02edd..2f7a3d0ea1c 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/Parser.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/Parser.java @@ -23,10 +23,12 @@ import java.util.Optional; import java.util.stream.Collectors; import software.amazon.smithy.utils.SmithyBuilder; +import software.amazon.smithy.utils.SmithyUnstableApi; /** * Defines the CLI argument parser of a {@link Command}. */ +@SmithyUnstableApi public final class Parser { private String positionalName; private String positionalHelp; diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/BuildCommand.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/BuildCommand.java index bae1583c352..c9234b86cd4 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/BuildCommand.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/BuildCommand.java @@ -42,7 +42,9 @@ import software.amazon.smithy.model.loader.ModelAssembler; import software.amazon.smithy.model.validation.Severity; import software.amazon.smithy.model.validation.ValidatedResult; +import software.amazon.smithy.utils.SmithyInternalApi; +@SmithyInternalApi public final class BuildCommand implements Command { private static final Logger LOGGER = Logger.getLogger(BuildCommand.class.getName()); diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/DiffCommand.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/DiffCommand.java index d1736bca25a..7aa7aba5307 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/DiffCommand.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/DiffCommand.java @@ -30,7 +30,9 @@ import software.amazon.smithy.model.validation.Severity; import software.amazon.smithy.model.validation.ValidatedResult; import software.amazon.smithy.model.validation.ValidationEvent; +import software.amazon.smithy.utils.SmithyInternalApi; +@SmithyInternalApi public final class DiffCommand implements Command { private static final Logger LOGGER = Logger.getLogger(DiffCommand.class.getName()); diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ValidateCommand.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ValidateCommand.java index 2712a742a23..fe4b98b4d77 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ValidateCommand.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ValidateCommand.java @@ -24,7 +24,9 @@ import software.amazon.smithy.model.Model; import software.amazon.smithy.model.loader.ModelAssembler; import software.amazon.smithy.model.validation.ValidatedResult; +import software.amazon.smithy.utils.SmithyInternalApi; +@SmithyInternalApi public final class ValidateCommand implements Command { @Override public String getName() { diff --git a/smithy-codegen-core/src/main/java/software/amazon/smithy/codegen/core/ReservedWordsBuilder.java b/smithy-codegen-core/src/main/java/software/amazon/smithy/codegen/core/ReservedWordsBuilder.java index c6ccae69100..ab3956e8fd2 100644 --- a/smithy-codegen-core/src/main/java/software/amazon/smithy/codegen/core/ReservedWordsBuilder.java +++ b/smithy-codegen-core/src/main/java/software/amazon/smithy/codegen/core/ReservedWordsBuilder.java @@ -36,7 +36,7 @@ * Builds a {@link ReservedWords} implementation from explicit * mappings and from line-delimited files that contain reserved words. */ -public class ReservedWordsBuilder { +public final class ReservedWordsBuilder { private final Map mappings = new HashMap<>(); private final List delegates = new ArrayList<>(); diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedEntityBinding.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedEntityBinding.java index e777a93b64f..c17e86eaa93 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedEntityBinding.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedEntityBinding.java @@ -34,7 +34,7 @@ * added, and an "AddedResourceBinding" eventId is used when a * resource is added. */ -public class AddedEntityBinding extends AbstractDiffEvaluator { +public final class AddedEntityBinding extends AbstractDiffEvaluator { private static final String ADDED_RESOURCE = "AddedResourceBinding"; private static final String ADDED_OPERATION = "AddedOperationBinding"; diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedMetadata.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedMetadata.java index ad4b6138a3c..36799d54b9a 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedMetadata.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedMetadata.java @@ -25,7 +25,7 @@ /** * Creates a NOTE event when metadata is added. */ -public class AddedMetadata extends AbstractDiffEvaluator { +public final class AddedMetadata extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.addedMetadata() diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedOperationError.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedOperationError.java index e06c2149a69..f667545d7be 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedOperationError.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedOperationError.java @@ -28,7 +28,7 @@ /** * Emits a warning when an error is added to an operation. */ -public class AddedOperationError extends AbstractDiffEvaluator { +public final class AddedOperationError extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(OperationShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedOperationInputOutput.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedOperationInputOutput.java index 4185e83ee44..54284267844 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedOperationInputOutput.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedOperationInputOutput.java @@ -38,7 +38,7 @@ * *

    TODO: Also check for the addition of streaming and event streams. */ -public class AddedOperationInputOutput implements DiffEvaluator { +public final class AddedOperationInputOutput implements DiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(OperationShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedShape.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedShape.java index 6a8ed3e242a..ab58d325f9a 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedShape.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedShape.java @@ -23,7 +23,7 @@ /** * Creates a NOTE event when a shape is added. */ -public class AddedShape extends AbstractDiffEvaluator { +public final class AddedShape extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.addedShapes() diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedTraitDefinition.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedTraitDefinition.java index 98495777115..c43c683bbd1 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedTraitDefinition.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/AddedTraitDefinition.java @@ -25,7 +25,7 @@ /** * Creates a NOTE event when a trait definition is added. */ -public class AddedTraitDefinition extends AbstractDiffEvaluator { +public final class AddedTraitDefinition extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.addedShapes() diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedEnumTrait.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedEnumTrait.java index f805db8a50e..8ccc9ad9f0c 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedEnumTrait.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedEnumTrait.java @@ -32,7 +32,7 @@ * Emits a NOTE when a new enum value is added, emits an ERROR when an * enum value is removed, and emits an ERROR when an enum name changes. */ -public class ChangedEnumTrait extends AbstractDiffEvaluator { +public final class ChangedEnumTrait extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes() diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedLengthTrait.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedLengthTrait.java index 4e9d8394d72..6fa7ec0b4b5 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedLengthTrait.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedLengthTrait.java @@ -23,7 +23,7 @@ * Detects when the Length trait is made more restrictive by either * raising the min or lowering the max. */ -public class ChangedLengthTrait extends AbstractLengthAndRangeValidator { +public final class ChangedLengthTrait extends AbstractLengthAndRangeValidator { @Override protected Class getTraitType() { return LengthTrait.class; diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedMemberTarget.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedMemberTarget.java index 554ad881b7d..552aae6da37 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedMemberTarget.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedMemberTarget.java @@ -34,7 +34,7 @@ * a simple shape of the same type with the same traits, then the emitted * event is a WARNING. All other changes are ERROR events. */ -public class ChangedMemberTarget extends AbstractDiffEvaluator { +public final class ChangedMemberTarget extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(MemberShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedMetadata.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedMetadata.java index 0fd5d3c3137..9c291b69aed 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedMetadata.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedMetadata.java @@ -25,7 +25,7 @@ /** * Creates a WARNING event when metadata is changed. */ -public class ChangedMetadata extends AbstractDiffEvaluator { +public final class ChangedMetadata extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedMetadata() diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedOperationInput.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedOperationInput.java index 77ac5b2495f..a1a2c33a32e 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedOperationInput.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedOperationInput.java @@ -25,7 +25,7 @@ * Emits an ERROR when the input shape of an operation is changed to * another shape. */ -public class ChangedOperationInput extends AbstractDiffEvaluator { +public final class ChangedOperationInput extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(OperationShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedOperationOutput.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedOperationOutput.java index 9ed09a9d51d..d20a8159a4a 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedOperationOutput.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedOperationOutput.java @@ -25,7 +25,7 @@ * Emits an ERROR when the output shape of an operation is changed to * another shape. */ -public class ChangedOperationOutput extends AbstractDiffEvaluator { +public final class ChangedOperationOutput extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(OperationShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedRangeTrait.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedRangeTrait.java index a6017e81d19..a949f5740da 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedRangeTrait.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedRangeTrait.java @@ -23,7 +23,7 @@ * Detects when the Range trait is made more restrictive by either * raising the min or lowering the max. */ -public class ChangedRangeTrait extends AbstractLengthAndRangeValidator { +public final class ChangedRangeTrait extends AbstractLengthAndRangeValidator { @Override protected Class getTraitType() { return RangeTrait.class; diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedResourceIdentifiers.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedResourceIdentifiers.java index 7d91d14e9c6..63950fb581d 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedResourceIdentifiers.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedResourceIdentifiers.java @@ -24,7 +24,7 @@ /** * Creates an ERROR event when the identifiers of a resource changes. */ -public class ChangedResourceIdentifiers extends AbstractDiffEvaluator { +public final class ChangedResourceIdentifiers extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(ResourceShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedShapeType.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedShapeType.java index 246f70322bf..68a1ec1265b 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedShapeType.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ChangedShapeType.java @@ -23,7 +23,7 @@ /** * Creates an ERROR event when the type of a shape changes. */ -public class ChangedShapeType extends AbstractDiffEvaluator { +public final class ChangedShapeType extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes() diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ModifiedTrait.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ModifiedTrait.java index ed64b1946f6..9334ca09066 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ModifiedTrait.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/ModifiedTrait.java @@ -42,7 +42,7 @@ *

  • diff.error.const: It is an error to add, remove, or change a trait.
  • * */ -public class ModifiedTrait extends AbstractDiffEvaluator { +public final class ModifiedTrait extends AbstractDiffEvaluator { /** Tags that indicates a breaking change if a trait is added. */ public static final String DIFF_ERROR_ADD = "diff.error.add"; diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedAuthenticationScheme.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedAuthenticationScheme.java index 916b41e450c..1d076ed7533 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedAuthenticationScheme.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedAuthenticationScheme.java @@ -23,7 +23,7 @@ /** * TODO: Implement evaluator to find removed authentication schemes. */ -public class RemovedAuthenticationScheme extends AbstractDiffEvaluator { +public final class RemovedAuthenticationScheme extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return Collections.emptyList(); diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedEntityBinding.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedEntityBinding.java index 4e9a03d6e81..78fd38fd192 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedEntityBinding.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedEntityBinding.java @@ -34,7 +34,7 @@ * removed, and a "RemovedResourceBinding" eventId is used when a * resource is removed. */ -public class RemovedEntityBinding extends AbstractDiffEvaluator { +public final class RemovedEntityBinding extends AbstractDiffEvaluator { private static final String REMOVED_RESOURCE = "RemovedResourceBinding"; private static final String REMOVED_OPERATION = "RemovedOperationBinding"; diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedMetadata.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedMetadata.java index 6290c125e26..5f8606d00f9 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedMetadata.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedMetadata.java @@ -25,7 +25,7 @@ /** * Creates a DANGER event when metadata is removed. */ -public class RemovedMetadata extends AbstractDiffEvaluator { +public final class RemovedMetadata extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.removedMetadata() diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationError.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationError.java index 43a9cb856eb..07743b5e792 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationError.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationError.java @@ -28,7 +28,7 @@ /** * Emits a warning when an error is removed from an operation. */ -public class RemovedOperationError extends AbstractDiffEvaluator { +public final class RemovedOperationError extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(OperationShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationInput.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationInput.java index 75f6b0f2f41..a8382b5be44 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationInput.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationInput.java @@ -24,7 +24,7 @@ /** * Emits an ERROR when the input shape is removed from an operation. */ -public class RemovedOperationInput extends AbstractDiffEvaluator { +public final class RemovedOperationInput extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(OperationShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationOutput.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationOutput.java index 7971f22cb3f..84334101e25 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationOutput.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedOperationOutput.java @@ -24,7 +24,7 @@ /** * Emits an ERROR when the output shape is removed from an operation. */ -public class RemovedOperationOutput extends AbstractDiffEvaluator { +public final class RemovedOperationOutput extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.changedShapes(OperationShape.class) diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedShape.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedShape.java index c4177133425..cfdafb343e2 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedShape.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedShape.java @@ -24,7 +24,7 @@ /** * Creates an ERROR event when a non-private shape is removed. */ -public class RemovedShape extends AbstractDiffEvaluator { +public final class RemovedShape extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.removedShapes() diff --git a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedTraitDefinition.java b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedTraitDefinition.java index b4dfca50ee2..da1458629b6 100644 --- a/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedTraitDefinition.java +++ b/smithy-diff/src/main/java/software/amazon/smithy/diff/evaluators/RemovedTraitDefinition.java @@ -25,7 +25,7 @@ /** * Creates an ERROR event when a trait definition is removed. */ -public class RemovedTraitDefinition extends AbstractDiffEvaluator { +public final class RemovedTraitDefinition extends AbstractDiffEvaluator { @Override public List evaluate(Differences differences) { return differences.removedShapes() diff --git a/smithy-linters/src/main/java/software/amazon/smithy/linters/InputOutputStructureReuseValidator.java b/smithy-linters/src/main/java/software/amazon/smithy/linters/InputOutputStructureReuseValidator.java index 4e3470e08fb..e3d42347b92 100644 --- a/smithy-linters/src/main/java/software/amazon/smithy/linters/InputOutputStructureReuseValidator.java +++ b/smithy-linters/src/main/java/software/amazon/smithy/linters/InputOutputStructureReuseValidator.java @@ -39,7 +39,7 @@ * Checks if a structure is used as both input and output and if the same * input or output structures are used across multiple operations. */ -public class InputOutputStructureReuseValidator extends AbstractValidator { +public final class InputOutputStructureReuseValidator extends AbstractValidator { public static final class Provider extends ValidatorService.Provider { public Provider() { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/pattern/SmithyPattern.java b/smithy-model/src/main/java/software/amazon/smithy/model/pattern/SmithyPattern.java index 2502f3854e3..1984e1a3d1c 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/pattern/SmithyPattern.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/pattern/SmithyPattern.java @@ -63,7 +63,7 @@ protected SmithyPattern(Builder builder) { * * @return All segments, in order, in an unmodifiable list. */ - public List getSegments() { + public final List getSegments() { return Collections.unmodifiableList(segments); } @@ -72,7 +72,7 @@ public List getSegments() { * * @return Label segments in an unmodifiable list. */ - public List getLabels() { + public final List getLabels() { return Collections.unmodifiableList( segments.stream().filter(Segment::isLabel).collect(Collectors.toList())); } @@ -83,7 +83,7 @@ public List getLabels() { * @param name Name of the label to retrieve. * @return An optionally found label. */ - public Optional getLabel(String name) { + public final Optional getLabel(String name) { String searchKey = name.toLowerCase(Locale.US); return segments.stream() .filter(Segment::isLabel) @@ -96,7 +96,7 @@ public Optional getLabel(String name) { * * @return Returns the optionally found segment that is a greedy label. */ - public Optional getGreedyLabel() { + public final Optional getGreedyLabel() { return segments.stream().filter(Segment::isGreedyLabel).findFirst(); } diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/traits/DynamicTrait.java b/smithy-model/src/main/java/software/amazon/smithy/model/traits/DynamicTrait.java index 1e615edff54..4dacbca65ea 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/traits/DynamicTrait.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/traits/DynamicTrait.java @@ -22,7 +22,7 @@ * A general-purpose trait used to represent traits that are defined in the * model and have no concrete implementation. */ -public class DynamicTrait extends AbstractTrait { +public final class DynamicTrait extends AbstractTrait { private final Node value; diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/traits/XmlFlattenedTrait.java b/smithy-model/src/main/java/software/amazon/smithy/model/traits/XmlFlattenedTrait.java index 9cb5788fdb2..b1930882951 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/traits/XmlFlattenedTrait.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/traits/XmlFlattenedTrait.java @@ -19,7 +19,7 @@ import software.amazon.smithy.model.node.ObjectNode; import software.amazon.smithy.model.shapes.ShapeId; -public class XmlFlattenedTrait extends AnnotationTrait { +public final class XmlFlattenedTrait extends AnnotationTrait { public static final ShapeId ID = ShapeId.from("smithy.api#xmlFlattened"); public XmlFlattenedTrait(ObjectNode node) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/node/CollectionLengthPlugin.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/node/CollectionLengthPlugin.java index c2620a10c7a..2abe8f36a52 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/node/CollectionLengthPlugin.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/node/CollectionLengthPlugin.java @@ -29,7 +29,7 @@ * target them. */ @SmithyInternalApi -public class CollectionLengthPlugin extends MemberAndShapeTraitPlugin { +public final class CollectionLengthPlugin extends MemberAndShapeTraitPlugin { public CollectionLengthPlugin() { super(CollectionShape.class, ArrayNode.class, LengthTrait.class); } diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/AuthTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/AuthTraitValidator.java index d628ddbb3e8..6b30b4ed7ad 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/AuthTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/AuthTraitValidator.java @@ -35,7 +35,7 @@ * to authentication traits applied to service shapes that enclose the * operation. */ -public class AuthTraitValidator extends AbstractValidator { +public final class AuthTraitValidator extends AbstractValidator { @Override public List validate(Model model) { List events = new ArrayList<>(); diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/EnumTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/EnumTraitValidator.java index 7079f447d24..e8e8eb77f4e 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/EnumTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/EnumTraitValidator.java @@ -37,7 +37,7 @@ * a name. All enum values and names must be unique across the list of * definitions. */ -public class EnumTraitValidator extends AbstractValidator { +public final class EnumTraitValidator extends AbstractValidator { private static final Pattern RECOMMENDED_NAME_PATTERN = Pattern.compile("^[A-Z]+[A-Z_0-9]*$"); @Override diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/EventPayloadTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/EventPayloadTraitValidator.java index a594391a41b..d2ddff5ab43 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/EventPayloadTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/EventPayloadTraitValidator.java @@ -36,7 +36,7 @@ *

    Only a single member can be marked with the eventPayload trait, and * this is validated using {@link ExclusiveStructureMemberTraitValidator}. */ -public class EventPayloadTraitValidator extends AbstractValidator { +public final class EventPayloadTraitValidator extends AbstractValidator { @Override public List validate(Model model) { return model.shapes(StructureShape.class) diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ExclusiveStructureMemberTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ExclusiveStructureMemberTraitValidator.java index 75f72b77baf..60093dd907c 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ExclusiveStructureMemberTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ExclusiveStructureMemberTraitValidator.java @@ -35,7 +35,7 @@ /** * Validates traits that can only be applied to a single structure member. */ -public class ExclusiveStructureMemberTraitValidator extends AbstractValidator { +public final class ExclusiveStructureMemberTraitValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HostLabelTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HostLabelTraitValidator.java index 785368db4c1..d0233c61838 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HostLabelTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HostLabelTraitValidator.java @@ -51,7 +51,7 @@ * each operation is a valid RFC 3896 host. * */ -public class HostLabelTraitValidator extends AbstractValidator { +public final class HostLabelTraitValidator extends AbstractValidator { /** * Match the expanded template to be a valid RFC 3896 host. */ diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/LengthTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/LengthTraitValidator.java index 198981669f4..c46c73e2ddd 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/LengthTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/LengthTraitValidator.java @@ -26,7 +26,7 @@ import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.utils.Pair; -public class LengthTraitValidator extends AbstractValidator { +public final class LengthTraitValidator extends AbstractValidator { @Override public List validate(Model model) { return model.shapes() diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/RangeTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/RangeTraitValidator.java index da782f6cba0..49999d4a7aa 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/RangeTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/RangeTraitValidator.java @@ -34,7 +34,7 @@ /** * Ensures that range traits are valid. */ -public class RangeTraitValidator extends AbstractValidator { +public final class RangeTraitValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ServiceValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ServiceValidator.java index 0f5cb1fd18e..5acb9520fb1 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ServiceValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ServiceValidator.java @@ -54,7 +54,7 @@ * detected for an operation or resource are emitted as an ERROR, and all * other forbidden conflicts are emitted as DANGER. */ -public class ServiceValidator extends AbstractValidator { +public final class ServiceValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ShapeIdConflictValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ShapeIdConflictValidator.java index e2f9034ea9c..764f2ebcae0 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ShapeIdConflictValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ShapeIdConflictValidator.java @@ -30,7 +30,7 @@ * Ensures that no two shapes in the model have the same case-insensitive * shape ID. */ -public class ShapeIdConflictValidator extends AbstractValidator { +public final class ShapeIdConflictValidator extends AbstractValidator { @Override public List validate(Model model) { Map> conflicts = model.shapes() diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ShapeRecursionValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ShapeRecursionValidator.java index b8060a5b524..4f75f32ac8d 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ShapeRecursionValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ShapeRecursionValidator.java @@ -43,7 +43,7 @@ * code generators where a list of itself or a list of maps of itself * is impossible to define. */ -public class ShapeRecursionValidator extends AbstractValidator { +public final class ShapeRecursionValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleOperationBindingValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleOperationBindingValidator.java index 502b0585f1a..c628e4a7b5d 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleOperationBindingValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleOperationBindingValidator.java @@ -34,7 +34,7 @@ * Validates that an operation is only bound to once in an entire * service closure. */ -public class SingleOperationBindingValidator extends AbstractValidator { +public final class SingleOperationBindingValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleResourceBindingValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleResourceBindingValidator.java index 51d6aa92b00..f11e29a6cca 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleResourceBindingValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/SingleResourceBindingValidator.java @@ -33,7 +33,7 @@ * Validates that a resource is only bound to once in an entire * service closure. */ -public class SingleResourceBindingValidator extends AbstractValidator { +public final class SingleResourceBindingValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/StreamingTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/StreamingTraitValidator.java index d88f023cfc2..162bbc3470f 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/StreamingTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/StreamingTraitValidator.java @@ -43,7 +43,7 @@ * *

    If the targeted shape is a union, ensures that all members are structures. */ -public class StreamingTraitValidator extends AbstractValidator { +public final class StreamingTraitValidator extends AbstractValidator { @Override public List validate(Model model) { List events = validateStreamingTargets(model); diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/TargetValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/TargetValidator.java index 416791c8bdb..24c76fa5e8c 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/TargetValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/TargetValidator.java @@ -42,7 +42,7 @@ /** * Validates that neighbors target resolvable shapes of the correct type. */ -public class TargetValidator extends AbstractValidator { +public final class TargetValidator extends AbstractValidator { private static final Set INVALID_MEMBER_TARGETS = SetUtils.of( ShapeType.SERVICE, ShapeType.RESOURCE, ShapeType.OPERATION, ShapeType.MEMBER); diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/XmlNamespaceTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/XmlNamespaceTraitValidator.java index 2c6b138264a..36270055805 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/XmlNamespaceTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/XmlNamespaceTraitValidator.java @@ -36,7 +36,7 @@ *

  • Validates that uri is valid.
  • * */ -public class XmlNamespaceTraitValidator extends AbstractValidator { +public final class XmlNamespaceTraitValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/package-info.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/package-info.java new file mode 100644 index 00000000000..11c3cc3eab5 --- /dev/null +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/package-info.java @@ -0,0 +1,26 @@ +/* + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/** + * Smithy validators. All validator implementations in this package + * should be considered internal. They are subject to change and + * should not be used directly outside of the Smithy project. For + * example, some of these validators may get removed and replaced + * with mode-only validation. + */ +@SmithyInternalApi +package software.amazon.smithy.model.validation.validators; + +import software.amazon.smithy.utils.SmithyInternalApi; diff --git a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/TopicBinding.java b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/TopicBinding.java index f76d8ed5487..2e5f8915981 100644 --- a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/TopicBinding.java +++ b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/TopicBinding.java @@ -61,7 +61,7 @@ * operations where an event member is marked with the {@code eventPayload} * trait. */ -public class TopicBinding { +public final class TopicBinding { private final OperationShape operation; private final T mqttTrait; private final Topic topic; diff --git a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttPublishInputValidator.java b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttPublishInputValidator.java index ab445c594e4..e583414d79c 100644 --- a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttPublishInputValidator.java +++ b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttPublishInputValidator.java @@ -26,11 +26,13 @@ import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.mqtt.traits.PublishTrait; import software.amazon.smithy.utils.OptionalUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Publish operations must not contain event streams. */ -public class MqttPublishInputValidator extends AbstractValidator { +@SmithyInternalApi +public final class MqttPublishInputValidator extends AbstractValidator { @Override public List validate(Model model) { return model.shapes(OperationShape.class) diff --git a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttSubscribeInputValidator.java b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttSubscribeInputValidator.java index 987c30c8acc..4a04da5be89 100644 --- a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttSubscribeInputValidator.java +++ b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttSubscribeInputValidator.java @@ -26,6 +26,7 @@ import software.amazon.smithy.mqtt.traits.SubscribeTrait; import software.amazon.smithy.mqtt.traits.TopicLabelTrait; import software.amazon.smithy.utils.OptionalUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates {@code @smithy.mqtt#subscribe} operation input. @@ -34,6 +35,7 @@ *
  • Subscribe operation input members must all have mqttLabel trait.
  • * */ +@SmithyInternalApi public final class MqttSubscribeInputValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttSubscribeOutputValidator.java b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttSubscribeOutputValidator.java index ea15d8e739a..d1f62c37790 100644 --- a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttSubscribeOutputValidator.java +++ b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttSubscribeOutputValidator.java @@ -34,6 +34,7 @@ import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.mqtt.traits.SubscribeTrait; import software.amazon.smithy.utils.OptionalUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates {@code subscribe} operation output. @@ -44,6 +45,7 @@ *
  • Subscribe operations should not use eventHeader traits.
  • * */ +@SmithyInternalApi public final class MqttSubscribeOutputValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicConflictValidator.java b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicConflictValidator.java index a59e926d9c2..58975bd9845 100644 --- a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicConflictValidator.java +++ b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicConflictValidator.java @@ -25,6 +25,7 @@ import software.amazon.smithy.mqtt.traits.ResolvedTopicIndex; import software.amazon.smithy.mqtt.traits.TopicBinding; import software.amazon.smithy.utils.Pair; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates that no two MQTT topics conflict. @@ -32,6 +33,7 @@ *

    MQTT topics are allowed to conflict if both topics target the * same shape. */ +@SmithyInternalApi public final class MqttTopicConflictValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicLabelValidator.java b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicLabelValidator.java index 9923b86148d..7f39e6ca3e9 100644 --- a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicLabelValidator.java +++ b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicLabelValidator.java @@ -34,6 +34,7 @@ import software.amazon.smithy.mqtt.traits.SubscribeTrait; import software.amazon.smithy.mqtt.traits.Topic; import software.amazon.smithy.mqtt.traits.TopicLabelTrait; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates that labels are correct for MQTT topics on @@ -45,6 +46,7 @@ *

  • The input must not contain extraneous labels.
  • * */ +@SmithyInternalApi public class MqttTopicLabelValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttUnsupportedErrorsValidator.java b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttUnsupportedErrorsValidator.java index bc9e2f62a98..27b60729ba4 100644 --- a/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttUnsupportedErrorsValidator.java +++ b/smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttUnsupportedErrorsValidator.java @@ -27,6 +27,7 @@ import software.amazon.smithy.mqtt.traits.SubscribeTrait; import software.amazon.smithy.mqtt.traits.TopicBinding; import software.amazon.smithy.utils.OptionalUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates that {@code @smithy.mqtt#publish} and {@code subscribe} @@ -35,6 +36,7 @@ *

    Errors have to just come back in the event stream of the output. * This violation may be suppressed since it emits a DANGER event. */ +@SmithyInternalApi public final class MqttUnsupportedErrorsValidator extends AbstractValidator { @Override public List validate(Model model) { diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/OpenApiJsonSchemaMapper.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/OpenApiJsonSchemaMapper.java index c1456619b85..0a20cdde044 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/OpenApiJsonSchemaMapper.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/OpenApiJsonSchemaMapper.java @@ -44,7 +44,7 @@ *

    Note: the properties and features added by this mapper can be removed using * {@link OpenApiConfig#setDisableFeatures}. */ -public class OpenApiJsonSchemaMapper implements JsonSchemaMapper { +public final class OpenApiJsonSchemaMapper implements JsonSchemaMapper { /** See https://swagger.io/docs/specification/data-models/keywords/. */ private static final Set UNSUPPORTED_KEYWORD_DIRECTIVES = SetUtils.of( diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/CheckForGreedyLabels.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/CheckForGreedyLabels.java index c2a3d997658..6fde85df6b6 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/CheckForGreedyLabels.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/CheckForGreedyLabels.java @@ -21,6 +21,7 @@ import software.amazon.smithy.openapi.fromsmithy.Context; import software.amazon.smithy.openapi.fromsmithy.OpenApiMapper; import software.amazon.smithy.openapi.model.OpenApi; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Checks for greedy labels and fails/warns depending on configuration. @@ -28,6 +29,7 @@ *

    Some vendors like API Gateway support greedy labels in the form of * "{foo+}", while others do not. */ +@SmithyInternalApi public class CheckForGreedyLabels implements OpenApiMapper { private static final Logger LOGGER = Logger.getLogger(CheckForGreedyLabels.class.getName()); diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/CheckForPrefixHeaders.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/CheckForPrefixHeaders.java index afe5cae767f..168fd354dca 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/CheckForPrefixHeaders.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/CheckForPrefixHeaders.java @@ -29,6 +29,7 @@ import software.amazon.smithy.openapi.fromsmithy.OpenApiMapper; import software.amazon.smithy.openapi.fromsmithy.OpenApiProtocol; import software.amazon.smithy.openapi.model.OpenApi; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Checks for prefix headers in the input or output of an operation, @@ -38,6 +39,7 @@ *

    Custom values for this setting need to be handled in a * {@link OpenApiProtocol}. */ +@SmithyInternalApi public class CheckForPrefixHeaders implements OpenApiMapper { private static final Logger LOGGER = Logger.getLogger(CheckForGreedyLabels.class.getName()); diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/OpenApiJsonAdd.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/OpenApiJsonAdd.java index fe3b7443d67..b6cd9e353a6 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/OpenApiJsonAdd.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/OpenApiJsonAdd.java @@ -25,6 +25,7 @@ import software.amazon.smithy.openapi.fromsmithy.Context; import software.amazon.smithy.openapi.fromsmithy.OpenApiMapper; import software.amazon.smithy.openapi.model.OpenApi; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Adds JSON values into the generated OpenAPI model using a JSON Patch @@ -34,6 +35,7 @@ *

    This mapper is applied using the contents of {@code openapi.jsonAdd}. * This is run after substitutions so it is unaffected by them. */ +@SmithyInternalApi public final class OpenApiJsonAdd implements OpenApiMapper { private static final Logger LOGGER = Logger.getLogger(OpenApiJsonAdd.class.getName()); diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/OpenApiJsonSubstitutions.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/OpenApiJsonSubstitutions.java index f14be3790aa..03422022818 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/OpenApiJsonSubstitutions.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/OpenApiJsonSubstitutions.java @@ -24,11 +24,13 @@ import software.amazon.smithy.openapi.fromsmithy.Context; import software.amazon.smithy.openapi.fromsmithy.OpenApiMapper; import software.amazon.smithy.openapi.model.OpenApi; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Substitutes JSON string values using the mapping defined in * {@code openapi.substitutions}. */ +@SmithyInternalApi public final class OpenApiJsonSubstitutions implements OpenApiMapper { private static final Logger LOGGER = Logger.getLogger(OpenApiJsonSubstitutions.class.getName()); diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveEmptyComponents.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveEmptyComponents.java index 94991eef60f..4f10327c057 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveEmptyComponents.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveEmptyComponents.java @@ -22,12 +22,14 @@ import software.amazon.smithy.openapi.fromsmithy.Context; import software.amazon.smithy.openapi.fromsmithy.OpenApiMapper; import software.amazon.smithy.openapi.model.OpenApi; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Removes empty key-value pairs in the "components" of a model if empty, and * removes the "components" key-value pair of a model if it is empty. */ -public class RemoveEmptyComponents implements OpenApiMapper { +@SmithyInternalApi +public final class RemoveEmptyComponents implements OpenApiMapper { private static final String COMPONENTS = "components"; @Override diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveUnusedComponents.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveUnusedComponents.java index 5477bf0dd9d..52193f945f2 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveUnusedComponents.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveUnusedComponents.java @@ -36,6 +36,7 @@ import software.amazon.smithy.openapi.model.OperationObject; import software.amazon.smithy.openapi.model.PathItem; import software.amazon.smithy.utils.SetUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Removes unused components from the OpenAPI model. @@ -46,7 +47,8 @@ * *

    TODO: This plugin currently only supports the removal of schemas and security schemes. */ -public class RemoveUnusedComponents implements OpenApiMapper { +@SmithyInternalApi +public final class RemoveUnusedComponents implements OpenApiMapper { private static final Logger LOGGER = Logger.getLogger(RemoveUnusedComponents.class.getName()); @Override diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/UnsupportedTraits.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/UnsupportedTraits.java index 56c20487501..a5e389f9dbb 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/UnsupportedTraits.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/UnsupportedTraits.java @@ -27,11 +27,13 @@ import software.amazon.smithy.openapi.model.OpenApi; import software.amazon.smithy.utils.Pair; import software.amazon.smithy.utils.SetUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Logs each instance of traits and features that are known to not * work in OpenAPI. */ +@SmithyInternalApi public final class UnsupportedTraits implements OpenApiMapper { private static final Logger LOGGER = Logger.getLogger(UnsupportedTraits.class.getName()); private static final Set TRAITS = SetUtils.of("endpoint", "hostLabel"); diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/AwsV4Converter.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/AwsV4Converter.java index 4fea698fc1b..8f987403411 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/AwsV4Converter.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/AwsV4Converter.java @@ -23,10 +23,12 @@ import software.amazon.smithy.openapi.fromsmithy.SecuritySchemeConverter; import software.amazon.smithy.openapi.model.SecurityScheme; import software.amazon.smithy.utils.SetUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Adds AWS signature version in a way that"s compatible with AWS API Gateway. */ +@SmithyInternalApi public final class AwsV4Converter implements SecuritySchemeConverter { private static final String AUTH_HEADER = "Authorization"; private static final Set REQUEST_HEADERS = SetUtils.of( diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpApiKeyAuthConverter.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpApiKeyAuthConverter.java index eaecfafa9d2..9ec38aa0935 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpApiKeyAuthConverter.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpApiKeyAuthConverter.java @@ -22,6 +22,7 @@ import software.amazon.smithy.openapi.fromsmithy.SecuritySchemeConverter; import software.amazon.smithy.openapi.model.SecurityScheme; import software.amazon.smithy.utils.SetUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Uses an HTTP header named X-Api-Key that contains an API key. @@ -30,6 +31,7 @@ * * @see API Gateway documentation */ +@SmithyInternalApi public final class HttpApiKeyAuthConverter implements SecuritySchemeConverter { @Override public Class getAuthSchemeType() { diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpBasicConverter.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpBasicConverter.java index 9cb0678ef49..61d2a1b9a2c 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpBasicConverter.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpBasicConverter.java @@ -20,10 +20,12 @@ import software.amazon.smithy.openapi.fromsmithy.Context; import software.amazon.smithy.openapi.fromsmithy.SecuritySchemeConverter; import software.amazon.smithy.openapi.model.SecurityScheme; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Applies Basic HTTP auth. */ +@SmithyInternalApi public final class HttpBasicConverter implements SecuritySchemeConverter { @Override public Class getAuthSchemeType() { diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpBearerConverter.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpBearerConverter.java index 5d93a7845bc..a46f7b95c6e 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpBearerConverter.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpBearerConverter.java @@ -20,10 +20,12 @@ import software.amazon.smithy.openapi.fromsmithy.Context; import software.amazon.smithy.openapi.fromsmithy.SecuritySchemeConverter; import software.amazon.smithy.openapi.model.SecurityScheme; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Uses the Bearer scheme of the Authentication header. */ +@SmithyInternalApi public final class HttpBearerConverter implements SecuritySchemeConverter { @Override public Class getAuthSchemeType() { diff --git a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpDigestConverter.java b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpDigestConverter.java index 9bfb58e0f1d..1e7bacf31b1 100644 --- a/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpDigestConverter.java +++ b/smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/security/HttpDigestConverter.java @@ -20,10 +20,12 @@ import software.amazon.smithy.openapi.fromsmithy.Context; import software.amazon.smithy.openapi.fromsmithy.SecuritySchemeConverter; import software.amazon.smithy.openapi.model.SecurityScheme; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Applies Digest HTTP auth. */ +@SmithyInternalApi public final class HttpDigestConverter implements SecuritySchemeConverter { @Override public Class getAuthSchemeType() { diff --git a/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpRequestTestsInputValidator.java b/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpRequestTestsInputValidator.java index 65b3f8851b0..6beca1e6278 100644 --- a/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpRequestTestsInputValidator.java +++ b/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpRequestTestsInputValidator.java @@ -19,11 +19,13 @@ import software.amazon.smithy.model.knowledge.OperationIndex; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.StructureShape; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Ensures that input parameters of protocol request test cases are * valid for the attached operation. */ +@SmithyInternalApi public final class HttpRequestTestsInputValidator extends ProtocolTestCaseValidator { public HttpRequestTestsInputValidator() { diff --git a/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpResponseTestsErrorValidator.java b/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpResponseTestsErrorValidator.java index 7f976afea8e..7eb46a86a36 100644 --- a/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpResponseTestsErrorValidator.java +++ b/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpResponseTestsErrorValidator.java @@ -18,10 +18,12 @@ import software.amazon.smithy.model.knowledge.OperationIndex; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.StructureShape; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates that protocol tests on errors use the correct params. */ +@SmithyInternalApi public final class HttpResponseTestsErrorValidator extends HttpResponseTestsOutputValidator { public HttpResponseTestsErrorValidator() { diff --git a/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpResponseTestsOutputValidator.java b/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpResponseTestsOutputValidator.java index 69338bd7f18..cb31a0ee7a9 100644 --- a/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpResponseTestsOutputValidator.java +++ b/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/HttpResponseTestsOutputValidator.java @@ -19,10 +19,12 @@ import software.amazon.smithy.model.knowledge.OperationIndex; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.StructureShape; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates that protocol tests on output use the correct params. */ +@SmithyInternalApi public class HttpResponseTestsOutputValidator extends ProtocolTestCaseValidator { public HttpResponseTestsOutputValidator() { diff --git a/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/UniqueProtocolTestCaseIdValidator.java b/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/UniqueProtocolTestCaseIdValidator.java index ea6a8b0b50a..e674a984058 100644 --- a/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/UniqueProtocolTestCaseIdValidator.java +++ b/smithy-protocol-test-traits/src/main/java/software/amazon/smithy/protocoltests/traits/UniqueProtocolTestCaseIdValidator.java @@ -29,12 +29,14 @@ import software.amazon.smithy.model.validation.AbstractValidator; import software.amazon.smithy.model.validation.ValidationEvent; import software.amazon.smithy.model.validation.ValidationUtils; +import software.amazon.smithy.utils.SmithyInternalApi; /** * Validates that the "id" property of {@code smithy.test#httpRequestTests} * and {@code smithy.test#httpResponseTests} are unique across all test * cases. */ +@SmithyInternalApi public class UniqueProtocolTestCaseIdValidator extends AbstractValidator { @Override