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

Use discriminated unions in object stores and file source template configs #19621

Conversation

davelopez
Copy link
Contributor

@davelopez davelopez commented Feb 14, 2025

It is the recommended way by Pydantic. Discriminated unions are both more performant and more predictable than untagged unions, as they allow you to control which member of the union to validate against.

https://docs.pydantic.dev/latest/concepts/unions/

Extracted from #19619 for easier review

How to test the changes?

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

…nfigs

It is the recommended way by Pydantic. They are both more performant and more predictable than untagged unions, as they allow you to control which member of the union to validate against.
@davelopez davelopez added kind/refactoring cleanup or refactoring of existing code, no functional changes area/backend labels Feb 14, 2025
Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and also gives much cleaner validation errors.

@github-actions github-actions bot added this to the 25.0 milestone Feb 14, 2025
@mvdbeek mvdbeek merged commit 08a146e into galaxyproject:dev Feb 17, 2025
53 of 58 checks passed
@davelopez davelopez deleted the improve_user_storage_config_templates_typing branch February 17, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants