Skip to content

Releases: nota/typed-api-spec

v0.6.0

23 Oct 00:31
6fd78ed

Choose a tag to compare

feat: upgrade typed-api-spec to support express@5 and @types/express@…

v0.5.4

27 Jun 02:14

Choose a tag to compare

(no breaking changes)

What's Changed

  • Export TypedString, JsonStringifyResult, Jsonify, JsonifyObject by @mpppk in #165

Full Changelog: v0.5.3...v0.5.4

v0.5.3

02 May 07:46

Choose a tag to compare

(no runtime breaking changes)

What's Changed

  • Fix JsonStringifyResult bug with tupple by @mpppk in #164
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

05 Apr 04:31

Choose a tag to compare

(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

05 Apr 03:26

Choose a tag to compare

v0.5.1 Pre-release
Pre-release

(no breaking changes)
See v0.5.2 release note

What's Changed

Full Changelog: v0.5.0...v0.5.1

v0.5.0

29 Mar 01:50

Choose a tag to compare

(no runtime breaking changes)

Breaking Changes (Type-Level)

  • The type of response.json now takes toJSON method 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

25 Mar 08:37

Choose a tag to compare

(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 => Date

What's Changed

Full Changelog: v0.4.2...v0.4.3

v0.4.2

25 Mar 04:05

Choose a tag to compare

(no breaking changes)

New Features

typed-api-spec now supports msw.

What's Changed

Full Changelog: v0.4.0...v0.4.2

v0.4.1

12 Mar 15:08

Choose a tag to compare

(no breaking changes)

What's Changed

  • Fix export

Full Changelog: v0.4.0...v0.4.1

v0.4.0

12 Mar 13:24

Choose a tag to compare

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. ZodApiEndpoints is no longer available, you should use ApiEndpointsSchema instead
    • You can use same type regardless of validation library

zod

  • anyZ is no longer available, you should implement it yourself as const anyZ = <T>() => z.any() as ZodType<T>

Express

  • validator(res.local.validate) returns StandarSchemaV1.Result instead of core/Result
  • validator(res.local.validate) is now an asynchronous function, you need await