Skip to content

Commit 9e90e7b

Browse files
authored
feat(comment): Use the defined comment (#19)
1 parent 17aa008 commit 9e90e7b

File tree

16 files changed

+14
-43
lines changed

16 files changed

+14
-43
lines changed

src/Converter/v3/components/Header.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export const generateInterface = (
8484
return factory.InterfaceDeclaration.create({
8585
export: true,
8686
name: converterContext.escapeDeclarationText(name),
87-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#headerObject`,
8887
members: generatePropertySignatures(entryPoint, currentPoint, factory, headers, context, converterContext),
8988
});
9089
};

src/Converter/v3/components/Headers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export const generateNamespace = (
2222
store.addComponent("headers", {
2323
kind: "namespace",
2424
name: Name.Components.Headers,
25-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#componentsObject`,
2625
});
2726
Object.entries(headers).forEach(([name, header]) => {
2827
if (Guard.isReference(header)) {

src/Converter/v3/components/MediaType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const generatePropertySignature = (
1818
name: converterContext.escapePropertySignatureName(protocol),
1919
optional: false,
2020
type: ToTypeNode.convert(entryPoint, currentPoint, factory, schema, context, converterContext),
21+
comment: schema.description,
2122
});
2223
};
2324

@@ -50,6 +51,5 @@ export const generateInterface = (
5051
export: true,
5152
name,
5253
members: generatePropertySignatures(entryPoint, currentPoint, factory, content, context, converterContext),
53-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#mediaTypeObject`,
5454
});
5555
};

src/Converter/v3/components/Parameter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const generatePropertySignature = (
5353
return factory.PropertySignature.create({
5454
name: converterContext.escapePropertySignatureName(localRef.name),
5555
optional: false,
56+
comment: localRef.description,
5657
type: factory.TypeReferenceNode.create({
5758
name: context.resolveReferencePath(currentPoint, reference.path).name,
5859
}),
@@ -62,6 +63,7 @@ export const generatePropertySignature = (
6263
return factory.PropertySignature.create({
6364
name: converterContext.escapePropertySignatureName(reference.data.name),
6465
optional: isPathProperty ? false : !reference.data.required,
66+
comment: reference.data.description,
6567
type: ToTypeNode.convert(
6668
entryPoint,
6769
reference.referencePoint,
@@ -77,6 +79,7 @@ export const generatePropertySignature = (
7779
name: converterContext.escapePropertySignatureName(parameter.name),
7880
optional: isPathProperty ? false : !parameter.required,
7981
type: ToTypeNode.convert(entryPoint, currentPoint, factory, parameter.schema || { type: "null" }, context, converterContext),
82+
comment: parameter.description,
8083
});
8184
};
8285

@@ -107,7 +110,6 @@ export const generateInterface = (
107110
return factory.InterfaceDeclaration.create({
108111
export: true,
109112
name,
110-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#headerObject`,
111113
members: generatePropertySignatures(entryPoint, currentPoint, store, factory, parameters, context, converterContext),
112114
});
113115
};
@@ -128,7 +130,6 @@ export const generateAliasInterface = (
128130
return factory.InterfaceDeclaration.create({
129131
export: true,
130132
name: converterContext.escapeDeclarationText(name),
131-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#headerObject`,
132133
members: generatePropertySignatures(entryPoint, currentPoint, store, factory, parameters, context, converterContext),
133134
});
134135
};

src/Converter/v3/components/Parameters.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const generateNamespace = (
2323
store.addComponent("parameters", {
2424
kind: "namespace",
2525
name: Name.Components.Parameters,
26-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#parameterObject`,
2726
});
2827

2928
Object.entries(parameters).forEach(([name, parameter]) => {
@@ -81,7 +80,6 @@ export const generateNamespaceWithList = (
8180
store.addComponent("parameters", {
8281
kind: "namespace",
8382
name: Name.Components.Parameters,
84-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#parameterObject`,
8583
});
8684

8785
parameters.forEach(parameter => {

src/Converter/v3/components/PathItems.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const generateNamespace = (
2424
store.addComponent("pathItems", {
2525
kind: "namespace",
2626
name: Name.Components.PathItems,
27-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#componentsObject`,
2827
});
2928

3029
Object.entries(pathItems).forEach(([key, pathItem]) => {

src/Converter/v3/components/RequestBodies.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const generateNamespace = (
2323
store.addComponent("requestBodies", {
2424
kind: "namespace",
2525
name: Name.Components.RequestBodies,
26-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#componentsObject`,
2726
});
2827

2928
Object.entries(requestBodies).forEach(([name, requestBody]) => {

src/Converter/v3/components/RequestBody.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export const generateInterface = (
2828
export: true,
2929
name,
3030
members: contentSignatures,
31-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#requestBodyObject`,
3231
});
3332
};
3433

src/Converter/v3/components/Responses.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export const generateNamespace = (
2727
store.addComponent("responses", {
2828
kind: "namespace",
2929
name: Name.Components.Responses,
30-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#responsesObject`,
3130
});
3231
Object.entries(responses).forEach(([name, response]) => {
3332
if (Guard.isReference(response)) {
@@ -69,7 +68,6 @@ export const generateNamespaceWithStatusCode = (
6968
store.addStatement(basePath, {
7069
kind: "namespace",
7170
name: Name.ComponentChild.Response,
72-
comment: `@see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#responsesObject`,
7371
});
7472

7573
Object.entries(responses).forEach(([statusCode, response]) => {

src/Converter/v3/components/Schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const generatePropertySignatures = (
2626
return factory.PropertySignature.create({
2727
name: convertContext.escapePropertySignatureName(propertyName),
2828
optional: !required.includes(propertyName),
29+
comment: schema.description,
2930
type: factory.TypeNode.create({
3031
type: "any",
3132
}),

0 commit comments

Comments
 (0)