Skip to content

Commit 64fb4c9

Browse files
committed
chore: fix formatting with prettier 3.0.3
1 parent d9cb3ff commit 64fb4c9

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

packages/express-wrapper/test/server.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const GetHelloWorld = async (params: { id: string }) =>
100100
({
101101
type: 'ok',
102102
payload: params,
103-
} as const);
103+
}) as const;
104104

105105
test('should offer a delightful developer experience', async () => {
106106
const app = createServer(ApiSpec, (app: express.Application) => {

packages/openapi-generator/src/openapi.ts

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@ function schemaToOpenAPI(
2424
case 'object':
2525
return {
2626
type: 'object',
27-
properties: Object.entries(schema.properties).reduce((acc, [name, prop]) => {
28-
const innerSchema = schemaToOpenAPI(prop);
29-
if (innerSchema === undefined) {
30-
return acc;
31-
}
27+
properties: Object.entries(schema.properties).reduce(
28+
(acc, [name, prop]) => {
29+
const innerSchema = schemaToOpenAPI(prop);
30+
if (innerSchema === undefined) {
31+
return acc;
32+
}
3233

33-
return { ...acc, [name]: innerSchema };
34-
}, {} as Record<string, OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject>),
34+
return { ...acc, [name]: innerSchema };
35+
},
36+
{} as Record<string, OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject>,
37+
),
3538
required: schema.required,
3639
};
3740
case 'intersection':
@@ -127,21 +130,27 @@ export function convertRoutesToOpenAPI(
127130
routes: Route[],
128131
schemas: Components,
129132
): OpenAPIV3_1.Document {
130-
const paths = routes.reduce((acc, route) => {
131-
const [path, method, pathItem] = routeToOpenAPI(route);
132-
let pathObject = acc[path] ?? {};
133-
pathObject[method] = pathItem;
134-
return { ...acc, [path]: pathObject };
135-
}, {} as Record<string, Record<string, OpenAPIV3_1.PathItemObject>>);
133+
const paths = routes.reduce(
134+
(acc, route) => {
135+
const [path, method, pathItem] = routeToOpenAPI(route);
136+
let pathObject = acc[path] ?? {};
137+
pathObject[method] = pathItem;
138+
return { ...acc, [path]: pathObject };
139+
},
140+
{} as Record<string, Record<string, OpenAPIV3_1.PathItemObject>>,
141+
);
136142

137-
const openapiSchemas = Object.entries(schemas).reduce((acc, [name, schema]) => {
138-
const openapiSchema = schemaToOpenAPI(schema);
139-
if (openapiSchema === undefined) {
140-
return acc;
141-
} else {
142-
return { ...acc, [name]: openapiSchema };
143-
}
144-
}, {} as Record<string, OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject>);
143+
const openapiSchemas = Object.entries(schemas).reduce(
144+
(acc, [name, schema]) => {
145+
const openapiSchema = schemaToOpenAPI(schema);
146+
if (openapiSchema === undefined) {
147+
return acc;
148+
} else {
149+
return { ...acc, [name]: openapiSchema };
150+
}
151+
},
152+
{} as Record<string, OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject>,
153+
);
145154

146155
return {
147156
openapi: '3.1.0',

0 commit comments

Comments
 (0)