[Pulp-dev] renaming user facing fields on content serializers

Brian Bouterse bmbouter at redhat.com
Tue Sep 10 19:48:44 UTC 2019


I also agree with this. As a user, it would feel random to have to specify
a field as _artifact or _relative_path when the underscore isn't a
well-known convention.

+1 to filing an issue and proceeding to fix. It'll be a breaking change so
it needs to be declared on the mailing list with the [BREAKING] subject
start if you don't mind.

Thank you for sending.

On Tue, Sep 10, 2019 at 6:14 AM David Davis <daviddavis at redhat.com> wrote:

> Matthias,
>
> I agree. Can you open an issue?
>
> David
>
>
> On Tue, Sep 10, 2019 at 4:39 AM Matthias Dellweg <dellweg at atix.de> wrote:
>
>> TL;DR: Should the fields "_relative_path" and "_artifact" on the
>> SingleArtifactSerializer be renamed to "relative_path" and "artifact"
>> respectively?
>>
>> While working on the upload create content serializer story [0], i
>> noticed, that there are two fields on the
>> SingleArtifactContentSerializer with unnecessary complicated names
>> ("_artifact" and "_relative_path"). In fact, all descendent
>> serializers, i know of take some hurdle [1] to rename "_relative_path"
>> back to "relative_path".
>> I believe, the leading underscore was added for a convention, that
>> pulpcore controlled database fields should not take names (like "href"),
>> that may be needed by plugins to represent a domain specific api.
>> I think, the naming here is taking this convention one step too far in
>> that the serializers themselves are merely a convenience layer for the
>> plugin writer, and those serializer fields do not directly correspond
>> to database fields on any content model. Moreover the file plugin turns
>> "relative_path" (without "_") into a real database field, and given the
>> name is seems safe to use a relative_path_validator on a string field
>> here.
>>
>> [0] https://pulp.plan.io/issues/5403?pn=1#note-4
>> [1]
>>
>> https://github.com/pulp/pulp_file/blob/b348e970d4ddcd2d7c9dc0b206a3fdd9cfc83cef/pulp_file/app/serializers.py#L36
>> [2]
>>
>> https://github.com/pulp/pulp_file/blob/b348e970d4ddcd2d7c9dc0b206a3fdd9cfc83cef/pulp_file/app/serializers.py#L54
>> _______________________________________________
>> Pulp-dev mailing list
>> Pulp-dev at redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-dev
>>
> _______________________________________________
> Pulp-dev mailing list
> Pulp-dev at redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20190910/031b92a3/attachment.htm>


More information about the Pulp-dev mailing list