-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fixes: #14606 - For Cable API add PK for cable terminations to serializer #17201
Conversation
This one is probably a bit stickier than I realized in the original bug report. We should really be using a nested CableTerminationSerializer here, omitting its However, the catch is that the generic serializer currently in use returns the fields We could address this in v4.1, however I'm hesitant to slip in a breaking change so late in the beta period. For now, we could settle with just adding the |
'TracedCableSerializer', | ||
) | ||
|
||
|
||
class GenericObjectTerminationSerializer(GenericObjectSerializer): |
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.
This doesn't require a new serializer: We can just add the id
field to GenericObjectSerializer.
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.
Unfortunately since a_terminations/b_terminations is a property function that includes the actual termination (Interface/CircuitTermination/etc) and not the CableTermination
object it won't be the proper id
(it will be the interface id for example, not the cable termination id).
This is why I opted to go this route, as as you mention, it would be a breaking change. Perhaps we should aim for 4.1 instead and I just rebase and swap the serializer.
It may also make more sense to maintain a_terminations
/b_terminations
as is (add ID however to GenericObjectSerializer
still) and add a generic "terminations" which operates on Cable.terminations
which is I think where it would be appropriate to use the CableTermination
serializer.
Let me know if you would rather replace |
This is going to be more involved than I originally anticipated, because the |
Appreciate your work on this @DanSheps. I'm going to close it out for now; let's re-evaluate our options for a potential change in v4.2. |
Fixes: #14606