@nestia/migrate 0.2.13 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/NestiaMigrateApplication.js +49 -6
- package/lib/NestiaMigrateApplication.js.map +1 -1
- package/lib/bundles/TEMPLATE.js +3 -3
- package/lib/bundles/TEMPLATE.js.map +1 -1
- package/lib/programmers/ControllerProgrammer.js +4 -14
- package/lib/programmers/ControllerProgrammer.js.map +1 -1
- package/lib/programmers/DtoProgrammer.js +8 -13
- package/lib/programmers/DtoProgrammer.js.map +1 -1
- package/lib/programmers/ImportProgrammer.d.ts +7 -3
- package/lib/programmers/ImportProgrammer.js +28 -7
- package/lib/programmers/ImportProgrammer.js.map +1 -1
- package/lib/programmers/MigrateProgrammer.js +5 -5
- package/lib/programmers/MigrateProgrammer.js.map +1 -1
- package/lib/programmers/RouteProgrammer.d.ts +2 -1
- package/lib/programmers/RouteProgrammer.js +19 -19
- package/lib/programmers/RouteProgrammer.js.map +1 -1
- package/lib/programmers/SchemaProgrammer.d.ts +2 -1
- package/lib/programmers/SchemaProgrammer.js +80 -51
- package/lib/programmers/SchemaProgrammer.js.map +1 -1
- package/lib/structures/IMigrateRoute.d.ts +1 -1
- package/lib/structures/ISwaggerRoute.d.ts +1 -1
- package/package.json +5 -5
- package/src/bundles/TEMPLATE.ts +3 -3
- package/src/programmers/ControllerProgrammer.ts +13 -29
- package/src/programmers/DtoProgrammer.ts +9 -17
- package/src/programmers/ImportProgrammer.ts +41 -13
- package/src/programmers/MigrateProgrammer.ts +5 -5
- package/src/programmers/RouteProgrammer.ts +31 -31
- package/src/programmers/SchemaProgrammer.ts +128 -61
- package/src/structures/IMigrateRoute.ts +1 -1
- package/src/structures/ISwaggerRoute.ts +1 -1
package/src/bundles/TEMPLATE.ts
CHANGED
@@ -47,7 +47,7 @@ export const TEMPLATE = [
|
|
47
47
|
{
|
48
48
|
"location": "",
|
49
49
|
"file": "package.json",
|
50
|
-
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"----------------------------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"prepare\": \"ts-patch install\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"-----------------------------------------------\": \"\",\r\n \"start\": \"node lib/executable/server\",\r\n \"test\": \"node bin/test\",\r\n \"------------------------------------------------\": \"\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.3.6\",\r\n \"@nestia/sdk\": \"^
|
50
|
+
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"----------------------------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"prepare\": \"ts-patch install\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"-----------------------------------------------\": \"\",\r\n \"start\": \"node lib/executable/server\",\r\n \"test\": \"node bin/test\",\r\n \"------------------------------------------------\": \"\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.3.6\",\r\n \"@nestia/sdk\": \"^2.0.1\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^3.3.1\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/inquirer\": \"^8.2.5\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^5.40.0\",\r\n \"@typescript-eslint/parser\": \"^5.40.0\",\r\n \"chalk\": \"^4.1.0\",\r\n \"cli\": \"^1.0.1\",\r\n \"eslint-plugin-deprecation\": \"^1.4.1\",\r\n \"nestia\": \"^4.5.0\",\r\n \"prettier\": \"^2.7.1\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.0\",\r\n \"typescript\": \"^5.2.2\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^2.0.1\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tstl\": \"^2.5.13\",\r\n \"typia\": \"^5.0.2\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}\r\n"
|
51
51
|
},
|
52
52
|
{
|
53
53
|
"location": "/packages/api",
|
@@ -57,7 +57,7 @@ export const TEMPLATE = [
|
|
57
57
|
{
|
58
58
|
"location": "/packages/api",
|
59
59
|
"file": "package.json",
|
60
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.0.0\",\r\n \"description\": \"API for PROJECT\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^
|
60
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.0.0\",\r\n \"description\": \"API for PROJECT\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-template\"\r\n },\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-template/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-template#readme\",\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.0.1\",\r\n \"typia\": \"^5.0.2\"\r\n }\r\n}\r\n"
|
61
61
|
},
|
62
62
|
{
|
63
63
|
"location": "/packages/api",
|
@@ -67,7 +67,7 @@ export const TEMPLATE = [
|
|
67
67
|
{
|
68
68
|
"location": "/packages/api",
|
69
69
|
"file": "swagger.json",
|
70
|
-
"content": "{\r\n \"openapi\": \"3.0.1\",\r\n \"servers\": [\r\n {\r\n \"url\": \"http://localhost:37001\",\r\n \"description\": \"Local Server\"\r\n }\r\n ],\r\n \"info\": {\r\n \"version\": \"0.1.0\",\r\n \"title\": \"@ORGANIZATION/PROJECT\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"license\": {\r\n \"name\": \"MIT\"\r\n }\r\n },\r\n \"paths\": {\r\n \"/bbs/articles/{section}\": {\r\n \"patch\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"description\": \"Target section\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"Pagination request info with searching and sorting options\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IRequest\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Paged articles witb summarization\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IPage_lt_IBbsArticle.ISummary_gt_\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"List up entire articles, but paginated and summarized\",\r\n \"description\": \"List up entire articles, but paginated and summarized.\\n\\nThis method is for listing up summarized articles with pagination.\\n\\nIf you want, you can search and sort articles with specific conditions.\",\r\n \"x-nestia-namespace\": \"bbs.articles.index\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Pagination request info with searching and sorting options\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Paged articles witb summarization\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"PATCH\"\r\n },\r\n \"post\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"description\": \"Target section\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"New article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IStore\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Newly created article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Store a new article\",\r\n \"description\": \"Store a new article.\\n\\nStore a new article and returns its detailed record info.\",\r\n \"x-nestia-namespace\": \"bbs.articles.store\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"New article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Newly created article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"POST\"\r\n }\r\n },\r\n \"/bbs/articles/{section}/{id}\": {\r\n \"get\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"description\": \"Target section\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"required\": true\r\n },\r\n {\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"description\": \"Target articles id\",\r\n \"schema\": {\r\n \"format\": \"uuid\",\r\n \"type\": \"string\"\r\n },\r\n \"required\": true\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"Detailed article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Get an article with detailed info\",\r\n \"description\": \"Get an article with detailed info.\\n\\nOpen an article with detailed info, increasing reading count.\",\r\n \"x-nestia-namespace\": \"bbs.articles.at\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"id\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target articles id\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Detailed article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"GET\"\r\n },\r\n \"put\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"description\": \"Target section\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"required\": true\r\n },\r\n {\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"description\": \"Target articles id\",\r\n \"schema\": {\r\n \"format\": \"uuid\",\r\n \"type\": \"string\"\r\n },\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"Content to update\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IUpdate\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Newly created content info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISnapshot\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Update article\",\r\n \"description\": \"Update article.\\n\\nWhen updating, this BBS system does not overwrite the content, but accumulate it.\\nTherefore, whenever an article being updated, length of {@link IBbsArticle.snapshots }\\nwould be increased and accumulated.\",\r\n \"x-nestia-namespace\": \"bbs.articles.update\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"id\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target articles id\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Content to update\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Newly created content info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"PUT\"\r\n }\r\n }\r\n },\r\n \"components\": {\r\n \"schemas\": {\r\n \"IBbsArticle.IRequest\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"search\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IRequest.ISearch\"\r\n },\r\n \"sort\": {\r\n \"$ref\": \"#/components/schemas/IPage.Sort_lt_IBbsArticle.IRequest.SortableColumns_gt_\"\r\n },\r\n \"page\": {\r\n \"description\": \"Page number.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"number\"\r\n },\r\n \"limit\": {\r\n \"description\": \"Limitation of records per a page.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"number\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"description\": \"Page request info with some options.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IRequest.ISearch\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"writer\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"description\": \"Searching options.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IPage.Sort_lt_IBbsArticle.IRequest.SortableColumns_gt_\": {\r\n \"description\": \"Sorting column specialization.\\n\\nThe plus means ascending order and the minus means descending order.\",\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"description\": \"Sorting column specialization.\\n\\nThe plus means ascending order and the minus means descending order.\",\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"-writer\",\r\n \"-title\",\r\n \"-created_at\",\r\n \"-updated_at\",\r\n \"+writer\",\r\n \"+title\",\r\n \"+created_at\",\r\n \"+updated_at\"\r\n ]\r\n }\r\n },\r\n \"IPage_lt_IBbsArticle.ISummary_gt_\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"pagination\": {\r\n \"$ref\": \"#/components/schemas/IPage.IPagination\"\r\n },\r\n \"data\": {\r\n \"description\": \"List of records.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISummary\"\r\n }\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"pagination\",\r\n \"data\"\r\n ],\r\n \"description\": \"A page.\\n\\nCollection of records with pagination indformation.\",\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"author\",\r\n \"text\": [\r\n {\r\n \"text\": \"Samchon\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ]\r\n },\r\n \"IPage.IPagination\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"current\": {\r\n \"description\": \"Current page number.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"number\"\r\n },\r\n \"limit\": {\r\n \"description\": \"Limitation of records per a page.\",\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"default\",\r\n \"text\": [\r\n {\r\n \"text\": \"100\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"number\",\r\n \"default\": 100\r\n },\r\n \"records\": {\r\n \"description\": \"Count of total records in database.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"number\"\r\n },\r\n \"pages\": {\r\n \"description\": \"Number of total pages.\\n\\nEqual to {@link records } / {@link limit } with ceiling.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"number\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"current\",\r\n \"limit\",\r\n \"records\",\r\n \"pages\"\r\n ],\r\n \"description\": \"Page information.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.ISummary\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"writer\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"created_at\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"updated_at\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"writer\",\r\n \"title\",\r\n \"created_at\",\r\n \"updated_at\"\r\n ],\r\n \"description\": \"Summarized info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"description\": \"Primary Key.\",\r\n \"x-typia-metaTags\": [\r\n {\r\n \"kind\": \"format\",\r\n \"value\": \"uuid\"\r\n }\r\n ],\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"format\",\r\n \"text\": [\r\n {\r\n \"text\": \"uuid\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"section\": {\r\n \"description\": \"Section code.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"writer\": {\r\n \"description\": \"Name of nickname of writer.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"snapshots\": {\r\n \"description\": \"List of snapshot contents.\\n\\nWhenever updating an article, its contents would be accumulated.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISnapshot\"\r\n }\r\n },\r\n \"created_at\": {\r\n \"description\": \"Creation time of the article.\",\r\n \"x-typia-metaTags\": [\r\n {\r\n \"kind\": \"format\",\r\n \"value\": \"datetime\"\r\n }\r\n ],\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"format\",\r\n \"text\": [\r\n {\r\n \"text\": \"date-time\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"section\",\r\n \"writer\",\r\n \"snapshots\",\r\n \"created_at\"\r\n ],\r\n \"description\": \"BBS article.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.ISnapshot\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"description\": \"Primary key of individual content.\",\r\n \"x-typia-metaTags\": [\r\n {\r\n \"kind\": \"format\",\r\n \"value\": \"uuid\"\r\n }\r\n ],\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"format\",\r\n \"text\": [\r\n {\r\n \"text\": \"uuid\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"created_at\": {\r\n \"description\": \"Creation time of this content.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"created_at\",\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\"\r\n ],\r\n \"description\": \"Content info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IAttachmentFile\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"name\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"extension\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"nullable\": true\r\n },\r\n \"url\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"name\",\r\n \"extension\",\r\n \"url\"\r\n ],\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IStore\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"writer\": {\r\n \"description\": \"Name or nickname of the writer.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n },\r\n \"password\": {\r\n \"description\": \"Password of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"writer\",\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\",\r\n \"password\"\r\n ],\r\n \"description\": \"Store info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IUpdate\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n },\r\n \"password\": {\r\n \"description\": \"Password of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\",\r\n \"password\"\r\n ],\r\n \"description\": \"Update info.\",\r\n \"x-typia-jsDocTags\": []\r\n }\r\n }\r\n }\r\n}"
|
70
|
+
"content": "{\r\n \"openapi\": \"3.0.1\",\r\n \"servers\": [\r\n {\r\n \"url\": \"http://localhost:37001\",\r\n \"description\": \"Local Server\"\r\n }\r\n ],\r\n \"info\": {\r\n \"version\": \"0.1.0\",\r\n \"title\": \"@ORGANIZATION/PROJECT\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"license\": {\r\n \"name\": \"MIT\"\r\n }\r\n },\r\n \"paths\": {\r\n \"/bbs/articles/{section}\": {\r\n \"patch\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"Pagination request info with searching and sorting options\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IRequest\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Paged articles witb summarization\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IPage_lt_IBbsArticle.ISummary_gt_\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"List up entire articles, but paginated and summarized\",\r\n \"description\": \"List up entire articles, but paginated and summarized.\\n\\nThis method is for listing up summarized articles with pagination.\\n\\nIf you want, you can search and sort articles with specific conditions.\",\r\n \"x-nestia-namespace\": \"bbs.articles.index\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Pagination request info with searching and sorting options\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Paged articles witb summarization\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"PATCH\"\r\n },\r\n \"post\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"New article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IStore\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Newly created article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Store a new article\",\r\n \"description\": \"Store a new article.\\n\\nStore a new article and returns its detailed record info.\",\r\n \"x-nestia-namespace\": \"bbs.articles.store\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"New article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Newly created article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"POST\"\r\n }\r\n },\r\n \"/bbs/articles/{section}/{id}\": {\r\n \"get\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n },\r\n {\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target articles id\",\r\n \"required\": true\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"Detailed article info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Get an article with detailed info\",\r\n \"description\": \"Get an article with detailed info.\\n\\nOpen an article with detailed info, increasing reading count.\",\r\n \"x-nestia-namespace\": \"bbs.articles.at\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"id\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target articles id\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Detailed article info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"GET\"\r\n },\r\n \"put\": {\r\n \"tags\": [],\r\n \"parameters\": [\r\n {\r\n \"name\": \"section\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\"\r\n },\r\n \"description\": \"Target section\",\r\n \"required\": true\r\n },\r\n {\r\n \"name\": \"id\",\r\n \"in\": \"path\",\r\n \"schema\": {\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"description\": \"Target articles id\",\r\n \"required\": true\r\n }\r\n ],\r\n \"requestBody\": {\r\n \"description\": \"Content to update\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IUpdate\"\r\n }\r\n }\r\n },\r\n \"required\": true,\r\n \"x-nestia-encrypted\": false\r\n },\r\n \"responses\": {\r\n \"201\": {\r\n \"description\": \"Newly created content info\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISnapshot\"\r\n }\r\n }\r\n },\r\n \"x-nestia-encrypted\": false\r\n }\r\n },\r\n \"summary\": \"Update article\",\r\n \"description\": \"Update article.\\n\\nWhen updating, this BBS system does not overwrite the content, but accumulate it.\\nTherefore, whenever an article being updated, length of {@link IBbsArticle.snapshots }\\nwould be increased and accumulated.\",\r\n \"x-nestia-namespace\": \"bbs.articles.update\",\r\n \"x-nestia-jsDocTags\": [\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"section\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target section\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"id\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Target articles id\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"param\",\r\n \"text\": [\r\n {\r\n \"text\": \"input\",\r\n \"kind\": \"parameterName\"\r\n },\r\n {\r\n \"text\": \" \",\r\n \"kind\": \"space\"\r\n },\r\n {\r\n \"text\": \"Content to update\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n },\r\n {\r\n \"name\": \"returns\",\r\n \"text\": [\r\n {\r\n \"text\": \"Newly created content info\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-nestia-method\": \"PUT\"\r\n }\r\n }\r\n },\r\n \"components\": {\r\n \"schemas\": {\r\n \"IBbsArticle.IRequest\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"search\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.IRequest.ISearch\"\r\n },\r\n \"sort\": {\r\n \"description\": \"Sorting options.\\n\\nThe plus sign means ASC and minus sign means DESC.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"description\": \"Sorting options.\\n\\nThe plus sign means ASC and minus sign means DESC.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"-writer\",\r\n \"-title\",\r\n \"-created_at\",\r\n \"-updated_at\",\r\n \"+writer\",\r\n \"+title\",\r\n \"+created_at\",\r\n \"+updated_at\"\r\n ]\r\n }\r\n },\r\n \"page\": {\r\n \"description\": \"Page number.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"integer\"\r\n },\r\n \"limit\": {\r\n \"description\": \"Limitation of records per a page.\",\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"integer\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"description\": \"Page request info with some options.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IRequest.ISearch\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"writer\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"x-typia-required\": false,\r\n \"x-typia-optional\": true,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"description\": \"Searching options.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IPage_lt_IBbsArticle.ISummary_gt_\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"pagination\": {\r\n \"$ref\": \"#/components/schemas/IPage.IPagination\"\r\n },\r\n \"data\": {\r\n \"description\": \"List of records.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISummary\"\r\n }\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"pagination\",\r\n \"data\"\r\n ],\r\n \"description\": \"A page.\\n\\nCollection of records with pagination indformation.\",\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"author\",\r\n \"text\": [\r\n {\r\n \"text\": \"Samchon\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ]\r\n },\r\n \"IPage.IPagination\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"current\": {\r\n \"description\": \"Current page number.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n },\r\n \"limit\": {\r\n \"description\": \"Limitation of records per a page.\",\r\n \"x-typia-jsDocTags\": [\r\n {\r\n \"name\": \"default\",\r\n \"text\": [\r\n {\r\n \"text\": \"100\",\r\n \"kind\": \"text\"\r\n }\r\n ]\r\n }\r\n ],\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\",\r\n \"default\": 100\r\n },\r\n \"records\": {\r\n \"description\": \"Count of total records in database.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n },\r\n \"pages\": {\r\n \"description\": \"Number of total pages.\\n\\nEqual to {@link records } / {@link limit } with ceiling.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"integer\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"current\",\r\n \"limit\",\r\n \"records\",\r\n \"pages\"\r\n ],\r\n \"description\": \"Page information.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.ISummary\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"writer\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"created_at\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"updated_at\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"writer\",\r\n \"title\",\r\n \"created_at\",\r\n \"updated_at\"\r\n ],\r\n \"description\": \"Summarized info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"description\": \"Primary Key.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"section\": {\r\n \"description\": \"Section code.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"writer\": {\r\n \"description\": \"Name of nickname of writer.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"snapshots\": {\r\n \"description\": \"List of snapshot contents.\\n\\nWhenever updating an article, its contents would be accumulated.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IBbsArticle.ISnapshot\"\r\n }\r\n },\r\n \"created_at\": {\r\n \"description\": \"Creation time of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"section\",\r\n \"writer\",\r\n \"snapshots\",\r\n \"created_at\"\r\n ],\r\n \"description\": \"BBS article.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.ISnapshot\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"id\": {\r\n \"description\": \"Primary key of individual content.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"uuid\"\r\n },\r\n \"created_at\": {\r\n \"description\": \"Creation time of this content.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"id\",\r\n \"created_at\",\r\n \"title\",\r\n \"format\",\r\n \"body\",\r\n \"files\"\r\n ],\r\n \"description\": \"Content info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IAttachmentFile\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"name\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"maxLength\": 255,\r\n \"minLength\": 1,\r\n \"nullable\": true\r\n },\r\n \"extension\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"maxLength\": 8,\r\n \"minLength\": 1,\r\n \"nullable\": true\r\n },\r\n \"url\": {\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"format\": \"url\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"name\",\r\n \"extension\",\r\n \"url\"\r\n ],\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IStore\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"writer\": {\r\n \"description\": \"Name or nickname of the writer.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n },\r\n \"password\": {\r\n \"description\": \"Password of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"writer\",\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\",\r\n \"password\"\r\n ],\r\n \"description\": \"Store info.\",\r\n \"x-typia-jsDocTags\": []\r\n },\r\n \"IBbsArticle.IUpdate\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"title\": {\r\n \"description\": \"Title of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"body\": {\r\n \"description\": \"Content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n },\r\n \"format\": {\r\n \"description\": \"Format of the content body.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\",\r\n \"enum\": [\r\n \"md\",\r\n \"html\",\r\n \"txt\"\r\n ]\r\n },\r\n \"files\": {\r\n \"description\": \"List of files (to be) attached.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"$ref\": \"#/components/schemas/IAttachmentFile\"\r\n }\r\n },\r\n \"password\": {\r\n \"description\": \"Password of the article.\",\r\n \"x-typia-required\": true,\r\n \"x-typia-optional\": false,\r\n \"type\": \"string\"\r\n }\r\n },\r\n \"nullable\": false,\r\n \"required\": [\r\n \"title\",\r\n \"body\",\r\n \"format\",\r\n \"files\",\r\n \"password\"\r\n ],\r\n \"description\": \"Update info.\",\r\n \"x-typia-jsDocTags\": []\r\n }\r\n }\r\n }\r\n}"
|
71
71
|
},
|
72
72
|
{
|
73
73
|
"location": "/packages/api",
|
@@ -122,20 +122,16 @@ export namespace ControllerProgrammer {
|
|
122
122
|
const importer: ImportProgrammer = new ImportProgrammer();
|
123
123
|
const references: ISwaggerSchema.IReference[] = [];
|
124
124
|
const body: string = [
|
125
|
-
`@${importer.
|
125
|
+
`@${importer.external({
|
126
126
|
library: "@nestjs/common",
|
127
127
|
instance: "Controller",
|
128
128
|
})}(${JSON.stringify(controller.path)})`,
|
129
129
|
`export class ${controller.name} {`,
|
130
130
|
controller.routes
|
131
131
|
.map((r) =>
|
132
|
-
RouteProgrammer.write(
|
133
|
-
|
134
|
-
|
135
|
-
library,
|
136
|
-
instance,
|
137
|
-
}),
|
138
|
-
)(components)(references)(r)
|
132
|
+
RouteProgrammer.write(components)(references)(importer)(
|
133
|
+
r,
|
134
|
+
)
|
139
135
|
.split("\n")
|
140
136
|
.map((l) => ` ${l}`)
|
141
137
|
.join("\n"),
|
@@ -143,28 +139,16 @@ export namespace ControllerProgrammer {
|
|
143
139
|
.join("\n\n"),
|
144
140
|
`}`,
|
145
141
|
].join("\n");
|
146
|
-
|
147
|
-
const dtoImports: string[] = [
|
148
|
-
...new Set(
|
149
|
-
references.map(
|
150
|
-
(r) =>
|
151
|
-
r.$ref
|
152
|
-
.replace("#/components/schemas/", "")
|
153
|
-
.split(".")[0],
|
154
|
-
),
|
155
|
-
),
|
156
|
-
].map(
|
157
|
-
(ref) =>
|
158
|
-
`import { ${ref} } from "${"../".repeat(
|
159
|
-
StringUtil.splitWithNormalization(controller.location)
|
160
|
-
.length - 1,
|
161
|
-
)}api/structures/${ref}"`,
|
162
|
-
);
|
163
|
-
|
164
142
|
return [
|
165
|
-
importer.toScript(
|
166
|
-
|
167
|
-
|
143
|
+
...importer.toScript(
|
144
|
+
(ref) =>
|
145
|
+
`${"../".repeat(
|
146
|
+
StringUtil.splitWithNormalization(
|
147
|
+
controller.location,
|
148
|
+
).length - 1,
|
149
|
+
)}api/structures/${ref}`,
|
150
|
+
),
|
151
|
+
...(importer.empty() ? [] : [""]),
|
168
152
|
body,
|
169
153
|
].join("\n");
|
170
154
|
};
|
@@ -3,6 +3,7 @@ import { ISwaggerSchema } from "../structures/ISwaggeSchema";
|
|
3
3
|
import { ISwagger } from "../structures/ISwagger";
|
4
4
|
import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
5
5
|
import { MapUtil } from "../utils/MapUtil";
|
6
|
+
import { ImportProgrammer } from "./ImportProgrammer";
|
6
7
|
import { SchemaProgrammer } from "./SchemaProgrammer";
|
7
8
|
|
8
9
|
export namespace DtoProgrammer {
|
@@ -30,22 +31,12 @@ export namespace DtoProgrammer {
|
|
30
31
|
(components: ISwaggerComponents) =>
|
31
32
|
(dto: IMigrateDto): string => {
|
32
33
|
const references: ISwaggerSchema.IReference[] = [];
|
33
|
-
const
|
34
|
-
const
|
35
|
-
|
36
|
-
references
|
37
|
-
.map(
|
38
|
-
(s) =>
|
39
|
-
s.$ref
|
40
|
-
.replace(`#/components/schemas/`, ``)
|
41
|
-
.split(".")[0],
|
42
|
-
)
|
43
|
-
.filter((str) => str !== dto.name),
|
44
|
-
),
|
45
|
-
];
|
34
|
+
const importer: ImportProgrammer = new ImportProgrammer();
|
35
|
+
const body: string = iterate(components)(references)(importer)(dto);
|
36
|
+
|
46
37
|
const content: string[] = [
|
47
|
-
...
|
48
|
-
...(
|
38
|
+
...importer.toScript((name) => `./${name}`, dto.name),
|
39
|
+
...(importer.empty() ? [] : [""]),
|
49
40
|
body,
|
50
41
|
];
|
51
42
|
return content.join("\n");
|
@@ -54,6 +45,7 @@ export namespace DtoProgrammer {
|
|
54
45
|
const iterate =
|
55
46
|
(components: ISwaggerComponents) =>
|
56
47
|
(references: ISwaggerSchema.IReference[]) =>
|
48
|
+
(importer: ImportProgrammer) =>
|
57
49
|
(dto: IMigrateDto): string => {
|
58
50
|
const content: string[] = [];
|
59
51
|
if (dto.schema) {
|
@@ -68,14 +60,14 @@ export namespace DtoProgrammer {
|
|
68
60
|
: []),
|
69
61
|
`export type ${dto.name} = ${SchemaProgrammer.write(
|
70
62
|
components,
|
71
|
-
)(references)(dto.schema)}`,
|
63
|
+
)(references)(importer)(dto.schema)}`,
|
72
64
|
);
|
73
65
|
}
|
74
66
|
if (dto.children.length) {
|
75
67
|
content.push(
|
76
68
|
`export namespace ${dto.name} {`,
|
77
69
|
...dto.children.map((c) =>
|
78
|
-
iterate(components)(references)(c)
|
70
|
+
iterate(components)(references)(importer)(c)
|
79
71
|
.split("\n")
|
80
72
|
.map((l) => ` ${l}`)
|
81
73
|
.join("\n"),
|
@@ -1,24 +1,52 @@
|
|
1
1
|
import { MapUtil } from "../utils/MapUtil";
|
2
2
|
|
3
3
|
export class ImportProgrammer {
|
4
|
-
private
|
4
|
+
private external_: Map<string, Set<string>> = new Map();
|
5
|
+
private dtos_: Set<string> = new Set();
|
5
6
|
|
6
|
-
public
|
7
|
-
|
8
|
-
|
7
|
+
public empty(): boolean {
|
8
|
+
return this.external_.size === 0 && this.dtos_.size === 0;
|
9
|
+
}
|
10
|
+
|
11
|
+
public external(props: ImportProgrammer.IProps): string {
|
12
|
+
MapUtil.take(this.external_)(props.library)(() => new Set()).add(
|
13
|
+
props.instance.split(".")[0],
|
9
14
|
);
|
10
15
|
return props.instance;
|
11
16
|
}
|
12
17
|
|
13
|
-
public
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
public tag(type: string, arg: number | string): string {
|
19
|
+
this.external({
|
20
|
+
library: "typia",
|
21
|
+
instance: "tags",
|
22
|
+
});
|
23
|
+
return `tags.${type}<${JSON.stringify(arg)}>`;
|
24
|
+
}
|
25
|
+
|
26
|
+
public dto(name: string): string {
|
27
|
+
this.dtos_.add(name.split(".")[0]);
|
28
|
+
return name;
|
29
|
+
}
|
30
|
+
|
31
|
+
public toScript(
|
32
|
+
dtoPath: (name: string) => string,
|
33
|
+
current?: string,
|
34
|
+
): string[] {
|
35
|
+
const content: string[] = [...this.external_.entries()].map(
|
36
|
+
([library, properties]) =>
|
37
|
+
`import { ${[...properties].join(", ")} } from "${library}";`,
|
38
|
+
);
|
39
|
+
if (this.external_.size && this.dtos_.size) content.push("");
|
40
|
+
content.push(
|
41
|
+
...[...this.dtos_]
|
42
|
+
.filter(
|
43
|
+
current
|
44
|
+
? (name) => name !== current!.split(".")[0]
|
45
|
+
: () => true,
|
46
|
+
)
|
47
|
+
.map((i) => `import { ${i} } from "${dtoPath(i)}";`),
|
48
|
+
);
|
49
|
+
return content;
|
22
50
|
}
|
23
51
|
}
|
24
52
|
export namespace ImportProgrammer {
|
@@ -19,16 +19,16 @@ export namespace MigrateProgrammer {
|
|
19
19
|
(components: ISwaggerComponents) =>
|
20
20
|
(program: IMigrateProgram): IMigrateFile[] => {
|
21
21
|
return [
|
22
|
-
...program.controllers.map((c) => ({
|
23
|
-
location: c.location,
|
24
|
-
file: `${c.name}.ts`,
|
25
|
-
content: ControllerProgrammer.write(components)(c),
|
26
|
-
})),
|
27
22
|
...program.structures.map((s) => ({
|
28
23
|
location: s.location,
|
29
24
|
file: `${s.name}.ts`,
|
30
25
|
content: DtoProgrammer.write(components)(s),
|
31
26
|
})),
|
27
|
+
...program.controllers.map((c) => ({
|
28
|
+
location: c.location,
|
29
|
+
file: `${c.name}.ts`,
|
30
|
+
content: ControllerProgrammer.write(components)(c),
|
31
|
+
})),
|
32
32
|
];
|
33
33
|
};
|
34
34
|
}
|
@@ -7,6 +7,7 @@ import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
|
7
7
|
import { ISwaggerRoute } from "../structures/ISwaggerRoute";
|
8
8
|
import { JsonTypeChecker } from "../utils/JsonTypeChecker";
|
9
9
|
import { StringUtil } from "../utils/StringUtil";
|
10
|
+
import { ImportProgrammer } from "./ImportProgrammer";
|
10
11
|
import { SchemaProgrammer } from "./SchemaProgrammer";
|
11
12
|
|
12
13
|
export namespace RouteProgrammer {
|
@@ -322,12 +323,12 @@ export namespace RouteProgrammer {
|
|
322
323
|
};
|
323
324
|
|
324
325
|
export const write =
|
325
|
-
(importer: (module: string) => (instance: string) => string) =>
|
326
326
|
(components: ISwaggerComponents) =>
|
327
327
|
(references: ISwaggerSchema.IReference[]) =>
|
328
|
+
(importer: ImportProgrammer) =>
|
328
329
|
(route: IMigrateRoute): string => {
|
329
330
|
const output: string = route.success
|
330
|
-
? SchemaProgrammer.write(components)(references)(
|
331
|
+
? SchemaProgrammer.write(components)(references)(importer)(
|
331
332
|
route.success.schema,
|
332
333
|
)
|
333
334
|
: "void";
|
@@ -336,40 +337,43 @@ export namespace RouteProgrammer {
|
|
336
337
|
`${composer(
|
337
338
|
StringUtil.capitalize(route.method),
|
338
339
|
)}(${JSON.stringify(route.path)})`;
|
340
|
+
const external = (lib: string) => (instance: string) =>
|
341
|
+
importer.external({ library: lib, instance });
|
342
|
+
|
339
343
|
const decorator: string[] =
|
340
344
|
route.success?.["x-nestia-encrypted"] === true
|
341
345
|
? [
|
342
|
-
`@${
|
346
|
+
`@${external("@nestia/core")(
|
343
347
|
"EncryptedRoute",
|
344
348
|
)}.${methoder((str) => str)}`,
|
345
349
|
]
|
346
350
|
: route.success?.type === "text/plain"
|
347
351
|
? [
|
348
|
-
`@${
|
352
|
+
`@${external("@nestjs/common")(
|
349
353
|
"Header",
|
350
354
|
)}("Content-Type", "text/plain")`,
|
351
355
|
`@${methoder((str) =>
|
352
|
-
|
356
|
+
external("@nestjs/common")(str),
|
353
357
|
)}`,
|
354
358
|
]
|
355
359
|
: route.method === "head"
|
356
360
|
? [
|
357
|
-
`@${
|
361
|
+
`@${external("@nestjs/common")("Head")}${methoder(
|
358
362
|
() => "",
|
359
363
|
)}`,
|
360
364
|
]
|
361
365
|
: [
|
362
|
-
`@${
|
366
|
+
`@${external("@nestia/core")(
|
363
367
|
"TypedRoute",
|
364
368
|
)}.${methoder((str) => str)}`,
|
365
369
|
];
|
366
370
|
for (const [key, value] of Object.entries(route.exceptions ?? {}))
|
367
371
|
decorator.push(
|
368
|
-
`@${
|
372
|
+
`@${external("@nestia/core")(
|
369
373
|
"TypedException",
|
370
374
|
)}<${SchemaProgrammer.write(components)(references)(
|
371
|
-
|
372
|
-
)}>(${
|
375
|
+
importer,
|
376
|
+
)(value.schema)}>(${
|
373
377
|
isNaN(Number(key)) ? JSON.stringify(key) : key
|
374
378
|
}, ${JSON.stringify(value.description)})`,
|
375
379
|
);
|
@@ -392,41 +396,41 @@ export namespace RouteProgrammer {
|
|
392
396
|
),
|
393
397
|
...(route.headers
|
394
398
|
? [
|
395
|
-
` @${
|
399
|
+
` @${external("@nestia/core")(
|
396
400
|
"TypedHeaders",
|
397
401
|
)}() headers: ${SchemaProgrammer.write(components)(
|
398
402
|
references,
|
399
|
-
)(route.headers)},`,
|
403
|
+
)(importer)(route.headers)},`,
|
400
404
|
]
|
401
405
|
: []),
|
402
406
|
...(route.query
|
403
407
|
? [
|
404
|
-
` @${
|
408
|
+
` @${external("@nestia/core")(
|
405
409
|
"TypedQuery",
|
406
410
|
)}() query: ${SchemaProgrammer.write(components)(
|
407
411
|
references,
|
408
|
-
)(route.query)},`,
|
412
|
+
)(importer)(route.query)},`,
|
409
413
|
]
|
410
414
|
: []),
|
411
415
|
...(route.body
|
412
416
|
? route.body["x-nestia-encrypted"] === true
|
413
417
|
? [
|
414
|
-
` @${
|
418
|
+
` @${external("@nestia/core")(
|
415
419
|
"EncryptedBody",
|
416
420
|
)}() body: ${SchemaProgrammer.write(components)(
|
417
421
|
references,
|
418
|
-
)(route.body.schema)},`,
|
422
|
+
)(importer)(route.body.schema)},`,
|
419
423
|
]
|
420
424
|
: route.body.type === "application/json"
|
421
425
|
? [
|
422
|
-
` @${
|
426
|
+
` @${external("@nestia/core")(
|
423
427
|
"TypedBody",
|
424
428
|
)}() body: ${SchemaProgrammer.write(components)(
|
425
429
|
references,
|
426
|
-
)(route.body.schema)},`,
|
430
|
+
)(importer)(route.body.schema)},`,
|
427
431
|
]
|
428
432
|
: [
|
429
|
-
` @${
|
433
|
+
` @${external("@nestia/core")(
|
430
434
|
"PlainBody",
|
431
435
|
)}() body: string,`,
|
432
436
|
]
|
@@ -440,7 +444,7 @@ export namespace RouteProgrammer {
|
|
440
444
|
...(route.body ? [" body;"] : []),
|
441
445
|
...(output !== "void"
|
442
446
|
? [
|
443
|
-
` return ${
|
447
|
+
` return ${external("typia")(
|
444
448
|
"random",
|
445
449
|
)}<${output}>();`,
|
446
450
|
]
|
@@ -452,19 +456,15 @@ export namespace RouteProgrammer {
|
|
452
456
|
|
453
457
|
const writeParameter =
|
454
458
|
(components: ISwaggerComponents) =>
|
455
|
-
(importer:
|
459
|
+
(importer: ImportProgrammer) =>
|
456
460
|
({ key, schema }: IMigrateRoute.IParameter): string => {
|
457
461
|
const variable = StringUtil.normalize(key);
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
key,
|
465
|
-
)}${
|
466
|
-
format ? `, ${JSON.stringify(format)}` : ""
|
467
|
-
}) ${variable}: ${SchemaProgrammer.write(components)([])(schema)}`;
|
462
|
+
return `@${importer.external({
|
463
|
+
library: "@nestia/core",
|
464
|
+
instance: "TypedParam",
|
465
|
+
})}(${JSON.stringify(key)}) ${variable}: ${SchemaProgrammer.write(
|
466
|
+
components,
|
467
|
+
)([])(importer)(schema)}`;
|
468
468
|
};
|
469
469
|
}
|
470
470
|
|