Skip to content

Commit e7aee32

Browse files
committed
resolve conflicts
2 parents daaea3a + 1830f73 commit e7aee32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+712
-637
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"@typescript-eslint/explicit-module-boundary-types": 0,
2525
"sort-imports": "off",
2626
"import/order": "off",
27-
"simple-import-sort/sort": "error",
27+
"simple-import-sort/imports": "error",
28+
"simple-import-sort/exports": "error",
2829
"prettier/prettier": ["error"]
2930
}
3031
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openapi-typescript-codegen",
3-
"version": "0.6.0",
3+
"version": "0.7.0-beta",
44
"description": "NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification.",
55
"author": "Ferdi Koomen",
66
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",

src/client/interfaces/Model.d.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,15 @@ import type { Schema } from './Schema';
33

44
export interface Model extends Schema {
55
name: string;
6-
export: 'reference' | 'generic' | 'enum' | 'array' | 'dictionary' | 'interface';
6+
export: 'reference' | 'generic' | 'enum' | 'array' | 'dictionary' | 'interface' | 'one-of' | 'any-of' | 'all-of';
77
type: string;
88
base: string;
99
template: string | null;
1010
link: Model | null;
1111
description: string | null;
1212
default?: string;
1313
imports: string[];
14-
extends: string[];
1514
enum: Enum[];
1615
enums: Model[];
1716
properties: Model[];
18-
extendedFrom?: string[];
19-
extendedBy?: string[];
2017
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { Model } from './Model';
2+
3+
export interface ModelComposition {
4+
type: 'one-of' | 'any-of' | 'all-of';
5+
imports: string[];
6+
enums: Model[];
7+
properties: Model[];
8+
}

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export enum HttpClient {
1313
NODE = 'node',
1414
}
1515

16-
export interface Options {
16+
export type Options = {
1717
input: string | Record<string, any>;
1818
output: string;
1919
httpClient?: HttpClient;
@@ -24,7 +24,7 @@ export interface Options {
2424
exportModels?: boolean;
2525
exportSchemas?: boolean;
2626
write?: boolean;
27-
}
27+
};
2828

2929
/**
3030
* Generate the OpenAPI client. This method will read the OpenAPI specification and based on the

src/openApi/v2/interfaces/OpenApiParameter.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { WithEnumExtension } from './Extensions/WithEnumExtension';
2-
import { WithNullableExtension } from './Extensions/WithNullableExtension';
2+
import type { WithNullableExtension } from './Extensions/WithNullableExtension';
33
import type { OpenApiItems } from './OpenApiItems';
44
import type { OpenApiReference } from './OpenApiReference';
55
import type { OpenApiSchema } from './OpenApiSchema';

src/openApi/v2/parser/constants.ts

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

src/openApi/v2/parser/extendEnum.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export function extendEnum(enumerators: Enum[], definition: WithEnumExtension):
1212
const descriptions = definition['x-enum-descriptions'];
1313

1414
return enumerators.map((enumerator, index) => ({
15-
name: (names && names[index]) || enumerator.name,
16-
description: (descriptions && descriptions[index]) || enumerator.description,
15+
name: names?.[index] || enumerator.name,
16+
description: descriptions?.[index] || enumerator.description,
1717
value: enumerator.value,
1818
type: enumerator.type,
1919
}));

src/openApi/v2/parser/getEnum.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Enum } from '../../../client/interfaces/Enum';
2-
import { PrimaryType } from './constants';
32
import { isDefined } from './isDefined';
43

54
export function getEnum(values?: (string | number)[]): Enum[] {
@@ -14,7 +13,7 @@ export function getEnum(values?: (string | number)[]): Enum[] {
1413
return {
1514
name: `_${value}`,
1615
value: String(value),
17-
type: PrimaryType.NUMBER,
16+
type: 'number',
1817
description: null,
1918
};
2019
}
@@ -25,7 +24,7 @@ export function getEnum(values?: (string | number)[]): Enum[] {
2524
.replace(/([a-z])([A-Z]+)/g, '$1_$2')
2625
.toUpperCase(),
2726
value: `'${value}'`,
28-
type: PrimaryType.STRING,
27+
type: 'string',
2928
description: null,
3029
};
3130
});

src/openApi/v2/parser/getEnumFromDescription.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Enum } from '../../../client/interfaces/Enum';
2-
import { PrimaryType } from './constants';
32

43
export function getEnumFromDescription(description: string): Enum[] {
54
// Check if we can find this special format string:
@@ -20,7 +19,7 @@ export function getEnumFromDescription(description: string): Enum[] {
2019
.replace(/([a-z])([A-Z]+)/g, '$1_$2')
2120
.toUpperCase(),
2221
value: String(value),
23-
type: PrimaryType.NUMBER,
22+
type: 'number',
2423
description: null,
2524
});
2625
}

0 commit comments

Comments
 (0)