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

Make UnreferencedShape an opt-in linter instead #2119

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

mtdowling
Copy link
Member

UnreferencedShape is no longer an on-by-default validator that ensures shapes must be connected to a service shape. There are plenty of cases where teams might create models that define shared shapes and don't necessarily connect those shapes to services. Emitting an UnreferencedShape validation event for these cases is harmless, but also annoying and desensitizing developers for when a shape is actually unreferenced.

This commit instead adds a new smithy-linters validator called UnreferencedShape that allows an optional "rootShapeSelector" to be provided that defines the "root" shapes that all other shape must be connected to. It defaults to "service". You might want to customize this to indicate that other shapes are your roots (e.g., maybe there is a specific trait that makes a shape a root).

Closes #2093

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

@mtdowling mtdowling requested a review from a team as a code owner January 30, 2024 23:29
Copy link
Contributor

@JordonPhillips JordonPhillips left a comment

Choose a reason for hiding this comment

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

Also moving this back to smithy-model would be nice

UnreferencedShape is no longer an on-by-default validator that ensures
shapes must be connected to a service shape. There are plenty of cases
where teams might create models that define shared shapes and don't
necessarily connect those shapes to services. Emitting an
UnreferencedShape validation event for these cases is harmless, but
also annoying and desensitizing developers for when a shape is actually
unreferenced.

This commit instead adds a new smithy-model linter called
UnreferencedShape that allows an optional "rootShapeSelector" to be
provided that defines the "root" shapes that all other shape must be
connected to. It defaults to "service". You might want to customize
this to indicate that other shapes are your roots (e.g., maybe there
is a specific trait that makes a shape a root).

Closes #2093
…/ValidationEventDecoratorTest.java

Co-authored-by: Kevin Stich <[email protected]>
@mtdowling mtdowling requested a review from kstich February 8, 2024 21:38
@kstich kstich requested review from JordonPhillips and removed request for sugmanue and JordonPhillips February 8, 2024 22:43
@mtdowling mtdowling merged commit 9e67ec4 into main Feb 8, 2024
11 checks passed
@mtdowling mtdowling deleted the customize-unreferenced-shapes branch September 22, 2024 00:13
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.

Allow opting out of UnreferencedShape?
3 participants