Skip to content

Commit 9085409

Browse files
committed
format
1 parent e9fd70d commit 9085409

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/__tests__/generators/EntityConverter.nullable-date-format.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ describe('EntityConverter - Nullable Date Format Handling', () => {
6363
expect(lastStatusAtProperty?.format).toBe('date');
6464

6565
// Regular nullable string should NOT have format
66-
const regularNullableProperty = schema?.properties?.['regular_nullable_string'];
66+
const regularNullableProperty =
67+
schema?.properties?.['regular_nullable_string'];
6768
expect(regularNullableProperty?.type).toEqual(['string', 'null']);
6869
expect(regularNullableProperty?.format).toBeUndefined();
6970
});
@@ -141,4 +142,4 @@ describe('EntityConverter - Nullable Date Format Handling', () => {
141142
expect(emailProperty?.type).toEqual(['string', 'null']);
142143
expect(emailProperty?.format).toBe('email');
143144
});
144-
});
145+
});

src/parsers/ParameterParser.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,22 @@ export class ParameterParser {
502502
// For string parameters, check for date/datetime formats
503503
if (param.schema.type === 'string' && rawParam.description) {
504504
const description = rawParam.description;
505-
505+
506506
// Check for date/datetime formats
507-
if (description.includes('[Date]') &&
508-
!description.toLowerCase().includes('[datetime]') &&
509-
!description.toLowerCase().includes('[iso8601') &&
510-
!description.toLowerCase().includes('iso8601')) {
507+
if (
508+
description.includes('[Date]') &&
509+
!description.toLowerCase().includes('[datetime]') &&
510+
!description.toLowerCase().includes('[iso8601') &&
511+
!description.toLowerCase().includes('iso8601')
512+
) {
511513
param.schema.format = 'date';
512-
} else if (description.includes('[Datetime]') ||
513-
description.includes('[ISO8601') ||
514-
description.toLowerCase().includes('iso8601') ||
515-
(description.toLowerCase().includes('datetime') &&
516-
!description.toLowerCase().includes('datetime-format'))) {
514+
} else if (
515+
description.includes('[Datetime]') ||
516+
description.includes('[ISO8601') ||
517+
description.toLowerCase().includes('iso8601') ||
518+
(description.toLowerCase().includes('datetime') &&
519+
!description.toLowerCase().includes('datetime-format'))
520+
) {
517521
param.schema.format = 'date-time';
518522
}
519523
}

0 commit comments

Comments
 (0)