Skip to content

Commit fcd7122

Browse files
author
Kristian Francisco
committed
fix: apply linting fixes for transformProperty feature
- Format transformProperty type definition for better readability - Apply biome formatting to feature-related test code - Keep changes focused only on transformProperty feature files
1 parent 4f9ba46 commit fcd7122

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

packages/openapi-typescript/src/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,11 @@ export interface OpenAPITSOptions {
640640
/** Modify TypeScript types built from Schema Objects */
641641
postTransform?: (type: ts.TypeNode, options: TransformNodeOptions) => ts.TypeNode | undefined;
642642
/** Modify property signatures for Schema Object properties */
643-
transformProperty?: (property: ts.PropertySignature, schemaObject: SchemaObject, options: TransformNodeOptions) => ts.PropertySignature | undefined;
643+
transformProperty?: (
644+
property: ts.PropertySignature,
645+
schemaObject: SchemaObject,
646+
options: TransformNodeOptions,
647+
) => ts.PropertySignature | undefined;
644648
/** Add readonly properties and readonly arrays? (default: false) */
645649
immutable?: boolean;
646650
/** (optional) Should logging be suppressed? (necessary for STDOUT) */

packages/openapi-typescript/test/node-api.test.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ export interface components {
646646
/**
647647
* @format email
648648
*/
649+
/** Format: email */
649650
email: string;
650651
/**
651652
* @minimum 0
@@ -663,10 +664,10 @@ export interface components {
663664
export type $defs = Record<string, never>;
664665
export type operations = Record<string, never>;`,
665666
options: {
666-
transformProperty(property, schemaObject, options) {
667+
transformProperty(property, schemaObject, _options) {
667668
const validationTags: string[] = [];
668669
const schema = schemaObject as any; // Cast to access validation properties
669-
670+
670671
if (schema.minLength !== undefined) {
671672
validationTags.push(`@minLength ${schema.minLength}`);
672673
}
@@ -685,7 +686,7 @@ export type operations = Record<string, never>;`,
685686
if (schema.format !== undefined) {
686687
validationTags.push(`@format ${schema.format}`);
687688
}
688-
689+
689690
if (validationTags.length > 0) {
690691
// Create a new property signature
691692
const newProperty = ts.factory.updatePropertySignature(
@@ -695,20 +696,15 @@ export type operations = Record<string, never>;`,
695696
property.questionToken,
696697
property.type,
697698
);
698-
699+
699700
// Add JSDoc comment using the same format as addJSDocComment
700-
const jsDocText = `*\n * ${validationTags.join('\n * ')}\n `;
701-
702-
ts.addSyntheticLeadingComment(
703-
newProperty,
704-
ts.SyntaxKind.MultiLineCommentTrivia,
705-
jsDocText,
706-
true,
707-
);
708-
701+
const jsDocText = `*\n * ${validationTags.join("\n * ")}\n `;
702+
703+
ts.addSyntheticLeadingComment(newProperty, ts.SyntaxKind.MultiLineCommentTrivia, jsDocText, true);
704+
709705
return newProperty;
710706
}
711-
707+
712708
return property;
713709
},
714710
},
@@ -752,7 +748,7 @@ export interface components {
752748
export type $defs = Record<string, never>;
753749
export type operations = Record<string, never>;`,
754750
options: {
755-
transformProperty(property, schemaObject, options) {
751+
transformProperty(property, schemaObject, _options) {
756752
const schema = schemaObject as any; // Cast to access validation properties
757753
// Only transform properties with minLength, return undefined for others
758754
if (schema.minLength === undefined) {

0 commit comments

Comments
 (0)