Skip to content

Commit 0e5f5e4

Browse files
author
John Cutburth
committed
add title to schema output
1 parent ea57e06 commit 0e5f5e4

30 files changed

+43
-0
lines changed

rollup.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const handlebarsPlugin = () => ({
3838
enumerator: true,
3939
escapeComment: true,
4040
escapeDescription: true,
41+
escapeTitle: true,
4142
camelCase: true,
4243
},
4344
});

src/client/interfaces/Model.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { Schema } from './Schema';
33

44
export interface Model extends Schema {
55
name: string;
6+
title: string | null;
67
export: 'reference' | 'generic' | 'enum' | 'array' | 'dictionary' | 'interface' | 'one-of' | 'any-of' | 'all-of';
78
type: string;
89
base: string;

src/openApi/v2/interfaces/OpenApiParameter.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { OpenApiSchema } from './OpenApiSchema';
99
*/
1010
export interface OpenApiParameter extends OpenApiReference, WithEnumExtension, WithNullableExtension {
1111
name: string;
12+
title?: string;
1213
in: 'path' | 'query' | 'header' | 'formData' | 'body';
1314
description?: string;
1415
required?: boolean;

src/openApi/v2/interfaces/OpenApiResponse.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { OpenApiSchema } from './OpenApiSchema';
99
*/
1010
export interface OpenApiResponse extends OpenApiReference {
1111
description: string;
12+
title: string;
1213
schema?: OpenApiSchema & OpenApiReference;
1314
headers?: Dictionary<OpenApiHeader>;
1415
examples?: OpenApiExample;

src/openApi/v2/parser/getModel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const getModel = (
1616
): Model => {
1717
const model: Model = {
1818
name,
19+
title: definition.title || null,
1920
export: 'interface',
2021
type: 'any',
2122
base: 'any',

src/openApi/v2/parser/getModelComposition.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const getModelComposition = (
6969
if (properties.length) {
7070
composition.properties.push({
7171
name: 'properties',
72+
title: '',
7273
export: 'interface',
7374
type: 'any',
7475
base: 'any',

src/openApi/v2/parser/getModelProperties.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const getModelProperties = (openApi: OpenApi, definition: OpenApiSchema,
1919
const model = getType(property.$ref);
2020
models.push({
2121
name: escapeName(propertyName),
22+
title: property.title || null,
2223
export: 'reference',
2324
type: model.type,
2425
base: model.base,
@@ -52,6 +53,7 @@ export const getModelProperties = (openApi: OpenApi, definition: OpenApiSchema,
5253
const model = getModel(openApi, property);
5354
models.push({
5455
name: escapeName(propertyName),
56+
title: property.title || null,
5557
export: model.export,
5658
type: model.type,
5759
base: model.base,

src/openApi/v2/parser/getOperationParameter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const getOperationParameter = (openApi: OpenApi, parameter: OpenApiParame
1717
prop: parameter.name,
1818
export: 'interface',
1919
name: getOperationParameterName(parameter.name),
20+
title: parameter.title || null,
2021
type: 'any',
2122
base: 'any',
2223
template: null,

src/openApi/v2/parser/getOperationResponse.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const getOperationResponse = (
1515
const operationResponse: OperationResponse = {
1616
in: 'response',
1717
name: '',
18+
title: response.title || null,
1819
code: responseCode,
1920
description: response.description || null,
2021
export: 'generic',

src/openApi/v2/parser/getOperationResults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const getOperationResults = (operationResponses: OperationResponse[]): Op
2424
operationResults.push({
2525
in: 'response',
2626
name: '',
27+
title: '',
2728
code: 200,
2829
description: '',
2930
export: 'generic',

0 commit comments

Comments
 (0)