Validate required scope defined in security schemes
@@ -109,6 +109,22 @@ func (m *MethodExpr) Validate() error {
}
}
}
+ for _, scope := range r.Scopes {
+ found := false
+ for _, s := range r.Schemes {
+ if s.Kind == OAuth2Kind || s.Kind == JWTKind {
+ for _, se := range s.Scopes {
+ if se.Name == scope {
+ found = true
+ break
+ }
+ }
+ }
+ }
+ if !found {
+ verr.Add(m, "security scope %q not found in any of the security schemes.", scope)
+ }
+ }
}
}
if m.Result != nil {
