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

Implement support for "fileMappings" #756

Merged
merged 6 commits into from
Sep 30, 2024

Conversation

jimmylewis
Copy link
Contributor

Summary of the changes:

  • Adds support for parsing fileMappings and calculating the goal state from them.
  • Adds support for fileMappings to the schema. Includes a schema validation error if the schema uses fileMappings but doesn't have a sufficiently high version set.
  • Enables manifest version "3.0" and sets that as the default for newly created manifests.

This implements #738. There will be an additional PR to make the JSON completion in the editor work for fileMappings.

{
errors ??= [];
string libraryId = LibraryNamingScheme.GetLibraryId(desiredState.Name, desiredState.Version);
errors.Add(PredefinedErrors.DestinationNotSpecified(libraryId));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a case for v1 manifests where (if they followed the schema) they could encounter this error?

Copy link
Contributor Author

@jimmylewis jimmylewis Jul 2, 2024

Choose a reason for hiding this comment

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

The v1 schema was declared such that either a defaultDestination must be set, or every library must set a destination. But it got too complicated to be oneOf (defaultDestination, or every library sets a destination, or (every library without fileMappings sets a destination or every fileMapping under a library without a destination includes a fileMapping destination)).

I updated the schema to draft-07 (the newest VS supports) in order to use the if-else logic.  This allows VS to detect that fileMappings are used and then apply a validation error that `"version"` must be set to 3.0.  (Trying to do it with an anyOf like for destination/defaultDestination would give a fairly ambiguous message instead.)
This becomes the default value for newly created libman.json files (so they will automatically get new feature support like fileMappings).
@phil-allen-msft phil-allen-msft merged commit e639b87 into aspnet:main Sep 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants