Skip to content

Commit

Permalink
feat: Initial commit of OpenAPI TypeScript Generator (#2)
Browse files Browse the repository at this point in the history
* feat: addExport

* feat: add oas3.0.1 types

* feat: update open api 3.1.0 types

* feat: update open api 3.1.0 types

* feat: factoryを作成

* feat: 整理

* refactor: 変数名の整理

* feat: schemaをTypeNodeに変換する

* feat: parametersに対応

* feat: commentsがつくように修正

* chore: add comment

* feat: referenceの再帰的解決ができるようになった

* refactor: entryPointとcurrentPointに変数名を変更

* feat: 各Propertyに処理を分離

* feat: requestBodiesを追加

* feat: add securitySchemes

* feat: pathItemsに対応

* docs: add comment

* feat: コメントを追加

* feat: typeGuardを追加

* fix: SingleCommentの場合の改行修正とReferenceの挙動修正

* feat: enumに対応

* feat: objectのrequiredに対応

* feat: additionalProperties対応をした

* fix: enum対応の漏れを修正

* fix: 日本語がエスケープされる不具合の修正

* fix: import name

* fix: oneOf, allOf対応

* refactor: ディレクトリ構造を整理

* feat: storeを作成

* feat: referenceの更新

* test: add test code

* chore(scripts): 開発用のwatcherを追加

* feat: referenceの挙動を確定

* fix: referenceの挙動を安定化

* feat: Storeの構造を調整

* refactor: rename test file

* feat: propAccess test

* test: PropAccess

* feat: 新しいStoreの構造でcodeが生成できるようになった

* feat: genericsにした

* feat: responses, headersの調整

* feat: securitySchemasに対応

* feat: pathItemsを対応

* feat: referenceがあった場合にTypeReferenceで登録できるようにした

* feat: reference取得時のcallbackを作成

* feat: setReferenceの更新

* feat: 参照の解決ができるようになった

* feat: requestBodiesを追加

* feat: operationのparametersに対応

* feat: operationに対応

* fix: localReferenceの整理

* refactor: errorを分類した

* docs: add test case

* test: testの修正

* fix: import order

* chore: update dependencies version

* feat: operation.parameteresのreference対応

* feat: pathItems.requestBodyに対応

* feat: responseに対応

* test: add validate

* feat: responsesの調整

* fix: StatusCodeが含まれない不具合の修正

* feat: pathItemsの定義を制限した

* refactor: coponentsに分離

* feat(header): headerをinterfaceに変更

* feat(header): headerをinterfaceに変更

* feat(parameter): namespaceからinterfaceに変更

* fix: schemasでtypeAliasが作成されていない不具合の修正

* feat: pathsの処理を分割

* feat: 引数の型定義を出力

* feat: 引数の型定義を生成

* refactor: factoryで利用できるts generatorを追加

* feat: コード生成用のテンプレートを作成

* feat: classが生成されるようになった

* feat: responseの型調整

* refactor: templateの調整

* feat: Generatorの分離

* refactor: remove file

* feat: async, union type対応

* feat: parametersの抽出

* feat: parameteresの取得

* feat: PathParameterを追加できるようにした

* fix: 係数倍の忘れを修正

* fix: replaceされなかったrequestUrlTicksがあった場合に最後に結合する

* feat: queryParameterとheaderParmaeterの生成

* feat: CallRequestを追加

* fix: typo

* fix: 型定義を調整

* fix: schemaのreferenceを最初にすべて解決する

* feat: remote referenceの解決

* feat: referenceを解決したobjectを入手できるようにした

* feat: Nameを一元管理

* feat: ResponseTypeを修正

* feat: ContentTypeのGenericsを追加

* feat: responseのcontentTypeが複数の場合に対応した

* feat: headerを追加

* feat: paramsのGenerics指定の完成

* feat: headerの挿入

* feat: requestBodyが存在する場合にパラメーターから取得するようにした

* feat: queryParameterが存在する場合だけ変数定義をする

* feat: QueryParmaeterの整形をDIするApiClientに任せるように調整

* fix: explodeが渡されない不具合の修正

* fix: PathParameterで/がつかない不具合の修正

* fix: pathIdentifer関係を削除

* fix: Local Reference対応

* fix: 利用されていないinterfaceの定義は出力しないようにした

* fix: response.contentにContentTypeが指定されていない場合はstatusCodeを読み取らないようにする

* feat: methodにコメントを入れる

* test: テストケースを追加

* refactor: tsのNodeに依存しないように修正

* feat: TODO整理

* fix: ParameterのLocalReferenceを修正

* feat: pathItemのreference対応

* feat: TODO棚卸し

* docs: update readme

* test: fix config

* ci: remove codeql

* ci: fix checkout sha

* fix: test code types

* chore: update libraries

* test: add snapshot test

* ci: change order

* ci: remove debug file

* ci: fix mkdir

* refactor: rename directory

* docs: add template

* refactor: CodeGenerator用のParmaeterを切り出し

* refactor: type names

* refactor: update name

* feat: コードをユーザーが自由に変更できるAPIを作成した

* feat: CodeTemplateを切り出し

* test: fix circular dependency

* feat: add validator

* test: テスト項目を随時追加

* test: add directory schema

* test: add parmaeters,responses,requestBodies

* test: direct remote referenceの試験を追加

* feat: update test

* test: update

* fix: parameter remote schema

* refactor: method move

* test: add response remote reference

* test: add requestBodies

* test: add header reference

* test: update

* refactor: remove unused variable

* feat: pathItemsのvalidatorを緩和

* fix: reference to reference

* docs: READMEを追加

* docs: update

* docs: update

* chore: add example project

* fix: parameters requiredの修正

* fix: referenceの不具合などを修正

* feat: add max log length

* fix: reference pointの指定ミス

* feat: support nullable

* docs: update example

* docs: update

* docs: update

* docs: update

* test: remove version text
  • Loading branch information
Himenon committed Jan 12, 2021
1 parent b897d69 commit df022c2
Show file tree
Hide file tree
Showing 186 changed files with 10,501 additions and 847 deletions.
1 change: 1 addition & 0 deletions .eslintignore
2 changes: 2 additions & 0 deletions .eslintingore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib
debug
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module.exports = {
},
plugins: ["@typescript-eslint"],
rules: {
"no-unused-vars": "error",
"no-unused-vars": "warn",
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/no-namespace": "off",
},
};
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: "🐛 Bug Report"
about: Report a reproducible bug or regression.
title: "Bug: "
labels: "Status: Unconfirmed"
---

