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

Filter out synthetic traits from build info #1374

Merged
merged 1 commit into from
Aug 29, 2022
Merged

Conversation

syall
Copy link
Contributor

@syall syall commented Aug 29, 2022

Issue #, if available:

N/A


Description of changes:

Filter out synthetic traits from build info traitNames, as synthetic traits should not be serialized and should only be in-memory.


Testing:

  • Ran ./gradlew clean build check.

  • Added unit test BuildInfoPluginTest > testFiltersSyntheticEnumTrait() that tests smithy.synthetic#enum is not present in smithy-build-info.json(synthetic enum trait generated from enum shape).

    <             "smithy.api#unstable",
    <             "smithy.synthetic#enum"
    ---
    >             "smithy.api#unstable"
    Complete Output Before / After
    • Before
      {
          "metadata": {},
          "operationShapeIds": [
              "smithy.example#ChangeCard"
          ],
          "projection": {
              "abstract": false,
              "imports": [],
              "plugins": {},
              "transforms": []
          },
          "projectionName": "TEST",
          "resourceShapeIds": [],
          "serviceShapeIds": [
              "smithy.example#Example"
          ],
          "traitDefNames": [
              "smithy.api#auth",
              "smithy.api#authDefinition",
              "smithy.api#box",
              "smithy.api#clientOptional",
              "smithy.api#cors",
              "smithy.api#default",
              "smithy.api#deprecated",
              "smithy.api#documentation",
              "smithy.api#endpoint",
              "smithy.api#enum",
              "smithy.api#enumValue",
              "smithy.api#error",
              "smithy.api#eventHeader",
              "smithy.api#eventPayload",
              "smithy.api#examples",
              "smithy.api#externalDocumentation",
              "smithy.api#hostLabel",
              "smithy.api#http",
              "smithy.api#httpApiKeyAuth",
              "smithy.api#httpBasicAuth",
              "smithy.api#httpBearerAuth",
              "smithy.api#httpChecksumRequired",
              "smithy.api#httpDigestAuth",
              "smithy.api#httpError",
              "smithy.api#httpHeader",
              "smithy.api#httpLabel",
              "smithy.api#httpPayload",
              "smithy.api#httpPrefixHeaders",
              "smithy.api#httpQuery",
              "smithy.api#httpQueryParams",
              "smithy.api#httpResponseCode",
              "smithy.api#idempotencyToken",
              "smithy.api#idempotent",
              "smithy.api#idRef",
              "smithy.api#input",
              "smithy.api#internal",
              "smithy.api#jsonName",
              "smithy.api#length",
              "smithy.api#mediaType",
              "smithy.api#mixin",
              "smithy.api#nestedProperties",
              "smithy.api#noReplace",
              "smithy.api#notProperty",
              "smithy.api#optionalAuth",
              "smithy.api#output",
              "smithy.api#paginated",
              "smithy.api#pattern",
              "smithy.api#private",
              "smithy.api#property",
              "smithy.api#protocolDefinition",
              "smithy.api#range",
              "smithy.api#readonly",
              "smithy.api#recommended",
              "smithy.api#references",
              "smithy.api#required",
              "smithy.api#requiresLength",
              "smithy.api#resourceIdentifier",
              "smithy.api#retryable",
              "smithy.api#sensitive",
              "smithy.api#since",
              "smithy.api#sparse",
              "smithy.api#streaming",
              "smithy.api#suppress",
              "smithy.api#tags",
              "smithy.api#timestampFormat",
              "smithy.api#title",
              "smithy.api#trait",
              "smithy.api#uniqueItems",
              "smithy.api#unitType",
              "smithy.api#unstable",
              "smithy.api#xmlAttribute",
              "smithy.api#xmlFlattened",
              "smithy.api#xmlName",
              "smithy.api#xmlNamespace"
          ],
          "traitNames": [
              "smithy.api#authDefinition",
              "smithy.api#box",
              "smithy.api#default",
              "smithy.api#deprecated",
              "smithy.api#documentation",
              "smithy.api#enumValue",
              "smithy.api#externalDocumentation",
              "smithy.api#idRef",
              "smithy.api#length",
              "smithy.api#notProperty",
              "smithy.api#pattern",
              "smithy.api#private",
              "smithy.api#range",
              "smithy.api#required",
              "smithy.api#tags",
              "smithy.api#trait",
              "smithy.api#uniqueItems",
              "smithy.api#unitType",
              "smithy.api#unstable",
              "smithy.synthetic#enum"
          ],
          "validationEvents": [],
          "version": "1.0"
      }
    • After
      {
          "metadata": {},
          "operationShapeIds": [
              "smithy.example#ChangeCard"
          ],
          "projection": {
              "abstract": false,
              "imports": [],
              "plugins": {},
              "transforms": []
          },
          "projectionName": "TEST",
          "resourceShapeIds": [],
          "serviceShapeIds": [
              "smithy.example#Example"
          ],
          "traitDefNames": [
              "smithy.api#auth",
              "smithy.api#authDefinition",
              "smithy.api#box",
              "smithy.api#clientOptional",
              "smithy.api#cors",
              "smithy.api#default",
              "smithy.api#deprecated",
              "smithy.api#documentation",
              "smithy.api#endpoint",
              "smithy.api#enum",
              "smithy.api#enumValue",
              "smithy.api#error",
              "smithy.api#eventHeader",
              "smithy.api#eventPayload",
              "smithy.api#examples",
              "smithy.api#externalDocumentation",
              "smithy.api#hostLabel",
              "smithy.api#http",
              "smithy.api#httpApiKeyAuth",
              "smithy.api#httpBasicAuth",
              "smithy.api#httpBearerAuth",
              "smithy.api#httpChecksumRequired",
              "smithy.api#httpDigestAuth",
              "smithy.api#httpError",
              "smithy.api#httpHeader",
              "smithy.api#httpLabel",
              "smithy.api#httpPayload",
              "smithy.api#httpPrefixHeaders",
              "smithy.api#httpQuery",
              "smithy.api#httpQueryParams",
              "smithy.api#httpResponseCode",
              "smithy.api#idempotencyToken",
              "smithy.api#idempotent",
              "smithy.api#idRef",
              "smithy.api#input",
              "smithy.api#internal",
              "smithy.api#jsonName",
              "smithy.api#length",
              "smithy.api#mediaType",
              "smithy.api#mixin",
              "smithy.api#nestedProperties",
              "smithy.api#noReplace",
              "smithy.api#notProperty",
              "smithy.api#optionalAuth",
              "smithy.api#output",
              "smithy.api#paginated",
              "smithy.api#pattern",
              "smithy.api#private",
              "smithy.api#property",
              "smithy.api#protocolDefinition",
              "smithy.api#range",
              "smithy.api#readonly",
              "smithy.api#recommended",
              "smithy.api#references",
              "smithy.api#required",
              "smithy.api#requiresLength",
              "smithy.api#resourceIdentifier",
              "smithy.api#retryable",
              "smithy.api#sensitive",
              "smithy.api#since",
              "smithy.api#sparse",
              "smithy.api#streaming",
              "smithy.api#suppress",
              "smithy.api#tags",
              "smithy.api#timestampFormat",
              "smithy.api#title",
              "smithy.api#trait",
              "smithy.api#uniqueItems",
              "smithy.api#unitType",
              "smithy.api#unstable",
              "smithy.api#xmlAttribute",
              "smithy.api#xmlFlattened",
              "smithy.api#xmlName",
              "smithy.api#xmlNamespace"
          ],
          "traitNames": [
              "smithy.api#authDefinition",
              "smithy.api#box",
              "smithy.api#default",
              "smithy.api#deprecated",
              "smithy.api#documentation",
              "smithy.api#enumValue",
              "smithy.api#externalDocumentation",
              "smithy.api#idRef",
              "smithy.api#length",
              "smithy.api#notProperty",
              "smithy.api#pattern",
              "smithy.api#private",
              "smithy.api#range",
              "smithy.api#required",
              "smithy.api#tags",
              "smithy.api#trait",
              "smithy.api#uniqueItems",
              "smithy.api#unitType",
              "smithy.api#unstable"
          ],
          "validationEvents": [],
          "version": "1.0"
      }

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

@syall syall force-pushed the synthetic branch 2 times, most recently from 535de07 to 1c5b0e4 Compare August 29, 2022 19:59
@syall syall marked this pull request as ready for review August 29, 2022 20:13
@syall syall requested a review from a team as a code owner August 29, 2022 20:13
Copy link
Contributor

@gosar gosar left a comment

Choose a reason for hiding this comment

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

Could you add a test that confirms the expected behavior?

@syall syall force-pushed the synthetic branch 2 times, most recently from a1a94a7 to 2b68b2b Compare August 29, 2022 21:33
@syall syall requested a review from gosar August 29, 2022 21:51
@syall syall merged commit 467dbae into smithy-lang:main Aug 29, 2022
@syall syall deleted the synthetic branch August 29, 2022 22:38
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.

3 participants