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

Promote certain failures to fail the build (was "Fail build when using Unreferenced shapes") #856

Closed
filletofish opened this issue Jul 6, 2021 · 1 comment · Fixed by #1890
Labels
feature-request A feature should be added or improved.

Comments

@filletofish
Copy link

HI all,

Is it possible to fail the build when discovering Unreferenced shape in the model?

For example, instead of receiving this note in the build logs, I would have it as Error and fail the whole build.

     [java] NOTE: com.example.service#InvalidInputException (UnreferencedShape)
     [java]      @ /path/to/smithy-model/errors.smithy
     [java]      |
     [java]   15 | structure InvalidInputException {
     [java]      | ^
     [java]      = The structure shape is not connected to from any service shape.

I personally sometimes miss those notes from the build logs. Then I waste time on finding the root cause for the errors in the service, only to find out that I forgot to reference the shape properly. If I had an option to enable this flag and fail my builds, it would save me some time during implementation.

@mtdowling mtdowling added the feature-request A feature should be added or improved. label Jul 8, 2021
@mtdowling
Copy link
Member

mtdowling commented Jul 8, 2021

I could see this as fitting nicely as a smithy-build.json configuration setting. Putting it in model metadata alongside validators and suppressions seems like the wrong approach because other teams building your model might not care about UnreferencedShapes. For example:

{
    "version": "1.0",
    "validation": {
        "elevate": [
            {"id": "UnreferencedShape", "severity": "DANGER"}
        ]
    }
}

Not sure if "elevate" is the right word. The use of an object rather than just a list of strings allows us to add more features too (like if we want to limit the elevation to specific namespaces or to specific selectors).

Edit: I like "severityOverrides" for this now, and if we require a namespace predicate, then it can live in metadata without issue.

@mtdowling mtdowling changed the title Fail build when using Unreferenced shapes Promote certain failures to fail the build (was "Fail build when using Unreferenced shapes") Jan 19, 2022
mtdowling added a commit that referenced this issue Jul 28, 2023
mtdowling added a commit that referenced this issue Jul 28, 2023
severityOverride cannot set an event to SUPPRESSED. Use suppressions
for that. It cannot lower the severity of an event, only elevate. This
prevents a backdoor for disabling built-in validation or ignoring
ERROR events.

Closes #856
mtdowling added a commit that referenced this issue Jul 28, 2023
severityOverride cannot set an event to SUPPRESSED. Use suppressions
for that. It cannot lower the severity of an event, only elevate. This
prevents a backdoor for disabling built-in validation or ignoring
ERROR events.

Closes #856
mtdowling added a commit that referenced this issue Aug 2, 2023
severityOverride cannot set an event to SUPPRESSED. Use suppressions
for that. It cannot lower the severity of an event, only elevate. This
prevents a backdoor for disabling built-in validation or ignoring
ERROR events.

Closes #856
mtdowling added a commit that referenced this issue Aug 2, 2023
severityOverride cannot set an event to SUPPRESSED. Use suppressions
for that. It cannot lower the severity of an event, only elevate. This
prevents a backdoor for disabling built-in validation or ignoring
ERROR events.

Closes #856
syall pushed a commit to Xtansia/smithy that referenced this issue Aug 11, 2023
severityOverride cannot set an event to SUPPRESSED. Use suppressions
for that. It cannot lower the severity of an event, only elevate. This
prevents a backdoor for disabling built-in validation or ignoring
ERROR events.

Closes smithy-lang#856
alextwoods pushed a commit to alextwoods/smithy that referenced this issue Sep 15, 2023
severityOverride cannot set an event to SUPPRESSED. Use suppressions
for that. It cannot lower the severity of an event, only elevate. This
prevents a backdoor for disabling built-in validation or ignoring
ERROR events.

Closes smithy-lang#856
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants