Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow alias where object field is expected #236

Open
wyfo opened this issue Nov 2, 2021 · 0 comments
Open

Allow alias where object field is expected #236

wyfo opened this issue Nov 2, 2021 · 0 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@wyfo
Copy link
Owner

wyfo commented Nov 2, 2021

Several features of apischema requires an object field to be passed, e.g. field ordering, field validator, or object serialization.

Fields can be either:

  • an apischema ObjectField
  • a dataclass Field
  • the field name as string

But it could be convenient to also use the field alias instead. For example, if object serialization is built dynamically from aliases passed in request parameters, it would avoid having to do the reverse mapping.

On the other hand, reverse mapping would be quite easy, so it's not really an issue (things gets more complicated when it comes to serialized methods). Also, allowing field names and aliases at the same could bring some edge cases with both overlapping, but IMO this kind of thing should not happen in real life.

@wyfo wyfo added enhancement New feature or request question Further information is requested labels Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant