-
Notifications
You must be signed in to change notification settings - Fork 15
Resource model break when specifying an array with unique: true #97
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
Comments
I think this is related to some issues in the class-transformer library. Maybe those workarounds are relevant: typestack/class-transformer#288 (comment) and typestack/class-transformer#495 (comment). Could you post an snippet of your models.ts file? I believe you can modify your generated models.ts with the provided workaround in order to figure out which change has to be made to the TypeScript code generator. |
Sure. It looks like this:
With
|
You can find a test reproducing what you faced here. |
This has been fixed by #98. |
I've noticed when specifying an array with unique: true translates the model into a Set instead of an Array (makes sense)
but then when passing an actual array as example input, the resource provider fails. Consider for example:
with input:
gives error
"message": "Error: Error: Unsupported type: object [Tag] for tags (Error)",
Removing the
uniqueItems
fixes the issue and the main thing I notice is that in the generated code the type changes from a Set to an ArrayThe text was updated successfully, but these errors were encountered: