Lily Acorn
Lily Acorn
Another bit of functionality that might be useful is merging two adapters. For example: ```python quick_registration_adapter = Adapter() quick_registration_adapter.field_add(adapters.fields.Email('email')) user_profile_adapter = Adapter() user_profile_adapter.field_add(adapters.fields.String('name')) full_registration_adapter = quick_registration_adapter.merge(user_profile_adapter) ```
I think it would be helpful too to be able to select a subset of an existing adapter: ```python profile_adapter = Adapter() profile_adapter.field_add(adapters.fields.String('name')) profile_adapter.field_add(adapters.fields.Email('email', required=False)) registration_adapter = profile_adapter.select_fields(['email']) ```
I understand your last comment is a big brain dump so I'll wait for you to clean it up in a new draft before digging into most of it. One...
Another thing that we need to consider is how to modify an existing field. The simplest option to implement is allowing direct replacement of a field, but more targeted changes...
The roles seem pretty shiny - I don't think I've seen that sort of idea with such a clean api before.
I like this. A clear distinction between validation and cleaning may also be useful for distinguishing validation that can only happen on the backend and validation that may also run...
Yeah... it's probably impossible to handle in the generic case. That shouldn't stop us thinking about how to support a subset though.
One really shiny thing that a tree/dag of validators/cleaners allows is a `ValidationError` will only prevent dependent validators from running. ~~This is much nicer than the current case where a...
I think my crossed-out comment _does_ apply to a DRF `Serializer.validate` method. The structure also allows raising more than one cross-field `ValidationError` without needing custom error handling within the `Form.clean`...
Currently working on this at https://github.com/Ian-Foote/new-serializers-notes.