## Steps To Reproduce

<!--
Please provide a clear and concise description of what the bug is. Include
screenshots if needed. Please test using the latest version of the relevant
React packages to make sure your issue has not already been fixed.
-->

<!--
Write the minimum OpenAPI JSON or YAML Schema needed to reproduce the bug.
-->

## The current behavior

## The expected behavior
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Summary

<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

## Test Plan

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. -->
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: main
ref: ${{ github.event.pull_request.head.sha }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Test & Build
run: |
yarn install --frozen-lockfile
yarn test
yarn build
yarn test
env:
CI: true
68 changes: 0 additions & 68 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/versionUp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: main
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v1
with:
node-version: "12.x"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ package-lock.json
.env*
*.log
private_npm_cache
test/code
debug
33 changes: 33 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "test:code:gen",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
"args": ["scripts/testCodeGen.ts"],
"cwd": "${workspaceRoot}",
"env": {
"TS_NODE_PROJECT": "tsconfig.build.json"
},
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
},
{
"name": "example:code:gen",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
"args": ["codegen.ts"],
"cwd": "${workspaceRoot}/example",
"env": {
"TS_NODE_PROJECT": "tsconfig.json"
},
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
]
}
84 changes: 0 additions & 84 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Himenon
Copyright (c) 2021 Himenon

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
Loading

0 comments on commit df022c2

Please sign in to comment.