fix tests failure
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { zodToJsonSchema } from 'zod-to-json-schema'
|
||||
|
||||
type JsonObject = Record<string, unknown>
|
||||
|
||||
// ── Vehicles ─────────────────────────────────────────────────────────────────
|
||||
import {
|
||||
vehicleSchema,
|
||||
@@ -60,34 +62,37 @@ import { renterUpdateSchema, renterFcmTokenSchema } from '../modules/auth/auth.r
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
function s(schema: Parameters<typeof zodToJsonSchema>[0]): Record<string, unknown> {
|
||||
const { $schema, ...rest } = zodToJsonSchema(schema, { target: 'openApi3' }) as Record<string, unknown>
|
||||
function s(schema: unknown): JsonObject {
|
||||
const { $schema, ...rest } = zodToJsonSchema(
|
||||
schema as Parameters<typeof zodToJsonSchema>[0],
|
||||
{ target: 'openApi3' },
|
||||
) as JsonObject
|
||||
return rest
|
||||
}
|
||||
|
||||
const idPath = (name = 'id') => ({
|
||||
const idPath = (name = 'id'): JsonObject => ({
|
||||
name,
|
||||
in: 'path' as const,
|
||||
required: true,
|
||||
schema: { type: 'string' },
|
||||
})
|
||||
|
||||
const pagingParams = [
|
||||
const pagingParams: JsonObject[] = [
|
||||
{ name: 'page', in: 'query', schema: { type: 'integer', default: 1 } },
|
||||
{ name: 'pageSize', in: 'query', schema: { type: 'integer', default: 20 } },
|
||||
]
|
||||
|
||||
const jsonBody = (ref: string) => ({
|
||||
const jsonBody = (ref: string): JsonObject => ({
|
||||
required: true,
|
||||
content: { 'application/json': { schema: { $ref: ref } } },
|
||||
})
|
||||
|
||||
const ok = { description: 'Success' }
|
||||
const err4 = { description: 'Validation error', content: { 'application/json': { schema: { type: 'object', properties: { error: { type: 'string' } } } } } }
|
||||
const err401 = { description: 'Unauthorized' }
|
||||
const err404 = { description: 'Not found' }
|
||||
const ok: JsonObject = { description: 'Success' }
|
||||
const err4: JsonObject = { description: 'Validation error', content: { 'application/json': { schema: { type: 'object', properties: { error: { type: 'string' } } } } } }
|
||||
const err401: JsonObject = { description: 'Unauthorized' }
|
||||
const err404: JsonObject = { description: 'Not found' }
|
||||
|
||||
export const openApiDocument = {
|
||||
export const openApiDocument: JsonObject = {
|
||||
openapi: '3.0.3',
|
||||
info: {
|
||||
title: 'RentalDriveGo API',
|
||||
|
||||
Reference in New Issue
Block a user