feat(csharp): idiomatic C# code generation for scalar types, validators, and defaults#231
Merged
Merged
Conversation
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
Contributor
|
How does an entity/instance deserialise/serialise to this e.g namespace org.acme.hr@1.0.0
scalar SSN extends String default="000-00-0000" regex=/\d{3}-\d{2}-\{4}+/
concept Person identified by ssn {
o SSN ssn
o String givenName
}would have an instance like {
"$class": "org.acme.hr@1.0.0.Person"
"ssn" : "000-00-0000",
"givenName": "Jamie"
} |
Contributor
Author
Thanks! I'd add a converter |
Contributor
|
we should have a round trip test for serialisation/deserialisation of instances to some generated classes. The metamodel would be one candidate... |
…t for serialisation Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
jamieshorten
approved these changes
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #
Summary
Significantly improves the C# code generator to produce idiomatic, type-safe C# from Concerto models. This PR adds DataAnnotations validation attributes, and emits default property initializers.
Changes
Scalar struct validators
When a scalar declares a validator (regex, length, range), the Value property is explicitly declared with the corresponding DataAnnotations attribute:
Numeric range validators on fields
Integer,Long, andDoublefields with a range validator emit[Range]:Open bounds (only min or only max declared) fill to the type's natural min/max.
Default property initializers
Fields with a default value emit a C# property initializer:
For scalar-typed fields, the field-level default takes precedence over the scalar declaration's default.
Author Checklist
--signoffoption of git commit.mainfromfork:branchname