Documentation
¶
Overview ¶
Package validate checks a feature-flags document against a project catalog: every cross-reference the JSON Schemas cannot express, plus the name and size rules, so callers that never run the schemas (the Flag Console, the library on load) still reject bad documents. The AppConfig validator Lambda runs the same checks at deployment.
Index ¶
Constants ¶
const ( // MaxDocumentBytes is the AppConfig hosted configuration and deployment // size quota (2,048 KB by default; raising it needs an AWS approval). MaxDocumentBytes = 2048 * 1024 // WarnDocumentPercent is how full the quota may get before CheckSize // warns, leaving room to react before saves start failing. WarnDocumentPercent = 75 )
const MaxGroupValues = 200
MaxGroupValues is the most values a group may list. Larger, data-driven segments belong in a resolver or a custom operator.
Variables ¶
This section is empty.
Functions ¶
func CheckSize ¶
CheckSize checks a document as it will be stored. It returns an error over MaxDocumentBytes, which AppConfig would reject, and a warning over WarnDocumentPercent of it.
func ValidateCatalog ¶
ValidateCatalog checks a catalog on its own: names, types, custom operators not shadowing built-ins, and resolvers keyed by and requiring catalog attributes. The error, when not nil, is an *Error.
Types ¶
type Error ¶
type Error struct {
Problems []Problem
}
Error is returned when the documents are invalid. It lists every problem found, in a stable order.
type Problem ¶
Problem is one finding, located by Path, e.g. `flags.new_withdraw_flow.rules[1] "10% rollout".if[0]`.
func Validate ¶
Validate checks flags against catalog, including the catalog itself. Warnings never make the documents invalid; they are for the person editing (e.g. two rules of a flag share a name). The error, when not nil, is an *Error.
Validating the live flags against a new catalog catches removed attributes and operators; ValidateCatalogChange also catches retyped ones.
func ValidateCatalogChange ¶
func ValidateCatalogChange(prev, next *document.Catalog, flags *document.Flags) (warnings []Problem, err error)
ValidateCatalogChange checks a new catalog before it replaces prev. It runs Validate(flags, next), where flags are the flags that will be evaluated against next, and also fails for every attribute those flags use whose type differs between prev and next: a rollout bucket or an exists condition holds no value, so only prev shows the change. A nil prev skips the comparison.