Skip to content

Commit e4ed97e

Browse files
authored
refactor: Naming the walker (#45)
1 parent 3fc87f2 commit e4ed97e

32 files changed

+67
-96
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
package.json
2+
test/code/
3+
lib/

CHANGELOG.md

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,94 +4,67 @@ All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

66
<a name="0.9.2"></a>
7-
## 0.9.2 (2021-04-25)
87

8+
## 0.9.2 (2021-04-25)
99

1010
### Code Refactoring
1111

12-
* classified the store ([#44](https://github.com/Himenon/openapi-typescript-code-generator/issues/44)) ([e6c1a85](https://github.com/Himenon/openapi-typescript-code-generator/commit/e6c1a85))
13-
14-
15-
16-
12+
- classified the store ([#44](https://github.com/Himenon/openapi-typescript-code-generator/issues/44)) ([e6c1a85](https://github.com/Himenon/openapi-typescript-code-generator/commit/e6c1a85))
1713

1814
<a name="0.9.1"></a>
19-
## 0.9.1 (2021-04-08)
2015

16+
## 0.9.1 (2021-04-08)
2117

2218
### Documentation
2319

24-
* **readme:** update ([#42](https://github.com/Himenon/openapi-typescript-code-generator/issues/42)) ([819f22f](https://github.com/Himenon/openapi-typescript-code-generator/commit/819f22f))
25-
26-
27-
28-
20+
- **readme:** update ([#42](https://github.com/Himenon/openapi-typescript-code-generator/issues/42)) ([819f22f](https://github.com/Himenon/openapi-typescript-code-generator/commit/819f22f))
2921

3022
<a name="0.9.0"></a>
31-
# 0.9.0 (2021-04-07)
3223

24+
# 0.9.0 (2021-04-07)
3325

3426
### Features
3527

36-
* changed so that options can be specified on a case-by-case basis ([#41](https://github.com/Himenon/openapi-typescript-code-generator/issues/41)) ([108ce3a](https://github.com/Himenon/openapi-typescript-code-generator/commit/108ce3a))
37-
38-
39-
40-
28+
- changed so that options can be specified on a case-by-case basis ([#41](https://github.com/Himenon/openapi-typescript-code-generator/issues/41)) ([108ce3a](https://github.com/Himenon/openapi-typescript-code-generator/commit/108ce3a))
4129

4230
<a name="0.8.2"></a>
43-
## 0.8.2 (2021-04-07)
4431

32+
## 0.8.2 (2021-04-07)
4533

4634
### Bug Fixes
4735

48-
* bring back the allowOperationIds option ([#40](https://github.com/Himenon/openapi-typescript-code-generator/issues/40)) ([cbccec3](https://github.com/Himenon/openapi-typescript-code-generator/commit/cbccec3))
49-
50-
51-
52-
36+
- bring back the allowOperationIds option ([#40](https://github.com/Himenon/openapi-typescript-code-generator/issues/40)) ([cbccec3](https://github.com/Himenon/openapi-typescript-code-generator/commit/cbccec3))
5337

5438
<a name="0.8.1"></a>
55-
## 0.8.1 (2021-04-07)
5639

40+
## 0.8.1 (2021-04-07)
5741

5842
### Documentation
5943

60-
* fix ([#39](https://github.com/Himenon/openapi-typescript-code-generator/issues/39)) ([fae0db8](https://github.com/Himenon/openapi-typescript-code-generator/commit/fae0db8))
61-
62-
63-
64-
44+
- fix ([#39](https://github.com/Himenon/openapi-typescript-code-generator/issues/39)) ([fae0db8](https://github.com/Himenon/openapi-typescript-code-generator/commit/fae0db8))
6545

6646
<a name="0.8.0"></a>
67-
# [0.8.0](https://github.com/Himenon/openapi-typescript-code-generator/compare/@himenon/openapi-typescript-code-generator@0.7.2...@himenon/openapi-typescript-code-generator@0.8.0) (2021-04-06)
6847

48+
# [0.8.0](https://github.com/Himenon/openapi-typescript-code-generator/compare/@himenon/openapi-typescript-code-generator@0.7.2...@himenon/openapi-typescript-code-generator@0.8.0) (2021-04-06)
6949

7050
### Bug Fixes
7151

72-
* code dependency ([#32](https://github.com/Himenon/openapi-typescript-code-generator/issues/32)) ([1992416](https://github.com/Himenon/openapi-typescript-code-generator/commit/1992416))
73-
52+
- code dependency ([#32](https://github.com/Himenon/openapi-typescript-code-generator/issues/32)) ([1992416](https://github.com/Himenon/openapi-typescript-code-generator/commit/1992416))
7453

7554
### Code Refactoring
7655

77-
* update test code generator ([#33](https://github.com/Himenon/openapi-typescript-code-generator/issues/33)) ([631af46](https://github.com/Himenon/openapi-typescript-code-generator/commit/631af46))
78-
56+
- update test code generator ([#33](https://github.com/Himenon/openapi-typescript-code-generator/issues/33)) ([631af46](https://github.com/Himenon/openapi-typescript-code-generator/commit/631af46))
7957

8058
### Documentation
8159

82-
* update readme ([#37](https://github.com/Himenon/openapi-typescript-code-generator/issues/37)) ([ad3ec06](https://github.com/Himenon/openapi-typescript-code-generator/commit/ad3ec06))
83-
60+
- update readme ([#37](https://github.com/Himenon/openapi-typescript-code-generator/issues/37)) ([ad3ec06](https://github.com/Himenon/openapi-typescript-code-generator/commit/ad3ec06))
8461

8562
### Features
8663

87-
* Add Code template feature ([#30](https://github.com/Himenon/openapi-typescript-code-generator/issues/30)) ([881625c](https://github.com/Himenon/openapi-typescript-code-generator/commit/881625c))
88-
* classify code generator ([#31](https://github.com/Himenon/openapi-typescript-code-generator/issues/31)) ([09f8509](https://github.com/Himenon/openapi-typescript-code-generator/commit/09f8509))
89-
* provide a convenient experimental API for code extension ([#35](https://github.com/Himenon/openapi-typescript-code-generator/issues/35)) ([5ce24d3](https://github.com/Himenon/openapi-typescript-code-generator/commit/5ce24d3))
90-
* split type definition ([#34](https://github.com/Himenon/openapi-typescript-code-generator/issues/34)) ([1c8dc40](https://github.com/Himenon/openapi-typescript-code-generator/commit/1c8dc40))
91-
92-
93-
94-
64+
- Add Code template feature ([#30](https://github.com/Himenon/openapi-typescript-code-generator/issues/30)) ([881625c](https://github.com/Himenon/openapi-typescript-code-generator/commit/881625c))
65+
- classify code generator ([#31](https://github.com/Himenon/openapi-typescript-code-generator/issues/31)) ([09f8509](https://github.com/Himenon/openapi-typescript-code-generator/commit/09f8509))
66+
- provide a convenient experimental API for code extension ([#35](https://github.com/Himenon/openapi-typescript-code-generator/issues/35)) ([5ce24d3](https://github.com/Himenon/openapi-typescript-code-generator/commit/5ce24d3))
67+
- split type definition ([#34](https://github.com/Himenon/openapi-typescript-code-generator/issues/34)) ([1c8dc40](https://github.com/Himenon/openapi-typescript-code-generator/commit/1c8dc40))
9568

9669
<a name="0.7.2"></a>
9770

docs/ja/README-ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ yarn add -D @himenon/openapi-typescript-code-generator
2222

2323
## 使い方
2424

25-
ここで記されている例は[DEMO用のリポジトリ](https://github.com/Himenon/openapi-typescript-code-generator-demo-project)をクローンして動作確認することができます。
25+
ここで記されている例は[DEMO 用のリポジトリ](https://github.com/Himenon/openapi-typescript-code-generator-demo-project)をクローンして動作確認することができます。
2626

2727
### 型定義のみのコードを生成する
2828

src/internal/OpenApiTools/Extractor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { CodeGenerator, OpenApi } from "../../types";
22
import * as ConverterContext from "./ConverterContext";
3-
import type { Store } from "./store";
3+
import type * as Walker from "./Walker";
44

55
const extractPickedParameter = (parameter: OpenApi.Parameter): CodeGenerator.PickedParameter => {
66
return {
@@ -56,7 +56,7 @@ const hasQueryParameters = (parameters?: OpenApi.Parameter[]): boolean => {
5656
};
5757

5858
export const generateCodeGeneratorParamsArray = (
59-
store: Store,
59+
store: Walker.Store,
6060
converterContext: ConverterContext.Types,
6161
allowOperationIds: string[] | undefined,
6262
): CodeGenerator.Params[] => {

src/internal/OpenApiTools/Guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { OpenApi } from "../../types";
2-
import { Def } from "./store";
32
import * as Types from "./types";
3+
import { Def } from "./Walker";
44

55
export const isReference = (data: any): data is OpenApi.Reference => {
66
if (typeof data !== "object" || data === null) {

src/internal/OpenApiTools/Parser.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,15 @@ import * as Schemas from "./components/Schemas";
1010
import * as ConvertContext from "./ConverterContext";
1111
import * as Extractor from "./Extractor";
1212
import * as Paths from "./paths";
13-
import { Store } from "./store";
1413
import * as TypeNodeContext from "./TypeNodeContext";
14+
import { Store } from "./Walker";
1515

1616
export class Parser {
1717
private currentPoint: string;
1818
private convertContext: ConvertContext.Types;
1919
private store: Store;
2020
private factory: TypeScriptCodeGenerator.Factory.Type;
21-
constructor(
22-
private entryPoint: string,
23-
private rootSchema: OpenApi.Document,
24-
noReferenceOpenApiSchema: OpenApi.Document,
25-
) {
21+
constructor(private entryPoint: string, private rootSchema: OpenApi.Document, noReferenceOpenApiSchema: OpenApi.Document) {
2622
this.currentPoint = entryPoint;
2723
this.convertContext = ConvertContext.create();
2824
this.factory = TypeScriptCodeGenerator.Factory.create();

src/internal/OpenApiTools/TypeNodeContext.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import ts from "typescript";
55
import { DevelopmentError } from "../Exception";
66
import * as TypeScriptCodeGenerator from "../TsGenerator";
77
import * as ConverterContext from "./ConverterContext";
8-
import type { Store } from "./store";
98
import * as ToTypeNode from "./toTypeNode";
9+
import type * as Walker from "./Walker";
1010

1111
export interface ReferencePathSet {
1212
pathArray: string[];
@@ -25,7 +25,7 @@ const generatePath = (entryPoint: string, currentPoint: string, referencePath: s
2525
};
2626
};
2727

28-
const calculateReferencePath = (store: Store, base: string, pathArray: string[]): ToTypeNode.ResolveReferencePath => {
28+
const calculateReferencePath = (store: Walker.Store, base: string, pathArray: string[]): ToTypeNode.ResolveReferencePath => {
2929
let names: string[] = [];
3030
let unresolvedPaths: string[] = [];
3131
pathArray.reduce((previous, lastPath, index) => {
@@ -75,7 +75,7 @@ const calculateReferencePath = (store: Store, base: string, pathArray: string[])
7575

7676
export const create = (
7777
entryPoint: string,
78-
store: Store,
78+
store: Walker.Store,
7979
factory: TypeScriptCodeGenerator.Factory.Type,
8080
converterContext: ConverterContext.Types,
8181
): ToTypeNode.Context => {

0 commit comments

Comments
 (0)