Skip to content

Commit

Permalink
add Response, implementation guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
kainpets committed Jun 25, 2024
1 parent bc53e69 commit c1fbc27
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/lib/blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ export interface Blueprint {
interface Route {
name: string
path: string
description: string | null
// descriptions will default to an empty string and emit a warning, e.g.
// if (description.trim().length === 0) console.warn(`... has an empty description`)
description: string
namespace: Namespace | null
endpoints: Endpoint[]
subroutes: Route[]
}

interface Namespace {
name: string
description: string
path: string
}

Expand All @@ -25,10 +28,12 @@ interface Endpoint {
methods: Method[]
semanticMethod: Method
preferredMethod: Method
description: string | null
description: string
// if (isDeprecated && deprecationMessage.trim().length === 0) console.warn(`... has an empty deprecation message`)
isDeprecated: boolean
deprecationMessage: string
parameters: Parameter[]
request: Request
response: Response
}

Expand All @@ -41,6 +46,13 @@ interface Parameter {
description: string
}

interface Request {
methods: Method[]
semanticMethod: Method
preferredMethod: Method
parameters: Parameter[]
}

interface Response {
description: string
}
Expand All @@ -62,7 +74,7 @@ export const createBlueprint = ({ openapi }: TypesModule): Blueprint => {
const namespaceName = operation.tags?.[0] ?? null
const namespace: Namespace | null =
namespaceName != null
? { name: namespaceName, path: namespaceName }
? { name: namespaceName, description: '', path: namespaceName }
: null

endpoints.push({

Check failure on line 80 in src/lib/blueprint.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v18)

Argument of type '{ name: string; path: string; methods: Method[]; description: string; parameters: { name: string; description: string; isRequired: false; isDeprecated: false; deprecationMessage: string; }[]; ... 4 more ...; deprecationMessage: string; }' is not assignable to parameter of type 'Endpoint'.

Check failure on line 80 in src/lib/blueprint.ts

View workflow job for this annotation

GitHub Actions / Typecheck (Node.js v20)

Argument of type '{ name: string; path: string; methods: Method[]; description: string; parameters: { name: string; description: string; isRequired: false; isDeprecated: false; deprecationMessage: string; }[]; ... 4 more ...; deprecationMessage: string; }' is not assignable to parameter of type 'Endpoint'.

Check failure on line 80 in src/lib/blueprint.ts

View workflow job for this annotation

GitHub Actions / Build / Package

Argument of type '{ name: string; path: string; methods: Method[]; description: string; parameters: { name: string; description: string; isRequired: false; isDeprecated: false; deprecationMessage: string; }[]; ... 4 more ...; deprecationMessage: string; }' is not assignable to parameter of type 'Endpoint'.
Expand Down Expand Up @@ -97,7 +109,7 @@ export const createBlueprint = ({ openapi }: TypesModule): Blueprint => {
endpoints,
// TODO: implement optional subroutes extraction
subroutes: [],
description: null,
description: '',
})
}
}
Expand Down

0 comments on commit c1fbc27

Please sign in to comment.