We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { getFromContainer, IsOptional, IsString, MaxLength, MetadataStorage } from 'class-validator' import { validationMetadatasToSchemas } from 'class-validator-jsonschema'
class BlogPost { @IsString() id: string
@IsOptional() @maxlength(20, { each: true }) tags: string[] }
{ "name": "openapi3x1", "version": "1.0.0", "description": "", "main": "server.js", "scripts": { "test": "echo "Error: no test specified" && exit 1", "start": "node ./dist/server.js" }, "author": "zoro", "license": "ISC", "dependencies": { "body-parser": "^1.19.0", "class-validator-jsonschema": "^1.3.0", "config": "^3.1.0", "express": "^4.17.1", "lodash": "^4.17.11", "routing-controllers-openapi": "^1.7.0" }, "devDependencies": { "@types/body-parser": "^1.17.0", "@types/config": "0.0.34", "@types/express": "^4.17.0", "@types/lodash": "^4.14.135", "@types/node": "^12.0.12" } }
The text was updated successfully, but these errors were encountered:
sorry, missing result
Sorry, something went wrong.
No branches or pull requests
I am trying to work with the current package without success.
I ran the sample code and I don't get the expect result.
Could you assist me please.
import { getFromContainer, IsOptional, IsString, MaxLength, MetadataStorage } from 'class-validator'
import { validationMetadatasToSchemas } from 'class-validator-jsonschema'
class BlogPost {
@IsString() id: string
@IsOptional()
@maxlength(20, { each: true })
tags: string[]
}
const metadatas = (getFromContainer(MetadataStorage) as any).validationMetadatas
const schemas = validationMetadatasToSchemas(metadatas)
console.log(schemas)
tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "./dist",
"rootDir": "./src",
"sourceMap": true,
"noImplicitAny": true
},
"include": [
"src/**/*.ts",
"package.json"
],
"exclude": [
"node_modules"
]
}
{
"name": "openapi3x1",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node ./dist/server.js"
},
"author": "zoro",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"class-validator-jsonschema": "^1.3.0",
"config": "^3.1.0",
"express": "^4.17.1",
"lodash": "^4.17.11",
"routing-controllers-openapi": "^1.7.0"
},
"devDependencies": {
"@types/body-parser": "^1.17.0",
"@types/config": "0.0.34",
"@types/express": "^4.17.0",
"@types/lodash": "^4.14.135",
"@types/node": "^12.0.12"
}
}
The text was updated successfully, but these errors were encountered: