You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Django-rest-framework JSONField can be any JSON primitive. In our codebase, its used in fields where we would expect specifically a Object Type or a List Type.
I'm not sure if it makes sense to update all of these, but it may be worth doing a general review. The possible benefits of this are:
provide more meaningful types for the user, because those things shows in the docs.
catch gross errors on desserialization
Some that may be more meaningful are the config ones (on repository.py, see below), where we could go further and custom object with the config keys, so it shows nicely in the REST API docs (this may be done with drf-spectacular extend_config_field).
Context
This was originally brought to my attention because of #3639, but its not directly related anymore.
Reference
This are the places where its used in pulp_rpm/app/serlializers:
We should revert the fix in #3679 when these fields are correctly represented in openapi schema.
Some approaches here are:
creating more specific sub-serializers, which should affect runtime as we'll be adding more validation
using drf-spectacular extends, which I believe doesnt affect runtime
Something to keep in mind is that fixing this should modify the bindings somehow, as it will be altering the schema types. That can potentially require that bindings users adapt their code.
Changing the API == breaking the API, even if it's in a good cause. Our "breaking changes" commitment is to the plugin API - generally speaking, the user-API isn't available to be broken for anything other than "it doesn't actually work" bugs.
We can add to the API - but we need to maintain the existing behavior.
Django-rest-framework JSONField can be any JSON primitive. In our codebase, its used in fields where we would expect specifically a Object Type or a List Type.
I'm not sure if it makes sense to update all of these, but it may be worth doing a general review. The possible benefits of this are:
Some that may be more meaningful are the config ones (on repository.py, see below), where we could go further and custom object with the config keys, so it shows nicely in the REST API docs (this may be done with drf-spectacular extend_config_field).
Context
This was originally brought to my attention because of #3639, but its not directly related anymore.
Reference
This are the places where its used in
pulp_rpm/app/serlializers
:The text was updated successfully, but these errors were encountered: