Contents
PR Summary
What problems was I solving
The generated admin gateway TypeScript/Zod client was rejecting valid server responses for document endpoints because nullable enum fields like sourceProviderType were emitted as type: [string, "null"] with an enum list, which the hey-api zod plugin interpreted as non-nullable. This caused runtime parse failures when the server returned null for fields such as sourceProviderType on uploaded documents.
What user-facing changes did I ship
Generated admin gateway client validators now correctly preserve null for nullable enum response fields (e.g. sourceProviderType, ogType, twitterCard), so API consumers will no longer see spurious validation errors for valid server responses. There are no UI or behavior changes to the admin gateway itself.
How I implemented it
Added a post-processing step in the admin gateway OpenAPI generator that recursively rewrites nullable enum schemas from type: [string, "null"] plus enum to an equivalent anyOf with a dedicated null branch, then regenerated openapi.yaml. Replaced the placeholder client test with a regression test that parses a complete-upload response containing sourceProviderType: null.
Description for the changelog
Normalize nullable enum schemas in the admin gateway OpenAPI output to anyOf so generated Zod/TypeScript clients preserve null branches. Regenerate the spec to include sourceProviderType on document responses and add a regression test for uploaded documents without a source provider.