-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
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
Unrelated schemas get merged together #38
Comments
Also, any idea why the generated components have these weird keys instead of the class names? In the |
Okay, I think I've figured it out. I'm running this within a cloud-functions setup where there the code is also minified with webpack. If I turn off webpack minification, the generated schema keys correspond to the actual class names and it no longer produces wrongly merged schemas. However it seems quite error-prone that the library relies on the class names as unique identifiers, would there not be a possibility for conflict even without minification? |
Hey, glad you figured it out. One way to handle minified or duplicate class names would be via JSON Schema's |
Thanks for the help, that could be a good way to solve this. Might be able to take a look at it a bit later 👍 |
@juiceo Have you tried this without the constructor? Stabbing in the dark a little bit here, but because decorators often modify the constructor, sometimes providing constructors can interfere with how the decorators work. |
I'm experiencing an issue where two entirely unrelated schemas are getting merged together.
Details
I'm using this library along with
routing-controllers-openapi
, so it's still a bit unsure if the issue is with this library or somewhere else. Regardless, here's the bug I'm experiencing:I have the following class, representing a product:
And the sub-types are as follows:
This configuration should clearly result in two different components being defined in my OpenAPI schema, but the resulting schema looks like this:
For some reason, the two classes are merged together.
Additional details
Here is the relevant code I'm using to generate the schema:
One possible cause could be that I'm using
getMetadataArgsStorage
for generating the actual spec, butdefaultMetadataStorage
as an argument tovalidationMetadatasToSchemas
, which seems a bit off. I'm unsure what would be the correct way to do this however.The text was updated successfully, but these errors were encountered: