Skip to content

Commit

Permalink
feat: output header descriptions as comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mashabow committed Jul 20, 2023
1 parent a960262 commit 67995e9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions samples/headers/@types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable */
export type X_Simple = string

/** This header has a description. */
export type X_Description = number

export type X_Ref = X_Simple
2 changes: 1 addition & 1 deletion src/buildV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export default (openapi: OpenAPIV3.Document) => {
})),
...headers.map(h => ({
name: h.name,
description: null,
description: typeof h.value === 'string' ? null : h.value.description,
text:
typeof h.value === 'string'
? h.value
Expand Down
2 changes: 1 addition & 1 deletion src/builderUtils/headers2Props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default (headers: OpenAPIV3.ComponentsObject['headers']) =>
} else {
const result = schema2value(target.schema, false)
if (!result) return null
value = result
value = { ...result, description: target.description ?? null }
}

return { name: defKey2defName(defKey), value }
Expand Down

0 comments on commit 67995e9

Please sign in to comment.