mirror of
https://github.com/ferdikoomen/openapi-typescript-codegen.git
synced 2025-12-08 20:16:21 +00:00
- Updated line endings
This commit is contained in:
parent
ba0b79daac
commit
c0137757e6
@ -1,22 +1,22 @@
|
||||
import { getMappedType } from './getMappedType';
|
||||
|
||||
describe('getMappedType', () => {
|
||||
it('should map types to the basics', () => {
|
||||
expect(getMappedType('File')).toEqual('binary');
|
||||
expect(getMappedType('file')).toEqual('binary');
|
||||
expect(getMappedType('string')).toEqual('string');
|
||||
expect(getMappedType('date')).toEqual('string');
|
||||
expect(getMappedType('date-time')).toEqual('string');
|
||||
expect(getMappedType('float')).toEqual('number');
|
||||
expect(getMappedType('double')).toEqual('number');
|
||||
expect(getMappedType('short')).toEqual('number');
|
||||
expect(getMappedType('int')).toEqual('number');
|
||||
expect(getMappedType('boolean')).toEqual('boolean');
|
||||
expect(getMappedType('any')).toEqual('any');
|
||||
expect(getMappedType('object')).toEqual('any');
|
||||
expect(getMappedType('void')).toEqual('void');
|
||||
expect(getMappedType('null')).toEqual('null');
|
||||
expect(getMappedType('unknown')).toEqual(undefined);
|
||||
expect(getMappedType('')).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
import { getMappedType } from './getMappedType';
|
||||
|
||||
describe('getMappedType', () => {
|
||||
it('should map types to the basics', () => {
|
||||
expect(getMappedType('File')).toEqual('binary');
|
||||
expect(getMappedType('file')).toEqual('binary');
|
||||
expect(getMappedType('string')).toEqual('string');
|
||||
expect(getMappedType('date')).toEqual('string');
|
||||
expect(getMappedType('date-time')).toEqual('string');
|
||||
expect(getMappedType('float')).toEqual('number');
|
||||
expect(getMappedType('double')).toEqual('number');
|
||||
expect(getMappedType('short')).toEqual('number');
|
||||
expect(getMappedType('int')).toEqual('number');
|
||||
expect(getMappedType('boolean')).toEqual('boolean');
|
||||
expect(getMappedType('any')).toEqual('any');
|
||||
expect(getMappedType('object')).toEqual('any');
|
||||
expect(getMappedType('void')).toEqual('void');
|
||||
expect(getMappedType('null')).toEqual('null');
|
||||
expect(getMappedType('unknown')).toEqual(undefined);
|
||||
expect(getMappedType('')).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,33 +1,33 @@
|
||||
const TYPE_MAPPINGS = new Map<string, string>([
|
||||
['File', 'binary'],
|
||||
['file', 'binary'],
|
||||
['any', 'any'],
|
||||
['object', 'any'],
|
||||
['array', 'any[]'],
|
||||
['boolean', 'boolean'],
|
||||
['byte', 'number'],
|
||||
['int', 'number'],
|
||||
['integer', 'number'],
|
||||
['float', 'number'],
|
||||
['double', 'number'],
|
||||
['short', 'number'],
|
||||
['long', 'number'],
|
||||
['number', 'number'],
|
||||
['char', 'string'],
|
||||
['date', 'string'],
|
||||
['date-time', 'string'],
|
||||
['password', 'string'],
|
||||
['string', 'string'],
|
||||
['void', 'void'],
|
||||
['null', 'null'],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Get mapped type for given type to any basic Typescript/Javascript type.
|
||||
*/
|
||||
export function getMappedType(type: string, format?: string): string | undefined {
|
||||
if (format === 'binary') {
|
||||
return 'binary';
|
||||
}
|
||||
return TYPE_MAPPINGS.get(type);
|
||||
}
|
||||
const TYPE_MAPPINGS = new Map<string, string>([
|
||||
['File', 'binary'],
|
||||
['file', 'binary'],
|
||||
['any', 'any'],
|
||||
['object', 'any'],
|
||||
['array', 'any[]'],
|
||||
['boolean', 'boolean'],
|
||||
['byte', 'number'],
|
||||
['int', 'number'],
|
||||
['integer', 'number'],
|
||||
['float', 'number'],
|
||||
['double', 'number'],
|
||||
['short', 'number'],
|
||||
['long', 'number'],
|
||||
['number', 'number'],
|
||||
['char', 'string'],
|
||||
['date', 'string'],
|
||||
['date-time', 'string'],
|
||||
['password', 'string'],
|
||||
['string', 'string'],
|
||||
['void', 'void'],
|
||||
['null', 'null'],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Get mapped type for given type to any basic Typescript/Javascript type.
|
||||
*/
|
||||
export function getMappedType(type: string, format?: string): string | undefined {
|
||||
if (format === 'binary') {
|
||||
return 'binary';
|
||||
}
|
||||
return TYPE_MAPPINGS.get(type);
|
||||
}
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
import { getMappedType } from './getMappedType';
|
||||
|
||||
describe('getMappedType', () => {
|
||||
it('should map types to the basics', () => {
|
||||
expect(getMappedType('File')).toEqual('binary');
|
||||
expect(getMappedType('file')).toEqual('binary');
|
||||
expect(getMappedType('string')).toEqual('string');
|
||||
expect(getMappedType('date')).toEqual('string');
|
||||
expect(getMappedType('date-time')).toEqual('string');
|
||||
expect(getMappedType('float')).toEqual('number');
|
||||
expect(getMappedType('double')).toEqual('number');
|
||||
expect(getMappedType('short')).toEqual('number');
|
||||
expect(getMappedType('int')).toEqual('number');
|
||||
expect(getMappedType('boolean')).toEqual('boolean');
|
||||
expect(getMappedType('any')).toEqual('any');
|
||||
expect(getMappedType('object')).toEqual('any');
|
||||
expect(getMappedType('void')).toEqual('void');
|
||||
expect(getMappedType('null')).toEqual('null');
|
||||
expect(getMappedType('unknown')).toEqual(undefined);
|
||||
expect(getMappedType('')).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
import { getMappedType } from './getMappedType';
|
||||
|
||||
describe('getMappedType', () => {
|
||||
it('should map types to the basics', () => {
|
||||
expect(getMappedType('File')).toEqual('binary');
|
||||
expect(getMappedType('file')).toEqual('binary');
|
||||
expect(getMappedType('string')).toEqual('string');
|
||||
expect(getMappedType('date')).toEqual('string');
|
||||
expect(getMappedType('date-time')).toEqual('string');
|
||||
expect(getMappedType('float')).toEqual('number');
|
||||
expect(getMappedType('double')).toEqual('number');
|
||||
expect(getMappedType('short')).toEqual('number');
|
||||
expect(getMappedType('int')).toEqual('number');
|
||||
expect(getMappedType('boolean')).toEqual('boolean');
|
||||
expect(getMappedType('any')).toEqual('any');
|
||||
expect(getMappedType('object')).toEqual('any');
|
||||
expect(getMappedType('void')).toEqual('void');
|
||||
expect(getMappedType('null')).toEqual('null');
|
||||
expect(getMappedType('unknown')).toEqual(undefined);
|
||||
expect(getMappedType('')).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,33 +1,33 @@
|
||||
const TYPE_MAPPINGS = new Map<string, string>([
|
||||
['File', 'binary'],
|
||||
['file', 'binary'],
|
||||
['any', 'any'],
|
||||
['object', 'any'],
|
||||
['array', 'any[]'],
|
||||
['boolean', 'boolean'],
|
||||
['byte', 'number'],
|
||||
['int', 'number'],
|
||||
['integer', 'number'],
|
||||
['float', 'number'],
|
||||
['double', 'number'],
|
||||
['short', 'number'],
|
||||
['long', 'number'],
|
||||
['number', 'number'],
|
||||
['char', 'string'],
|
||||
['date', 'string'],
|
||||
['date-time', 'string'],
|
||||
['password', 'string'],
|
||||
['string', 'string'],
|
||||
['void', 'void'],
|
||||
['null', 'null'],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Get mapped type for given type to any basic Typescript/Javascript type.
|
||||
*/
|
||||
export function getMappedType(type: string, format?: string): string | undefined {
|
||||
if (format === 'binary') {
|
||||
return 'binary';
|
||||
}
|
||||
return TYPE_MAPPINGS.get(type);
|
||||
}
|
||||
const TYPE_MAPPINGS = new Map<string, string>([
|
||||
['File', 'binary'],
|
||||
['file', 'binary'],
|
||||
['any', 'any'],
|
||||
['object', 'any'],
|
||||
['array', 'any[]'],
|
||||
['boolean', 'boolean'],
|
||||
['byte', 'number'],
|
||||
['int', 'number'],
|
||||
['integer', 'number'],
|
||||
['float', 'number'],
|
||||
['double', 'number'],
|
||||
['short', 'number'],
|
||||
['long', 'number'],
|
||||
['number', 'number'],
|
||||
['char', 'string'],
|
||||
['date', 'string'],
|
||||
['date-time', 'string'],
|
||||
['password', 'string'],
|
||||
['string', 'string'],
|
||||
['void', 'void'],
|
||||
['null', 'null'],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Get mapped type for given type to any basic Typescript/Javascript type.
|
||||
*/
|
||||
export function getMappedType(type: string, format?: string): string | undefined {
|
||||
if (format === 'binary') {
|
||||
return 'binary';
|
||||
}
|
||||
return TYPE_MAPPINGS.get(type);
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
{{~#equals base 'binary'~}}
|
||||
{{~#equals @root.httpClient 'fetch'}}Blob{{/equals~}}
|
||||
{{~#equals @root.httpClient 'xhr'}}Blob{{/equals~}}
|
||||
{{~#equals @root.httpClient 'axios'}}Blob{{/equals~}}
|
||||
{{~#equals @root.httpClient 'node'}}Buffer | ArrayBuffer | ArrayBufferView{{/equals~}}
|
||||
{{~else~}}
|
||||
{{{base}}}
|
||||
{{~/equals~}}
|
||||
{{~#equals base 'binary'~}}
|
||||
{{~#equals @root.httpClient 'fetch'}}Blob{{/equals~}}
|
||||
{{~#equals @root.httpClient 'xhr'}}Blob{{/equals~}}
|
||||
{{~#equals @root.httpClient 'axios'}}Blob{{/equals~}}
|
||||
{{~#equals @root.httpClient 'node'}}Buffer | ArrayBuffer | ArrayBufferView{{/equals~}}
|
||||
{{~else~}}
|
||||
{{{base}}}
|
||||
{{~/equals~}}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user