Skip to content

Commit 0b8fe10

Browse files
authored
fix(type-safe-api): add missing gitignores for manifest files and remove openapi generator config (#869)
* fix(type-safe-api): add missing gitignores for manifest files and remove openapi generator config Add missing .gitignore entries for the `.tsapi-manifest` file. Remove the OpenAPI generator CLI configs from projects which no longer use OpenAPI generator. * feat(type-safe-api): deprecate html2 documentation format Deprecate HTML2 documentation format. HTML_REDOC should be used for HTML documentation instead. The HTML2 documentation format will be removed in 0.24.0.
1 parent c2f9c90 commit 0b8fe10

13 files changed

+193
-1821
lines changed

packages/type-safe-api/src/project/codegen/documentation/generated-html-redoc-documentation-project.ts

-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
SPDX-License-Identifier: Apache-2.0 */
33
import { Project, ProjectOptions, Task } from "projen";
44
import { GeneratedHtmlRedocDocumentationOptions } from "../../types";
5-
import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file";
65
import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment";
76

87
export interface GeneratedHtmlRedocDocumentationProjectOptions
@@ -21,11 +20,6 @@ export class GeneratedHtmlRedocDocumentationProject extends Project {
2120
super(options);
2221
TypeSafeApiCommandEnvironment.ensure(this);
2322

24-
// Add OpenAPI Generator cli configuration
25-
OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig(
26-
options.openApiGeneratorCliConfig
27-
);
28-
2923
this.generateTask = this.addTask("generate");
3024
this.generateTask.exec(
3125
`npx --yes @redocly/[email protected] build-docs "${options.specPath}" --output ./index.html`

packages/type-safe-api/src/project/codegen/documentation/generated-markdown-documentation-project.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
SPDX-License-Identifier: Apache-2.0 */
33
import { Project, ProjectOptions, Task } from "projen";
44
import { GeneratedMarkdownDocumentationOptions } from "../../types";
5-
import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file";
65
import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment";
76
import {
87
buildCodegenCommandArgs,
@@ -26,11 +25,6 @@ export class GeneratedMarkdownDocumentationProject extends Project {
2625
super(options);
2726
TypeSafeApiCommandEnvironment.ensure(this);
2827

29-
// Add OpenAPI Generator cli configuration
30-
OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig(
31-
options.openApiGeneratorCliConfig
32-
);
33-
3428
this.generateTask = this.addTask("generate");
3529
this.generateTask.exec(
3630
buildTypeSafeApiExecCommand(
@@ -45,14 +39,9 @@ export class GeneratedMarkdownDocumentationProject extends Project {
4539
this.compileTask.spawn(this.generateTask);
4640

4741
if (!options.commitGeneratedCode) {
48-
this.gitignore.addPatterns(
49-
".openapi-generator",
50-
"Apis",
51-
"Models",
52-
"README.md"
53-
);
54-
} else {
55-
this.gitignore.addPatterns(".openapi-generator");
42+
this.gitignore.addPatterns("Apis", "Models", "README.md");
5643
}
44+
45+
this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest");
5746
}
5847
}

packages/type-safe-api/src/project/codegen/documentation/generated-plantuml-documentation-project.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
SPDX-License-Identifier: Apache-2.0 */
33
import { Project, ProjectOptions, Task } from "projen";
44
import { GeneratedPlantumlDocumentationOptions } from "../../types";
5-
import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file";
65
import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment";
76
import {
87
buildCodegenCommandArgs,
@@ -26,11 +25,6 @@ export class GeneratedPlantumlDocumentationProject extends Project {
2625
super(options);
2726
TypeSafeApiCommandEnvironment.ensure(this);
2827

29-
// Add OpenAPI Generator cli configuration
30-
OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig(
31-
options.openApiGeneratorCliConfig
32-
);
33-
3428
this.generateTask = this.addTask("generate");
3529
this.generateTask.exec(
3630
buildTypeSafeApiExecCommand(
@@ -45,9 +39,9 @@ export class GeneratedPlantumlDocumentationProject extends Project {
4539
this.compileTask.spawn(this.generateTask);
4640

4741
if (!options.commitGeneratedCode) {
48-
this.gitignore.addPatterns(".openapi-generator", "schemas.plantuml");
49-
} else {
50-
this.gitignore.addPatterns(".openapi-generator");
42+
this.gitignore.addPatterns("schemas.plantuml");
5143
}
44+
45+
this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest");
5246
}
5347
}

packages/type-safe-api/src/project/codegen/infrastructure/cdk/generated-java-cdk-infrastructure-base-project.ts

+2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ export abstract class GeneratedJavaCdkInfrastructureBaseProject extends JavaProj
128128
"echo $(pwd) > src/main/resources/project-absolute-path.txt"
129129
);
130130

131+
this.gitignore.addPatterns(".tsapi-manifest", ".openapi-generator");
132+
131133
this.preCompileTask.spawn(generateTask);
132134
}
133135

packages/type-safe-api/src/project/codegen/library/generated-typescript-library-project.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,7 @@ export abstract class GeneratedTypescriptLibraryProject extends TypeScriptProjec
9292

9393
if (!options.commitGeneratedCode) {
9494
// Ignore all the generated code
95-
this.gitignore.addPatterns(
96-
"src",
97-
".npmignore",
98-
"README.md",
99-
".openapi-generator"
100-
);
95+
this.gitignore.addPatterns("src", ".npmignore", "README.md");
10196
}
10297

10398
this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest");

packages/type-safe-api/src/project/languages.ts

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export enum DocumentationFormat {
5959
/**
6060
* OpenAPI Generator 'html2' documentation
6161
* @see https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/html2.md
62+
* @deprecated Will be removed in 0.24.0. Please use HTML_REDOC instead for HTML documentation.
6263
*/
6364
HTML2 = "html2",
6465
/**

packages/type-safe-api/src/project/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ export interface GeneratedDocumentationOptions {
505505
readonly htmlRedoc?: GeneratedHtmlRedocDocumentationOptions;
506506
/**
507507
* Generated html2 documentation project options
508+
* @deprecated Will be removed in 0.24.0. Please use HTML_REDOC for HTML documentation.
508509
*/
509510
readonly html2?: GeneratedHtml2DocumentationOptions;
510511
/**
@@ -541,6 +542,7 @@ export interface GeneratedDocumentationProjects {
541542
readonly htmlRedoc?: Project;
542543
/**
543544
* Generated html2 documentation project
545+
* @deprecated Will be removed in 0.24.0. Please use HTML_REDOC for HTML documentation.
544546
*/
545547
readonly html2?: Project;
546548
/**

0 commit comments

Comments
 (0)