Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(type-safe-api): add missing gitignores for manifest files and remove openapi generator config #869

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
SPDX-License-Identifier: Apache-2.0 */
import { Project, ProjectOptions, Task } from "projen";
import { GeneratedHtmlRedocDocumentationOptions } from "../../types";
import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file";
import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment";

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

// Add OpenAPI Generator cli configuration
OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig(
options.openApiGeneratorCliConfig
);

this.generateTask = this.addTask("generate");
this.generateTask.exec(
`npx --yes @redocly/cli@1.25.4 build-docs "${options.specPath}" --output ./index.html`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
SPDX-License-Identifier: Apache-2.0 */
import { Project, ProjectOptions, Task } from "projen";
import { GeneratedMarkdownDocumentationOptions } from "../../types";
import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file";
import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment";
import {
buildCodegenCommandArgs,
Expand All @@ -26,11 +25,6 @@ export class GeneratedMarkdownDocumentationProject extends Project {
super(options);
TypeSafeApiCommandEnvironment.ensure(this);

// Add OpenAPI Generator cli configuration
OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig(
options.openApiGeneratorCliConfig
);

this.generateTask = this.addTask("generate");
this.generateTask.exec(
buildTypeSafeApiExecCommand(
Expand All @@ -45,14 +39,9 @@ export class GeneratedMarkdownDocumentationProject extends Project {
this.compileTask.spawn(this.generateTask);

if (!options.commitGeneratedCode) {
this.gitignore.addPatterns(
".openapi-generator",
"Apis",
"Models",
"README.md"
);
} else {
this.gitignore.addPatterns(".openapi-generator");
this.gitignore.addPatterns("Apis", "Models", "README.md");
}

this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
SPDX-License-Identifier: Apache-2.0 */
import { Project, ProjectOptions, Task } from "projen";
import { GeneratedPlantumlDocumentationOptions } from "../../types";
import { OpenApiToolsJsonFile } from "../components/open-api-tools-json-file";
import { TypeSafeApiCommandEnvironment } from "../components/type-safe-api-command-environment";
import {
buildCodegenCommandArgs,
Expand All @@ -26,11 +25,6 @@ export class GeneratedPlantumlDocumentationProject extends Project {
super(options);
TypeSafeApiCommandEnvironment.ensure(this);

// Add OpenAPI Generator cli configuration
OpenApiToolsJsonFile.ensure(this).addOpenApiGeneratorCliConfig(
options.openApiGeneratorCliConfig
);

this.generateTask = this.addTask("generate");
this.generateTask.exec(
buildTypeSafeApiExecCommand(
Expand All @@ -45,9 +39,9 @@ export class GeneratedPlantumlDocumentationProject extends Project {
this.compileTask.spawn(this.generateTask);

if (!options.commitGeneratedCode) {
this.gitignore.addPatterns(".openapi-generator", "schemas.plantuml");
} else {
this.gitignore.addPatterns(".openapi-generator");
this.gitignore.addPatterns("schemas.plantuml");
}

this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ export abstract class GeneratedJavaCdkInfrastructureBaseProject extends JavaProj
"echo $(pwd) > src/main/resources/project-absolute-path.txt"
);

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

this.preCompileTask.spawn(generateTask);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,7 @@ export abstract class GeneratedTypescriptLibraryProject extends TypeScriptProjec

if (!options.commitGeneratedCode) {
// Ignore all the generated code
this.gitignore.addPatterns(
"src",
".npmignore",
"README.md",
".openapi-generator"
);
this.gitignore.addPatterns("src", ".npmignore", "README.md");
}

this.gitignore.addPatterns(".openapi-generator", ".tsapi-manifest");
Expand Down
1 change: 1 addition & 0 deletions packages/type-safe-api/src/project/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export enum DocumentationFormat {
/**
* OpenAPI Generator 'html2' documentation
* @see https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/html2.md
* @deprecated Will be removed in 0.24.0. Please use HTML_REDOC instead for HTML documentation.
*/
HTML2 = "html2",
/**
Expand Down
2 changes: 2 additions & 0 deletions packages/type-safe-api/src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ export interface GeneratedDocumentationOptions {
readonly htmlRedoc?: GeneratedHtmlRedocDocumentationOptions;
/**
* Generated html2 documentation project options
* @deprecated Will be removed in 0.24.0. Please use HTML_REDOC for HTML documentation.
*/
readonly html2?: GeneratedHtml2DocumentationOptions;
/**
Expand Down Expand Up @@ -541,6 +542,7 @@ export interface GeneratedDocumentationProjects {
readonly htmlRedoc?: Project;
/**
* Generated html2 documentation project
* @deprecated Will be removed in 0.24.0. Please use HTML_REDOC for HTML documentation.
*/
readonly html2?: Project;
/**
Expand Down
Loading
Loading