Skip to content
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

Resources API always include link #12110

Closed
etj opened this issue Mar 29, 2024 · 0 comments · Fixed by #12123
Closed

Resources API always include link #12110

etj opened this issue Mar 29, 2024 · 0 comments · Fixed by #12123
Assignees
Milestone

Comments

@etj
Copy link
Contributor

etj commented Mar 29, 2024

Even with the changes done in #12079, when exclude[]=* is added, a link to the resource is always added,

Sample request
 curl -s 'http://10.10.100.5/api/v2/resources?exclude[]=*&include[]=pk'  | jq . 
{
  "links": {
    "next": null,
    "previous": null
  },
  "total": 5,
  "page": 1,
  "page_size": 10,
  "resources": [
    {
      "pk": "5",
      "link": "http://10.10.100.5/api/v2/resources/5"
    },
    {
      "pk": "4",
      "link": "http://10.10.100.5/api/v2/resources/4"
    },
    {
      "pk": "3",
      "link": "http://10.10.100.5/api/v2/resources/3"
    },
    {
      "pk": "2",
      "link": "http://10.10.100.5/api/v2/resources/2"
    },
    {
      "pk": "1",
      "link": "http://10.10.100.5/api/v2/resources/1"
    }
  ]
}

Note that the initial requirement was #7529, implemented in #7530 , where the new class BaseDynamicModelSerializer adds the link info into the representation, with no way to remove such info.

Moving such field as an ephemeral field in the Serializer would make the various rest logic to handle the content properly, so that it could be removed and added at will using proper query parameters.

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

Successfully merging a pull request may close this issue.

2 participants