Releases: BitGo/api-ts
Releases · BitGo/api-ts
@api-ts/[email protected]
@api-ts/openapi-generator 5.7.0 (2025-03-05)
Features
-
Output boolean query parameters as booleans instead of string enums (#1017)
This feature update changes how boolean parameters are represented in the OpenAPI specification generated by api-ts. Previously, boolean values in query parameters were represented as string enums with values "true" and "false". With this change, they are now represented as native OpenAPI boolean types.
Concretely, this httpRoute:
import * as t from 'io-ts'; import * as h from '@api-ts/io-ts-http'; import { BooleanFromString } from 'io-ts-types'; export const route = h.httpRoute({ path: '/resources', method: 'GET', request: h.httpRequest({ query: { // Boolean parameters isActive: BooleanFromString, includeDeleted: BooleanFromString, // Mixed boolean/number union filterOption: t.union([BooleanFromString, t.number]) } }), response: { 200: t.type({ results: t.array(t.string), pagination: t.type({ hasMore: t.boolean }) }) } });
now generates the following OpenAPI specification:
{ "openapi": "3.0.3", "paths": { "/resources": { "get": { "parameters": [ { "name": "isActive", "in": "query", "required": true, "schema": { - "type": "string", - "enum": ["true", "false"] + "type": "boolean" } }, { "name": "includeDeleted", "in": "query", "required": true, "schema": { - "type": "string", - "enum": ["true", "false"] + "type": "boolean" } }, { "name": "filterOption", "in": "query", "required": true, "schema": { "oneOf": [ - { "type": "string", "enum": ["true", "false"] }, + { "type": "boolean" }, { "type": "number" } ] } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "results": { "type": "array", "items": { "type": "string" } }, "pagination": { "type": "object", "properties": { "hasMore": { "type": "boolean" } }, "required": ["hasMore"] } }, "required": ["results", "pagination"] } } } } } } } } }
This update aligns with OpenAPI best practices by using native types rather than string-based enumerations for boolean query parameters in API specifications.
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/[email protected]
@api-ts/typed-express-router 1.1.13 (2024-12-23)
Dependencies
- @api-ts/superagent-wrapper: upgraded to 1.3.3