Skip to content

Consider enumerating on all supported versions #29

@ItsDrike

Description

@ItsDrike

Currently, the function to obtain data for a given version & edition combination relies purely on the edition enum and a version string, leading to an exception if the version string doesn't match a supported version.

This proposes to instead keep track of an enum class with all supported mc versions and use that. This would also allow us to potentially make type overloads and return different models for different mc version in a type-safe way.

This would be a benefit, as in many cases, some of the fields in our models are optional when all new versions are expected to contain them, and we can't just make them required as those older versions do miss them. Without doing something hacky like coming up with non-None defaults for these, an alternative would be to just construct multiple models. This would be a bit annoying to maintain, but it might be worth doing, perhaps at least for the latest few versions.

Note that this issue does not propose to implement this logic for multiple versioned models, it's purely about keeping the versions in an enum instead of just taking a string & edition enum combination, however, if we do want the behavior mentioned above, an enum would be preferred to have, so if that's something we want, this is a prerequisite.

This would be a breaking change, as the interface for getting version data would need to change (taking enum instead of the version & edition). It should be possible to provide deprecations for this behavior if we want to though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: apiRelated to core public API of the projectm: breakingThis introduces backwards compatibility breaking changes to the public APIp: 2 - normalShould be done reasonably soon, but not urgent/blockings: staleHas had no activity for a while (might get closed for inactivity/marked up for grabs soon)t: revisionComplete or partial rewrite of something (code cleanup, performance improvements, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions