marshmallow-jsonapi icon indicating copy to clipboard operation
marshmallow-jsonapi copied to clipboard

self_url_kwargs should come from object, not schema

Open fhriley opened this issue 4 years ago • 2 comments

related_url_kwargs are pulled from object data. self_url_kwargs are pulled from schema data. This is inconsistent (I got bit by it the first time I tried using self_url_kwargs). Furthermore, it means that all kwargs used in self_url_kwargs must be serialized as part of the schema, which I don't always want to do. For example:

class Meta:
    type_ = "bars"
    self_url = "/foos/{foo_id}/bars/{bar_id}"
    self_url_kwargs = {"foo_id": "<foo_id>, "bar_id": "<id>"}

I don't want foo_id to be serialized in a bars schema.

fhriley avatar Dec 05 '19 17:12 fhriley

I'm not sure I'm understanding correctly, but is this a duplicate of my issue, #247?

multimeric avatar Dec 06 '19 01:12 multimeric

This looks like the same issue, but #247 is on self_view_kwargs. They should probably be fixed together.

fhriley avatar Dec 06 '19 02:12 fhriley