Open mlqn opened 1 week ago
JSON files should be deserialized into strongly-typed C# classes. This would prevent error like #14004.
https://github.com/Altinn/altinn-studio/blob/0aa6a457fd7dcc608a2fd5463ed6bd769d782894/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs#L385-L391
https://github.com/Altinn/altinn-studio/blob/fc5f892a26ca5bf49189d327abcfbd7210671844/backend/src/Designer/Services/Implementation/TextsService.cs#L398-L407
public async Task<Layout> GetLayout(string layoutSetName, string layoutName, CancellationToken cancellationToken = default) { ... return JsonSerializer.Deserialize<Layout>(fileContent); }
private static bool UpdateSourceKeys(Source source, TextIdMutation mutation) { if (source.Label == mutation.OldId && mutation.NewId.HasValue) { source.Label = mutation.NewId.Value; return true; } return false; }
Description
JSON files should be deserialized into strongly-typed C# classes. This would prevent error like #14004.
Current situation:
https://github.com/Altinn/altinn-studio/blob/0aa6a457fd7dcc608a2fd5463ed6bd769d782894/backend/src/Designer/Infrastructure/GitRepository/AltinnAppGitRepository.cs#L385-L391
https://github.com/Altinn/altinn-studio/blob/fc5f892a26ca5bf49189d327abcfbd7210671844/backend/src/Designer/Services/Implementation/TextsService.cs#L398-L407
Suggested solution: