mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
feat: add descriptions to schema output
This commit is contained in:
parent
aae6306a5a
commit
9f388bf182
@ -32,6 +32,7 @@ const handlebarsPlugin = () => ({
|
||||
preventIndent: true,
|
||||
knownHelpersOnly: true,
|
||||
knownHelpers: {
|
||||
escapeQuotes: true,
|
||||
equals: true,
|
||||
notEquals: true,
|
||||
containsSpaces: true,
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
{
|
||||
type: '{{export}}',
|
||||
{{#if description}}
|
||||
description: '{{{escapeQuotes description}}}',
|
||||
{{/if}}
|
||||
contains: [{{#each properties}}{{>schema}}{{#unless @last}}, {{/unless}}{{/each}}],
|
||||
{{#if isReadOnly}}
|
||||
isReadOnly: {{{isReadOnly}}},
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
{{#if type}}
|
||||
type: '{{{base}}}',
|
||||
{{/if}}
|
||||
{{#if description}}
|
||||
description: '{{{escapeQuotes description}}}',
|
||||
{{/if}}
|
||||
{{#if isReadOnly}}
|
||||
isReadOnly: {{{isReadOnly}}},
|
||||
{{/if}}
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
{
|
||||
{{#if description}}
|
||||
description: '{{{escapeQuotes description}}}',
|
||||
{{/if}}
|
||||
properties: {
|
||||
{{#if properties}}
|
||||
{{#each properties}}
|
||||
|
||||
@ -10,6 +10,10 @@ export function registerHandlebarHelpers(root: {
|
||||
useOptions: boolean;
|
||||
useUnionTypes: boolean;
|
||||
}): void {
|
||||
Handlebars.registerHelper('escapeQuotes', function (value: string): string {
|
||||
return value.replace(/(['"])/g, '\\$1');
|
||||
});
|
||||
|
||||
Handlebars.registerHelper(
|
||||
'equals',
|
||||
function (this: any, a: string, b: string, options: Handlebars.HelperOptions): string {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user