sillsdev / languageforge-lexbox

Lexbox, SIL linguistic data hub
MIT License
7 stars 2 forks source link

Changing entries in a list results in unsupported JSON patch operations #1099

Open myieye opened 1 month ago

myieye commented 1 month ago

This boils down to the fact that we really need to decide how we want to handle reordering.

Here's one such example that occurs if I replace the only semantic domain on a sense with a different one:

[fw-lite:local-web-app]       Failed to invoke hub method 'UpdateSense'.
[fw-lite:local-web-app]       System.NotSupportedException: no path operation can be made with an index, path: /semanticDomains/0/code
[fw-lite:local-web-app]          at LcmCrdt.Changes.<JsonPatchChange>F10BD6BCCDAB814FA329EAA352D2C6D6EA4DB4CF958F14BE59F84482F01C9EFD6__JsonPatchValidator.ValidatePatchDocument(IJsonPatchDocument patchDocument) in D:\code\languageforge-lexbox\backend\FwLite\LcmCrdt\Changes\JsonPatchChange.cs:line 66
[fw-lite:local-web-app]          at LcmCrdt.Changes.JsonPatchChange`1..ctor(Guid entityId, IJsonPatchDocument patchDocument, JsonSerializerOptions options) in D:\code\languageforge-lexbox\backend\FwLite\LcmCrdt\Changes\JsonPatchChange.cs:line 34
[fw-lite:local-web-app]          at LcmCrdt.Objects.Sense.ChangesFromJsonPatch(Sense sense, JsonPatchDocument`1 patch)+MoveNext() in D:\code\languageforge-lexbox\backend\FwLite\LcmCrdt\Objects\Sense.cs:line 67
[fw-lite:local-web-app]          at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
[fw-lite:local-web-app]          at LcmCrdt.CrdtMiniLcmApi.UpdateSense(Guid entryId, Guid senseId, UpdateObjectInput`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LcmCrdt\CrdtMiniLcmApi.cs:line 299
[fw-lite:local-web-app]          at LocalWebApp.Hubs.MiniLcmApiHubBase.UpdateSense(Guid entryId, Guid senseId, JsonPatchDocument`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\MiniLcmApiHubBase.cs:line 83
[fw-lite:local-web-app]          at LocalWebApp.Hubs.CrdtMiniLcmApiHub.UpdateSense(Guid entryId, Guid senseId, JsonPatchDocument`1 update) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\CrdtMiniLcmApiHub.cs:line 55
[fw-lite:local-web-app]          at lambda_method25(Closure, Object)
[fw-lite:local-web-app]          at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.ExecuteMethod(ObjectMethodExecutor methodExecutor, Hub hub, Object[] arguments)
[fw-lite:local-web-app]          at LocalWebApp.Hubs.LockedProjectFilter.InvokeMethodAsync(HubInvocationContext invocationContext, Func`2 next) in D:\code\languageforge-lexbox\backend\FwLite\LocalWebApp\Hubs\LockedProjectFilter.cs:line 12
[fw-lite:local-web-app]          at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.<Invoke>g__ExecuteInvocation|18_0(DefaultHubDispatcher`1 dispatcher, ObjectMethodExecutor methodExecutor, THub hub, Object[] arguments, AsyncServiceScope scope, IHubActivator`1 hubActivator, HubConnectionContext connection, HubMethodInvocationMessage hubMethodInvocationMessage, Boolean isStreamCall)
hahn-kev commented 10 hours ago

hopefully #1181 will fix this issue