Skip to content

Wondering why url field is no longer present in serializers using the rest_framework_json_api.JSONRenderer #1233

Answered by sliverc
Sam-Macpherson asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for bringing this up. The URL field is tricky. It is actually a reserved field used by HyperlinkedModelSerializer to define the identity location. The name can actually be configured with URL_FIELD_NAME which is per default url. This URL field is used in JSON:API as a self-link. That it is why the URL is excluded in attributes.

However it should actually only be excluded if it is a URL field name and of type HyperlinkedIdentityField. So this is a regression.

I will have a look and see how easy it is to fix also considering that sparse fields should handle URL as a field if it is overwritten as you do it (that was the initial change, which caused this regression).

What you can do as…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Sam-Macpherson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants