Skip to content

Commit c972d9b

Browse files
committed
extracted the parameters tests
1 parent 9b011d5 commit c972d9b

File tree

5 files changed

+578
-573
lines changed

5 files changed

+578
-573
lines changed

spec/lib/helpers.ts

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import { OpenAPIGenerator, OpenApiVersion } from '../../src/openapi-generator';
1+
import {
2+
OpenAPIGenerator,
3+
OpenAPIObjectConfig,
4+
OpenApiVersion,
5+
} from '../../src/openapi-generator';
26
import type { SchemasObject } from 'openapi3-ts';
37
import type { ZodSchema } from 'zod';
4-
import { OpenAPIRegistry } from '../../src/openapi-registry';
8+
import { OpenAPIRegistry, RouteConfig } from '../../src/openapi-registry';
59

610
export function createSchemas(
711
zodSchemas: ZodSchema<any>[],
@@ -38,3 +42,30 @@ export function registerSchema<T extends ZodSchema<any>>(
3842

3943
return registry.register(refId, zodSchema);
4044
}
45+
46+
export function createTestRoute(props: Partial<RouteConfig> = {}): RouteConfig {
47+
return {
48+
method: 'get',
49+
path: '/',
50+
responses: {
51+
200: {
52+
description: 'OK Response',
53+
},
54+
},
55+
...props,
56+
};
57+
}
58+
59+
export const testDocConfig: OpenAPIObjectConfig = {
60+
info: {
61+
version: '1.0.0',
62+
title: 'Swagger Petstore',
63+
description: 'A sample API',
64+
termsOfService: 'http://swagger.io/terms/',
65+
license: {
66+
name: 'Apache 2.0',
67+
url: 'https://www.apache.org/licenses/LICENSE-2.0.html',
68+
},
69+
},
70+
servers: [{ url: 'v1' }],
71+
};

0 commit comments

Comments
 (0)