223 instantiations of AtsTypeRef
Aspire.Hosting.CodeGeneration.Go.Tests (24)
AtsGoDerivedBuilderTests.cs (10)
489private static readonly AtsTypeRef s_builder = new() { TypeId = AtsConstants.BuilderTypeId, Category = AtsTypeCategory.Handle, IsInterface = true }; 496private static readonly AtsTypeRef s_string = new() { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 497private static readonly AtsTypeRef s_poolSettings = new() { TypeId = PoolSettingsId, Category = AtsTypeCategory.Dto }; 614private static AtsTypeRef Handle(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Handle }; 616private static AtsTypeRef ArrayOf(AtsTypeRef element) => new() 624private static AtsTypeRef ListOf(AtsTypeRef element) => new() 631private static AtsTypeRef ReadOnlyDictOf(AtsTypeRef key, AtsTypeRef value) => new() 640private static AtsTypeRef UnionOf(params AtsTypeRef[] members) => new() 654Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 657CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }
GoDocCommentTests.cs (6)
361var resourceType = new AtsTypeRef { TypeId = ResourceTypeId, Category = AtsTypeCategory.Handle }; 362var settingsType = new AtsTypeRef { TypeId = SettingsTypeId, Category = AtsTypeCategory.Dto }; 363var statusType = new AtsTypeRef { TypeId = StatusTypeId, Category = AtsTypeCategory.Enum }; 364var tagsType = new AtsTypeRef { TypeId = "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType }; 475private static AtsTypeRef Primitive(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Primitive }; 496var resourceType = new AtsTypeRef { TypeId = ResourceTypeId, Category = AtsTypeCategory.Handle };
GoGeneratorEscapingTests.cs (8)
95var tagsType = new AtsTypeRef { TypeId = "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType }; 96var unionType = new AtsTypeRef { TypeId = "Tests/Union", Category = AtsTypeCategory.Union, UnionTypes = [stringType, numberType] }; 97var callbackType = new AtsTypeRef { TypeId = "Tests/Callback", Category = AtsTypeCategory.Callback }; 98var enumType = new AtsTypeRef { TypeId = StatusTypeId, Category = AtsTypeCategory.Enum }; 99var lookupType = new AtsTypeRef { TypeId = "Tests/Dict<string,string>", Category = AtsTypeCategory.Dict, KeyType = stringType, ValueType = stringType, IsReadOnly = true }; 100var unknownType = new AtsTypeRef { TypeId = "Tests/Unknown", Category = AtsTypeCategory.Unknown }; 197private static AtsTypeRef Primitive(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Primitive }; 199private static AtsTypeRef Handle(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Handle };
Aspire.Hosting.CodeGeneration.Java.Tests (44)
AtsJavaCodeGeneratorTests.cs (44)
2698new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = MutableStringDict() }); 2711new AtsTypeRef 2728var stringType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }; 2729var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2732new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }); 2775var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2776var stringType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 2777var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2778var matrixType = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }; 2783Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 2785CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2792ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 2813var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2817Type = new AtsTypeRef { TypeId = AtsConstants.CancellationToken, Category = AtsTypeCategory.Dto } 2824ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 2841var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2857Type = new AtsTypeRef 2885var resourceType = new AtsTypeRef 2895new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }), 2899new AtsTypeRef { TypeId = AtsConstants.Number, Category = AtsTypeCategory.Primitive, IsNullable = true }), 3025var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3026var nullableNumber = new AtsTypeRef 3032var nullableBoolean = new AtsTypeRef 3038var numberArray = new AtsTypeRef 3044var booleanArray = new AtsTypeRef 3050var booleanMatrix = new AtsTypeRef 3060Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3066CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3073ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3315var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3331Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3344Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3350CallbackReturnType = new AtsTypeRef 3406var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3407var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3412Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3417CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3424ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3446Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3633Type = new AtsTypeRef { TypeId = "KeywordProbe", Category = AtsTypeCategory.Dto } 3692new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }); 3721private static AtsTypeRef MutableStringDict() => new() 3726KeyType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }, 3727ValueType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }
Aspire.Hosting.CodeGeneration.Python.Tests (20)
AtsPythonCodeGeneratorTests.cs (20)
390Type = new AtsTypeRef 866var resourceType = new AtsTypeRef 891Type = new AtsTypeRef 922var resourceType = new AtsTypeRef 947Type = new AtsTypeRef 981var genericBaseTypeRef = new AtsTypeRef 988var genericInterfaceTypeRef = new AtsTypeRef 996var resourceType = new AtsTypeRef 1021ReturnType = new AtsTypeRef 1061var unionType = new AtsTypeRef 1067new AtsTypeRef 1073new AtsTypeRef 1081new AtsTypeRef 1116Type = new AtsTypeRef 1120ElementType = new AtsTypeRef 1130ReturnType = new AtsTypeRef 1166var stringType = new AtsTypeRef 1172var boolType = new AtsTypeRef 1178var projectType = new AtsTypeRef 1185var containerType = new AtsTypeRef
Aspire.Hosting.CodeGeneration.TypeScript.Tests (30)
AtsTypeScriptCodeGeneratorTests.cs (30)
281var targetType = new AtsTypeRef 286var stringType = new AtsTypeRef 949var nullableNumberType = new AtsTypeRef 955var nullableNumberArrayType = new AtsTypeRef 1006var typeRef = new AtsTypeRef 1022var stringType = new AtsTypeRef 1027var listType = new AtsTypeRef 1033var dictionaryType = new AtsTypeRef 1049var nullableNumber = new AtsTypeRef 1055var returnType = new AtsTypeRef 1059KeyType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }, 1060ValueType = new AtsTypeRef 1732var resourceTypeRef = new AtsTypeRef 1993new() 2006ReturnType = new AtsTypeRef 2031ReturnType = new AtsTypeRef 3014var targetType = new AtsTypeRef 3019var stringType = new AtsTypeRef 3024var voidType = new AtsTypeRef 3219new AtsTypeRef 3227new AtsTypeRef 3313var targetType = new AtsTypeRef 3328ReturnType = new AtsTypeRef 3431var targetType = new AtsTypeRef 3446Type = new AtsTypeRef 3461CallbackReturnType = new AtsTypeRef 3468ReturnType = new AtsTypeRef 3495Type = new AtsTypeRef 3504Type = new AtsTypeRef 3512ReturnType = new AtsTypeRef
Aspire.Hosting.Native.CodeGeneration (34)
src\Aspire.Hosting.RemoteHost\AtsCapabilityScanner.cs (34)
927var targetTypeRef = capability.TargetType ?? new AtsTypeRef 957var concreteTypeRef = new AtsTypeRef 1171? new AtsTypeRef { TypeId = "callback", ClrType = prop.PropertyType, Category = AtsTypeCategory.Callback } 1691: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1693propertyTypeRef = new AtsTypeRef 1718propertyTypeRef = new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 2231? new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback } 2288returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2292returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2300?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2301: new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2306?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2334var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2667private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2703return new AtsTypeRef 2785return new AtsTypeRef { TypeId = primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive }; 2791return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2796return new AtsTypeRef 2801KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2802ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2809return new AtsTypeRef 2814ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2824return new AtsTypeRef 2847return new AtsTypeRef 2870return new AtsTypeRef 2892return new AtsTypeRef 2912return new AtsTypeRef 2957return new AtsTypeRef 2973return new AtsTypeRef 2985return new AtsTypeRef 2995return new AtsTypeRef 3090allInterfaces.Add(new AtsTypeRef 3157return new AtsTypeRef 3416return 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)
927var targetTypeRef = capability.TargetType ?? new AtsTypeRef 957var concreteTypeRef = new AtsTypeRef 1171? new AtsTypeRef { TypeId = "callback", ClrType = prop.PropertyType, Category = AtsTypeCategory.Callback } 1691: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1693propertyTypeRef = new AtsTypeRef 1718propertyTypeRef = new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 2231? new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback } 2288returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2292returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2300?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2301: new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2306?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2334var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2667private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2703return new AtsTypeRef 2785return new AtsTypeRef { TypeId = primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive }; 2791return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2796return new AtsTypeRef 2801KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2802ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2809return new AtsTypeRef 2814ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2824return new AtsTypeRef 2847return new AtsTypeRef 2870return new AtsTypeRef 2892return new AtsTypeRef 2912return new AtsTypeRef 2957return new AtsTypeRef 2973return new AtsTypeRef 2985return new AtsTypeRef 2995return new AtsTypeRef 3090allInterfaces.Add(new AtsTypeRef 3157return new AtsTypeRef 3416return 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 },
453 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 (31)
AtsGoCodeGenerator.ApiProjection.cs (4)
722var returnType = capability.ReturnType; 1061foreach (var expandedTargetType in capability.ExpandedTargetTypes) 1109private void RegisterTypeOwners(AtsTypeRef? typeRef) 1124foreach (var unionType in typeRef.UnionTypes ?? [])
AtsGoCodeGenerator.cs (27)
217foreach (var expanded in capability.ExpandedTargetTypes) 441private static void CollectHandleTypeIds(HashSet<string> set, AtsTypeRef? typeRef) 470foreach (var u in typeRef.UnionTypes) 560: (IReadOnlyList<AtsTypeRef>)Array.Empty<AtsTypeRef>(); 562foreach (var targetType in targetTypes) 977AtsTypeRef typeRef, 1223private static List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> 1226var result = new List<(string, string, AtsTypeRef, string, string?)>(); 1261List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 1359List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 1608var returnType = capability.ReturnType!; 1648List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 1700var returnType = capability.ReturnType!; 1772var returnType = capability.ReturnType!; 2044private string GetCallbackArgExpression(AtsTypeRef type, int index, string? clientExpression) 2060(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description) g, 2076private (string Wrapper, string TypeArgs) ListDictTypeArgs(AtsTypeRef returnType) 2343private string GetUnionAllowedTypes(AtsTypeRef typeRef) => string.Join(", ", GetUnionMemberTypes(typeRef)); 2351private string GetUnionTypeSwitchCases(AtsTypeRef typeRef) 2362private string[] GetUnionMemberTypes(AtsTypeRef typeRef) 2582private string MapTypeRefToGo(AtsTypeRef? typeRef, bool isOptional) => 2589/// everything else use <see cref="MapTypeRefToGo(AtsTypeRef?, bool)"/>. 2591private string MapInputTypeRefToGo(AtsTypeRef? typeRef, bool isOptional) => 2594private string MapTypeRefToGo(AtsTypeRef? typeRef, bool isOptional, bool asInput) 2635private string MapDtoPropertyTypeToGo(AtsTypeRef? typeRef, bool isOptional) 2673private static bool ShouldApplyNullableType(AtsTypeRef typeRef) =>
Aspire.Hosting.CodeGeneration.Go.Tests (59)
AtsGoCodeGeneratorTests.cs (4)
1211var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 1243var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[])));
AtsGoDerivedBuilderTests.cs (26)
489private static readonly AtsTypeRef s_builder = new() { TypeId = AtsConstants.BuilderTypeId, Category = AtsTypeCategory.Handle, IsInterface = true }; 490private static readonly AtsTypeRef s_pool = Handle(PoolId); 491private static readonly AtsTypeRef s_aksPool = Handle(AksPoolId); 492private static readonly AtsTypeRef s_spotPool = Handle(SpotPoolId); 493private static readonly AtsTypeRef s_gpuSpotPool = Handle(GpuSpotPoolId); 494private static readonly AtsTypeRef s_workload = Handle(WorkloadId); 495private static readonly AtsTypeRef s_queue = Handle(QueueId); 496private static readonly AtsTypeRef s_string = new() { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 497private static readonly AtsTypeRef s_poolSettings = new() { TypeId = PoolSettingsId, Category = AtsTypeCategory.Dto }; 614private static AtsTypeRef Handle(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Handle }; 616private static AtsTypeRef ArrayOf(AtsTypeRef element) => new() 624private static AtsTypeRef ListOf(AtsTypeRef element) => new() 631private static AtsTypeRef ReadOnlyDictOf(AtsTypeRef key, AtsTypeRef value) => new() 640private static AtsTypeRef UnionOf(params AtsTypeRef[] members) => new() 647private static AtsParameterInfo Required(string name, AtsTypeRef type) => new() { Name = name, Type = type }; 649private static AtsParameterInfo Optional(string name, AtsTypeRef type) => new() { Name = name, Type = type, IsOptional = true, IsNullable = true }; 651private static AtsParameterInfo Callback(string name, params (string Name, AtsTypeRef Type)[] parameters) => new() 660private static AtsCapabilityInfo Factory(string methodName, AtsTypeRef returnType) => 668AtsTypeRef target, 669IReadOnlyList<AtsTypeRef> expandedTargets, 671AtsTypeRef returnType) => new()
GoDocCommentTests.cs (11)
358var stringType = Primitive(AtsConstants.String); 359var boolType = Primitive(AtsConstants.Boolean); 360var voidType = Primitive(AtsConstants.Void); 361var resourceType = new AtsTypeRef { TypeId = ResourceTypeId, Category = AtsTypeCategory.Handle }; 362var settingsType = new AtsTypeRef { TypeId = SettingsTypeId, Category = AtsTypeCategory.Dto }; 363var statusType = new AtsTypeRef { TypeId = StatusTypeId, Category = AtsTypeCategory.Enum }; 364var tagsType = new AtsTypeRef { TypeId = "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType }; 475private static AtsTypeRef Primitive(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Primitive }; 477private static AtsParameterInfo Parameter(string name, AtsTypeRef type, string? summary = null, bool isOptional = false) => new() 487AtsTypeRef returnType, 496var resourceType = new AtsTypeRef { TypeId = ResourceTypeId, Category = AtsTypeCategory.Handle };
GoGeneratorEscapingTests.cs (18)
91var stringType = Primitive(AtsConstants.String); 92var numberType = Primitive(AtsConstants.Number); 93var voidType = Primitive(AtsConstants.Void); 94var resourceType = Handle(ResourceTypeId); 95var tagsType = new AtsTypeRef { TypeId = "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType }; 96var unionType = new AtsTypeRef { TypeId = "Tests/Union", Category = AtsTypeCategory.Union, UnionTypes = [stringType, numberType] }; 97var callbackType = new AtsTypeRef { TypeId = "Tests/Callback", Category = AtsTypeCategory.Callback }; 98var enumType = new AtsTypeRef { TypeId = StatusTypeId, Category = AtsTypeCategory.Enum }; 99var lookupType = new AtsTypeRef { TypeId = "Tests/Dict<string,string>", Category = AtsTypeCategory.Dict, KeyType = stringType, ValueType = stringType, IsReadOnly = true }; 100var unknownType = new AtsTypeRef { TypeId = "Tests/Unknown", Category = AtsTypeCategory.Unknown }; 189private static AtsExportedValueInfo ExportedValue(IReadOnlyList<string> pathSegments, AtsTypeRef type, JsonNode value) => new() 197private static AtsTypeRef Primitive(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Primitive }; 199private static AtsTypeRef Handle(string typeId) => new() { TypeId = typeId, Category = AtsTypeCategory.Handle }; 201private static AtsParameterInfo Parameter(string name, AtsTypeRef type, string? summary = null, bool isOptional = false) => new() 209private static AtsParameterInfo Callback(string name, AtsTypeRef type, IReadOnlyList<AtsCallbackParameterInfo> parameters, AtsTypeRef returnType) => new() 221AtsTypeRef returnType, 231var 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 (27)
AtsJavaCodeGeneratorTests.cs (27)
2728var stringType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }; 2729var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2775var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2776var stringType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 2777var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2778var matrixType = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }; 2813var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2841var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2885var resourceType = new AtsTypeRef 3025var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3026var nullableNumber = new AtsTypeRef 3032var nullableBoolean = new AtsTypeRef 3038var numberArray = new AtsTypeRef 3044var booleanArray = new AtsTypeRef 3050var booleanMatrix = new AtsTypeRef 3315var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3406var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3407var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3652var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 3653var nullableFlags = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(bool?[]))); 3695private static AtsContext CreateContextWithSingleDtoProperty(string propertyName, AtsTypeRef propertyType) 3721private static AtsTypeRef MutableStringDict() => new() 3730private static AtsContext CreateContextWithProbeCapabilities(AtsTypeRef resourceType, params AtsCapabilityInfo[] capabilities) 3741private 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)
866var resourceType = new AtsTypeRef 922var resourceType = new AtsTypeRef 981var genericBaseTypeRef = new AtsTypeRef 988var genericInterfaceTypeRef = new AtsTypeRef 996var resourceType = new AtsTypeRef 1061var unionType = new AtsTypeRef 1166var stringType = new AtsTypeRef 1172var boolType = new AtsTypeRef 1178var projectType = new AtsTypeRef 1185var 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)
281var targetType = new AtsTypeRef 286var stringType = new AtsTypeRef 522var testRedisTarget = withOptionalString.ExpandedTargetTypes.FirstOrDefault(t => 774foreach (var expandedType in cap.ExpandedTargetTypes) 838var testRedisExpanded = withConnectionStringDirect.ExpandedTargetTypes 866var testRedisExpanded = withRedisSpecific.ExpandedTargetTypes 892var containerExpanded = withBindMount.ExpandedTargetTypes 949var nullableNumberType = new AtsTypeRef 955var nullableNumberArrayType = new AtsTypeRef 1006var typeRef = new AtsTypeRef 1022var stringType = new AtsTypeRef 1027var listType = new AtsTypeRef 1033var dictionaryType = new AtsTypeRef 1049var nullableNumber = new AtsTypeRef 1055var returnType = new AtsTypeRef 1119foreach (var expandedType in withConnectionStringDirect.ExpandedTargetTypes) 1154var testRedisExpanded = testWithEnvironmentCallback.ExpandedTargetTypes 1732var resourceTypeRef = new AtsTypeRef 1992private static AtsTypeRef CreateResourceTypeRef<TResource>() where TResource : IResource => 3014var targetType = new AtsTypeRef 3019var stringType = new AtsTypeRef 3024var voidType = new AtsTypeRef 3313var targetType = new AtsTypeRef 3429AtsTypeRef callbackPayloadType) 3431var 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)
676private static void CollectEnumClrTypes(AtsTypeRef? typeRef, Dictionary<string, Type> enumTypes) 696foreach (var unionType in typeRef.UnionTypes) 760private static void ResolveTypeRef(AtsTypeRef? typeRef, HashSet<string> validTypes) 781foreach (var memberType in typeRef.UnionTypes) 856private static string? FindUnknownType(AtsTypeRef? typeRef) 881foreach (var memberType in typeRef.UnionTypes) 927var targetTypeRef = capability.TargetType ?? new AtsTypeRef 944private static Dictionary<string, List<AtsTypeRef>> BuildTypeCompatibilityMap( 947var typeToCompatibleTypes = new Dictionary<string, List<AtsTypeRef>>(); 957var concreteTypeRef = new AtsTypeRef 972foreach (var iface in typeInfo.ImplementedInterfaces) 978foreach (var baseType in typeInfo.BaseTypeHierarchy) 991Dictionary<string, List<AtsTypeRef>> map, 993AtsTypeRef concreteTypeRef) 1170var propTypeRef = isCallback 1187AtsTypeRef? callbackReturnType = null; 1336var typeRef = CreateTypeRef(memberType, enumCollector: null, assemblyExportedTypeCache); 1373AtsTypeRef? typeRef, 1400AtsTypeRef typeRef, 1428var propertyTypeRef = CreateTypeRef(property.PropertyType, enumCollector: null, assemblyExportedTypeCache); 1671AtsTypeRef? propertyTypeRef; 1686var keyTypeRef = CreateTypeRef(propType.GetGenericArguments().First(), enumCollector: null, assemblyExportedTypeCache); 1689var valueTypeRef = propertyUnionAttr != null 1734var getterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.ReadState); 1735var setterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.WriteState); 1738var contextTypeRef = CreateHandleTypeRef(contextType); 1851var instanceContextTypeRef = CreateHandleTypeRef(contextType); 1972var returnTypeRef = CreateReturnTypeRef(method, assemblyExportedTypeCache); 2093AtsTypeRef? extendsTypeRef = null; 2149var returnTypeRef = CreateReturnTypeRef(method, assemblyExportedTypeCache); 2190var unionTypeRef = CreateUnionTypeRef(unionAttr, $"parameter '{paramName}'", assemblyExportedTypeCache); 2207var typeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2219AtsTypeRef? callbackReturnType = null; 2230var finalTypeRef = isCallback 2251private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractCallbackSignature( 2270var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2284AtsTypeRef? returnTypeRef; 2317private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractWellKnownDelegateSignature( 2334var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2343var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2364var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2376AtsTypeRef returnTypeRef; 2661public static AtsTypeRef? CreateTypeRef(Type? type) => 2667private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2673private static AtsTypeRef? CreateReturnTypeRef(MethodInfo method, AssemblyExportedTypeCache assemblyExportedTypeCache) 2675var typeRef = CreateTypeRef(method.ReturnType, enumCollector: null, assemblyExportedTypeCache); 2694private static AtsTypeRef WithNullability(AtsTypeRef typeRef, Type declaredType, NullabilityState nullabilityState) 2723private static AtsTypeRef? CreateTypeRef( 2777var typeRef = CreateTypeRef(underlyingType, enumCollector, assemblyExportedTypeCache); 2843var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2844var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2866var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2867var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2889var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2909var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2954var elementTypeRef = CreateTypeRef(elementType, enumCollector, assemblyExportedTypeCache); 3068private static List<AtsTypeRef> CollectAllInterfaces(Type type) 3070var allInterfaces = new List<AtsTypeRef>(); 3108private static List<AtsTypeRef> CollectBaseTypeHierarchy(Type type) 3110var baseTypes = new List<AtsTypeRef>(); 3139private static AtsTypeRef CreateHandleTypeRef(Type type) 3143AtsTypeRef? baseTypeRef = null; 3390private static AtsTypeRef CreateUnionTypeRef( 3402var unionTypes = new List<AtsTypeRef>(); 3405var 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)
676private static void CollectEnumClrTypes(AtsTypeRef? typeRef, Dictionary<string, Type> enumTypes) 696foreach (var unionType in typeRef.UnionTypes) 760private static void ResolveTypeRef(AtsTypeRef? typeRef, HashSet<string> validTypes) 781foreach (var memberType in typeRef.UnionTypes) 856private static string? FindUnknownType(AtsTypeRef? typeRef) 881foreach (var memberType in typeRef.UnionTypes) 927var targetTypeRef = capability.TargetType ?? new AtsTypeRef 944private static Dictionary<string, List<AtsTypeRef>> BuildTypeCompatibilityMap( 947var typeToCompatibleTypes = new Dictionary<string, List<AtsTypeRef>>(); 957var concreteTypeRef = new AtsTypeRef 972foreach (var iface in typeInfo.ImplementedInterfaces) 978foreach (var baseType in typeInfo.BaseTypeHierarchy) 991Dictionary<string, List<AtsTypeRef>> map, 993AtsTypeRef concreteTypeRef) 1170var propTypeRef = isCallback 1187AtsTypeRef? callbackReturnType = null; 1336var typeRef = CreateTypeRef(memberType, enumCollector: null, assemblyExportedTypeCache); 1373AtsTypeRef? typeRef, 1400AtsTypeRef typeRef, 1428var propertyTypeRef = CreateTypeRef(property.PropertyType, enumCollector: null, assemblyExportedTypeCache); 1671AtsTypeRef? propertyTypeRef; 1686var keyTypeRef = CreateTypeRef(propType.GetGenericArguments().First(), enumCollector: null, assemblyExportedTypeCache); 1689var valueTypeRef = propertyUnionAttr != null 1734var getterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.ReadState); 1735var setterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.WriteState); 1738var contextTypeRef = CreateHandleTypeRef(contextType); 1851var instanceContextTypeRef = CreateHandleTypeRef(contextType); 1972var returnTypeRef = CreateReturnTypeRef(method, assemblyExportedTypeCache); 2093AtsTypeRef? extendsTypeRef = null; 2149var returnTypeRef = CreateReturnTypeRef(method, assemblyExportedTypeCache); 2190var unionTypeRef = CreateUnionTypeRef(unionAttr, $"parameter '{paramName}'", assemblyExportedTypeCache); 2207var typeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2219AtsTypeRef? callbackReturnType = null; 2230var finalTypeRef = isCallback 2251private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractCallbackSignature( 2270var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2284AtsTypeRef? returnTypeRef; 2317private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractWellKnownDelegateSignature( 2334var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2343var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2364var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2376AtsTypeRef returnTypeRef; 2661public static AtsTypeRef? CreateTypeRef(Type? type) => 2667private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2673private static AtsTypeRef? CreateReturnTypeRef(MethodInfo method, AssemblyExportedTypeCache assemblyExportedTypeCache) 2675var typeRef = CreateTypeRef(method.ReturnType, enumCollector: null, assemblyExportedTypeCache); 2694private static AtsTypeRef WithNullability(AtsTypeRef typeRef, Type declaredType, NullabilityState nullabilityState) 2723private static AtsTypeRef? CreateTypeRef( 2777var typeRef = CreateTypeRef(underlyingType, enumCollector, assemblyExportedTypeCache); 2843var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2844var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2866var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2867var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2889var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2909var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2954var elementTypeRef = CreateTypeRef(elementType, enumCollector, assemblyExportedTypeCache); 3068private static List<AtsTypeRef> CollectAllInterfaces(Type type) 3070var allInterfaces = new List<AtsTypeRef>(); 3108private static List<AtsTypeRef> CollectBaseTypeHierarchy(Type type) 3110var baseTypes = new List<AtsTypeRef>(); 3139private static AtsTypeRef CreateHandleTypeRef(Type type) 3143AtsTypeRef? baseTypeRef = null; 3390private static AtsTypeRef CreateUnionTypeRef( 3402var unionTypes = new List<AtsTypeRef>(); 3405var 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; } 316public required AtsTypeRef ReturnType { get; init; } 327public AtsTypeRef? TargetType { get; init; } 343public IReadOnlyList<AtsTypeRef> ExpandedTargetTypes { get; set; } = []; 382public AtsTypeRef? Type { get; init; } 410public AtsTypeRef? CallbackReturnType { get; init; } 436public required AtsTypeRef Type { get; init; } 469public IReadOnlyList<AtsTypeRef> ImplementedInterfaces { get; init; } = []; 476public IReadOnlyList<AtsTypeRef> BaseTypeHierarchy { get; init; } = []; 551public required AtsTypeRef Type { get; init; } 569public AtsTypeRef? CallbackReturnType { get; init; }
AtsExportedValueInfo.cs (1)
34public required AtsTypeRef Type { get; init; }