Feature: Added Code generation based on swagger.json #4

Merged
igorpropisnov merged 6 commits from feature/generate-api-client into main 2024-05-22 15:48:01 +02:00
4 changed files with 69 additions and 5 deletions
Showing only changes of commit 0b027c77cd - Show all commits

View File

@ -0,0 +1,15 @@
{
"npmName": "Ticket-API-Services",
"npmVersion": "0.0.0",
"providedIn": "root",
"withInterfaces": true,
"enumNameSuffix": "Enum",
"supportsES6": true,
"ngVersion": "17.0.0",
"modelSuffix": "Model",
"stringEnums": true,
"enumPropertyNaming": "PascalCase",
"modelPropertyNaming": "original",
"fileNaming": "camelCase",
"paramNaming": "camelCase"
}

48
backend/openapitools.json Normal file
View File

@ -0,0 +1,48 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.6.0",
"generators": {
"typescript-angular": {
"generatorName": "typescript-angular",
"output": "web-api",
"inputSpec": "http://localhost:3000/api-json",
"additionalProperties": {
"npmName": "Ticket-API-Services",
"npmVersion": "0.0.0",
"ngVersion": "17.0.0",
"npmRepository": null,
"configurationPrefix": null,
"apiModulePrefix" : "TicketApi",
"providedIn": "any",
"fileNaming": "camelCase",
"paramNaming": "camelCase",
"enumPropertyNamingReplaceSpecialChar": "false",
"enumUnknownDefaultCase": "false",
"enumNameSuffix": "ApiEnum",
"enumPropertyNaming": "PascalCase",
"modelPropertyNaming": "original",
"modelSuffix": "ApiModel",
"modelFileSuffix": ".api.model",
"serviceSuffix": "ApiService",
"serviceFileSuffix": ".api.service",
"withInterfaces": true,
"supportsES6": true,
"stringEnums": true,
"sortParamsByRequiredFlag": true,
"sortModelPropertiesByRequiredFlag": true,
"useSingleRequestParameter": false,
"taggedUnions": false,
"snapshot": false,
"prependFormOrBodyParameters": false,
"nullSafeAdditionalProps": false,
"legacyDiscriminatorBehavior": true,
"ensureUniqueParams": true,
"disallowAdditionalPropertiesIfNotPresent": true,
"allowUnicodeIdentifiers": false
}
}
}
}
}

View File

@ -17,7 +17,8 @@
"test:watch": "jest --watch", "test:watch": "jest --watch",
"test:cov": "jest --coverage", "test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json" "test:e2e": "jest --config ./test/jest-e2e.json",
"build:api": "pnpm openapi-generator-cli generate"
}, },
"dependencies": { "dependencies": {
"@nestjs/common": "^10.0.0", "@nestjs/common": "^10.0.0",
@ -28,6 +29,7 @@
"@nestjs/platform-express": "^10.0.0", "@nestjs/platform-express": "^10.0.0",
"@nestjs/swagger": "^7.3.1", "@nestjs/swagger": "^7.3.1",
"@nestjs/typeorm": "^10.0.2", "@nestjs/typeorm": "^10.0.2",
"argon2": "^0.40.1",
"class-transformer": "^0.5.1", "class-transformer": "^0.5.1",
"class-validator": "^0.14.1", "class-validator": "^0.14.1",
"install": "^0.13.0", "install": "^0.13.0",

View File

@ -29,6 +29,9 @@ dependencies:
'@nestjs/typeorm': '@nestjs/typeorm':
specifier: ^10.0.2 specifier: ^10.0.2
version: 10.0.2(@nestjs/common@10.3.7)(@nestjs/core@10.3.7)(reflect-metadata@0.2.2)(rxjs@7.8.1)(typeorm@0.3.20) version: 10.0.2(@nestjs/common@10.3.7)(@nestjs/core@10.3.7)(reflect-metadata@0.2.2)(rxjs@7.8.1)(typeorm@0.3.20)
argon2:
specifier: ^0.40.1
version: 0.40.1
class-transformer: class-transformer:
specifier: ^0.5.1 specifier: ^0.5.1
version: 0.5.1 version: 0.5.1
@ -1182,7 +1185,6 @@ packages:
/@phc/format@1.0.0: /@phc/format@1.0.0:
resolution: {integrity: sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ==} resolution: {integrity: sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ==}
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true
/@pkgjs/parseargs@0.11.0: /@pkgjs/parseargs@0.11.0:
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
@ -1823,7 +1825,6 @@ packages:
'@phc/format': 1.0.0 '@phc/format': 1.0.0
node-addon-api: 7.1.0 node-addon-api: 7.1.0
node-gyp-build: 4.8.1 node-gyp-build: 4.8.1
dev: true
/argparse@1.0.10: /argparse@1.0.10:
resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
@ -4230,7 +4231,6 @@ packages:
/node-addon-api@7.1.0: /node-addon-api@7.1.0:
resolution: {integrity: sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==} resolution: {integrity: sha512-mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g==}
engines: {node: ^16 || ^18 || >= 20} engines: {node: ^16 || ^18 || >= 20}
dev: true
/node-emoji@1.11.0: /node-emoji@1.11.0:
resolution: {integrity: sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==} resolution: {integrity: sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==}
@ -4252,7 +4252,6 @@ packages:
/node-gyp-build@4.8.1: /node-gyp-build@4.8.1:
resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==} resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==}
hasBin: true hasBin: true
dev: true
/node-int64@0.4.0: /node-int64@0.4.0:
resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==}