schematics/schematics

Why is the _append_field() method private?

raffclar opened this issue · 2 comments

I use _append_field() to avoid having to write duplicate code and reduce the risk of bugs. Cheers for adding it!

I just want to know why it's got the private convention?
I'm happy to make a PR if it turns out it could be made public.

Mainly because of this TODO:

field.type._setup(field.name, self.model) # TODO: remove model reference

The idea was to remove this dependence of the schema on the model.
This initializing of the field by passing in the model is basically used for the compound types to dynamically resolve string model refs.

The PR here would be to try and separate these functions:

  • model depends on schema, but not the other way (break the double ref)
  • field depend on schema instead of model (to keep the dynamic options access)
  • compound types string model name resolver be refactored into some helper infrastructure code

Thanks for explaining and for updating Schematics