What you get for each endpoint
…Request- the JSON body, with required fields non-optional and each field's pattern, range or default as a JSDoc comment.…PathParamsand…Query- for GET routes such as/v1/horoscope/daily/:sign, including the enum of signs.…Data- the payload insidedata(…Jobfor the three asynchronous report routes, whose 202 is a job handle).…Response- the full body:request_id,data,interpretationandmeta. The two chat-service routes that answer at the top level get only this one.
Names come from the path: POST /v1/dasha/vimshottari gives DashaVimshottariRequest, DashaVimshottariData, DashaVimshottariResponse. The envelope is described in the response envelope reference.
How the conversion works
A build script reads specs/api.openapi.json and specs/chat.openapi.json and converts each schema node: anyOf becomes a union (so the panchang's sunrise is string | null), enum a union of literals (the dasha levels is 1 | 2 | 3 | 4 | 5), integer a number marked integer, and an object keyed by arbitrary names a Record or index signature. Nothing is cut short: unions keep every member and nesting goes all the way down.
The output is committed with the site and a CI check fails when it no longer matches the spec, so the page cannot drift from the API.
Declared versus recorded response fields
For 85 of the 122 endpoints the spec declares data without a schema, because those routes return computed results whose shape is checked at runtime rather than declared. For them the spec carries a shape recorded from one real response to the endpoint's sample request. The generated …Data for those endpoints says so in its comment, every field is optional, and each array shows the element shape that response contained. Request types are always the declared, validated contract. The response JSON explorer uses the same flag.
Common mistakes
- Treating recorded fields as guaranteed. A field present in the sample may be absent for another chart (an empty list, a missing optional block). Narrow before you use it.
- Typing the whole body as `…Data`. Public-API results sit under
data; errors use{ request_id, error: { code, message, details } }instead. - Assuming integers are checked by TypeScript.
numberaccepts 330.5 fortz_offset_minutes; the server rejects it with 400. The JSDoc shows the range. - Regenerating by hand. For a whole typed client use
openapi-typescripton the live spec - see the typed client guide.
FAQ
- How is this different from running openapi-typescript?
- openapi-typescript produces one
pathsinterface for the whole API, addressed by URL. This page gives named interfaces for a single endpoint, ready to paste into a project that calls one or two routes. - Are the chat API endpoints included?
- Yes, from the chat service's own spec. The streaming route has no JSON body, so it gets only a request type and a note.
- What about the request headers?
- They are the same for every endpoint -
Authorization: Bearer <key>and, for POST,Content-Type: application/json- so they are not repeated per endpoint.