Strongly typed classes define all properties as nullable
- Dominant language
- C#
- Stars
- 4.6k
- Forks
- 605
- PR merge metrics
- No merged PRs in 30d
Description
**Description**
Using the generated `Sheet` class as an example, it seems that (pretty much all) the strongly typed classes define all their properties as nullable. For example:
```csharp
public StringValue? Name
{
get => GetAttribute();
set => SetAttribute(value);
}
```
This is done even where the schema defines the corresponding attributes as required, meaning they will (or should) not be null. For example:
```xml
```
Flagging all properties as nullable is at least not helpful. It would be better to have `Name`, `SheetId`, and `Id` not nullable and only `State` nullable, meaning the schema would be reflected in the nullability of the properties. Otherwise, you'll have to add countless `!` to tell the compiler that everything is fine.
**Information**
- .NET Target: all
- DocumentFormat.OpenXml Version: latest
**Observed**
Nullability is not in line with schema.
**Expected**
Nullability should be in line with schema.
Contributor guide
Assessment
This issue has not been assessed yet.