231 instantiations of AtsTypeRef
Aspire.Hosting.CodeGeneration.Go.Tests (30)
AtsGoCodeGeneratorTests.cs (4)
2636var stringType = new AtsTypeRef 2642var int64Type = new AtsTypeRef 2648var voidType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2732Type = new AtsTypeRef
AtsGoDerivedBuilderTests.cs (10)
490private static readonly AtsTypeRef s_builder = new() { TypeId = AtsConstants.BuilderTypeId, Category = AtsTypeCategory.Handle, IsInterface = true }; 497private static readonly AtsTypeRef s_string = new() { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 498private static readonly AtsTypeRef s_poolSettings = new() { TypeId = PoolSettingsId, Category = AtsTypeCategory.Dto }; 615private static AtsTypeRef Handle(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Handle }; 617private static AtsTypeRef ArrayOf(AtsTypeRef element) => new() 625private static AtsTypeRef ListOf(AtsTypeRef element) => new() 632private static AtsTypeRef ReadOnlyDictOf(AtsTypeRef key, AtsTypeRef value) => new() 641private static AtsTypeRef UnionOf(params AtsTypeRef[] members) => new() 655Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 658CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }
GoApiExportTests.cs (2)
334new AtsDtoPropertyInfo { Name = "Required", Type = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive } }, 335new AtsDtoPropertyInfo { Name = "Optional", Type = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }, IsOptional = true }
GoDocCommentTests.cs (6)
451var resourceType = new AtsTypeRef { TypeId = ResourceTypeId, Category = AtsTypeCategory.Handle }; 452var settingsType = new AtsTypeRef { TypeId = SettingsTypeId, Category = AtsTypeCategory.Dto }; 453var statusType = new AtsTypeRef { TypeId = StatusTypeId, Category = AtsTypeCategory.Enum }; 454var tagsType = new AtsTypeRef { TypeId = "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType }; 565private static AtsTypeRef Primitive(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Primitive }; 586var resourceType = new AtsTypeRef { TypeId = ResourceTypeId, Category = AtsTypeCategory.Handle };
GoGeneratorEscapingTests.cs (8)
119var tagsType = new AtsTypeRef { TypeId = "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType }; 120var unionType = new AtsTypeRef { TypeId = "Tests/Union", Category = AtsTypeCategory.Union, UnionTypes = [stringType, numberType] }; 121var callbackType = new AtsTypeRef { TypeId = "Tests/Callback", Category = AtsTypeCategory.Callback }; 122var enumType = new AtsTypeRef { TypeId = StatusTypeId, Category = AtsTypeCategory.Enum }; 123var lookupType = new AtsTypeRef { TypeId = "Tests/Dict<string,string>", Category = AtsTypeCategory.Dict, KeyType = stringType, ValueType = stringType, IsReadOnly = true }; 124var unknownType = new AtsTypeRef { TypeId = "Tests/Unknown", Category = AtsTypeCategory.Unknown }; 223private static AtsTypeRef Primitive(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Primitive }; 225private static AtsTypeRef Handle(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Handle };
Aspire.Hosting.CodeGeneration.Java.Tests (46)
AtsJavaCodeGeneratorTests.cs (46)
719var numberType = new AtsTypeRef { TypeId = AtsConstants.Number, Category = AtsTypeCategory.Primitive }; 720var booleanType = new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive }; 2920new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = MutableStringDict() }); 2933new AtsTypeRef 2950var stringType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }; 2951var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2954new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }); 2997var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2998var stringType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 2999var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 3000var matrixType = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }; 3005Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3007CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3014ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3035var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3039Type = new AtsTypeRef { TypeId = AtsConstants.CancellationToken, Category = AtsTypeCategory.Dto } 3046ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3063var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3079Type = new AtsTypeRef 3107var resourceType = new AtsTypeRef 3117new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }), 3121new AtsTypeRef { TypeId = AtsConstants.Number, Category = AtsTypeCategory.Primitive, IsNullable = true }), 3247var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3248var nullableNumber = new AtsTypeRef 3254var nullableBoolean = new AtsTypeRef 3260var numberArray = new AtsTypeRef 3266var booleanArray = new AtsTypeRef 3272var booleanMatrix = new AtsTypeRef 3282Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3288CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3295ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3537var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3553Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3566Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3572CallbackReturnType = new AtsTypeRef 3628var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3629var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3634Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3639CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3646ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3668Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3855Type = new AtsTypeRef { TypeId = "KeywordProbe", Category = AtsTypeCategory.Dto } 3914new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }); 3943private static AtsTypeRef MutableStringDict() => new() 3948KeyType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }, 3949ValueType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }
Aspire.Hosting.CodeGeneration.Python.Tests (20)
AtsPythonCodeGeneratorTests.cs (20)
390Type = new AtsTypeRef 858var resourceType = new AtsTypeRef 883Type = new AtsTypeRef 914var resourceType = new AtsTypeRef 939Type = new AtsTypeRef 973var genericBaseTypeRef = new AtsTypeRef 980var genericInterfaceTypeRef = new AtsTypeRef 988var resourceType = new AtsTypeRef 1013ReturnType = new AtsTypeRef 1053var unionType = new AtsTypeRef 1059new AtsTypeRef 1065new AtsTypeRef 1073new AtsTypeRef 1108Type = new AtsTypeRef 1112ElementType = new AtsTypeRef 1122ReturnType = new AtsTypeRef 1158var stringType = new AtsTypeRef 1164var boolType = new AtsTypeRef 1170var projectType = new AtsTypeRef 1177var containerType = new AtsTypeRef
Aspire.Hosting.CodeGeneration.TypeScript.Tests (30)
AtsTypeScriptCodeGeneratorTests.cs (30)
280var targetType = new AtsTypeRef 285var stringType = new AtsTypeRef 967var nullableNumberType = new AtsTypeRef 973var nullableNumberArrayType = new AtsTypeRef 1024var typeRef = new AtsTypeRef 1040var stringType = new AtsTypeRef 1045var listType = new AtsTypeRef 1051var dictionaryType = new AtsTypeRef 1067var nullableNumber = new AtsTypeRef 1073var returnType = new AtsTypeRef 1077KeyType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }, 1078ValueType = new AtsTypeRef 1817var resourceTypeRef = new AtsTypeRef 2101new() 2114ReturnType = new AtsTypeRef 2139ReturnType = new AtsTypeRef 3127var targetType = new AtsTypeRef 3132var stringType = new AtsTypeRef 3137var voidType = new AtsTypeRef 3332new AtsTypeRef 3340new AtsTypeRef 3426var targetType = new AtsTypeRef 3441ReturnType = new AtsTypeRef 3544var targetType = new AtsTypeRef 3559Type = new AtsTypeRef 3574CallbackReturnType = new AtsTypeRef 3581ReturnType = new AtsTypeRef 3608Type = new AtsTypeRef 3617Type = new AtsTypeRef 3625ReturnType = new AtsTypeRef
Aspire.Hosting.Native.CodeGeneration (34)
src\Aspire.Hosting.RemoteHost\AtsCapabilityScanner.cs (34)
933var targetTypeRef = capability.TargetType ?? new AtsTypeRef 963var concreteTypeRef = new AtsTypeRef 1178? new AtsTypeRef { TypeId = "callback", ClrType = prop.PropertyType, Category = AtsTypeCategory.Callback } 1704: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1706propertyTypeRef = new AtsTypeRef 1731propertyTypeRef = new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 2244? new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback } 2301returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2305returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2313?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2314: new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2319?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2347var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2680private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2716return new AtsTypeRef 2798return new AtsTypeRef { TypeId = primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive }; 2804return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2809return new AtsTypeRef 2814KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2815ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2822return new AtsTypeRef 2827ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2837return new AtsTypeRef 2860return new AtsTypeRef 2883return new AtsTypeRef 2905return new AtsTypeRef 2925return new AtsTypeRef 2970return new AtsTypeRef 2986return new AtsTypeRef 2998return new AtsTypeRef 3008return new AtsTypeRef 3103allInterfaces.Add(new AtsTypeRef 3170return new AtsTypeRef 3429return new AtsTypeRef
Aspire.Hosting.RemoteHost (39)
Ats\AtsMarshaller.cs (1)
424return new AtsTypeRef
Ats\ExternalCapabilityRegistry.cs (2)
796: new AtsTypeRef { TypeId = "unknown", Category = AtsTypeCategory.Unknown } 806=> new()
AtsCapabilityScanner.cs (34)
933var targetTypeRef = capability.TargetType ?? new AtsTypeRef 963var concreteTypeRef = new AtsTypeRef 1178? new AtsTypeRef { TypeId = "callback", ClrType = prop.PropertyType, Category = AtsTypeCategory.Callback } 1704: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1706propertyTypeRef = new AtsTypeRef 1731propertyTypeRef = new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 2244? new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback } 2301returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2305returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2313?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2314: new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2319?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2347var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2680private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2716return new AtsTypeRef 2798return new AtsTypeRef { TypeId = primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive }; 2804return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2809return new AtsTypeRef 2814KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2815ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2822return new AtsTypeRef 2827ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2837return new AtsTypeRef 2860return new AtsTypeRef 2883return new AtsTypeRef 2905return new AtsTypeRef 2925return new AtsTypeRef 2970return new AtsTypeRef 2986return new AtsTypeRef 2998return new AtsTypeRef 3008return new AtsTypeRef 3103allInterfaces.Add(new AtsTypeRef 3170return new AtsTypeRef 3429return new AtsTypeRef
AtsContextFilter.cs (2)
322targetType = new AtsTypeRef 342ReturnType = new AtsTypeRef
Aspire.Hosting.RemoteHost.Tests (32)
AtsContextFilterTests.cs (17)
189Type = new AtsTypeRef 196ReturnType = new AtsTypeRef 202TargetType = new AtsTypeRef 274Type = new AtsTypeRef 285Type = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 292Type = new AtsTypeRef 432Type = new AtsTypeRef 485Type = new AtsTypeRef 505Type = new AtsTypeRef 515Type = new AtsTypeRef 525Type = new AtsTypeRef 533ReturnType = new AtsTypeRef 541TargetType = new AtsTypeRef 558ReturnType = new AtsTypeRef 576Type = new AtsTypeRef 589Type = new AtsTypeRef 602Type = new AtsTypeRef
AtsMarshallerTests.cs (12)
169var typeRef = new AtsTypeRef 175new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 176new AtsTypeRef { TypeId = AtsConstants.Number, ClrType = typeof(int), Category = AtsTypeCategory.Primitive }, 177new AtsTypeRef { TypeId = AtsConstants.Boolean, ClrType = typeof(bool), Category = AtsTypeCategory.Primitive } 192var typeRef = new AtsTypeRef 198new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 199new AtsTypeRef { TypeId = "test/IResource", ClrType = typeof(IResource), Category = AtsTypeCategory.Handle } 214var typeRef = new AtsTypeRef 220new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 221new AtsTypeRef { TypeId = AtsConstants.Boolean, ClrType = typeof(bool), Category = AtsTypeCategory.Primitive } 291var typeRef = new AtsTypeRef 1021var typeRef = new AtsTypeRef { TypeId = "test/SelfReferencingDto", Category = AtsTypeCategory.Dto };
ExternalCapabilityRegistryTests.cs (3)
894ReturnType = new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive } 920ReturnType = new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive } 964Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive },
464 references to AtsTypeRef
aspire-managed (2)
AppHostServerV2CodeGeneration.cs (2)
48foreach (var type in capability.Parameters.Select(parameter => parameter.Type) 112void AddHandle(AtsTypeRef type)
Aspire.Hosting.CodeGeneration.Go (37)
AtsGoCodeGenerator.ApiProjection.cs (4)
872var returnType = capability.ReturnType; 1219foreach (var expandedTargetType in capability.ExpandedTargetTypes) 1267private void RegisterTypeOwners(AtsTypeRef? typeRef) 1282foreach (var unionType in typeRef.UnionTypes ?? [])
AtsGoCodeGenerator.cs (33)
137foreach (var expandedTarget in capability.ExpandedTargetTypes) 266private static void CollectRequiredType(AtsTypeRef? type, HashSet<string> requiredTypeIds) 278foreach (var unionType in type.UnionTypes ?? []) 282foreach (var implementedInterface in type.ImplementedInterfaces) 443foreach (var expanded in capability.ExpandedTargetTypes) 712private static void CollectHandleTypeIds(HashSet<string> set, AtsTypeRef? typeRef) 741foreach (var u in typeRef.UnionTypes) 831: (IReadOnlyList<AtsTypeRef>)Array.Empty<AtsTypeRef>(); 833foreach (var targetType in targetTypes) 1249AtsTypeRef typeRef, 1495private static List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> 1498var result = new List<(string, string, AtsTypeRef, string, string?)>(); 1533List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 1634List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 1860var returnType = capability.ReturnType!; 1900List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 1952var returnType = capability.ReturnType!; 2027var returnType = capability.ReturnType!; 2283private string GetCallbackArgExpression(AtsTypeRef type, int index, string? clientExpression) 2304(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description) g, 2322private (string Wrapper, string TypeArgs) ListDictTypeArgs(AtsTypeRef returnType) 2531private static bool CanUseDirectOptionType(AtsTypeRef type) 2796private string GetUnionAllowedTypes(AtsTypeRef typeRef) => string.Join(", ", GetUnionMemberTypes(typeRef)); 2804private string GetUnionTypeSwitchCases(AtsTypeRef typeRef) 2815private string[] GetUnionMemberTypes(AtsTypeRef typeRef) 3046private string MapTypeRefToGo(AtsTypeRef? typeRef, bool isOptional) => 3053/// everything else use <see cref="MapTypeRefToGo(AtsTypeRef?, bool)"/>. 3055private string MapInputTypeRefToGo(AtsTypeRef? typeRef, bool isOptional) => 3058private string MapTypeRefToGo(AtsTypeRef? typeRef, bool isOptional, bool asInput) 3099private string MapDtoPropertyTypeToGo(AtsTypeRef? typeRef, bool isOptional) 3137private static bool ShouldApplyNullableType(AtsTypeRef typeRef) => 3166private static string MapPrimitiveType(AtsTypeRef typeRef) => typeRef.TypeId switch
Aspire.Hosting.CodeGeneration.Go.Tests (62)
AtsGoCodeGeneratorTests.cs (7)
1832var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 1864var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 2636var stringType = new AtsTypeRef 2642var int64Type = new AtsTypeRef 2648var voidType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive };
AtsGoDerivedBuilderTests.cs (26)
490private static readonly AtsTypeRef s_builder = new() { TypeId = AtsConstants.BuilderTypeId, Category = AtsTypeCategory.Handle, IsInterface = true }; 491private static readonly AtsTypeRef s_pool = Handle(PoolId); 492private static readonly AtsTypeRef s_aksPool = Handle(AksPoolId); 493private static readonly AtsTypeRef s_spotPool = Handle(SpotPoolId); 494private static readonly AtsTypeRef s_gpuSpotPool = Handle(GpuSpotPoolId); 495private static readonly AtsTypeRef s_workload = Handle(WorkloadId); 496private static readonly AtsTypeRef s_queue = Handle(QueueId); 497private static readonly AtsTypeRef s_string = new() { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 498private static readonly AtsTypeRef s_poolSettings = new() { TypeId = PoolSettingsId, Category = AtsTypeCategory.Dto }; 615private static AtsTypeRef Handle(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Handle }; 617private static AtsTypeRef ArrayOf(AtsTypeRef element) => new() 625private static AtsTypeRef ListOf(AtsTypeRef element) => new() 632private static AtsTypeRef ReadOnlyDictOf(AtsTypeRef key, AtsTypeRef value) => new() 641private static AtsTypeRef UnionOf(params AtsTypeRef[] members) => new() 648private static AtsParameterInfo Required(string name, AtsTypeRef type) => new() { Name = name, Type = type }; 650private static AtsParameterInfo Optional(string name, AtsTypeRef type) => new() { Name = name, Type = type, IsOptional = true, IsNullable = true }; 652private static AtsParameterInfo Callback(string name, params (string Name, AtsTypeRef Type)[] parameters) => new() 661private static AtsCapabilityInfo Factory(string methodName, AtsTypeRef returnType) => 669AtsTypeRef target, 670IReadOnlyList<AtsTypeRef> expandedTargets, 672AtsTypeRef returnType) => new()
GoDocCommentTests.cs (11)
448var stringType = Primitive(AtsConstants.String); 449var boolType = Primitive(AtsConstants.Boolean); 450var voidType = Primitive(AtsConstants.Void); 451var resourceType = new AtsTypeRef { TypeId = ResourceTypeId, Category = AtsTypeCategory.Handle }; 452var settingsType = new AtsTypeRef { TypeId = SettingsTypeId, Category = AtsTypeCategory.Dto }; 453var statusType = new AtsTypeRef { TypeId = StatusTypeId, Category = AtsTypeCategory.Enum }; 454var tagsType = new AtsTypeRef { TypeId = "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType }; 565private static AtsTypeRef Primitive(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Primitive }; 567private static AtsParameterInfo Parameter(string name, AtsTypeRef type, string? summary = null, bool isOptional = false) => new() 577AtsTypeRef returnType, 586var resourceType = new AtsTypeRef { TypeId = ResourceTypeId, Category = AtsTypeCategory.Handle };
GoGeneratorEscapingTests.cs (18)
115var stringType = Primitive(AtsConstants.String); 116var numberType = Primitive(AtsConstants.Number); 117var voidType = Primitive(AtsConstants.Void); 118var resourceType = Handle(ResourceTypeId); 119var tagsType = new AtsTypeRef { TypeId = "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType }; 120var unionType = new AtsTypeRef { TypeId = "Tests/Union", Category = AtsTypeCategory.Union, UnionTypes = [stringType, numberType] }; 121var callbackType = new AtsTypeRef { TypeId = "Tests/Callback", Category = AtsTypeCategory.Callback }; 122var enumType = new AtsTypeRef { TypeId = StatusTypeId, Category = AtsTypeCategory.Enum }; 123var lookupType = new AtsTypeRef { TypeId = "Tests/Dict<string,string>", Category = AtsTypeCategory.Dict, KeyType = stringType, ValueType = stringType, IsReadOnly = true }; 124var unknownType = new AtsTypeRef { TypeId = "Tests/Unknown", Category = AtsTypeCategory.Unknown }; 215private static AtsExportedValueInfo ExportedValue(IReadOnlyList<string> pathSegments, AtsTypeRef type, JsonNode value) => new() 223private static AtsTypeRef Primitive(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Primitive }; 225private static AtsTypeRef Handle(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Handle }; 227private static AtsParameterInfo Parameter(string name, AtsTypeRef type, string? summary = null, bool isOptional = false) => new() 235private static AtsParameterInfo Callback(string name, AtsTypeRef type, IReadOnlyList<AtsCallbackParameterInfo> parameters, AtsTypeRef returnType) => new() 247AtsTypeRef returnType, 257var resourceType = Handle(ResourceTypeId);
Aspire.Hosting.CodeGeneration.Java (27)
AtsJavaCodeGenerator.cs (27)
869AtsTypeRef typeRef, 1427foreach (var unionType in unionTypes 1523private static List<List<AtsTypeRef>> CartesianProduct(List<List<AtsTypeRef>> lists) 1525var result = new List<List<AtsTypeRef>> { new() }; 1528var temp = new List<List<AtsTypeRef>>(); 1531foreach (var item in list) 1533var combined = new List<AtsTypeRef>(existing) { item }; 1617foreach (var unionType in unionTypes 1695AtsTypeRef unionType) 1902private string GenerateCallbackTypeSignature(IReadOnlyList<AtsCallbackParameterInfo>? callbackParameters, AtsTypeRef? callbackReturnType) 2043private string RenderJavaTransportValueConversion(AtsTypeRef? typeRef, string valueExpression, bool isOptional, int depth = 0) 2077private string RenderJavaArrayTransportValueConversion(AtsTypeRef typeRef, string valueExpression, bool allowNull, int depth) 2092private string RenderJavaDtoPropertyTransportValueConversion(AtsTypeRef? typeRef, string valueExpression, bool isOptional, int depth = 0) 2209private string RenderJavaListTransportValueConversion(AtsTypeRef typeRef, string valueExpression, bool allowNull, int depth) 2222private string MapCallbackTypeToJava(AtsTypeRef? typeRef) 2244private static bool IsListOrDictPropertyGetter(AtsTypeRef? returnType) 2256var returnType = capability.ReturnType!; 2442foreach (var expandedType in capability.ExpandedTargetTypes) 2481var exportedBaseType = handleTypeInfo.BaseTypeHierarchy 2519foreach (var targetType in targetTypes) 2562private string MapTypeRefToJava(AtsTypeRef? typeRef, bool isOptional, bool useBoxedTypes = false) 2594private string MapDtoPropertyTypeToJava(AtsTypeRef? typeRef, bool isOptional, bool useBoxedTypes = false) 2616private string MapInputTypeToJava(AtsTypeRef? typeRef, bool isOptional = false) 2680private static bool IsUnionType(AtsTypeRef? typeRef) => typeRef?.Category == AtsTypeCategory.Union; 2689private static void AddHandleTypeIfNeeded(HashSet<string> handleTypeIds, AtsTypeRef? typeRef) 2709private static void AddListOrDictTypeIfNeeded(Dictionary<string, bool> typeIds, AtsTypeRef? typeRef)
Aspire.Hosting.CodeGeneration.Java.Tests (29)
AtsJavaCodeGeneratorTests.cs (29)
719var numberType = new AtsTypeRef { TypeId = AtsConstants.Number, Category = AtsTypeCategory.Primitive }; 720var booleanType = new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive }; 2950var stringType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }; 2951var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2997var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2998var stringType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 2999var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 3000var matrixType = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }; 3035var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3063var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3107var resourceType = new AtsTypeRef 3247var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3248var nullableNumber = new AtsTypeRef 3254var nullableBoolean = new AtsTypeRef 3260var numberArray = new AtsTypeRef 3266var booleanArray = new AtsTypeRef 3272var booleanMatrix = new AtsTypeRef 3537var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3628var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3629var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3874var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 3875var nullableFlags = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(bool?[]))); 3917private static AtsContext CreateContextWithSingleDtoProperty(string propertyName, AtsTypeRef propertyType) 3943private static AtsTypeRef MutableStringDict() => new() 3952private static AtsContext CreateContextWithProbeCapabilities(AtsTypeRef resourceType, params AtsCapabilityInfo[] capabilities) 3963private static AtsCapabilityInfo CreateProbeCapability(AtsTypeRef resourceType, string methodName, AtsTypeRef returnType)
Aspire.Hosting.CodeGeneration.Python (29)
AtsPythonCodeGenerator.cs (29)
24public AtsTypeRef? TargetType { get; init; } 157private static bool IsHandleType(AtsTypeRef? typeRef) => 165private static bool IsTargetTypeCoveredByBaseHierarchy(AtsTypeRef? capabilityTargetType, AtsTypeRef? builderTargetType) 179var currentBase = builderTargetType.BaseType; 207private string MapTypeRefToPython(AtsTypeRef? typeRef) 239private static string ApplyNullableType(AtsTypeRef typeRef, string mappedType) 244private static bool ShouldApplyNullableType(AtsTypeRef typeRef) => 519private static bool AllowsNoneAtTopLevel(AtsTypeRef? typeRef) 582private string MapUnionTypeToPython(AtsTypeRef typeRef) 596private string MapDtoPropertyTypeToPython(AtsTypeRef? typeRef) 612private string MapDtoUnionTypeToPython(AtsTypeRef typeRef) 1002AtsTypeRef typeRef, 1540var baseType = builder.TargetType?.BaseType; 1567foreach (var i in implementedInterfaces) 1925var typeRefsByTypeId = new Dictionary<string, AtsTypeRef>(); 1932var targetTypeRef = cap.TargetType; 1960foreach (var expandedType in expandedTypes) 1989var typeRef = typeRefsByTypeId.GetValueOrDefault(typeId); 2018var typeRef = typeRefsByTypeId.GetValueOrDefault(interfaceTypeId); 2152foreach (var iface in builder.TargetType.ImplementedInterfaces) 2178private Dictionary<string, AtsTypeRef> CollectAllReferencedTypes(IReadOnlyList<AtsCapabilityInfo> capabilities) 2180var typeRefs = new Dictionary<string, AtsTypeRef>(); 2182void CollectFromTypeRef(AtsTypeRef? typeRef) 2208foreach (var unionType in typeRef.UnionTypes) 2215foreach (var iface in typeRef.ImplementedInterfaces) 2266private static string DeriveClassName(AtsTypeRef typeRef) 2443private static string GetBuilderTypeId(AtsTypeRef typeRef) 2814private string GenerateCallbackTypeSignature(IReadOnlyList<AtsCallbackParameterInfo>? parameters, AtsTypeRef? returnType)
Aspire.Hosting.CodeGeneration.Python.Tests (10)
AtsPythonCodeGeneratorTests.cs (10)
858var resourceType = new AtsTypeRef 914var resourceType = new AtsTypeRef 973var genericBaseTypeRef = new AtsTypeRef 980var genericInterfaceTypeRef = new AtsTypeRef 988var resourceType = new AtsTypeRef 1053var unionType = new AtsTypeRef 1158var stringType = new AtsTypeRef 1164var boolType = new AtsTypeRef 1170var projectType = new AtsTypeRef 1177var containerType = new AtsTypeRef
Aspire.Hosting.CodeGeneration.Rust (16)
AtsRustCodeGenerator.cs (16)
368AtsTypeRef? typeRef, 602var returnTypeRef = capability.ReturnType; 649private static bool IsListOrDictPropertyGetter(AtsTypeRef? returnType) 663var returnType = capability.ReturnType!; 807foreach (var expandedType in capability.ExpandedTargetTypes) 858foreach (var targetType in targetTypes) 900private string MapTypeRefToRust(AtsTypeRef? typeRef, bool isOptional) 938private string MapTypeRefToRustForDto(AtsTypeRef? typeRef, bool isOptional) 978private string MapTypeRefToRustForExportedValue(AtsTypeRef? typeRef) 1029private string MapParameterTypeToRust(AtsTypeRef? typeRef, bool isOptional) 1061private static bool ShouldApplyNullableType(AtsTypeRef typeRef) => 1066private static bool IsHandleType(AtsTypeRef? typeRef) => 1071private static bool IsCollectionOfHandleTypes(AtsTypeRef? typeRef) => 1077private static bool IsAspireListOrDictParam(AtsTypeRef? typeRef) => 1089private static void AddHandleTypeIfNeeded(HashSet<string> handleTypeIds, AtsTypeRef? typeRef) 1109private static void AddListOrDictTypeIfNeeded(HashSet<string> typeIds, AtsTypeRef? typeRef)
Aspire.Hosting.CodeGeneration.Rust.Tests (4)
AtsRustCodeGeneratorTests.cs (4)
148var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 180var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[])));
Aspire.Hosting.CodeGeneration.TypeScript (44)
AtsTypeScriptCodeGenerator.cs (6)
22public AtsTypeRef? TargetType { get; init; } 324private static string GetRpcArgumentValueExpression(string parameterName, AtsTypeRef? typeRef) 342private static string GetRpcArgumentEntry(string parameterName, AtsTypeRef? typeRef) 383private bool TryGetDtoCallbackMarshallingProperties(AtsTypeRef? typeRef, out List<AtsDtoPropertyInfo> marshallingProperties) 400private bool RequiresDtoCallbackMarshalling(AtsTypeRef? typeRef, HashSet<string>? visitedDtoTypeIds = null) 1365private void GeneratePromiseResolutionForParam(string paramName, AtsTypeRef? paramType, string indent = " ")
TypeScriptApiProjector.cs (38)
102internal Dictionary<string, AtsTypeRef> TypeRefsById => _typeRefsById; 220foreach (var alias in directlyReturnedAliases) 764private string RenderTypeScriptExportedValue(JsonNode? value, AtsTypeRef typeRef) 1573private readonly Dictionary<string, AtsTypeRef> _typeRefsById = new(StringComparer.Ordinal); 1647internal static bool IsHandleType(AtsTypeRef? typeRef) => 1655internal string MapTypeRefToTypeScript(AtsTypeRef? typeRef) 1708internal static string ApplyNullableType(AtsTypeRef typeRef, string mappedType) 1720internal string MapDtoPropertyTypeToTypeScript(AtsTypeRef? typeRef) 1736private static string FormatArrayType(AtsTypeRef? elementType, string mappedElementType) 1744internal string MapDtoUnionTypeToTypeScript(AtsTypeRef typeRef) 1797internal string MapUnionTypeToTypeScript(AtsTypeRef typeRef) 1857internal string MapInputTypeToTypeScript(AtsTypeRef? typeRef) 1894internal string MapInputUnionTypeToTypeScript(AtsTypeRef typeRef) 1906foreach (var memberRef in typeRef.UnionTypes) 1953internal string? TryMapInterfaceInputTypeToTypeScript(AtsTypeRef typeRef) 1957foreach (var candidateTypeRef in _typeRefsById.Values) 1979internal static bool IsAssignableToInterface(AtsTypeRef candidateTypeRef, string interfaceTypeId) 1986foreach (var implementedInterface in candidateTypeRef.ImplementedInterfaces) 2002internal static bool IsInterfaceHandleType(AtsTypeRef? typeRef) 2011internal static bool IsCancellationTokenType(AtsTypeRef? typeRef) => typeRef?.TypeId == AtsConstants.CancellationToken; 2461internal string GetGetterOnlyPropertyReturnType(AtsTypeRef? typeRef) 2484internal bool TryGetPromiseWrapperType(AtsTypeRef? typeRef, out string promiseInterfaceName, out string promiseImplementationClassName) 2499internal string GetGetterOnlyPropertyMethodReturnType(AtsTypeRef? typeRef) 2526internal bool IsWidenedHandleType(AtsTypeRef? typeRef) 2623internal static bool IsDictionaryType(AtsTypeRef? typeRef) 2632internal static bool IsListType(AtsTypeRef? typeRef) 2651var typeRefsByTypeId = new Dictionary<string, AtsTypeRef>(); 2658var targetTypeRef = cap.TargetType; 2684foreach (var expandedType in expandedTypes) 2730var typeRef = typeRefsByTypeId.GetValueOrDefault(typeId); 2764var typeRef = typeRefsByTypeId.GetValueOrDefault(interfaceTypeId); 2912private static bool IsTypeInHierarchy(AtsTypeRef typeRef, string typeId) 2931internal static Dictionary<string, AtsTypeRef> CollectAllReferencedTypes(IReadOnlyList<AtsCapabilityInfo> capabilities) 2933var typeRefs = new Dictionary<string, AtsTypeRef>(); 2935void CollectFromTypeRef(AtsTypeRef? typeRef) 2953foreach (var unionType in typeRef.UnionTypes) 3077internal string? GetPromiseWrapperForReturnType(AtsTypeRef? returnType) 3095internal string GenerateCallbackTypeSignature(IReadOnlyList<AtsCallbackParameterInfo>? callbackParameters, AtsTypeRef? callbackReturnType)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (25)
AtsTypeScriptCodeGeneratorTests.cs (25)
280var targetType = new AtsTypeRef 285var stringType = new AtsTypeRef 521var testRedisTarget = withOptionalString.ExpandedTargetTypes.FirstOrDefault(t => 792foreach (var expandedType in cap.ExpandedTargetTypes) 856var testRedisExpanded = withConnectionStringDirect.ExpandedTargetTypes 884var testRedisExpanded = withRedisSpecific.ExpandedTargetTypes 910var containerExpanded = withBindMount.ExpandedTargetTypes 967var nullableNumberType = new AtsTypeRef 973var nullableNumberArrayType = new AtsTypeRef 1024var typeRef = new AtsTypeRef 1040var stringType = new AtsTypeRef 1045var listType = new AtsTypeRef 1051var dictionaryType = new AtsTypeRef 1067var nullableNumber = new AtsTypeRef 1073var returnType = new AtsTypeRef 1137foreach (var expandedType in withConnectionStringDirect.ExpandedTargetTypes) 1172var testRedisExpanded = testWithEnvironmentCallback.ExpandedTargetTypes 1817var resourceTypeRef = new AtsTypeRef 2100private static AtsTypeRef CreateResourceTypeRef<TResource>() where TResource : IResource => 3127var targetType = new AtsTypeRef 3132var stringType = new AtsTypeRef 3137var voidType = new AtsTypeRef 3426var targetType = new AtsTypeRef 3542AtsTypeRef callbackPayloadType) 3544var targetType = new AtsTypeRef
Aspire.Hosting.Native.CodeGeneration (70)
NativeCSharpProjection.cs (2)
233string TypeName(AtsTypeRef type) 258private static bool ContainsHandle(AtsTypeRef type) => type.Category == AtsTypeCategory.Handle ||
NativeProviderTypeScriptProjection.cs (2)
26.Append(method.ReturnType)).OfType<AtsTypeRef>().Where(type => type.Category == AtsTypeCategory.Handle) 87string TypeName(AtsTypeRef type)
src\Aspire.Hosting.RemoteHost\AtsCapabilityScanner.cs (66)
682private static void CollectEnumClrTypes(AtsTypeRef? typeRef, Dictionary<string, Type> enumTypes) 702foreach (var unionType in typeRef.UnionTypes) 766private static void ResolveTypeRef(AtsTypeRef? typeRef, HashSet<string> validTypes) 787foreach (var memberType in typeRef.UnionTypes) 862private static string? FindUnknownType(AtsTypeRef? typeRef) 887foreach (var memberType in typeRef.UnionTypes) 933var targetTypeRef = capability.TargetType ?? new AtsTypeRef 950private static Dictionary<string, List<AtsTypeRef>> BuildTypeCompatibilityMap( 953var typeToCompatibleTypes = new Dictionary<string, List<AtsTypeRef>>(); 963var concreteTypeRef = new AtsTypeRef 978foreach (var iface in typeInfo.ImplementedInterfaces) 984foreach (var baseType in typeInfo.BaseTypeHierarchy) 997Dictionary<string, List<AtsTypeRef>> map, 999AtsTypeRef concreteTypeRef) 1177var propTypeRef = isCallback 1194AtsTypeRef? callbackReturnType = null; 1348var typeRef = CreateTypeRef(memberType, enumCollector: null, assemblyExportedTypeCache); 1386AtsTypeRef? typeRef, 1413AtsTypeRef typeRef, 1441var propertyTypeRef = CreateTypeRef(property.PropertyType, enumCollector: null, assemblyExportedTypeCache); 1684AtsTypeRef? propertyTypeRef; 1699var keyTypeRef = CreateTypeRef(propType.GetGenericArguments().First(), enumCollector: null, assemblyExportedTypeCache); 1702var valueTypeRef = propertyUnionAttr != null 1747var getterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.ReadState); 1748var setterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.WriteState); 1751var contextTypeRef = CreateHandleTypeRef(contextType); 1864var instanceContextTypeRef = CreateHandleTypeRef(contextType); 1985var returnTypeRef = CreateReturnTypeRef(method, assemblyExportedTypeCache); 2106AtsTypeRef? extendsTypeRef = null; 2162var returnTypeRef = CreateReturnTypeRef(method, assemblyExportedTypeCache); 2203var unionTypeRef = CreateUnionTypeRef(unionAttr, $"parameter '{paramName}'", assemblyExportedTypeCache); 2220var typeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2232AtsTypeRef? callbackReturnType = null; 2243var finalTypeRef = isCallback 2264private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractCallbackSignature( 2283var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2297AtsTypeRef? returnTypeRef; 2330private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractWellKnownDelegateSignature( 2347var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2356var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2377var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2389AtsTypeRef returnTypeRef; 2674public static AtsTypeRef? CreateTypeRef(Type? type) => 2680private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2686private static AtsTypeRef? CreateReturnTypeRef(MethodInfo method, AssemblyExportedTypeCache assemblyExportedTypeCache) 2688var typeRef = CreateTypeRef(method.ReturnType, enumCollector: null, assemblyExportedTypeCache); 2707private static AtsTypeRef WithNullability(AtsTypeRef typeRef, Type declaredType, NullabilityState nullabilityState) 2736private static AtsTypeRef? CreateTypeRef( 2790var typeRef = CreateTypeRef(underlyingType, enumCollector, assemblyExportedTypeCache); 2856var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2857var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2879var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2880var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2902var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2922var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2967var elementTypeRef = CreateTypeRef(elementType, enumCollector, assemblyExportedTypeCache); 3081private static List<AtsTypeRef> CollectAllInterfaces(Type type) 3083var allInterfaces = new List<AtsTypeRef>(); 3121private static List<AtsTypeRef> CollectBaseTypeHierarchy(Type type) 3123var baseTypes = new List<AtsTypeRef>(); 3152private static AtsTypeRef CreateHandleTypeRef(Type type) 3156AtsTypeRef? baseTypeRef = null; 3403private static AtsTypeRef CreateUnionTypeRef( 3415var unionTypes = new List<AtsTypeRef>(); 3418var typeRef = CreateTypeRef(memberType, enumCollector: null, assemblyExportedTypeCache);
Aspire.Hosting.RemoteHost (84)
Ats\AtsMarshaller.cs (6)
137public JsonNode? MarshalToJson(object? value, AtsTypeRef typeRef) 169private JsonNode? MarshalUnion(object value, AtsTypeRef typeRef) 175foreach (var member in members) 384private JsonNode? SerializeArray(object value, AtsTypeRef? elementType) 401private AtsTypeRef? CreateElementTypeRef(Type declaredType) 422private AtsTypeRef CreateTypeRef(Type type)
Ats\ExternalCapabilityRegistry.cs (1)
805private static AtsTypeRef CreateTypeRef(ExternalTypeRef typeRef)
AtsCapabilityScanner.cs (66)
682private static void CollectEnumClrTypes(AtsTypeRef? typeRef, Dictionary<string, Type> enumTypes) 702foreach (var unionType in typeRef.UnionTypes) 766private static void ResolveTypeRef(AtsTypeRef? typeRef, HashSet<string> validTypes) 787foreach (var memberType in typeRef.UnionTypes) 862private static string? FindUnknownType(AtsTypeRef? typeRef) 887foreach (var memberType in typeRef.UnionTypes) 933var targetTypeRef = capability.TargetType ?? new AtsTypeRef 950private static Dictionary<string, List<AtsTypeRef>> BuildTypeCompatibilityMap( 953var typeToCompatibleTypes = new Dictionary<string, List<AtsTypeRef>>(); 963var concreteTypeRef = new AtsTypeRef 978foreach (var iface in typeInfo.ImplementedInterfaces) 984foreach (var baseType in typeInfo.BaseTypeHierarchy) 997Dictionary<string, List<AtsTypeRef>> map, 999AtsTypeRef concreteTypeRef) 1177var propTypeRef = isCallback 1194AtsTypeRef? callbackReturnType = null; 1348var typeRef = CreateTypeRef(memberType, enumCollector: null, assemblyExportedTypeCache); 1386AtsTypeRef? typeRef, 1413AtsTypeRef typeRef, 1441var propertyTypeRef = CreateTypeRef(property.PropertyType, enumCollector: null, assemblyExportedTypeCache); 1684AtsTypeRef? propertyTypeRef; 1699var keyTypeRef = CreateTypeRef(propType.GetGenericArguments().First(), enumCollector: null, assemblyExportedTypeCache); 1702var valueTypeRef = propertyUnionAttr != null 1747var getterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.ReadState); 1748var setterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.WriteState); 1751var contextTypeRef = CreateHandleTypeRef(contextType); 1864var instanceContextTypeRef = CreateHandleTypeRef(contextType); 1985var returnTypeRef = CreateReturnTypeRef(method, assemblyExportedTypeCache); 2106AtsTypeRef? extendsTypeRef = null; 2162var returnTypeRef = CreateReturnTypeRef(method, assemblyExportedTypeCache); 2203var unionTypeRef = CreateUnionTypeRef(unionAttr, $"parameter '{paramName}'", assemblyExportedTypeCache); 2220var typeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2232AtsTypeRef? callbackReturnType = null; 2243var finalTypeRef = isCallback 2264private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractCallbackSignature( 2283var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2297AtsTypeRef? returnTypeRef; 2330private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractWellKnownDelegateSignature( 2347var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2356var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2377var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2389AtsTypeRef returnTypeRef; 2674public static AtsTypeRef? CreateTypeRef(Type? type) => 2680private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2686private static AtsTypeRef? CreateReturnTypeRef(MethodInfo method, AssemblyExportedTypeCache assemblyExportedTypeCache) 2688var typeRef = CreateTypeRef(method.ReturnType, enumCollector: null, assemblyExportedTypeCache); 2707private static AtsTypeRef WithNullability(AtsTypeRef typeRef, Type declaredType, NullabilityState nullabilityState) 2736private static AtsTypeRef? CreateTypeRef( 2790var typeRef = CreateTypeRef(underlyingType, enumCollector, assemblyExportedTypeCache); 2856var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2857var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2879var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2880var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2902var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2922var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2967var elementTypeRef = CreateTypeRef(elementType, enumCollector, assemblyExportedTypeCache); 3081private static List<AtsTypeRef> CollectAllInterfaces(Type type) 3083var allInterfaces = new List<AtsTypeRef>(); 3121private static List<AtsTypeRef> CollectBaseTypeHierarchy(Type type) 3123var baseTypes = new List<AtsTypeRef>(); 3152private static AtsTypeRef CreateHandleTypeRef(Type type) 3156AtsTypeRef? baseTypeRef = null; 3403private static AtsTypeRef CreateUnionTypeRef( 3415var unionTypes = new List<AtsTypeRef>(); 3418var typeRef = CreateTypeRef(memberType, enumCollector: null, assemblyExportedTypeCache);
AtsContextFilter.cs (10)
177foreach (var expandedTargetType in capability.ExpandedTargetTypes) 252foreach (var expandedTargetType in capability.ExpandedTargetTypes) 317var targetType = capability.TargetType; 361var referencedHandleTypes = new Dictionary<string, AtsTypeRef>(StringComparer.Ordinal); 387void CollectHandleTypes(AtsTypeRef? typeRef) 404foreach (var unionType in unionTypes) 413AtsTypeRef? typeRef, 447foreach (var unionType in typeRef.UnionTypes) 463foreach (var implementedInterface in handleType.ImplementedInterfaces) 468foreach (var baseType in handleType.BaseTypeHierarchy)
CodeGeneration\CodeGenerationService.cs (1)
148private static TypeRefResponse MapTypeRef(AtsTypeRef t) => new()
Aspire.Hosting.RemoteHost.Tests (8)
AtsCapabilityScannerTests.cs (3)
159var itemsType = Assert.IsType<AtsTypeRef>(itemsParameter.Type); 174var typeRef = AtsCapabilityScanner.CreateTypeRef(arrayType);
AtsMarshallerTests.cs (5)
169var typeRef = new AtsTypeRef 192var typeRef = new AtsTypeRef 214var typeRef = new AtsTypeRef 291var typeRef = new AtsTypeRef 1021var typeRef = new AtsTypeRef { TypeId = "test/SelfReferencingDto", Category = AtsTypeCategory.Dto };
Aspire.TypeSystem (17)
AtsCapabilityInfo.cs (16)
54public AtsTypeRef? ElementType { get; init; } 59public AtsTypeRef? KeyType { get; init; } 64public AtsTypeRef? ValueType { get; init; } 92public IReadOnlyList<AtsTypeRef>? UnionTypes { get; init; } 103public IReadOnlyList<AtsTypeRef> ImplementedInterfaces { get; init; } = []; 114public AtsTypeRef? BaseType { get; init; } 322public required AtsTypeRef ReturnType { get; init; } 333public AtsTypeRef? TargetType { get; init; } 349public IReadOnlyList<AtsTypeRef> ExpandedTargetTypes { get; set; } = []; 388public AtsTypeRef? Type { get; init; } 416public AtsTypeRef? CallbackReturnType { get; init; } 442public required AtsTypeRef Type { get; init; } 475public IReadOnlyList<AtsTypeRef> ImplementedInterfaces { get; init; } = []; 482public IReadOnlyList<AtsTypeRef> BaseTypeHierarchy { get; init; } = []; 569public required AtsTypeRef Type { get; init; } 587public AtsTypeRef? CallbackReturnType { get; init; }
AtsExportedValueInfo.cs (1)
35public required AtsTypeRef Type { get; init; }