snapcraft icon indicating copy to clipboard operation
snapcraft copied to clipboard

Refactor `platform` validation

Open mr-cal opened this issue 11 months ago • 0 comments

Based on Rockcraft, the platform validation occurs in snapcraft.models.SnapcraftBuildPlanner and snapcraft.models.Project. This can be combined in snapcraft.models.Project.

Scope of work:

  • [ ] move and rework validation code
  • [ ] adjust unit tests
  • [ ] adjust types in both models and satisfy the type checkers

Source

It feels that we handle this by defining a platform model separately and let pydantic do the heavylifting of hierarchically validating platforms as a list of platform models, isn't that possible? It would reduce the complexity of this validator.

Originally posted by @cmatsuoka in https://github.com/canonical/snapcraft/pull/4630#discussion_r1517943384

mr-cal avatar Mar 08 '24 21:03 mr-cal