Validate config
validate_configValidate a Guard config dict against the installed pydantic model to confirm validity and catch unknown keys that pydantic silently ignores before runtime.
Instructions
Check a Guard config dict against the installed library's real pydantic model.
Use this to confirm a config is valid, or to find out why a setting seems to have no effect. Use config_fields instead when you do not yet know the setting's name.
Returns valid (bool), package, version, model, errors (type errors, each with field, message and input), unknown_fields (each with name and did_you_mean suggestions), deprecated (field and message) and construction_warnings. Unknown keys matter: pydantic silently ignores them, so a misspelled setting does nothing at runtime and raises no error anywhere else. construction_warnings carries guard-core's own logged-not-raised misconfiguration warnings: an unknown constructor keyword, a trusted_proxies or whitelist /0 network, and enabled_detection_categories empty while penetration detection is enabled.
Read-only: the config is validated in memory and never applied. If the library is not installed, or package is not recognized, returns an object with an error key (plus a hint when the cause is a missing install) instead of raising.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| config | Yes | The config as a JSON object of field names to values, exactly as you would pass it to the model's constructor | |
| package | No | Which Guard library's installed model to validate against. One of fastapi-guard (SecurityConfig), guard-core (SecurityConfig) or guard-agent (AgentConfig). Any other value returns an error object | fastapi-guard |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||