Skip to content

Commit

Permalink
fix: returning a validation error in case of wrong configuration.
Browse files Browse the repository at this point in the history
As of now, while using deck to create a
route-scoped plugin with a `service` field
defined, the sync goes through the first
time but errors out subsequently. Under a
route, we do not want the user to add the
`service` field for a plugin. Thus, we are
checking for this specific scenario and
erroring out, instead of letting the sync
action go through.

For: Kong/deck#1353
  • Loading branch information
Prashansa-K committed Jan 9, 2025
1 parent 1f4216e commit 1bbbb8f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/file/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,10 @@ func (b *stateBuilder) ingestRoute(r FRoute) error {
// plugins for the route
var plugins []FPlugin
for _, p := range r.Plugins {
if p.Service != nil && !utils.Empty(p.Service.ID) {
return fmt.Errorf("nesting service (%v) under route-scoped plugin (%v) is not allowed", *p.Service.ID, *p.Name)
}

p.Route = utils.GetRouteReference(r.Route)
plugins = append(plugins, *p)
}
Expand Down

0 comments on commit 1bbbb8f

Please sign in to comment.