-
Notifications
You must be signed in to change notification settings - Fork 868
Add ability to dynamically set nested schema type #415
Add ability to dynamically set nested schema type #415
Conversation
Hi @paularmstrong @gaearon. Is there anyone who maintains normalizr that might be available to review this? |
Hi @paularmstrong @gaearon. Sorry to pester but this is blocking us at Unsplash from upgrading from v2 to v3. Would you mind reviewing, or do you know anyone who can? Thanks 😄 |
Ping @paularmstrong |
const user = new schema.Entity('users'); | ||
|
||
const responseSchema = new schema.Object({ users: new schema.Array(user) }); | ||
const normalizedData = normalize(data, responseSchema); | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do these added brackets do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They provide unique block scope for each of the tests, so I can redeclare variables using the same name.
Coming across this a while after it was posted/implemented, but has anyone noticed that this approach doesn't seem to work when calling |
Problem
Reinstates #159, which was unfortunately lost when v3 was released.
Fixes https://github.com/paularmstrong/normalizr/issues/413
Related: https://github.com/paularmstrong/normalizr/issues/130
I will update documentation once the code side of things has been approved.
/cc @paularmstrong @jgutta @fxck @joewestcott
TODO