164 instantiations of AtsTypeRef
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 2883var resourceType = new AtsTypeRef 2893new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }), 2897new AtsTypeRef { TypeId = AtsConstants.Number, Category = AtsTypeCategory.Primitive, IsNullable = true })); 3015var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3016var nullableNumber = new AtsTypeRef 3022var nullableBoolean = new AtsTypeRef 3028var numberArray = new AtsTypeRef 3034var booleanArray = new AtsTypeRef 3040var booleanMatrix = new AtsTypeRef 3050Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3056CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3063ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3271var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3287Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3300Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3306CallbackReturnType = new AtsTypeRef 3362var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3363var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3368Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3373CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3380ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3402Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3589Type = new AtsTypeRef { TypeId = "KeywordProbe", Category = AtsTypeCategory.Dto } 3648new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }); 3677private static AtsTypeRef MutableStringDict() => new() 3682KeyType = new AtsTypeRef { TypeId = "string", Category = AtsTypeCategory.Primitive }, 3683ValueType = 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 (30)
AtsTypeScriptCodeGeneratorTests.cs (30)
273var targetType = new AtsTypeRef 278var stringType = new AtsTypeRef 887var nullableNumberType = new AtsTypeRef 893var nullableNumberArrayType = new AtsTypeRef 944var typeRef = new AtsTypeRef 960var stringType = new AtsTypeRef 965var listType = new AtsTypeRef 971var dictionaryType = new AtsTypeRef 987var nullableNumber = new AtsTypeRef 993var returnType = new AtsTypeRef 997KeyType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }, 998ValueType = new AtsTypeRef 1573var resourceTypeRef = new AtsTypeRef 1834new() 1847ReturnType = new AtsTypeRef 1872ReturnType = new AtsTypeRef 2831var targetType = new AtsTypeRef 2836var stringType = new AtsTypeRef 2841var voidType = new AtsTypeRef 3036new AtsTypeRef 3044new AtsTypeRef 3130var targetType = new AtsTypeRef 3145ReturnType = new AtsTypeRef 3248var targetType = new AtsTypeRef 3263Type = new AtsTypeRef 3278CallbackReturnType = new AtsTypeRef 3285ReturnType = new AtsTypeRef 3312Type = new AtsTypeRef 3321Type = new AtsTypeRef 3329ReturnType = 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 2682return new AtsTypeRef 2764return new AtsTypeRef { TypeId = primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive }; 2770return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2775return new AtsTypeRef 2780KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2781ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2788return new AtsTypeRef 2793ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2803return new AtsTypeRef 2826return new AtsTypeRef 2849return new AtsTypeRef 2871return new AtsTypeRef 2891return new AtsTypeRef 2936return new AtsTypeRef 2952return new AtsTypeRef 2964return new AtsTypeRef 2974return new AtsTypeRef 3069allInterfaces.Add(new AtsTypeRef 3136return new AtsTypeRef 3395return 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 },
314 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)
210var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 242var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[])));
Aspire.Hosting.CodeGeneration.Java (27)
AtsJavaCodeGenerator.cs (27)
868AtsTypeRef typeRef, 1426foreach (var unionType in unionTypes 1522private static List<List<AtsTypeRef>> CartesianProduct(List<List<AtsTypeRef>> lists) 1524var result = new List<List<AtsTypeRef>> { new() }; 1527var temp = new List<List<AtsTypeRef>>(); 1530foreach (var item in list) 1532var combined = new List<AtsTypeRef>(existing) { item }; 1616foreach (var unionType in unionTypes 1694AtsTypeRef unionType) 1901private string GenerateCallbackTypeSignature(IReadOnlyList<AtsCallbackParameterInfo>? callbackParameters, AtsTypeRef? callbackReturnType) 2042private string RenderJavaTransportValueConversion(AtsTypeRef? typeRef, string valueExpression, bool isOptional, int depth = 0) 2076private string RenderJavaArrayTransportValueConversion(AtsTypeRef typeRef, string valueExpression, bool allowNull, int depth) 2091private string RenderJavaDtoPropertyTransportValueConversion(AtsTypeRef? typeRef, string valueExpression, bool isOptional, int depth = 0) 2208private string RenderJavaListTransportValueConversion(AtsTypeRef typeRef, string valueExpression, bool allowNull, int depth) 2221private string MapCallbackTypeToJava(AtsTypeRef? typeRef) 2243private static bool IsListOrDictPropertyGetter(AtsTypeRef? returnType) 2255var returnType = capability.ReturnType!; 2441foreach (var expandedType in capability.ExpandedTargetTypes) 2480var exportedBaseType = handleTypeInfo.BaseTypeHierarchy 2518foreach (var targetType in targetTypes) 2561private string MapTypeRefToJava(AtsTypeRef? typeRef, bool isOptional, bool useBoxedTypes = false) 2593private string MapDtoPropertyTypeToJava(AtsTypeRef? typeRef, bool isOptional, bool useBoxedTypes = false) 2615private string MapInputTypeToJava(AtsTypeRef? typeRef, bool isOptional = false) 2679private static bool IsUnionType(AtsTypeRef? typeRef) => typeRef?.Category == AtsTypeCategory.Union; 2688private static void AddHandleTypeIfNeeded(HashSet<string> handleTypeIds, AtsTypeRef? typeRef) 2708private 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 }; 2883var resourceType = new AtsTypeRef 3015var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3016var nullableNumber = new AtsTypeRef 3022var nullableBoolean = new AtsTypeRef 3028var numberArray = new AtsTypeRef 3034var booleanArray = new AtsTypeRef 3040var booleanMatrix = new AtsTypeRef 3271var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3362var resourceType = new AtsTypeRef { TypeId = "Tests/ProbeResource", Category = AtsTypeCategory.Handle }; 3363var contextType = new AtsTypeRef { TypeId = "Tests/MutableContext", Category = AtsTypeCategory.Dto }; 3608var nullableNumbers = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(double?[]))); 3609var nullableFlags = Assert.IsType<AtsTypeRef>(AtsCapabilityScanner.CreateTypeRef(typeof(bool?[]))); 3651private static AtsContext CreateContextWithSingleDtoProperty(string propertyName, AtsTypeRef propertyType) 3677private static AtsTypeRef MutableStringDict() => new() 3686private static AtsContext CreateContextWithProbeCapabilities(AtsTypeRef resourceType, params AtsCapabilityInfo[] capabilities) 3697private 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) 985AtsTypeRef typeRef, 1523var baseType = builder.TargetType?.BaseType; 1550foreach (var i in implementedInterfaces) 1908var typeRefsByTypeId = new Dictionary<string, AtsTypeRef>(); 1915var targetTypeRef = cap.TargetType; 1943foreach (var expandedType in expandedTypes) 1972var typeRef = typeRefsByTypeId.GetValueOrDefault(typeId); 2001var typeRef = typeRefsByTypeId.GetValueOrDefault(interfaceTypeId); 2135foreach (var iface in builder.TargetType.ImplementedInterfaces) 2161private Dictionary<string, AtsTypeRef> CollectAllReferencedTypes(IReadOnlyList<AtsCapabilityInfo> capabilities) 2163var typeRefs = new Dictionary<string, AtsTypeRef>(); 2165void CollectFromTypeRef(AtsTypeRef? typeRef) 2191foreach (var unionType in typeRef.UnionTypes) 2198foreach (var iface in typeRef.ImplementedInterfaces) 2249private static string DeriveClassName(AtsTypeRef typeRef) 2426private static string GetBuilderTypeId(AtsTypeRef typeRef) 2785private 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; } 322private static string GetRpcArgumentValueExpression(string parameterName, AtsTypeRef? typeRef) 340private static string GetRpcArgumentEntry(string parameterName, AtsTypeRef? typeRef) 381private bool TryGetDtoCallbackMarshallingProperties(AtsTypeRef? typeRef, out List<AtsDtoPropertyInfo> marshallingProperties) 398private bool RequiresDtoCallbackMarshalling(AtsTypeRef? typeRef, HashSet<string>? visitedDtoTypeIds = null) 1341private 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)
273var targetType = new AtsTypeRef 278var stringType = new AtsTypeRef 514var testRedisTarget = withOptionalString.ExpandedTargetTypes.FirstOrDefault(t => 712foreach (var expandedType in cap.ExpandedTargetTypes) 776var testRedisExpanded = withConnectionStringDirect.ExpandedTargetTypes 804var testRedisExpanded = withRedisSpecific.ExpandedTargetTypes 830var containerExpanded = withBindMount.ExpandedTargetTypes 887var nullableNumberType = new AtsTypeRef 893var nullableNumberArrayType = new AtsTypeRef 944var typeRef = new AtsTypeRef 960var stringType = new AtsTypeRef 965var listType = new AtsTypeRef 971var dictionaryType = new AtsTypeRef 987var nullableNumber = new AtsTypeRef 993var returnType = new AtsTypeRef 1057foreach (var expandedType in withConnectionStringDirect.ExpandedTargetTypes) 1092var testRedisExpanded = testWithEnvironmentCallback.ExpandedTargetTypes 1573var resourceTypeRef = new AtsTypeRef 1833private static AtsTypeRef CreateResourceTypeRef<TResource>() where TResource : IResource => 2831var targetType = new AtsTypeRef 2836var stringType = new AtsTypeRef 2841var voidType = new AtsTypeRef 3130var targetType = new AtsTypeRef 3246AtsTypeRef callbackPayloadType) 3248var targetType = new AtsTypeRef
Aspire.Hosting.RemoteHost (82)
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 (64)
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 = CreateTypeRef(method.ReturnType, enumCollector: null, assemblyExportedTypeCache); 2093AtsTypeRef? extendsTypeRef = null; 2149var returnTypeRef = CreateTypeRef(method.ReturnType, enumCollector: null, 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 WithNullability(AtsTypeRef typeRef, Type declaredType, NullabilityState nullabilityState) 2702private static AtsTypeRef? CreateTypeRef( 2756var typeRef = CreateTypeRef(underlyingType, enumCollector, assemblyExportedTypeCache); 2822var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2823var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2845var keyTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2846var valueTypeRef = CreateTypeRef(genericArgs[1], enumCollector, assemblyExportedTypeCache); 2868var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2888var elementTypeRef = CreateTypeRef(genericArgs[0], enumCollector, assemblyExportedTypeCache); 2933var elementTypeRef = CreateTypeRef(elementType, enumCollector, assemblyExportedTypeCache); 3047private static List<AtsTypeRef> CollectAllInterfaces(Type type) 3049var allInterfaces = new List<AtsTypeRef>(); 3087private static List<AtsTypeRef> CollectBaseTypeHierarchy(Type type) 3089var baseTypes = new List<AtsTypeRef>(); 3118private static AtsTypeRef CreateHandleTypeRef(Type type) 3122AtsTypeRef? baseTypeRef = null; 3369private static AtsTypeRef CreateUnionTypeRef( 3381var unionTypes = new List<AtsTypeRef>(); 3384var 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; }