edgedb-python
edgedb-python copied to clipboard
fields with leading underscore
Fields starting with underscore have a special meaning in Pydantic and cannot be supported out of the gate
Things to fix / take care of / ideas:
- Generator should issue a warning when it sees a field with leading underscore or a field that's not valid in Python for some reason
-
GelModelmachinery should mangle the name so that pydantic can have this field at all -
GelModelmachinery should add analiasarg toFieldInfowith the original unmangled field name. That will make pydantic accept the original field from input. - We can also potentially create computeds with demangled names that can write and read from mangled field. Test this.
type Spam{
_foo: str
}
class Spam:
p_foo: Property[str, '_foo']
or even
class Spam:
p_foo: RenamedProperty[str, '_foo']
Instead of p we can have a long suffix or a long prefix (or some awkward and less likely to be invented by a human stuff like P_foo)