Skip to content

Validations in C# Codes

fonlow edited this page Feb 28, 2024 · 3 revisions

Validations in C# for POCO classes are generally done through declarative attributes decorating each property. OpenApiClientGen can generate client API C# codes with respective attributes according to data constraints in OpenAPI definitions.

Mappings

Validations

Constraints Attributes
required Required
minLength MinLength
maxLength MaxLength
minimum Range
maximum Range
pattern RegularExpression
date DateType(DataAnnotations.DataType.Date) if DateToDateOnly is false

Examples of Generated Codes