Comments (7)
same here (with class-validator 0.14.0)
return metadatas.map((meta) => { app_1 | ^ app_1 | app_1 | TypeError: metadatas.map is not a function app_1 | at populateMetadatasWithConstraints (.../node_modules/class-validator-jsonschema/build/index.js:60:22) app_1 | at getMetadatasFromStorage (/(.../node_modules/class-validator-jsonschema/build/index.js:56:12) app_1 | at validationMetadatasToSchemas ((.../node_modules/class-validator-jsonschema/build/index.js:15:23
@mcankudis I upgraded class-validator-jsonschema
to 5.0.0 but still finding this issue.
from class-validator-jsonschema.
Got a similar error on version 3.1.1 after upgrading the class-validator
from 0.13.2 to 0.14. Upgraded class-validator-jsonschema
to 5.0.0 and things started working again. If you haven't done so yet, try upgrading the class-validator
, maybe that helps.
The error for reference:
TypeError: metadatas.map is not a function
at populateMetadatasWithConstraints (<my_path>/node_modules/class-validator-jsonschema/src/index.ts:141:20)
at getMetadatasFromStorage (<my_path>/node_modules/class-validator-jsonschema/src/index.ts:132:10)
at validationMetadatasToSchemas (<my_path>/node_modules/class-validator-jsonschema/src/index.ts:26:21)
from class-validator-jsonschema.
same here (with class-validator 0.14.0)
return metadatas.map((meta) => {
app_1 | ^
app_1 |
app_1 | TypeError: metadatas.map is not a function
app_1 | at populateMetadatasWithConstraints (.../node_modules/class-validator-jsonschema/build/index.js:60:22)
app_1 | at getMetadatasFromStorage (/(.../node_modules/class-validator-jsonschema/build/index.js:56:12)
app_1 | at validationMetadatasToSchemas ((.../node_modules/class-validator-jsonschema/build/index.js:15:23
from class-validator-jsonschema.
I was able to solve it as follows:
import * as oa from "openapi3-ts";
import { getMetadataArgsStorage, RoutingControllersOptions } from "routing-controllers";
import { routingControllersToSpec } from "routing-controllers-openapi";
import { validationMetadatasToSchemas } from "class-validator-jsonschema";
const metadataSchemas = validationMetadatasToSchemas();
const storage = getMetadataArgsStorage();
return routingControllersToSpec(storage, routingControllersOptions, {
components: {
schemas: metadataSchemas as Record<string, oa.SchemaObject | oa.ReferenceObject>
}
});
Library versions
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"class-validator-jsonschema": "^5.0.0",
"routing-controllers": "^0.10.1",
"routing-controllers-openapi": "^4.0.0",
from class-validator-jsonschema.
Hello! Any updates for this issue? I am trying to integrate class-validator-jsonschema
and It seem I can`t work with nested objects.
from class-validator-jsonschema.
Hello! Any updates for this issue? I am trying to integrate
class-validator-jsonschema
and It seem I can`t work with nested objects.
For object arrays too
from class-validator-jsonschema.
anyone created some fork with this fix ?
from class-validator-jsonschema.
Related Issues (20)
- Mixed array of custom type
- Incorrectly generated schema for subclasses HOT 2
- Don't use refs for nested objects HOT 3
- Cannot find module 'class-transformer/metadata/MetadataStorage' HOT 1
- Validation Groups Feature HOT 1
- class-transformer package is missing as npm dependency HOT 1
- How to get jsonschema for only one class ? HOT 10
- Can you convert from JSON back to class? HOT 1
- Regular expression for IS_DATE_STRING is missing escape characters HOT 1
- Typescript build failing HOT 1
- @isEnum "type": "string"
- Reflect.getMetadata is not a function when using @Type nested property type HOT 1
- Support for Fastify or Fastify-Swagger
- Bug with decorator `@Exclude` processing on classes inheritance HOT 1
- Regular expression for IS_DATE_STRING is missing escape characters
- class-transformer version mismatch HOT 1
- Move inherited properties before sub class properties
- Error with latest version of node
- class transformer discriminators
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from class-validator-jsonschema.