We maintain a multi-file JSON Schema tree (~110 files) that is the source of truth for several generated client packages. Every discriminated union in it crosses a file boundary, so we carry a ~200-line bundling script whose only remaining job is to flatten each spec into one document so mappings resolve. With this fixed, that script goes away and the generator can read our sources directly.
The client generator resolves a cross-file $ref fine, but a discriminator.mapping value pointing at that same file fails with invalid_discriminator_mapping. The effect is that a spec split across multiple files works right up until it uses a discriminated union, which forces consumers to pre-bundle every spec into a single document purely to satisfy mapping resolution.
We maintain a multi-file JSON Schema tree (~110 files) that is the source of truth for several generated client packages. Every discriminated union in it crosses a file boundary, so we carry a ~200-line bundling script whose only remaining job is to flatten each spec into one document so mappings resolve. With this fixed, that script goes away and the generator can read our sources directly.
The client generator resolves a cross-file $ref fine, but a discriminator.mapping value pointing at that same file fails with invalid_discriminator_mapping. The effect is that a spec split across multiple files works right up until it uses a discriminated union, which forces consumers to pre-bundle every spec into a single document purely to satisfy mapping resolution.