feat(api): add react-query client generation and redesign api responses
This commit is contained in:
parent
6c9569ae40
commit
3a0ce64c00
12 changed files with 2026 additions and 119 deletions
|
@ -1,61 +1,8 @@
|
|||
import { createSwaggerSpec } from 'next-swagger-doc';
|
||||
|
||||
import swaggerConfig from '../../next-swagger-doc.json';
|
||||
|
||||
export const getApiDocs = async () => {
|
||||
const spec = createSwaggerSpec({
|
||||
apiFolder: 'src/app/api',
|
||||
definition: {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: 'MeetUP API',
|
||||
version: '1.0',
|
||||
},
|
||||
// components: {
|
||||
// securitySchemes: {
|
||||
// BearerAuth: {
|
||||
// type: "http",
|
||||
// scheme: "bearer",
|
||||
// bearerFormat: "JWT",
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
components:{
|
||||
schemas: {
|
||||
ErrorResponse: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
message: {
|
||||
type: 'string',
|
||||
description: 'Error message',
|
||||
},
|
||||
},
|
||||
},
|
||||
User: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
first_name: { type: 'string' },
|
||||
last_name: { type: 'string' },
|
||||
email: { type: 'string', format: 'email' },
|
||||
image: { type: 'string', format: 'uri' },
|
||||
timezone: { type: 'string', description: 'User timezone' },
|
||||
},
|
||||
},
|
||||
PublicUser: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string' },
|
||||
name: { type: 'string' },
|
||||
first_name: { type: 'string' },
|
||||
last_name: { type: 'string' },
|
||||
image: { type: 'string', format: 'uri' },
|
||||
timezone: { type: 'string', description: 'User timezone' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
security: [],
|
||||
},
|
||||
});
|
||||
const spec = createSwaggerSpec(swaggerConfig);
|
||||
return spec;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue