I researched the validate_assignment feature in the pydantic_core project and need to understand how Rust translates to Python. When Rust builds, it creates a folder called python/pydantic_core that includes files like core_schema.py and _pydantic_core.py based on the core of Pydantic.

I noticed that when Python generates a schema, it sets every overridden function as a JSON object like this:

{

'type': 'function-after',

'function': {'type': 'no-info', 'function': function},

...

}

This gets converted to a dictionary. For the _model_wrap_validator, the type is set as type='function-wrap', and the function name is no_info_wrap_validator_function. This helped me understand that Rust flags every function accordingly. We are now getting closer to finishing a real Rust project.

nostr:nevent1qvzqqqqqqypzq5n94htpreyd8fjwperfrl5v5e20uy63eqpwc046ma6vw7lp0867qyg8wumn8ghj7mn0wd68ytnddakj7qg4waehxw309aex2mrp0yhxgctdw4eju6t09uqsuamnwvaz7tmwdaejumr0dshsqgy0lm26rxkketdng5zsnncdrmt7n0ckps5vh0zj6wp0z83lst0wlc6mdq2d

Reply to this note

Please Login to reply.

Discussion

No replies yet.