Skip to content

Commit

Permalink
Complete v3.19 update with editor and migrate.
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Nov 11, 2024
1 parent 7c79b77 commit 8e66379
Show file tree
Hide file tree
Showing 29 changed files with 673 additions and 133 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@nestia/station",
"version": "3.19.0-dev.20241112",
"version": "3.19.1",
"description": "Nestia station",
"scripts": {
"build": "node build/index.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/core",
"version": "3.19.0-dev.20241112",
"version": "3.19.1",
"description": "Super-fast validation decorators of NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -36,7 +36,7 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "../fetcher/nestia-fetcher-3.19.0-dev.20241112.tgz",
"@nestia/fetcher": "^3.19.1",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@samchon/openapi": "^1.2.2",
Expand All @@ -53,7 +53,7 @@
"ws": "^7.5.3"
},
"peerDependencies": {
"@nestia/fetcher": ">=3.19.0-dev.20241112",
"@nestia/fetcher": ">=3.19.1",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/programmers/PlainBodyProgrammer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const validate = (metadata: Metadata): string[] => {
.reduce((a, b) => a + b, 0);
if (expected === 0 || expected !== metadata.size())
insert(`only string type is allowed`);
if (metadata.isRequired() === false) insert(`do not allow undefindable type`);
if (metadata.nullable === true) insert(`do not allow nullable type`);
else if (metadata.any === true) insert(`do not allow any type`);

Expand Down
4 changes: 2 additions & 2 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/editor",
"version": "0.7.1",
"version": "0.8.0",
"typings": "lib/index.d.ts",
"main": "lib/index.js",
"module": "lib/index.mjs",
Expand Down Expand Up @@ -34,7 +34,7 @@
"homepage": "https://nestia.io",
"dependencies": {
"@mui/material": "^5.15.6",
"@nestia/migrate": "^0.19.0",
"@nestia/migrate": "^0.20.0",
"@stackblitz/sdk": "^1.11.0",
"js-yaml": "^4.1.0",
"prettier": "^3.3.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetcher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/fetcher",
"version": "3.19.0-dev.20241112",
"version": "3.19.1",
"description": "Fetcher library of Nestia SDK",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
111 changes: 111 additions & 0 deletions packages/migrate/assets/input/v3.1/body-optional.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"openapi": "3.1.0",
"servers": [
{
"url": "https://github.com/samchon/nestia",
"description": "insert your server url"
}
],
"info": {
"version": "3.19.0-dev.20241111",
"title": "@samchon/nestia-test",
"description": "Test program of Nestia",
"license": {
"name": "MIT"
}
},
"paths": {
"/body/optional/json": {
"post": {
"tags": [],
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IBodyOptional"
}
}
},
"required": false
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/IBodyOptional"
}
}
}
}
}
}
},
"/body/optional/plain": {
"post": {
"tags": [],
"parameters": [],
"requestBody": {
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
},
"required": false
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/health": {
"get": {
"tags": [],
"parameters": [],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {}
}
}
}
}
}
},
"components": {
"schemas": {
"IBodyOptional": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"value": {
"type": "number"
}
},
"required": [
"id",
"value"
]
}
}
},
"tags": [],
"x-samchon-emended": true
}
4 changes: 2 additions & 2 deletions packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
"homepage": "https://nestia.io",
"devDependencies": {
"@nestia/benchmark": "^0.2.3",
"@nestia/core": "^3.19.0",
"@nestia/core": "^3.19.1",
"@nestia/e2e": "^0.7.0",
"@nestia/fetcher": "^3.19.0",
"@nestia/fetcher": "^3.19.1",
"@nestjs/common": "^10.3.8",
"@nestjs/core": "^10.3.8",
"@nestjs/platform-express": "^10.3.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ export namespace MigrateApiFunctionProgrammer {
ts.factory.createTypeReferenceNode(
`${route.accessor.at(-1)!}.Input`,
),
(route.body.type === "application/json" ||
route.body.type === "text/plain") &&
route.operation().requestBody?.required === false
? ts.factory.createToken(ts.SyntaxKind.QuestionToken)
: undefined,
),
]
: []),
Expand Down
11 changes: 7 additions & 4 deletions packages/migrate/src/programmers/MigrateNestMethodProgrammer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export namespace MigrateNestMethodProgrammer {
writeDtoParameter({ method: "TypedHeaders", variable: "headers" })(
components,
)(importer)({
required: true,
schema: route.headers.schema,
example: route.headers.example(),
examples: route.headers.examples(),
Expand All @@ -210,6 +211,7 @@ export namespace MigrateNestMethodProgrammer {
writeDtoParameter({ method: "TypedQuery", variable: "query" })(
components,
)(importer)({
required: true,
schema: route.query.schema,
example: route.query.example(),
examples: route.query.examples(),
Expand All @@ -233,10 +235,11 @@ export namespace MigrateNestMethodProgrammer {
variable: "body",
})(components)(importer)({
schema: route.body.schema,
required:
(route.body.type !== "application/json" &&
route.body.type !== "text/plain") ||
!!route.operation().requestBody?.required,
required: !(
(route.body.type === "application/json" ||
route.body.type === "text/plain") &&
route.operation().requestBody?.required === false
),
example: route.body.media().example,
examples: route.body.media().examples,
}),
Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/sdk",
"version": "3.19.0-dev.20241112",
"version": "3.19.1",
"description": "Nestia SDK and Swagger generator",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -32,8 +32,8 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/core": "../core/nestia-core-3.19.0-dev.20241112.tgz",
"@nestia/fetcher": "../fetcher/nestia-fetcher-3.19.0-dev.20241112.tgz",
"@nestia/core": "^3.19.1",
"@nestia/fetcher": "^3.19.1",
"@samchon/openapi": "^1.2.2",
"cli": "^1.0.1",
"get-function-location": "^2.0.0",
Expand All @@ -47,8 +47,8 @@
"typia": "^6.12.0"
},
"peerDependencies": {
"@nestia/core": ">=3.19.0-dev.20241112",
"@nestia/fetcher": ">=3.19.0-dev.20241112",
"@nestia/core": ">=3.19.1",
"@nestia/fetcher": ">=3.19.1",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @packageDocumentation
* @module api.functional
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
//================================================================
export * as query from "./query";
Loading

0 comments on commit 8e66379

Please sign in to comment.