nginxinc / nginx-go-crossplane

A library for working with NGINX configs in Go
Apache License 2.0
52 stars 14 forks source link

Fix analyze map body validation #30

Closed valyria257 closed 1 year ago

valyria257 commented 1 year ago

Proposed changes

The current validation of a map block would check that all parameters had exactly 1 argument. This would cause parse errors on valid configs with other "map-like" directives and "special parameters". For example, the volatile parameter can be used without any additional arguments inside the map directive. Different directives also have different constraints on how many arguments a parameter can have, for example, parameter's in match can have 1 or more arguments.

http {
    match check {
        require $variable ...;
    }
}

This improves the previous rudimentary validation to use the bit masks, so each directive can be customized so their bodies can have different validation checks.

Checklist

Before creating a PR, run through this checklist and mark each as complete.