Releases: nota/typed-api-spec
Releases · nota/typed-api-spec
v0.6.0
v0.5.4
v0.5.3
(no runtime breaking changes)
What's Changed
JsonStringifyResult<[number, number]>
// v0.5.2 or earlier => number[]
// v0.5.3 or later => [number, number]Full Changelog: v0.5.2...v0.5.3
v0.5.2
(no breaking changes)
New Features
- The init parameter can now be omitted if no additional information is required. (See Doc)
What's Changed
Full Changelog: v0.5.0...v0.5.2
(v0.5.1 is pre-release, so changelog starts from v0.5.0)
v0.5.1
v0.5.0
(no runtime breaking changes)
Breaking Changes (Type-Level)
- The type of response.json now takes
toJSONmethod into account
const pathMap = {
"/users": { get: { responses: { 200: {body: z.object({date: z.date()})} } } }
} satisfies ApiEndpointsSchema;
const fetchT = fetch as FetchT<"", ToApiEndpoints<typeof pathMap>>;
const body = await (await fetchT("/users")).json()
// v0.4.3 or earlier => {date: Date}
// v0.5.0 or later => {date: string}What's Changed
Full Changelog: v0.4.3...v0.5.0
v0.4.3
(no runtime breaking changes)
Breaking Changes (Type-Level)
- The type inferred in the server and client has changed from Input to Output of schema
const pathMap = {
body: v.object({ date: v.pipe(v.string(), v.transform((s) => new Date(s)))}),
responses: {...},
} satisfies ApiSpecSchema;
type Body = ToApiSpec<typeof pathMap>["body"]["date"]
// v0.4.2 or earlier => string
// v0.4.3 or later => DateWhat's Changed
Full Changelog: v0.4.2...v0.4.3
v0.4.2
v0.4.1
v0.4.0
New Features
- typed-api-spec now supports standard-schema
- You can use any validation libraries which is compatible with standard-schema, like zod, valibot, ArcType, etc.
Breaking Changes
Schema
- validation library specific type helpers are removed
- e.g.
ZodApiEndpointsis no longer available, you should useApiEndpointsSchemainstead - You can use same type regardless of validation library
- e.g.
zod
anyZis no longer available, you should implement it yourself asconst anyZ = <T>() => z.any() as ZodType<T>
Express
- validator(
res.local.validate) returnsStandarSchemaV1.Resultinstead ofcore/Result - validator(
res.local.validate) is now an asynchronous function, you needawait