Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@accordproject/concerto-codegen",
"version": "4.1.1",
"version": "4.1.2",
"description": "Code Generation for the Concerto Modeling Language",
"homepage": "https://github.com/accordproject/concerto",
"engines": {
Expand Down
77 changes: 75 additions & 2 deletions types/lib/codegen/fromcto/csharp/csharpvisitor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,41 @@ declare class CSharpVisitor {
* @return {Object} the result of visiting or null
* @private
*/
private visitScalarDeclarationField;
private visitScalarDeclaration;
/**
* Build the DataAnnotations attribute lines for a scalar declaration's validator.
* @param {ScalarDeclaration} scalarDeclaration - the scalar declaration
* @returns {string[]} attribute lines, empty if no validator
* @private
*/
private buildScalarValidatorLines;
/**
* Visitor design pattern
* @param {MapDeclaration} mapDeclaration - the object being visited
* @param {Object} parameters - the parameter
* @return {Object} the result of visiting or null
* @private
*/
private visitMapDeclaration;
/**
* Resolve the C# key and value types for a MapDeclaration.
* Handles primitives, scalars (via global using aliases and special UUID mapping),
* and concept types.
* @param {MapDeclaration} mapDeclaration - the map declaration to resolve types for
* @param {Object} parameters - the visitor parameters (used for PascalCase conversion)
* @returns {{ keyType: string, valueType: string }} the resolved C# key and value type strings
* @private
*/
private resolveMapTypes;
/**
* Resolve a single map key or value side to a C# type string.
* @param {MapKeyType|MapValueType} side - key or value side of the map
* @param {ModelFile} modelFile - the model file containing the map declaration
* @param {Object} parameters - the visitor parameters
* @returns {string} - the resolved type string for the map side
* @private
*/
private resolveMapSide;
/**
* Visitor design pattern
* @param {Field} field - the object being visited
Expand All @@ -87,10 +121,27 @@ declare class CSharpVisitor {
* @param {Object} parameters - the parameter
* @param {string} [externalFieldType] - the external field type like UUID (optional)
* @param {bool} [isOptional] - the bool value indicating if external field type like UUID is optional (optional)
* @param {*} [scalarDefaultValue] - pre-resolved default value for scalar-typed fields (optional)
* @return {Object} the result of visiting or null
* @private
*/
private writeField;
/**
* Determines if a property should emit the C# `required` modifier.
* This centralizes required-emission decisions for fields and relationships.
* @param {Object} parameters - visitor parameters
* @param {Object} options - decision options
* @param {string} [options.nullableType] - nullable marker (`?`) when present
* @param {boolean} [options.hasDefault] - true when a default initializer is emitted
* @param {boolean} [options.isArray] - true when property is an array type
* @param {boolean} [options.isScalarAlias] - true for scalar alias value-type wrappers
* @param {boolean} [options.isPrimitive] - true for Concerto primitive fields
* @param {boolean} [options.isEnum] - true for enum fields
* @param {string} [options.csharpType] - resolved C# type string
* @returns {boolean} true if `required` should be emitted
* @private
*/
private shouldEmitRequired;
/**
* Visitor design pattern
* @param {EnumValueDeclaration} enumValueDeclaration - the object being visited
Expand All @@ -107,6 +158,26 @@ declare class CSharpVisitor {
* @private
*/
private visitRelationship;
/**
* Determines whether a generated C# property type is a reference type.
* @param {string} csharpType - resolved C# type name
* @param {boolean} isArray - whether the property is an array
* @returns {boolean} true if reference type
* @private
*/
private isCSharpReferenceType;
/**
* Format a Concerto default value as a C# literal suitable for a property initializer.
* String values are quoted; scalar-typed fields wrap the literal in `new(...)`.
* @param {*} value - the raw default value from getDefaultValue()
* @param {string} concertoType - the underlying Concerto primitive type
* @param {boolean} isScalar - true when the property type is a scalar struct
* @param {Field} [field] - the field for context when handling enum defaults (optional)
* @param {string} [resolvedFieldType] - resolved C# property type used for enum qualification
* @returns {string|null} C# literal string, or null if no default
* @private
*/
private formatDefaultLiteral;
/**
* Ensures that a concerto property name is valid in CSharp
* @param {string} access the CSharp field access
Expand All @@ -117,9 +188,11 @@ declare class CSharpVisitor {
* @param {string} nullableType the nullable expression ?
* @param {string} getset the getter and setter declaration
* @param {Object} [parameters] - the parameter
* @param {string} [resolvedType] - pre-built C# type string; when provided, skips toCSharpType
* @param {boolean} [emitRequired] - true to emit the C# `required` modifier
* @returns {string} the property declaration
*/
toCSharpProperty(access: string, parentName: string | undefined, propertyName: string, propertyType: string, array: string, nullableType: string, getset: string, parameters?: any): string;
toCSharpProperty(access: string, parentName: string | undefined, propertyName: string, propertyType: string, array: string, nullableType: string, getset: string, parameters?: any, resolvedType?: string, emitRequired?: boolean): string;
/**
* Converts a Concerto namespace to a CSharp namespace. If pascal casing is enabled,
* each component of the namespace is pascal cased - for example org.example will
Expand Down
16 changes: 16 additions & 0 deletions types/lib/codegen/fromcto/typescript/typescriptvisitor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ declare class TypescriptVisitor {
* @private
*/
private visitClassDeclaration;
/**
* Visitor design pattern
* @param {Object} scalarDeclaration - the object being visited
* @param {Object} parameters - the parameter
* @return {Object} the result of visiting or null
* @private
*/
private visitScalarDeclaration;
/**
* Visitor design pattern
* @param {Field} field - the object being visited
Expand All @@ -58,6 +66,14 @@ declare class TypescriptVisitor {
* @private
*/
private visitField;
/**
* Visitor design pattern - handles fields whose type is a scalar declaration
* @param {Object} field - the scalar-typed field being visited
* @param {Object} parameters - the parameter
* @return {Object} the result of visiting or null
* @private
*/
private visitScalarField;
/**
* Visitor design pattern
* @param {EnumValueDeclaration} enumValueDeclaration - the object being visited
Expand Down
Loading