Make the Buildpack API version check more robust #421
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, if a
buildpack.toml
either:[[metadata]]
)...then a generic "failed to deserialise buildpack.toml" message was shown, rather than any error about the buildpack API version not matching.
In cases where the chosen API version is actually the cause of the error (for example if a future API version makes breaking changes to the schema), then this means the underlying cause isn't mentioned.
Now, the check uses a minimal
BuildpackDescriptorApiOnly
type when deserialisingbuildpack.toml
, to ensure the API version can still be determined in those cases.The
BuildpackDescriptorApiOnly
type was used instead of a rawtoml::value::Table
, since otherwise there are a myriad ofOption
s and related to handle, from both the potential lack ofapi
field and it not having a value of type string etc.GUS-W-11324328.