Add a new postprocessing hook 'add_api_servers' that dynamically configures
the servers array in the OpenAPI specification based on the request environment.
This hook:
- Detects the current environment (local, staging, or production) from the
request host
- Adds the current server URL as the primary option
- Includes production (https://api.prowler.com) as a fallback option when
generating from non-production environments
- Enables users to toggle between local and production servers in Mintlify's
API playground via a dropdown
Server detection logic:
- localhost/127.0.0.1 → "Local Development Server"
- hosts with 'dev' or 'staging' → "Development/Staging API"
- api.prowler.com → "Prowler Cloud API"
This enables the "Try it out" feature in Mintlify documentation and allows
testing against different environments without modifying the spec.
Add three postprocessing hooks to fix OpenAPI 3.0.x compatibility issues
generated by drf-spectacular-jsonapi:
1. fix_empty_id_fields: Fixes empty id field definitions ({}) in JSON:API
request schemas (particularly PATCH/update requests) by replacing them
with proper schema: {"type": "string", "format": "uuid", "description": "..."}
2. fix_pattern_properties: Converts patternProperties to additionalProperties
for OpenAPI 3.0 compatibility. patternProperties is only available in
OpenAPI 3.1+, but drf-spectacular generates 3.0.3 specs. This is needed
for the Prowler mutelist configuration which uses dynamic keys.
3. fix_type_formats: Fixes invalid type values like "email" that
drf-spectacular generates from Django's EmailField. Converts them to
proper OpenAPI format: "type": "string" with "format": "email".
Also handles "url" → "uri" and "uuid" formats.
These hooks ensure the generated OpenAPI schema validates correctly with
Mintlify and other OpenAPI 3.0.x tools.