140 instantiations of AtsTypeRef
Aspire.Hosting.CodeGeneration.Java.Tests (44)
AtsJavaCodeGeneratorTests.cs (44)
2646new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = MutableStringDict() }); 2659new AtsTypeRef 2676var stringType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }; 2677var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2680new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }); 2723var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2724var stringType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 2725var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2726var matrixType = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }; 2731Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 2733CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2740ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 2761var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2765Type = new AtsTypeRef { TypeId = AtsConstants.CancellationToken, Category = AtsTypeCategory.Dto } 2772ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 2789var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2805Type = new AtsTypeRef 2831var resourceType = new AtsTypeRef 2841new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }), 2845new AtsTypeRef { TypeId = AtsConstants.Number, Category = AtsTypeCategory.Primitive, IsNullable = true })); 2963var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2964var nullableNumber = new AtsTypeRef 2970var nullableBoolean = new AtsTypeRef 2976var numberArray = new AtsTypeRef 2982var booleanArray = new AtsTypeRef 2988var booleanMatrix = new AtsTypeRef 2998Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3004CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3011ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3219var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3235Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3248Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3254CallbackReturnType = new AtsTypeRef 3310var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3311var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3316Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3321CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3328ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3350Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3537Type = new AtsTypeRef { TypeId = "KeywordProbe", Category = AtsTypeCategory.Dto } 3596new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }); 3625private static AtsTypeRef MutableStringDict() => new() 3630KeyType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }, 3631ValueType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }
Aspire.Hosting.CodeGeneration.Python.Tests (19)
AtsPythonCodeGeneratorTests.cs (19)
496var resourceType = new AtsTypeRef 521Type = new AtsTypeRef 552var resourceType = new AtsTypeRef 577Type = new AtsTypeRef 611var genericBaseTypeRef = new AtsTypeRef 618var genericInterfaceTypeRef = new AtsTypeRef 626var resourceType = new AtsTypeRef 651ReturnType = new AtsTypeRef 691var unionType = new AtsTypeRef 697new AtsTypeRef 703new AtsTypeRef 711new AtsTypeRef 746Type = new AtsTypeRef 750ElementType = new AtsTypeRef 760ReturnType = new AtsTypeRef 796var stringType = new AtsTypeRef 802var boolType = new AtsTypeRef 808var projectType = new AtsTypeRef 815var containerType = new AtsTypeRef
Aspire.Hosting.CodeGeneration.TypeScript.Tests (21)
AtsTypeScriptCodeGeneratorTests.cs (21)
782var nullableNumberType = new AtsTypeRef 788var nullableNumberArrayType = new AtsTypeRef 839var typeRef = new AtsTypeRef 1378var resourceTypeRef = new AtsTypeRef 1624new() 1637ReturnType = new AtsTypeRef 1660ReturnType = new AtsTypeRef 2563var targetType = new AtsTypeRef 2568var stringType = new AtsTypeRef 2573var voidType = new AtsTypeRef 2768new AtsTypeRef 2776new AtsTypeRef 2862var targetType = new AtsTypeRef 2877ReturnType = new AtsTypeRef 2980var targetType = new AtsTypeRef 2995Type = new AtsTypeRef 3010CallbackReturnType = new AtsTypeRef 3017ReturnType = new AtsTypeRef 3044Type = new AtsTypeRef 3053Type = new AtsTypeRef 3061ReturnType = new AtsTypeRef
Aspire.Hosting.RemoteHost (37)
Ats\AtsMarshaller.cs (1)
441return new AtsTypeRef
AtsCapabilityScanner.cs (34)
853var targetTypeRef = capability.TargetType ?? new AtsTypeRef 883var concreteTypeRef = new AtsTypeRef 1097? new AtsTypeRef { TypeId = "callback", ClrType = prop.PropertyType, Category = AtsTypeCategory.Callback } 1617: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1619propertyTypeRef = new AtsTypeRef 1644propertyTypeRef = new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 2150? new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback } 2207returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2211returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2219?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2220: new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2225?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2253var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2586private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2601return new AtsTypeRef 2683return new AtsTypeRef { TypeId = primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive }; 2689return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2694return new AtsTypeRef 2699KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2700ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2707return new AtsTypeRef 2712ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2722return new AtsTypeRef 2745return new AtsTypeRef 2768return new AtsTypeRef 2790return new AtsTypeRef 2810return new AtsTypeRef 2855return new AtsTypeRef 2871return new AtsTypeRef 2883return new AtsTypeRef 2893return new AtsTypeRef 2988allInterfaces.Add(new AtsTypeRef 3055return new AtsTypeRef 3314return new AtsTypeRef
AtsContextFilter.cs (2)
322targetType = new AtsTypeRef 341ReturnType = new AtsTypeRef
Aspire.Hosting.RemoteHost.Tests (19)
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 (2)
223var typeRef = new AtsTypeRef 953var typeRef = new AtsTypeRef { TypeId = "test/SelfReferencingDto", Category = AtsTypeCategory.Dto };
301 references to AtsTypeRef
Aspire.Hosting.CodeGeneration.Go (21)
AtsGoCodeGenerator.cs (21)
181foreach (var expanded in capability.ExpandedTargetTypes) 309private static void CollectHandleTypeIds(HashSet<string> set, AtsTypeRef? typeRef) 338foreach (var u in typeRef.UnionTypes) 428: (IReadOnlyList<AtsTypeRef>)Array.Empty<AtsTypeRef>(); 430foreach (var targetType in targetTypes) 683AtsTypeRef typeRef, 857private static List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> 860var result = new List<(string, string, AtsTypeRef, string, string?)>(); 895List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 950List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 1176var returnType = capability.ReturnType!; 1216List<(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description)> listDictGetters) 1276var returnType = capability.ReturnType!; 1348var returnType = capability.ReturnType!; 1617(string Field, string MethodName, AtsTypeRef ReturnType, string CapabilityId, string? Description) g) 1635private (string Wrapper, string TypeArgs) ListDictTypeArgs(AtsTypeRef returnType) 1883private string GetUnionAllowedTypes(AtsTypeRef typeRef) 2091private string MapTypeRefToGo(AtsTypeRef? typeRef, bool isOptional) 2129private string MapDtoPropertyTypeToGo(AtsTypeRef? typeRef, bool isOptional) 2163private static bool ShouldApplyNullableType(AtsTypeRef typeRef) =>
Aspire.Hosting.CodeGeneration.Go.Tests (4)
AtsGoCodeGeneratorTests.cs (4)
48var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 80var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[])));
Aspire.Hosting.CodeGeneration.Java (27)
AtsJavaCodeGenerator.cs (27)
853AtsTypeRef typeRef, 1407foreach (var unionType in unionTypes 1503private static List<List<AtsTypeRef>> CartesianProduct(List<List<AtsTypeRef>> lists) 1505var result = new List<List<AtsTypeRef>> { new() }; 1508var temp = new List<List<AtsTypeRef>>(); 1511foreach (var item in list) 1513var combined = new List<AtsTypeRef>(existing) { item }; 1597foreach (var unionType in unionTypes 1675AtsTypeRef unionType) 1882private string GenerateCallbackTypeSignature(IReadOnlyList<AtsCallbackParameterInfo>? callbackParameters, AtsTypeRef? callbackReturnType) 2023private string RenderJavaTransportValueConversion(AtsTypeRef? typeRef, string valueExpression, bool isOptional, int depth = 0) 2057private string RenderJavaArrayTransportValueConversion(AtsTypeRef typeRef, string valueExpression, bool allowNull, int depth) 2072private string RenderJavaDtoPropertyTransportValueConversion(AtsTypeRef? typeRef, string valueExpression, bool isOptional, int depth = 0) 2189private string RenderJavaListTransportValueConversion(AtsTypeRef typeRef, string valueExpression, bool allowNull, int depth) 2202private string MapCallbackTypeToJava(AtsTypeRef? typeRef) 2224private static bool IsListOrDictPropertyGetter(AtsTypeRef? returnType) 2236var returnType = capability.ReturnType!; 2422foreach (var expandedType in capability.ExpandedTargetTypes) 2461var exportedBaseType = handleTypeInfo.BaseTypeHierarchy 2499foreach (var targetType in targetTypes) 2542private string MapTypeRefToJava(AtsTypeRef? typeRef, bool isOptional, bool useBoxedTypes = false) 2574private string MapDtoPropertyTypeToJava(AtsTypeRef? typeRef, bool isOptional, bool useBoxedTypes = false) 2596private string MapInputTypeToJava(AtsTypeRef? typeRef, bool isOptional = false) 2660private static bool IsUnionType(AtsTypeRef? typeRef) => typeRef?.Category == AtsTypeCategory.Union; 2669private static void AddHandleTypeIfNeeded(HashSet<string> handleTypeIds, AtsTypeRef? typeRef) 2689private static void AddListOrDictTypeIfNeeded(Dictionary<string, bool> typeIds, AtsTypeRef? typeRef)
Aspire.Hosting.CodeGeneration.Java.Tests (27)
AtsJavaCodeGeneratorTests.cs (27)
2676var stringType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }; 2677var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2723var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2724var stringType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 2725var innerArray = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = stringType }; 2726var matrixType = new AtsTypeRef { TypeId = "array", Category = AtsTypeCategory.Array, ElementType = innerArray }; 2761var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2789var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2831var resourceType = new AtsTypeRef 2963var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 2964var nullableNumber = new AtsTypeRef 2970var nullableBoolean = new AtsTypeRef 2976var numberArray = new AtsTypeRef 2982var booleanArray = new AtsTypeRef 2988var booleanMatrix = new AtsTypeRef 3219var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3310var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3311var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3556var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 3557var nullableFlags = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(bool?[]))); 3599private static AtsContext CreateContextWithSingleDtoProperty(string propertyName, AtsTypeRef propertyType) 3625private static AtsTypeRef MutableStringDict() => new() 3634private static AtsContext CreateContextWithProbeCapabilities(AtsTypeRef resourceType, params AtsCapabilityInfo[] capabilities) 3645private 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) => 514private static bool AllowsNoneAtTopLevel(AtsTypeRef? typeRef) 577private string MapUnionTypeToPython(AtsTypeRef typeRef) 591private string MapDtoPropertyTypeToPython(AtsTypeRef? typeRef) 607private string MapDtoUnionTypeToPython(AtsTypeRef typeRef) 987AtsTypeRef typeRef, 1525var baseType = builder.TargetType?.BaseType; 1552foreach (var i in implementedInterfaces) 1910var typeRefsByTypeId = new Dictionary<string, AtsTypeRef>(); 1917var targetTypeRef = cap.TargetType; 1945foreach (var expandedType in expandedTypes) 1974var typeRef = typeRefsByTypeId.GetValueOrDefault(typeId); 2003var typeRef = typeRefsByTypeId.GetValueOrDefault(interfaceTypeId); 2137foreach (var iface in builder.TargetType.ImplementedInterfaces) 2163private Dictionary<string, AtsTypeRef> CollectAllReferencedTypes(IReadOnlyList<AtsCapabilityInfo> capabilities) 2165var typeRefs = new Dictionary<string, AtsTypeRef>(); 2167void CollectFromTypeRef(AtsTypeRef? typeRef) 2193foreach (var unionType in typeRef.UnionTypes) 2200foreach (var iface in typeRef.ImplementedInterfaces) 2251private static string DeriveClassName(AtsTypeRef typeRef) 2428private static string GetBuilderTypeId(AtsTypeRef typeRef) 2787private string GenerateCallbackTypeSignature(IReadOnlyList<AtsCallbackParameterInfo>? parameters, AtsTypeRef? returnType)
Aspire.Hosting.CodeGeneration.Python.Tests (10)
AtsPythonCodeGeneratorTests.cs (10)
496var resourceType = new AtsTypeRef 552var resourceType = new AtsTypeRef 611var genericBaseTypeRef = new AtsTypeRef 618var genericInterfaceTypeRef = new AtsTypeRef 626var resourceType = new AtsTypeRef 691var unionType = new AtsTypeRef 796var stringType = new AtsTypeRef 802var boolType = new AtsTypeRef 808var projectType = new AtsTypeRef 815var containerType = new AtsTypeRef
Aspire.Hosting.CodeGeneration.Rust (16)
AtsRustCodeGenerator.cs (16)
365AtsTypeRef? typeRef, 600var returnTypeRef = capability.ReturnType; 647private static bool IsListOrDictPropertyGetter(AtsTypeRef? returnType) 661var returnType = capability.ReturnType!; 805foreach (var expandedType in capability.ExpandedTargetTypes) 856foreach (var targetType in targetTypes) 898private string MapTypeRefToRust(AtsTypeRef? typeRef, bool isOptional) 936private string MapTypeRefToRustForDto(AtsTypeRef? typeRef, bool isOptional) 976private string MapTypeRefToRustForExportedValue(AtsTypeRef? typeRef) 1027private string MapParameterTypeToRust(AtsTypeRef? typeRef, bool isOptional) 1059private static bool ShouldApplyNullableType(AtsTypeRef typeRef) => 1064private static bool IsHandleType(AtsTypeRef? typeRef) => 1069private static bool IsCollectionOfHandleTypes(AtsTypeRef? typeRef) => 1075private static bool IsAspireListOrDictParam(AtsTypeRef? typeRef) => 1087private static void AddHandleTypeIfNeeded(HashSet<string> handleTypeIds, AtsTypeRef? typeRef) 1107private static void AddListOrDictTypeIfNeeded(HashSet<string> typeIds, AtsTypeRef? typeRef)
Aspire.Hosting.CodeGeneration.Rust.Tests (4)
AtsRustCodeGeneratorTests.cs (4)
48var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 80var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[])));
Aspire.Hosting.CodeGeneration.TypeScript (44)
AtsTypeScriptCodeGenerator.cs (6)
21public AtsTypeRef? TargetType { get; init; } 311private static string GetRpcArgumentValueExpression(string parameterName, AtsTypeRef? typeRef) 329private static string GetRpcArgumentEntry(string parameterName, AtsTypeRef? typeRef) 370private bool TryGetDtoCallbackMarshallingProperties(AtsTypeRef? typeRef, out List<AtsDtoPropertyInfo> marshallingProperties) 387private bool RequiresDtoCallbackMarshalling(AtsTypeRef? typeRef, HashSet<string>? visitedDtoTypeIds = null) 1329private 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) 1569private readonly Dictionary<string, AtsTypeRef> _typeRefsById = new(StringComparer.Ordinal); 1643internal static bool IsHandleType(AtsTypeRef? typeRef) => 1651internal string MapTypeRefToTypeScript(AtsTypeRef? typeRef) 1704internal static string ApplyNullableType(AtsTypeRef typeRef, string mappedType) 1716internal string MapDtoPropertyTypeToTypeScript(AtsTypeRef? typeRef) 1732private static string FormatArrayType(AtsTypeRef? elementType, string mappedElementType) 1740internal string MapDtoUnionTypeToTypeScript(AtsTypeRef typeRef) 1793internal string MapUnionTypeToTypeScript(AtsTypeRef typeRef) 1853internal string MapInputTypeToTypeScript(AtsTypeRef? typeRef) 1890internal string MapInputUnionTypeToTypeScript(AtsTypeRef typeRef) 1902foreach (var memberRef in typeRef.UnionTypes) 1949internal string? TryMapInterfaceInputTypeToTypeScript(AtsTypeRef typeRef) 1953foreach (var candidateTypeRef in _typeRefsById.Values) 1975internal static bool IsAssignableToInterface(AtsTypeRef candidateTypeRef, string interfaceTypeId) 1982foreach (var implementedInterface in candidateTypeRef.ImplementedInterfaces) 1998internal static bool IsInterfaceHandleType(AtsTypeRef? typeRef) 2007internal static bool IsCancellationTokenType(AtsTypeRef? typeRef) => typeRef?.TypeId == AtsConstants.CancellationToken; 2457internal string GetGetterOnlyPropertyReturnType(AtsTypeRef? typeRef) 2480internal bool TryGetPromiseWrapperType(AtsTypeRef? typeRef, out string promiseInterfaceName, out string promiseImplementationClassName) 2495internal string GetGetterOnlyPropertyMethodReturnType(AtsTypeRef? typeRef) 2522internal bool IsWidenedHandleType(AtsTypeRef? typeRef) 2619internal static bool IsDictionaryType(AtsTypeRef? typeRef) 2628internal static bool IsListType(AtsTypeRef? typeRef) 2647var typeRefsByTypeId = new Dictionary<string, AtsTypeRef>(); 2654var targetTypeRef = cap.TargetType; 2680foreach (var expandedType in expandedTypes) 2726var typeRef = typeRefsByTypeId.GetValueOrDefault(typeId); 2760var typeRef = typeRefsByTypeId.GetValueOrDefault(interfaceTypeId); 2908private static bool IsTypeInHierarchy(AtsTypeRef typeRef, string typeId) 2927internal static Dictionary<string, AtsTypeRef> CollectAllReferencedTypes(IReadOnlyList<AtsCapabilityInfo> capabilities) 2929var typeRefs = new Dictionary<string, AtsTypeRef>(); 2931void CollectFromTypeRef(AtsTypeRef? typeRef) 2949foreach (var unionType in typeRef.UnionTypes) 3073internal string? GetPromiseWrapperForReturnType(AtsTypeRef? returnType) 3091internal string GenerateCallbackTypeSignature(IReadOnlyList<AtsCallbackParameterInfo>? callbackParameters, AtsTypeRef? callbackReturnType)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (18)
AtsTypeScriptCodeGeneratorTests.cs (18)
409var testRedisTarget = withOptionalString.ExpandedTargetTypes.FirstOrDefault(t => 607foreach (var expandedType in cap.ExpandedTargetTypes) 671var testRedisExpanded = withConnectionStringDirect.ExpandedTargetTypes 699var testRedisExpanded = withRedisSpecific.ExpandedTargetTypes 725var containerExpanded = withBindMount.ExpandedTargetTypes 782var nullableNumberType = new AtsTypeRef 788var nullableNumberArrayType = new AtsTypeRef 839var typeRef = new AtsTypeRef 896foreach (var expandedType in withConnectionStringDirect.ExpandedTargetTypes) 931var testRedisExpanded = testWithEnvironmentCallback.ExpandedTargetTypes 1378var resourceTypeRef = new AtsTypeRef 1623private static AtsTypeRef CreateResourceTypeRef<TResource>() where TResource : IResource => 2563var targetType = new AtsTypeRef 2568var stringType = new AtsTypeRef 2573var voidType = new AtsTypeRef 2862var targetType = new AtsTypeRef 2978AtsTypeRef callbackPayloadType) 2980var targetType = new AtsTypeRef
Aspire.Hosting.RemoteHost (79)
Ats\AtsMarshaller.cs (4)
137public JsonNode? MarshalToJson(object? value, AtsTypeRef typeRef) 401private JsonNode? SerializeArray(object value, AtsTypeRef? elementType) 418private AtsTypeRef? CreateElementTypeRef(Type declaredType) 439private AtsTypeRef CreateTypeRef(Type type)
AtsCapabilityScanner.cs (64)
602private static void CollectEnumClrTypes(AtsTypeRef? typeRef, Dictionary<string, Type> enumTypes) 622foreach (var unionType in typeRef.UnionTypes) 686private static void ResolveTypeRef(AtsTypeRef? typeRef, HashSet<string> validTypes) 707foreach (var memberType in typeRef.UnionTypes) 782private static string? FindUnknownType(AtsTypeRef? typeRef) 807foreach (var memberType in typeRef.UnionTypes) 853var targetTypeRef = capability.TargetType ?? new AtsTypeRef 870private static Dictionary<string, List<AtsTypeRef>> BuildTypeCompatibilityMap( 873var typeToCompatibleTypes = new Dictionary<string, List<AtsTypeRef>>(); 883var concreteTypeRef = new AtsTypeRef 898foreach (var iface in typeInfo.ImplementedInterfaces) 904foreach (var baseType in typeInfo.BaseTypeHierarchy) 917Dictionary<string, List<AtsTypeRef>> map, 919AtsTypeRef concreteTypeRef) 1096var propTypeRef = isCallback 1113AtsTypeRef? callbackReturnType = null; 1262var typeRef = CreateTypeRef(memberType, enumCollector: null, assemblyExportedTypeCache); 1299AtsTypeRef? typeRef, 1326AtsTypeRef typeRef, 1354var propertyTypeRef = CreateTypeRef(property.PropertyType, enumCollector: null, assemblyExportedTypeCache); 1597AtsTypeRef? propertyTypeRef; 1612var keyTypeRef = CreateTypeRef(propType.GetGenericArguments().First(), enumCollector: null, assemblyExportedTypeCache); 1615var valueTypeRef = propertyUnionAttr != null 1660var getterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.ReadState); 1661var setterTypeRef = WithNullability(propertyTypeRef!, propType, propertyNullability.WriteState); 1664var contextTypeRef = CreateHandleTypeRef(contextType); 1774var instanceContextTypeRef = CreateHandleTypeRef(contextType); 1895var returnTypeRef = CreateTypeRef(method.ReturnType, enumCollector: null, assemblyExportedTypeCache); 2013AtsTypeRef? extendsTypeRef = null; 2069var returnTypeRef = CreateTypeRef(method.ReturnType, enumCollector: null, assemblyExportedTypeCache); 2109var unionTypeRef = CreateUnionTypeRef(unionAttr, $"parameter '{paramName}'", assemblyExportedTypeCache); 2126var typeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2138AtsTypeRef? callbackReturnType = null; 2149var finalTypeRef = isCallback 2170private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractCallbackSignature( 2189var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2203AtsTypeRef? returnTypeRef; 2236private static (IReadOnlyList<AtsCallbackParameterInfo>? Parameters, AtsTypeRef? ReturnType) ExtractWellKnownDelegateSignature( 2253var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2262var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2283var paramTypeRef = CreateTypeRef(paramType, enumCollector: null, assemblyExportedTypeCache); 2295AtsTypeRef returnTypeRef; 2580public static AtsTypeRef? CreateTypeRef(Type? type) => 2586private static AtsTypeRef CreateVoidTypeRef() => new AtsTypeRef 2592private static AtsTypeRef WithNullability(AtsTypeRef typeRef, Type declaredType, NullabilityState nullabilityState) 2621private static AtsTypeRef? CreateTypeRef( 2675var typeRef = CreateTypeRef(underlyingType, enumCollector, assemblyExportedTypeCache); 2741var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2742var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2764var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2765var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2787var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2807var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2852var elementTypeRef = CreateTypeRef(elementType, enumCollector, assemblyExportedTypeCache); 2966private static List<AtsTypeRef> CollectAllInterfaces(Type type) 2968var allInterfaces = new List<AtsTypeRef>(); 3006private static List<AtsTypeRef> CollectBaseTypeHierarchy(Type type) 3008var baseTypes = new List<AtsTypeRef>(); 3037private static AtsTypeRef CreateHandleTypeRef(Type type) 3041AtsTypeRef? baseTypeRef = null; 3288private static AtsTypeRef CreateUnionTypeRef( 3300var unionTypes = new List<AtsTypeRef>(); 3303var 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; 360var referencedHandleTypes = new Dictionary<string, AtsTypeRef>(StringComparer.Ordinal); 386void CollectHandleTypes(AtsTypeRef? typeRef) 403foreach (var unionType in unionTypes) 412AtsTypeRef? typeRef, 446foreach (var unionType in typeRef.UnionTypes) 462foreach (var implementedInterface in handleType.ImplementedInterfaces) 467foreach (var baseType in handleType.BaseTypeHierarchy)
CodeGeneration\CodeGenerationService.cs (1)
139private static TypeRefResponse MapTypeRef(AtsTypeRef t) => new()
Aspire.Hosting.RemoteHost.Tests (5)
AtsCapabilityScannerTests.cs (3)
158var itemsType = Assert.IsType<AtsTypeRef>(itemsParameter.Type); 173var typeRef = AtsCapabilityScanner.CreateTypeRef(arrayType);
AtsMarshallerTests.cs (2)
223var typeRef = new AtsTypeRef 953var 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; } 311public required AtsTypeRef ReturnType { get; init; } 322public AtsTypeRef? TargetType { get; init; } 338public IReadOnlyList<AtsTypeRef> ExpandedTargetTypes { get; set; } = []; 377public AtsTypeRef? Type { get; init; } 405public AtsTypeRef? CallbackReturnType { get; init; } 431public required AtsTypeRef Type { get; init; } 464public IReadOnlyList<AtsTypeRef> ImplementedInterfaces { get; init; } = []; 471public IReadOnlyList<AtsTypeRef> BaseTypeHierarchy { get; init; } = []; 546public required AtsTypeRef Type { get; init; } 564public AtsTypeRef? CallbackReturnType { get; init; }
AtsExportedValueInfo.cs (1)
34public required AtsTypeRef Type { get; init; }