Improve generated types: discriminated unions, schema flattening, spec overrides - #4
Merged
Merged
Conversation
Normalize selected empty allOf input base schemas from Record<string, never> to {} so intersection child configs are constructible, and add compile-time type tests plus spec hash pinning to keep generation deterministic.
Made-with: Cursor
Add a DataStreamCreateInput override so create() accepts either a single DLO object or an array, matching observed runtime API behavior while keeping generated schema types intact. Made-with: Cursor
- Discriminated unions for connector inputs (DataStreamConnectorInput, ConnectionCreateInput, ConnectionUpdateInput) generated from a config validated against the spec's oneOf entries. - Flatten 332 allOf schemas into plain object types for readable IntelliSense hovers and error messages. - Structured SCHEMA_OVERRIDES to patch spec bugs: relax incorrectly required fields (mappings, sourceFields, orgUnitIdentifierFieldName, recordModifiedFieldName) and fix dataLakeObjectInfo array-only type. - Add Simplify<T> utility type for complex intersections. - Service methods accept strict discriminated unions with raw type escape hatches for unknown connector types. - Add scripts/README.md documenting the generation pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DataStreamConnectorInput,ConnectionCreateInput,ConnectionUpdateInput) — generated from a config validated against the spec'soneOfentries. CheckingconnectorTypenow narrowsconnectorDetailsto the correct config type.allOfschemas are pre-resolved into flat object types at generation time, so IntelliSense hovers and error messages show readable property lists instead ofA & B & Cintersection chains.SCHEMA_OVERRIDES) — structured config to patch spec bugs: relaxes incorrectly required fields (mappings,sourceFields,orgUnitIdentifierFieldName,recordModifiedFieldName) and fixesdataLakeObjectInfoarray-only type to accept single objects.Simplify<T>utility type for complex intersections.scripts/README.md— documents the full generation pipeline, flattening, overrides, and discriminated union config.Test plan
npm run generate— validates all configs against the spec, no errors or warningsnpm run typecheck— clean compile includingscripts/type-tests.tsassertionsnpm test— 211 tests passnpm run build && npm pack— tarball builds with.d.tsfiles included