Skip to content

Commit

Permalink
Merge pull request #4 from LeMikaelF/ignore-label-linting
Browse files Browse the repository at this point in the history
Remove lint for labels on resource references.
  • Loading branch information
withnocode authored Feb 8, 2024
2 parents 3e8fcfb + 022efdf commit 895ed27
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions internal/docs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"regexp"
"sort"
"strings"

"github.com/Jeffail/gabs/v2"
)

const labelExpression = `^[a-z0-9_]+$`
Expand All @@ -31,16 +29,7 @@ func ValidateLabel(label string) error {

var labelField = FieldString(
"label", "An optional label to use as an identifier for observability data such as metrics and logging.",
).OmitWhen(func(field, parent any) (string, bool) {
gObj := gabs.Wrap(parent)
if typeStr, exists := gObj.S("type").Data().(string); exists && typeStr == "resource" {
return "label field should be omitted when pointing to a resource", true
}
if resourceStr, exists := gObj.S("resource").Data().(string); exists && resourceStr != "" {
return "label field should be omitted when pointing to a resource", true
}
return "", false
}).AtVersion("3.44.0").LinterFunc(func(ctx LintContext, line, col int, v any) []Lint {
).AtVersion("3.44.0").LinterFunc(func(ctx LintContext, line, col int, v any) []Lint {
l, _ := v.(string)
if l == "" {
return nil
Expand Down

0 comments on commit 895ed27

Please sign in to comment.