Normalizr - How to generate slug/id related to parent entity : <p>How can I assign id/slug related to the entity's parent using <a href="https://github.com/paularmstrong/normalizr" rel="noreferrer">normalizr</a>?</p>

<p>Example:</p>

<p>API Response for a user call:</p>

<pre><code>{
  id: '12345',
  firstName: 'John',
  images: [
    {
      url: 'https://www.domain.com/image0',
      name: 'image0'
    },
    {
      url: 'https://www.domain.com/image1',
      name: 'image1'
    }
  ]
}
</code></pre>

<p>I could define my schemas in the following way:</p>

<pre><code>const image = new Schema('images');
const user = new Schema('users');

user.define({
  images: arrayOf(image)
})
</code></pre>

<p>The problem is that images don't have an <code>id</code> property, so normalizr will not be able to distinguish them unless we provide an <code>id</code> property. Of course, we could do something like </p>

<pre><code>const image = new Schema('images', { idAttribute: uuid.v4() });
</code></pre>

<p>and generate unique identifiers.</p>

<p>Suppose we receive a user update and an image's name has been updated. Because we generate unique identifiers in every normalization, we are not able to identify and update the existing image.</p>

<p>I need a way to reference the parent entity (user) in the image entity (either in its id/slug like <code>12345-image0</code>, <code>12345-image1</code> or as a separate property.</p>

<p>What would be the optimal way to achieve this?</p>
