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

buildsys: validate manifest metadata when deserializing #273

Open
webern opened this issue Jun 6, 2024 · 0 comments
Open

buildsys: validate manifest metadata when deserializing #273

webern opened this issue Jun 6, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@webern
Copy link
Contributor

webern commented Jun 6, 2024

The ManifestInfo type deserializes certain sections from Cargo.toml

  • package.metadata.build-package
  • package.metadata.build-kit
  • package.metadata.build-variant

Currently the differences between build-package, build-kit and build-variant is not constrained by an enum. This leads to a lot of "late binding" errors if an expected field is missing. Instead a different type for each of these should be created. For example:

struct BuildPackageInfo { }
struct BuildKitInfo { }
struct BuildVariantInfo { }

enum BuildsysMetadata {
    Package(BuildPackageInfo),
    Kit(BuildKitInfo),
    Variant(BuildVariantInfo),
}

If serde is used correctly with this structure, then missing information will cause an error at deserialization time and get rid of Options and errors downstream when fields are being accessed.


          We should create an issue, if we don't have one already, for deserializing these manifest metadata sections with Serde in a validating manner. We should catch these errors earlier.

Originally posted by @webern in #271 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant