Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

excludeAttributes on nested endpoints #72

Open
kurenai-ryu opened this issue Nov 17, 2020 · 0 comments
Open

excludeAttributes on nested endpoints #72

kurenai-ryu opened this issue Nov 17, 2020 · 0 comments

Comments

@kurenai-ryu
Copy link

I managed to exclude attributes on associated models, both via excludeAttributes object, and associations object,
(like in test for #161)

    test.uResource = rest.resource({
      model: test.models.AncientGod,
      associations: true,
      excludeAttributes: {
        own: ['nickname', 'special_power'],
        Activities: ['description']
      },
      endpoints: ['/api/ancientgods', '/api/ancientgods/:id']
    });

or

    test.uResource = rest.resource({
      model: test.models.AncientGod,
      associations: {
        Activities:{
          excludeAttributes: ['description']
        }
      },
      endpoints: ['/api/ancientgods', '/api/ancientgods/:id']
    });

it works if we get the list data from /api/ancientgods or individual from /api/ancientgods/1 both cases, Activities list doesn't have a description field.

BUT if we get the list from /api/ancientgods/1/activities or /api/ancientgods/1/activities/2 the activities will have the excluded description field.

I'm planing to expand the excludeAttributes on the associations resources, so this is mere documentation before a PR

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant