fix(csharp): cross-namespace type and enum resolution, scalar validator guards, and array defaults#233
Merged
Conversation
…, and array defaults 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
There was a problem hiding this comment.
Pull request overview
This PR updates the C# code generator to improve cross-namespace type resolution (relationships + map sides), tighten when DataAnnotations validators are emitted (avoiding invalid attributes on scalar-backed struct properties), and prevent invalid array default initializers. It also bumps Concerto dependencies to 4.1.3 and adjusts tests/snapshots accordingly.
Changes:
- Always emit
using System.Collections.Generic;andusing System.ComponentModel.DataAnnotations;in generated C# files. - Fix type qualification for cross-namespace relationship/map references; add additional guards around scalar validators and array defaults.
- Update unit tests and snapshots; bump
@accordproject/concerto-*dependency versions to4.1.3.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/codegen/fromcto/csharp/csharpvisitor.js | Generator logic updates: namespace/type qualification, validator guarding, array default handling, and map type resolution changes. |
| test/codegen/fromcto/csharp/csharpvisitor.js | Updates/extends test expectations for new using lines, relationship qualification, and validator/range behavior; removes several Newtonsoft scalar tests. |
| test/codegen/snapshots/codegen.js.snap | Snapshot updates reflecting new using lines and validator emission changes. |
| package.json | Bumps Concerto dependency versions to 4.1.3. |
| package-lock.json | Lockfile updates for Concerto 4.1.3. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: muhammed-abdulkadir <muhammed.abdulkadir@docusign.com>
jamieshorten
approved these changes
May 26, 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 #
using System.Collections.Genericandusing System.ComponentModel.DataAnnotationswriteField: DataAnnotation attributes ([MinLength],[MaxLength],[RegularExpression],[Range]) are now only emitted on raw primitive-typed fields. Previously they were also emitted on scalar-backed fields, which produced invalid attributes like[RegularExpression]on a struct property rather than on the struct's innerValue.visitRelationshipandresolveMapSidenow callgetDotNetNamespaceOfTypeto fully qualify types whose target lives in a different C# namespace. Previously cross-namespace references were emitted as unqualified names that wouldn't compile.public SSN[] Ssns { get; set; } = new("default");which is invalid C#.mapSideHasValidatorsno longer called after[ValidateComplexType]was removed in a prior commit.Related Issues
Author Checklist
--signoffoption of git commit.mainfromfork:branchname