Skip to content

Commit cd04598

Browse files
committed
Remove chalk usage
1 parent baf1f61 commit cd04598

4 files changed

Lines changed: 7 additions & 10 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@povio/openapi-codegen-cli",
3-
"version": "0.4.2",
3+
"version": "0.4.3",
44
"main": "./dist/index.js",
55
"bin": {
66
"openapi-codegen": "./dist/sh.js"

src/generators/core/SchemaResolver.class.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { OpenAPIV3 } from "openapi-types";
2-
import { chk } from "src/helpers/chalk.helper";
32
import { ALLOWED_METHODS } from "../const/openapi.const";
43
import { GenerateOptions } from "../types/options";
54
import { ValidationError } from "../types/validation";
@@ -254,7 +253,7 @@ export class SchemaResolver {
254253
operation.parameters?.map((parameter) => {
255254
const parameterObject = parameter as OpenAPIV3.ParameterObject;
256255
const parameterSchema = parameterObject.schema;
257-
const schemaInfo = `operation ${chk.gray(operation.operationId ?? path)} parameter ${chk.gray(parameterObject.name)}`;
256+
const schemaInfo = `operation ${operation.operationId ?? path} parameter ${parameterObject.name}`;
258257

259258
schemaRefObjs.push(...getSchemaRefObjs(this, parameterSchema, schemaInfo));
260259

@@ -276,7 +275,7 @@ export class SchemaResolver {
276275
const matchingMediaType = mediaTypes.find(isParamMediaTypeAllowed);
277276
if (matchingMediaType) {
278277
const matchingMediaSchema = requestBodyObj.content?.[matchingMediaType]?.schema;
279-
const schemaInfo = `operation ${chk.gray(operation.operationId)} request body`;
278+
const schemaInfo = `operation ${operation.operationId} request body`;
280279

281280
schemaRefObjs.push(...getSchemaRefObjs(this, matchingMediaSchema, schemaInfo));
282281

@@ -298,7 +297,7 @@ export class SchemaResolver {
298297
const matchingMediaType = mediaTypes.find(isMediaTypeAllowed);
299298
if (matchingMediaType) {
300299
const matchingMediaSchema = responseObj.content?.[matchingMediaType]?.schema;
301-
const schemaInfo = `operation ${chk.gray(operation.operationId)} response body`;
300+
const schemaInfo = `operation ${operation.operationId} response body`;
302301

303302
schemaRefObjs.push(...getSchemaRefObjs(this, matchingMediaSchema, schemaInfo));
304303

src/generators/core/zod/updateEnumZodSchemaData.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { getSchemaNameByRef, isReferenceObject } from "src/generators/utils/open
44
import { capitalize, getMostCommonAdjacentCombinationSplit } from "src/generators/utils/string.utils";
55
import { getNotAllowedInlineEnumError } from "src/generators/utils/validation.utils";
66
import { getEnumZodSchemaName } from "src/generators/utils/zod-schema.utils";
7-
import { chk } from "src/helpers/chalk.helper";
87
import { iterateSchema } from "../openapi/iterateSchema";
98
import { EnumZodSchemaData, SchemaResolver } from "../SchemaResolver.class";
109
import { getEnumZodSchemaCode } from "./getZodSchema";
@@ -77,7 +76,7 @@ function handleEnumZodSchemaDataUpdate({
7776
resolver.validationErrors.push(
7877
getNotAllowedInlineEnumError(
7978
schemaRef
80-
? `schema ${chk.gray(getSchemaNameByRef(schemaRef))} property ${chk.gray(nameSegments[nameSegments.length - 1])}`
79+
? `schema ${getSchemaNameByRef(schemaRef)} property ${nameSegments[nameSegments.length - 1]}`
8180
: schemaInfo ?? nameSegments.join("->"),
8281
),
8382
);

src/generators/utils/validation.utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { chk } from "src/helpers/chalk.helper";
21
import { EndpointParameter } from "../types/endpoint";
32
import { ValidationError, ValidationErrorType } from "../types/validation";
43

@@ -7,13 +6,13 @@ export function getInvalidSchemaError(schemaInfo: string): ValidationError {
76
}
87

98
export function getInvalidOperationIdError(operationId: string): ValidationError {
10-
return { type: "invalid-operation-id", message: `Operation ${chk.gray(operationId)}` };
9+
return { type: "invalid-operation-id", message: `Operation ${operationId}` };
1110
}
1211

1312
export function getMissingPathParameterError(params: EndpointParameter[], path: string): ValidationError {
1413
return {
1514
type: "missing-path-parameter",
16-
message: `Path ${chk.gray(path)} is missing [${params.map(({ name }) => chk.gray(name)).join(", ")}]`,
15+
message: `Path ${path} is missing [${params.join(", ")}]`,
1716
};
1817
}
1918

0 commit comments

Comments
 (0)