diff --git a/src/lib/blueprint.ts b/src/lib/blueprint.ts index a14aa5c0..a87b5b69 100644 --- a/src/lib/blueprint.ts +++ b/src/lib/blueprint.ts @@ -1,23 +1,17 @@ import type { Openapi } from './openapi.js' -interface Parameter { +export interface Blueprint { name: string - isRequired: boolean - description: string -} - -interface Response { - description: string + routes: Route[] } - -type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' - interface Endpoint { name: string path: string - method: Method[] - semanticMethod?: string - routeDescription?: string | undefined + methods: Method[] + semanticMethod: string + description: string | null + isDeprecated: boolean + depractionMessage: string parameters: Parameter[] response: Response } @@ -25,9 +19,10 @@ interface Endpoint { interface Route { name: string path: string + description: string | null namespace: Namespace | null endpoints: Endpoint[] - subroutes: Route[] | null + subroutes: Route[] } interface Namespace { @@ -35,11 +30,19 @@ interface Namespace { path: string } -export interface Blueprint { + +interface Parameter { name: string - routes: Route[] + isRequired: boolean + description: string } +interface Response { + description: string +} + +type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' + export interface TypesModule { openapi: Openapi } @@ -60,9 +63,9 @@ export const createBlueprint = ({ openapi }: TypesModule): Blueprint => { endpoints.push({ name: operation.operationId, path, - method: [method.toUpperCase() as Method], - // TODO: fix routeDescription - routeDescription: operation.summary, + methods: [method.toUpperCase() as Method], + // TODO: fix description of route + description: operation.summary || 'No Description', parameters: [], response: { description: @@ -77,7 +80,7 @@ export const createBlueprint = ({ openapi }: TypesModule): Blueprint => { namespace, endpoints, // TODO: implement optional subroutes extraction - subroutes: null, + subroutes: '', }) } }