mirror of
https://github.com/yusing/godoxy.git
synced 2026-02-24 11:24:52 +01:00
feat(route): add YAML anchor exclusion reason
Add ExcludedReasonYAMLAnchor to explicitly identify routes with "x-" prefix used for YAML anchors and references. These routes are removed before validation.
This commit is contained in:
@@ -749,6 +749,7 @@ const (
|
||||
ExcludedReasonNoPortSpecified
|
||||
ExcludedReasonBlacklisted
|
||||
ExcludedReasonBuildx
|
||||
ExcludedReasonYAMLAnchor
|
||||
ExcludedReasonOld
|
||||
)
|
||||
|
||||
@@ -768,6 +769,8 @@ func (re ExcludedReason) String() string {
|
||||
return "Blacklisted (backend service or database)"
|
||||
case ExcludedReasonBuildx:
|
||||
return "Buildx"
|
||||
case ExcludedReasonYAMLAnchor:
|
||||
return "YAML anchor or reference"
|
||||
case ExcludedReasonOld:
|
||||
return "Container renaming intermediate state"
|
||||
default:
|
||||
@@ -802,6 +805,12 @@ func (r *Route) findExcludedReason() ExcludedReason {
|
||||
} else if r.IsZeroPort() && r.Scheme != route.SchemeFileServer {
|
||||
return ExcludedReasonNoPortSpecified
|
||||
}
|
||||
// this should happen on validation API only,
|
||||
// those routes are removed before validation.
|
||||
// see removeXPrefix in provider/file.go
|
||||
if strings.HasPrefix(r.Alias, "x-") { // for YAML anchors and references
|
||||
return ExcludedReasonYAMLAnchor
|
||||
}
|
||||
if strings.HasSuffix(r.Alias, "-old") {
|
||||
return ExcludedReasonOld
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user