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