Altinn / Altinn/app-lib-dotnet

Consider: Why do we have new() as default value for signature and payment config

Open
#1,108 0 comments 0 reactions 0 assignees View on GitHub
area/payment area/signing kind/chore
Dominant language
C#
Stars
8
Forks
27
Avg merge
1h 21m
Merged PRs (30d)
7

Description

If you do this on a non-signature task, you will get a new-ed up signature config with all default values.

```csharp
AltinnTaskExtension? taskConfig;
try
{
taskConfig = _processReader.GetAltinnTaskExtension(taskId);
}
catch (Exception)
{
return false;
}

AltinnSignatureConfiguration? signingConfiguration = taskConfig?.SignatureConfiguration;
```

In a non-signature task I would expect it to be null.

Can we remove the default value without causing harm?
```csharp
///
/// Gets or sets the configuration for signature
///
[XmlElement("signatureConfig", Namespace = "http://altinn.no/process")]
public AltinnSignatureConfiguration? SignatureConfiguration { get; set; } = new AltinnSignatureConfiguration();

///
/// Gets or sets the configuration for signature
///
[XmlElement("paymentConfig", Namespace = "http://altinn.no/process")]
public AltinnPaymentConfiguration? PaymentConfiguration { get; set; } = new AltinnPaymentConfiguration();
```

Contributor guide

Open the contributing guide

Research direction

Start with the AltinnTaskExtension, SignatureConfiguration, and PaymentConfiguration declarations shown in the issue, then inspect their XML serialization and deserialization consumers. Confirm whether non-signature and non-payment tasks can leave these properties null without affecting existing configurations; done means the defaults are removed safely and relevant behavior remains covered by existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.