-
Notifications
You must be signed in to change notification settings - Fork 110
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
Nested schemas in Array type cause properties not to be written to ddb #196
Comments
Thanks. We'll check this out. But for immediate feedback, the nested schema must be an Object not Array. i.e. addresses cannot be an array and use nested schemas. We'd really like nested schemas to work for TS on Arrays and Objects to any depth, but currently it only works on Objects. AND, you do not get TS bindings for the nested schema. We're exploring the TS magic required to make this work, but TS typings are a dark art and we are still looking for the magic potion to make it happen. We want nested schemas to be automatically generated from the schema and not require a build-time generate to create typings. |
@mobsense Is there an issue with wanting build-time generated types? Prisma does this and it seems like a nice way around TS black magic |
Using TS magic, you get full typing of your schema and data in tools like VS code. Requiring a build step would make this impossible without building after each code change. |
Second this bug fix! Right now I'm getting the same error that the property doesn't exist when using a nested object schema |
Using the following should work. i.e. Field.items with a nested schema.
|
Describe the bug
If you use nested schemas for fields typed as Array, Model.create method will not write the parent field.
Possibly related - typescript doesn't know anything about the nested schema and types the parent field as any[]. This happens with nested schema for Obect types as well - you get a ts error if you try to access a nested field:
Property 'fieldName' does not exist on type 'object'
To Reproduce
Expected behavior
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context
I'm having a hard time in general using typescript with dynamodb-onetable. As mentioned above, you don't get typings for nested schemas, and in fact, typescript will complain if you try to access a nested field. Even more problematic is the issue already mentioned in #185
Thank you
The text was updated successfully, but these errors were encountered: