Skip to content

Commit

Permalink
fix: swagger json schema
Browse files Browse the repository at this point in the history
  • Loading branch information
tea-artist committed Dec 20, 2024
1 parent bcbb977 commit 42ae4bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/openapi/src/generate.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function registerAllRoute() {
type: 'http',
scheme: 'bearer',
});
registry.registerPath({ ...routeObj, security: [{ [bearerAuth.name]: [] }] });
const path = routeObj.path.startsWith('/') ? routeObj.path : `/${routeObj.path}`;
registry.registerPath({ ...routeObj, path, security: [{ [bearerAuth.name]: [] }] });
}
return registry;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi/src/share/view-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const shareViewGetVoSchema = z.object({
shareMeta: shareViewMetaSchema.optional(),
view: viewVoSchema.optional(),
fields: fieldVoSchema.array(),
records: recordSchema.array().openapi('first 50 records'),
records: recordSchema.array().openapi({ description: 'first 50 records' }),
extra: z
.object({
groupPoints: groupPointsVoSchema.optional().openapi({
Expand Down
5 changes: 4 additions & 1 deletion packages/openapi/src/share/view-link-records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export const shareViewLinkRecordsRoSchema = getRecordsRoSchema
.extend({
fieldId: z.string(),
search: z.string().optional(),
type: z.nativeEnum(ShareViewLinkRecordsType).optional().openapi('Only used for plugin views'),
type: z
.nativeEnum(ShareViewLinkRecordsType)
.optional()
.openapi({ description: 'Only used for plugin views' }),
});

export type IShareViewLinkRecordsRo = z.infer<typeof shareViewLinkRecordsRoSchema>;
Expand Down

0 comments on commit 42ae4bb

Please sign in to comment.