Repository navigation
fix(generate): emit TypeScript types; type /build's 207 and missing[] - #15
Merged
Merged
Conversation
… 207 and missing[] (#14) - scripts/openapi-to-ts.ts: pure OpenAPI → TS converter (objects, $ref, arrays, maps, enum/const, type lists, anyOf, JSDoc, Params interfaces); generate.ts now uses it and accepts a URL or a local spec path, then prettiers the output. - src/core/types.generated.ts regenerated from api.auto.dev/openapi (4,702 → ~1,400 lines of real types). - src/core/types.build.ts: hand-kept BuildResponse.missing[], BuildPartialResponse (207), BuildCatalog, isPartialBuild; the live spec still documents one 200 per route. - AutoDev.build() resolves AutoDevResponse<BuildResult>; types exported from the package root. - auto_build / CLI description names the 207 so MCP clients branch on build === null. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- converter: `not` renders as never (keeps anyOf arms), bare objects as Record<string, unknown>, multiline descriptions as proper JSDoc; scalarToTs takes one type. - generate.ts counts param interfaces from the spec, not by regexing its own output. - types.build.ts: BuildMissReason drops invalid_vin (a 404, never a 207); vehicle named BuildVehicle and exported. - CLI build command reads ENDPOINTS.build.description instead of a hand copy. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Closes #14.
Summary
The generator pasted JSON-schema objects inside
export interface; now it emits TypeScript./build's 207 andmissing[]are still absent fromapi.auto.dev/openapi, so they live by hand beside the generated file.Callers branch once:
Evidence
types.generated.tsline 687 was a schema blob;build()returnedunknown; the MCP description said nothing about the 207.After:
pnpm typecheck0 errors;pnpm test23 files / 154 tests pass, including newtest/scripts/openapi-to-ts.test.ts(refs, arrays, maps, enum/const/anyOf,not, JSDoc, Params), a client test that a 207 body passes through asdata, a type-level test onbuild(), and an MCP test thatauto_buildmentions the 207. Re-runningpnpm generateagainst the live spec reproduces the committed file byte-for-byte.Merge Danger
Door: two-way. Revert restores the old generator and file; nothing persisted.
Blast Radius: consumers
build()narrows fromAutoDevResponse<unknown>toAutoDevResponse<BuildResult>; code that castunknownkeeps compiling, code that passed it somewhere typedunknownis unaffected.ListingsFiltersetc.) keep their names; one newOpenrecallsVinParamsappears because the live spec now lists it.pnpm version patch && pnpm publishafter merge to reach users.🤖 Generated with Claude Code