-
Notifications
You must be signed in to change notification settings - Fork 82
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
Conversation
{ | ||
errors ??= []; | ||
string libraryId = LibraryNamingScheme.GetLibraryId(desiredState.Name, desiredState.Version); | ||
errors.Add(PredefinedErrors.DestinationNotSpecified(libraryId)); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
Summary of the changes:
This implements #738. There will be an additional PR to make the JSON completion in the editor work for fileMappings.