Skip to content

Commit a9680a3

Browse files
committed
format
1 parent e4c2e1a commit a9680a3

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

src/__tests__/generators/EntityConverter.iso639-format.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,4 @@ describe('EntityConverter - ISO 639 format detection', () => {
187187
expect(result.type).toEqual(['string', 'null']);
188188
expect(result.format).toBe('iso-639-1');
189189
});
190-
});
190+
});

src/__tests__/generators/TypeParser.iso639-format.test.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ describe('TypeParser - ISO 639 format detection', () => {
1010
});
1111

1212
test('should apply iso-639-1 format to single string with ISO 639-1 indicator', () => {
13-
const result = typeParser.parseType('String (ISO 639-1 language two-letter code)');
13+
const result = typeParser.parseType(
14+
'String (ISO 639-1 language two-letter code)'
15+
);
1416

1517
expect(result).toEqual({
1618
type: 'string',
@@ -19,7 +21,9 @@ describe('TypeParser - ISO 639 format detection', () => {
1921
});
2022

2123
test('should apply iso-639-1 format to single string with ISO 639 Part 1 indicator', () => {
22-
const result = typeParser.parseType('String (ISO 639 Part 1 two-letter language code)');
24+
const result = typeParser.parseType(
25+
'String (ISO 639 Part 1 two-letter language code)'
26+
);
2327

2428
expect(result).toEqual({
2529
type: 'string',
@@ -28,7 +32,9 @@ describe('TypeParser - ISO 639 format detection', () => {
2832
});
2933

3034
test('should apply iso-639-1 format to array items when type indicates ISO 639-1', () => {
31-
const result = typeParser.parseType('Array of String (ISO 639-1 language two-letter code)');
35+
const result = typeParser.parseType(
36+
'Array of String (ISO 639-1 language two-letter code)'
37+
);
3238

3339
expect(result).toEqual({
3440
type: 'array',
@@ -40,7 +46,9 @@ describe('TypeParser - ISO 639 format detection', () => {
4046
});
4147

4248
test('should apply iso-639-1 format to array items with ISO 639 Part 1 indicator', () => {
43-
const result = typeParser.parseType('Array of String (ISO 639 Part 1 two-letter language code)');
49+
const result = typeParser.parseType(
50+
'Array of String (ISO 639 Part 1 two-letter language code)'
51+
);
4452

4553
expect(result).toEqual({
4654
type: 'array',
@@ -95,7 +103,9 @@ describe('TypeParser - ISO 639 format detection', () => {
95103
});
96104

97105
test('should apply iso-639-1 format with "or empty string" variation', () => {
98-
const result = typeParser.parseType('String (ISO 639-1 language two-letter code) or empty string');
106+
const result = typeParser.parseType(
107+
'String (ISO 639-1 language two-letter code) or empty string'
108+
);
99109

100110
expect(result).toEqual({
101111
type: 'string',
@@ -106,7 +116,8 @@ describe('TypeParser - ISO 639 format detection', () => {
106116
test('should apply iso-639-1 format to parameters with ISO 639 in description', () => {
107117
const parameter = {
108118
name: 'lang',
109-
description: 'The ISO 639-1 two-letter language code to use while rendering the authorization form.',
119+
description:
120+
'The ISO 639-1 two-letter language code to use while rendering the authorization form.',
110121
enumValues: [],
111122
};
112123

@@ -115,7 +126,8 @@ describe('TypeParser - ISO 639 format detection', () => {
115126
expect(result).toEqual({
116127
type: 'string',
117128
format: 'iso-639-1',
118-
description: 'The ISO 639-1 two-letter language code to use while rendering the authorization form.',
129+
description:
130+
'The ISO 639-1 two-letter language code to use while rendering the authorization form.',
119131
});
120132
});
121133

@@ -134,4 +146,4 @@ describe('TypeParser - ISO 639 format detection', () => {
134146
description: 'ISO 639 language code for this status.',
135147
});
136148
});
137-
});
149+
});

src/generators/TypeParser.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,11 @@ class TypeParser {
550550
};
551551

552552
// Check for ISO 639 format in parameter description
553-
if (param.description &&
554-
(param.description.toLowerCase().includes('iso 639') ||
555-
param.description.toLowerCase().includes('iso639'))) {
553+
if (
554+
param.description &&
555+
(param.description.toLowerCase().includes('iso 639') ||
556+
param.description.toLowerCase().includes('iso639'))
557+
) {
556558
schema.format = 'iso-639-1';
557559
}
558560

0 commit comments

Comments
 (0)