Skip to content

Commit b871eab

Browse files
committed
1 parent 9ab6973 commit b871eab

15 files changed

+73
-89
lines changed

src/openApi/v2/parser/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export const TYPE_MAPPINGS = new Map<string, PrimaryType>([
1717
['boolean', PrimaryType.BOOLEAN],
1818
['byte', PrimaryType.NUMBER],
1919
['int', PrimaryType.NUMBER],
20-
['int32', PrimaryType.NUMBER],
21-
['int64', PrimaryType.NUMBER],
2220
['integer', PrimaryType.NUMBER],
2321
['float', PrimaryType.NUMBER],
2422
['double', PrimaryType.NUMBER],

src/openApi/v2/parser/getMappedType.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { getMappedType } from './getMappedType';
22

33
describe('getMappedType', () => {
44
it('should map types to the basics', () => {
5-
expect(getMappedType('File')).toEqual('File');
6-
expect(getMappedType('String')).toEqual('string');
5+
expect(getMappedType('file')).toEqual('File');
6+
expect(getMappedType('string')).toEqual('string');
77
expect(getMappedType('date')).toEqual('string');
88
expect(getMappedType('date-time')).toEqual('string');
99
expect(getMappedType('float')).toEqual('number');

src/openApi/v2/parser/getMappedType.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { PrimaryType, TYPE_MAPPINGS } from './constants';
44
* Get mapped type for given type to any basic Typescript/Javascript type.
55
*/
66
export function getMappedType(type: string): PrimaryType | undefined {
7-
return TYPE_MAPPINGS.get(type.toLowerCase());
7+
return TYPE_MAPPINGS.get(type);
88
}
99

1010
export function hasMappedType(type: string): boolean {
11-
return TYPE_MAPPINGS.has(type.toLowerCase());
11+
return TYPE_MAPPINGS.has(type);
1212
}

src/openApi/v2/parser/getType.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ describe('getType', () => {
1010
});
1111

1212
it('should convert string', () => {
13-
const type = getType('String');
13+
const type = getType('string');
1414
expect(type.type).toEqual('string');
1515
expect(type.base).toEqual('string');
1616
expect(type.template).toEqual(null);
1717
expect(type.imports).toEqual([]);
1818
});
1919

2020
it('should convert string array', () => {
21-
const type = getType('Array[String]');
21+
const type = getType('array[string]');
2222
expect(type.type).toEqual('string[]');
2323
expect(type.base).toEqual('string');
2424
expect(type.template).toEqual(null);
2525
expect(type.imports).toEqual([]);
2626
});
2727

2828
it('should convert template with primary', () => {
29-
const type = getType('#/definitions/Link[String]');
29+
const type = getType('#/definitions/Link[string]');
3030
expect(type.type).toEqual('Link<string>');
3131
expect(type.base).toEqual('Link');
3232
expect(type.template).toEqual('string');

src/openApi/v2/parser/isPrimaryType.spec.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/openApi/v2/parser/isPrimaryType.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/openApi/v3/parser/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export const TYPE_MAPPINGS = new Map<string, PrimaryType>([
1717
['boolean', PrimaryType.BOOLEAN],
1818
['byte', PrimaryType.NUMBER],
1919
['int', PrimaryType.NUMBER],
20-
['int32', PrimaryType.NUMBER],
21-
['int64', PrimaryType.NUMBER],
2220
['integer', PrimaryType.NUMBER],
2321
['float', PrimaryType.NUMBER],
2422
['double', PrimaryType.NUMBER],

src/openApi/v3/parser/getMappedType.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { getMappedType } from './getMappedType';
22

33
describe('getMappedType', () => {
44
it('should map types to the basics', () => {
5-
expect(getMappedType('File')).toEqual('File');
6-
expect(getMappedType('String')).toEqual('string');
5+
expect(getMappedType('file')).toEqual('File');
6+
expect(getMappedType('string')).toEqual('string');
77
expect(getMappedType('date')).toEqual('string');
88
expect(getMappedType('date-time')).toEqual('string');
99
expect(getMappedType('float')).toEqual('number');

src/openApi/v3/parser/getMappedType.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { PrimaryType, TYPE_MAPPINGS } from './constants';
44
* Get mapped type for given type to any basic Typescript/Javascript type.
55
*/
66
export function getMappedType(type: string): PrimaryType | undefined {
7-
return TYPE_MAPPINGS.get(type.toLowerCase());
7+
return TYPE_MAPPINGS.get(type);
88
}
99

1010
export function hasMappedType(type: string): boolean {
11-
return TYPE_MAPPINGS.has(type.toLowerCase());
11+
return TYPE_MAPPINGS.has(type);
1212
}

src/openApi/v3/parser/getType.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ describe('getType', () => {
1010
});
1111

1212
it('should convert string', () => {
13-
const type = getType('String');
13+
const type = getType('string');
1414
expect(type.type).toEqual('string');
1515
expect(type.base).toEqual('string');
1616
expect(type.template).toEqual(null);
1717
expect(type.imports).toEqual([]);
1818
});
1919

2020
it('should convert string array', () => {
21-
const type = getType('Array[String]');
21+
const type = getType('array[string]');
2222
expect(type.type).toEqual('string[]');
2323
expect(type.base).toEqual('string');
2424
expect(type.template).toEqual(null);
2525
expect(type.imports).toEqual([]);
2626
});
2727

2828
it('should convert template with primary', () => {
29-
const type = getType('#/components/schemas/Link[String]');
29+
const type = getType('#/components/schemas/Link[string]');
3030
expect(type.type).toEqual('Link<string>');
3131
expect(type.base).toEqual('Link');
3232
expect(type.template).toEqual('string');

0 commit comments

Comments
 (0)