223 writes to TypeId
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 }; 618TypeId = AtsConstants.ArrayTypeId(element.TypeId), 626TypeId = AtsConstants.ListTypeId(element.TypeId), 633TypeId = AtsConstants.DictTypeId(key.TypeId, value.TypeId), 642TypeId = string.Join("|", members.Select(member => member.TypeId)), 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() }); 2713TypeId = "list", 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 }; 2859TypeId = AtsConstants.Number, 2887TypeId = "Tests/ProbeResource", 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 }; 3028TypeId = AtsConstants.Number, 3034TypeId = AtsConstants.Boolean, 3040TypeId = "numberArray", 3046TypeId = "booleanArray", 3052TypeId = "booleanMatrix", 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 }, 3352TypeId = AtsConstants.Void, 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 }); 3723TypeId = "dict", 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)
392TypeId = context.DtoTypes.Single(t => t.Name == "TerminalOptions").TypeId, 868TypeId = "Tests/KeywordResource", 893TypeId = AtsConstants.String, 924TypeId = "Tests/AcronymResource", 949TypeId = AtsConstants.String, 983TypeId = genericBaseType.AssemblyQualifiedName!, 990TypeId = genericInterfaceType.AssemblyQualifiedName!, 998TypeId = "Tests/GenericResource", 1023TypeId = AtsConstants.Void, 1063TypeId = "Tests/NullableUnion", 1069TypeId = "Tests/NestedNullableUnion", 1075TypeId = AtsConstants.Number, 1083TypeId = AtsConstants.String, 1118TypeId = "Tests/NullableItems", 1122TypeId = AtsConstants.Number, 1132TypeId = AtsConstants.Void, 1168TypeId = AtsConstants.String, 1174TypeId = AtsConstants.Boolean, 1180TypeId = "Tests/CollidingAlphaResource", 1187TypeId = "Tests/CollidingBetaResource",
Aspire.Hosting.CodeGeneration.TypeScript.Tests (30)
AtsTypeScriptCodeGeneratorTests.cs (30)
283TypeId = $"{ApiExportPackageName}/PropertyContext", 288TypeId = AtsConstants.String, 951TypeId = AtsConstants.Number, 957TypeId = $"{AtsConstants.Number}[]", 1008TypeId = "test/EmptyUnion", 1024TypeId = "string", 1029TypeId = "list", 1035TypeId = "dictionary", 1051TypeId = AtsConstants.Number, 1057TypeId = "dictionary", 1059KeyType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }, 1062TypeId = "list", 1734TypeId = $"{resourceType.Assembly.GetName().Name}/{resourceType.FullName}", 1995TypeId = GetAtsTypeId(typeof(TResource)), 2008TypeId = AtsConstants.Void, 2033TypeId = AtsConstants.Void, 3016TypeId = $"{ApiExportPackageName}/PromiseContext", 3021TypeId = AtsConstants.String, 3026TypeId = AtsConstants.Void, 3221TypeId = $"{eventHubsPackage}/AzureEventHubsEmulatorResource", 3229TypeId = $"{serviceBusPackage}/AzureServiceBusEmulatorResource", 3315TypeId = targetTypeId, 3330TypeId = AtsConstants.Void, 3433TypeId = $"Aspire.Hosting/{targetTypeName}", 3448TypeId = "callback", 3463TypeId = AtsConstants.Void, 3470TypeId = AtsConstants.Void, 3497TypeId = AtsConstants.String, 3506TypeId = AtsConstants.Number, 3514TypeId = AtsConstants.Void,
Aspire.Hosting.Native.CodeGeneration (34)
src\Aspire.Hosting.RemoteHost\AtsCapabilityScanner.cs (34)
929TypeId = originalTarget, 959TypeId = typeInfo.AtsTypeId, 1171? new AtsTypeRef { TypeId = "callback", ClrType = prop.PropertyType, Category = AtsTypeCategory.Callback } 1691: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1695TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 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 }; 2669TypeId = AtsConstants.Void, 2705TypeId = typeRef.TypeId, 2785return new AtsTypeRef { TypeId = primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive }; 2791return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2798TypeId = AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any), 2801KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2802ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2811TypeId = AtsConstants.ListTypeId(AtsConstants.Any), 2814ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2826TypeId = AtsConstants.EnumTypeId(type.FullName ?? type.Name), 2849TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2872TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2894TypeId = AtsConstants.ListTypeId(elementTypeRef.TypeId), 2914TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 2959TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 2975TypeId = AtsTypeMapping.DeriveTypeId(type), 2987TypeId = AtsTypeMapping.DeriveTypeId(type), 2997TypeId = AtsTypeMapping.DeriveTypeId(type), 3092TypeId = ifaceTypeId, 3159TypeId = typeId, 3418TypeId = string.Join("|", unionTypes.Select(u => u.TypeId)),
Aspire.Hosting.RemoteHost (39)
Ats\AtsMarshaller.cs (1)
426TypeId = AtsTypeMapping.DeriveTypeId(type),
Ats\ExternalCapabilityRegistry.cs (2)
796: new AtsTypeRef { TypeId = "unknown", Category = AtsTypeCategory.Unknown } 808TypeId = typeRef.TypeId,
AtsCapabilityScanner.cs (34)
929TypeId = originalTarget, 959TypeId = typeInfo.AtsTypeId, 1171? new AtsTypeRef { TypeId = "callback", ClrType = prop.PropertyType, Category = AtsTypeCategory.Callback } 1691: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1695TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 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 }; 2669TypeId = AtsConstants.Void, 2705TypeId = typeRef.TypeId, 2785return new AtsTypeRef { TypeId = primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive }; 2791return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2798TypeId = AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any), 2801KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2802ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2811TypeId = AtsConstants.ListTypeId(AtsConstants.Any), 2814ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2826TypeId = AtsConstants.EnumTypeId(type.FullName ?? type.Name), 2849TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2872TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2894TypeId = AtsConstants.ListTypeId(elementTypeRef.TypeId), 2914TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 2959TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 2975TypeId = AtsTypeMapping.DeriveTypeId(type), 2987TypeId = AtsTypeMapping.DeriveTypeId(type), 2997TypeId = AtsTypeMapping.DeriveTypeId(type), 3092TypeId = ifaceTypeId, 3159TypeId = typeId, 3418TypeId = string.Join("|", unionTypes.Select(u => u.TypeId)),
AtsContextFilter.cs (2)
324TypeId = targetTypeId, 344TypeId = AtsConstants.Void,
Aspire.Hosting.RemoteHost.Tests (32)
AtsContextFilterTests.cs (17)
191TypeId = "Aspire.TypeSystem/AtsContext", 198TypeId = "Aspire.Hosting/Aspire.Hosting.DistributedApplication", 204TypeId = referencedHandleType.AtsTypeId, 276TypeId = foreignEnum.TypeId, 285Type = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 294TypeId = foreignCallbackEnum.TypeId, 434TypeId = AtsConstants.EnumTypeId(typeof(TestMode).FullName!), 487TypeId = exportedValueOnlyEnumType.TypeId, 507TypeId = selectedHandleType.AtsTypeId, 517TypeId = referencedCoreDtoType.TypeId, 527TypeId = referencedCoreEnumType.TypeId, 535TypeId = referencedCoreHandleType.AtsTypeId, 543TypeId = selectedHandleType.AtsTypeId, 560TypeId = unrelatedCoreHandleType.AtsTypeId, 578TypeId = "System/String", 591TypeId = exportedValueOnlyDtoType.TypeId, 604TypeId = "System/String",
AtsMarshallerTests.cs (12)
171TypeId = "string|number|boolean", 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 } 194TypeId = "string|resource", 198new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 199new AtsTypeRef { TypeId = "test/IResource", ClrType = typeof(IResource), Category = AtsTypeCategory.Handle } 216TypeId = "string|boolean", 220new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 221new AtsTypeRef { TypeId = AtsConstants.Boolean, ClrType = typeof(bool), Category = AtsTypeCategory.Primitive } 293TypeId = AtsConstants.CancellationToken, 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 },
477 references to TypeId
aspire-managed (6)
AppHostServerV2CodeGeneration.cs (2)
116handles.TryAdd(type.TypeId, new AtsTypeInfo { AtsTypeId = type.TypeId });
src\Shared\NativeProviderContractReader.cs (4)
43capability.Parameters is null || capability.ReturnType is null || string.IsNullOrWhiteSpace(capability.ReturnType.TypeId)) 50string.IsNullOrWhiteSpace(parameter.Type.TypeId)) 55string.IsNullOrWhiteSpace(parameter.CallbackReturnType.TypeId) || 56parameter.CallbackParameters.Any(value => value is null || value.Type is null || string.IsNullOrWhiteSpace(value.Type.TypeId))))
Aspire.Hosting.CodeGeneration.Go (42)
AtsGoCodeGenerator.ApiProjection.cs (6)
641.Select(implemented => _interfaceNames.GetValueOrDefault(implemented.TypeId)) 723var hasReturn = returnType is not null && returnType.TypeId != AtsConstants.Void; 730? new GoApiOptions { TypeName = MapDtoType(directOptionsParameter.Type!.TypeId), IsDirect = true } 746ReturnsReceiver = returnsHandle && IsSameType(returnType!.TypeId, capability, typeId) 1118_typeOwners.TryAdd(typeRef.TypeId, GetOwningAssemblyName(typeRef.TypeId, clrType.Assembly.GetName().Name));
AtsGoCodeGenerator.cs (36)
220if (!string.IsNullOrEmpty(expanded.TypeId)) 222expansionTargetIds.Add(expanded.TypeId); 384.Select(baseType => baseType.TypeId) 447if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId 448|| IsCancellationTokenTypeId(typeRef.TypeId)) 454set.Add(typeRef.TypeId); 564if (string.IsNullOrEmpty(targetType.TypeId)) 570if (!_implNames.ContainsKey(targetType.TypeId)) 574if (!result.TryGetValue(targetType.TypeId, out var list)) 577result[targetType.TypeId] = list; 689? directOptionsParam.Documentation?.Summary ?? $"Optional parameters; see {RenderTypeLink(MapDtoType(directOptionsParam.Type!.TypeId))}." 694var returnsValue = capability.ReturnType is not null && capability.ReturnType.TypeId != AtsConstants.Void; 988AtsTypeCategory.Enum => $"{MapEnumType(typeRef.TypeId)}({RenderGoJsonValue(value)})", 989AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoInfo) 1004? MapPrimitiveType(typeRef.TypeId) 1005: MapEnumType(typeRef.TypeId); 1533sb.Append(MapDtoType(directOptionsParam.Type!.TypeId)); 1579&& p.CallbackReturnType.TypeId != AtsConstants.Void; 1596var hasReturn = capability.ReturnType is not null && capability.ReturnType.TypeId != AtsConstants.Void; 1613if (IsSameType(returnType.TypeId, capability, currentTypeId)) 1701var isFluent = IsSameType(returnType.TypeId, capability, currentTypeId); 1715var childImplName = returnType.TypeId is not null && _implNames.TryGetValue(returnType.TypeId, out var implTarget) 1890var dtoType = MapDtoType(directOptionsParam.Type!.TypeId); 1983&& p.CallbackReturnType.TypeId != AtsConstants.Void; 2048&& _implNames.ContainsKey(type.TypeId)) 2050return $"callbackHandleArg({clientExpression}, args, {index}, new{_interfaceNames[type.TypeId]}FromHandle)"; 2387var hasReturn = capability.ReturnType is not null && capability.ReturnType.TypeId != AtsConstants.Void; 2601if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2611AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId), 2612AtsTypeCategory.Enum => MapEnumType(typeRef.TypeId), 2613AtsTypeCategory.Handle => MapHandleType(typeRef.TypeId, asInput), 2614AtsTypeCategory.Dto => "*" + MapDtoType(typeRef.TypeId), 2642if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2676&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 2727IsCancellationTokenTypeId(parameter.Type?.TypeId);
Aspire.Hosting.CodeGeneration.Go.Tests (10)
AtsGoCodeGeneratorTests.cs (2)
1327Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string"); 1445.Any(i => i.TypeId.Contains("IResourceWithEnvironment"));
AtsGoDerivedBuilderTests.cs (6)
618TypeId = AtsConstants.ArrayTypeId(element.TypeId), 626TypeId = AtsConstants.ListTypeId(element.TypeId), 633TypeId = AtsConstants.DictTypeId(key.TypeId, value.TypeId), 642TypeId = string.Join("|", members.Select(member => member.TypeId)), 675TargetTypeId = target.TypeId,
GoDocCommentTests.cs (1)
512ReturnsBuilder = returnType.TypeId == ResourceTypeId,
GoGeneratorEscapingTests.cs (1)
247ReturnsBuilder = returnType.TypeId == ResourceTypeId,
Aspire.Hosting.CodeGeneration.Java (39)
AtsJavaCodeGenerator.cs (39)
881AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoInfo) 1014if (!string.Equals(left.Type?.TypeId, right.Type?.TypeId, StringComparison.Ordinal)) 1038if (!string.Equals(leftCallbackParameters[i].Type.TypeId, rightCallbackParameters[i].Type.TypeId, StringComparison.Ordinal)) 1044return string.Equals(left.CallbackReturnType?.TypeId, right.CallbackReturnType?.TypeId, StringComparison.Ordinal); 1886var returnsDifferentBuilder = capability.ReturnType?.TypeId is { } returnTypeId && 1891? new(MapHandleType(capability.ReturnType!.TypeId!), HasReturn: true, ReturnsCurrentBuilder: false) 1895var hasReturn = capability.ReturnType?.TypeId != AtsConstants.Void; 1910var hasReturnType = callbackReturnType != null && callbackReturnType.TypeId != AtsConstants.Void; 1944var hasReturnType = callbackParam.CallbackReturnType != null && callbackParam.CallbackReturnType.TypeId != AtsConstants.Void; 2000var hasReturnType = property.CallbackReturnType != null && property.CallbackReturnType.TypeId != AtsConstants.Void; 2030if (callbackParameter.Type?.TypeId == AtsConstants.CancellationToken) 2050if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2055if (IsCancellationTokenTypeId(typeRef.TypeId)) 2063AtsTypeCategory.Primitive => RenderJavaPrimitiveTransportValueConversion(typeRef.TypeId, valueExpression, allowNull), 2064AtsTypeCategory.Enum => RenderJavaEnumTransportValueConversion(typeRef.TypeId, valueExpression, allowNull), 2065AtsTypeCategory.Dto => RenderJavaDtoTransportValueConversion(typeRef.TypeId, valueExpression, allowNull), 2229if (typeRef.TypeId == AtsConstants.CancellationToken) 2482.FirstOrDefault(baseType => !string.Equals(baseType.TypeId, typeId, StringComparison.Ordinal) 2483&& _classNames.ContainsKey(baseType.TypeId)); 2487baseClassName = _classNames[exportedBaseType.TypeId]; 2521if (targetType.TypeId is null) 2526if (!result.TryGetValue(targetType.TypeId, out var list)) 2529result[targetType.TypeId] = list; 2569if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2576AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId, isOptional || useBoxedTypes), 2577AtsTypeCategory.Enum => MapEnumType(typeRef.TypeId), 2578AtsTypeCategory.Handle => MapHandleType(typeRef.TypeId), 2579AtsTypeCategory.Dto => MapDtoType(typeRef.TypeId), 2601if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2623if (IsCancellationTokenTypeId(typeRef.TypeId)) 2683IsCancellationTokenTypeId(parameter.Type?.TypeId); 2697if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId 2698|| IsCancellationTokenTypeId(typeRef.TypeId)) 2705handleTypeIds.Add(typeRef.TypeId); 2720typeIds[typeRef.TypeId] = false; // false = List 2727typeIds[typeRef.TypeId] = true; // true = Dict
Aspire.Hosting.CodeGeneration.Java.Tests (13)
AtsJavaCodeGeneratorTests.cs (13)
184Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string"); 326.Any(i => i.TypeId.Contains("IResourceWithEnvironment")); 2793TargetTypeId = resourceType.TypeId, 2825TargetTypeId = resourceType.TypeId, 2867TargetTypeId = resourceType.TypeId, 3074TargetTypeId = resourceType.TypeId, 3088HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.TypeId! }], 3325TypeId = contextType.TypeId!, 3425TargetTypeId = resourceType.TypeId, 3434HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.TypeId! }], 3440TypeId = contextType.TypeId!, 3735HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.TypeId! }], 3749TargetTypeId = resourceType.TypeId,
Aspire.Hosting.CodeGeneration.Python (53)
AtsPythonCodeGenerator.cs (53)
173if (capabilityTargetType.TypeId == builderTargetType.TypeId) 183if (capabilityTargetType.TypeId == currentBase.TypeId) 191if (currentBase.ImplementedInterfaces.Any(i => i.TypeId == capabilityTargetType.TypeId)) 215if (_wrapperClassNames.TryGetValue(typeRef.TypeId, out var wrapperClassName)) 222AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId), 223AtsTypeCategory.Enum => MapEnumType(typeRef.TypeId), 224AtsTypeCategory.Handle => GetWrapperOrHandleName(typeRef.TypeId), 225AtsTypeCategory.Dto => GetDtoClassName(typeRef.TypeId), 247&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 275if (param.Type?.TypeId == AtsConstants.CancellationToken) 288if (param.Type?.TypeId == AtsConstants.CancellationToken) 297var writeback = parameter.CallbackReturnType?.TypeId == AtsConstants.Void && 298parameter.CallbackParameters?.Any(p => p.Type.Category == AtsTypeCategory.Dto && p.Type.TypeId != AtsConstants.CancellationToken) == true 310? JsonValue.Create(callbackParameter.Type.TypeId)!.ToJsonString() 459filtered = filtered.Where(p => p.Type?.TypeId != AtsConstants.CancellationToken); 471if (param.Type?.TypeId == AtsConstants.CancellationToken) 533if (typeRef.Category == AtsTypeCategory.Primitive && typeRef.TypeId == AtsConstants.Void) 666if (param.Type?.TypeId == AtsConstants.CancellationToken) 691private static string? GetReturnTypeId(AtsCapabilityInfo capability) => capability.ReturnType?.TypeId; 808if (IsHandleType(cap.ReturnType) && !dtoTypeIds.Contains(cap.ReturnType!.TypeId)) 815if (IsHandleType(param.Type) && !dtoTypeIds.Contains(param.Type!.TypeId)) 817typeIds.Add(param.Type!.TypeId); 824if (IsHandleType(cbParam.Type) && !dtoTypeIds.Contains(cbParam.Type.TypeId)) 826typeIds.Add(cbParam.Type.TypeId); 1016AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoInfo) 1376var returnsSelf = isDistributedApplicationBuilder && capability.ReturnType?.TypeId == capability.TargetTypeId; 1480.Select(i => i.TypeId), 1483.Where(i => !transitivelyImplemented.Contains(i.TypeId)) 1485baseClass = string.Join(", ", implementedInterfaces.Select(i => DeriveClassName(i.TypeId))); 1545baseTypeInterfaces = baseType.ImplementedInterfaces.Select(i => i.TypeId).ToList(); 1554var implementedInterfaces = builder.TargetType?.ImplementedInterfaces.Where(i => !baseTypeInterfaces.Contains(i.TypeId)).ToList(); 1561.Select(i => i.TypeId), 1564.Where(i => !transitivelyImplemented.Contains(i.TypeId)) 1681var returnsBuilder = capability.ReturnsBuilder && capability.ReturnType!.TypeId == capability.TargetTypeId; 1682var returnsChildBuilder = capability.ReturnsBuilder && capability.ReturnType != null && IsHandleType(capability.ReturnType) && capability.ReturnType.TypeId != capability.TargetTypeId; 1962if (!capabilitiesByTypeId.TryGetValue(expandedType.TypeId, out var list)) 1965capabilitiesByTypeId[expandedType.TypeId] = list; 1966typeRefsByTypeId[expandedType.TypeId] = expandedType; 2062.Select(i => i.TypeId) 2189if (!string.IsNullOrEmpty(typeRef.TypeId) && typeRef.Category == AtsTypeCategory.Handle) 2191typeRefs.TryAdd(typeRef.TypeId, typeRef); 2193if (!string.IsNullOrEmpty(typeRef.TypeId) && typeRef.Category == AtsTypeCategory.Dict) 2195_moduleBuilder.HandleRegistrations.TryAdd(typeRef.TypeId, "AspireDict"); 2197if (!string.IsNullOrEmpty(typeRef.TypeId) && typeRef.Category == AtsTypeCategory.List) 2199_moduleBuilder.HandleRegistrations.TryAdd(typeRef.TypeId, "AspireList"); 2278return DeriveClassName(typeRef.TypeId); 2447var tickIndex = typeRef.TypeId.IndexOf('`'); 2450return typeRef.TypeId[..tickIndex] + "T"; 2453return typeRef.TypeId + "T"; 2456return typeRef.TypeId;
Aspire.Hosting.CodeGeneration.Python.Tests (14)
AtsPythonCodeGeneratorTests.cs (14)
102Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string"); 220.Any(i => i.TypeId.Contains("IResourceWithEnvironment")); 899TargetTypeId = resourceType.TypeId, 911AtsTypeId = resourceType.TypeId, 955TargetTypeId = resourceType.TypeId, 967AtsTypeId = resourceType.TypeId, 1026TargetTypeId = resourceType.TypeId, 1037AtsTypeId = resourceType.TypeId, 1044AtsTypeId = genericBaseTypeRef.TypeId, 1049AtsTypeId = genericInterfaceTypeRef.TypeId, 1210TargetTypeId = projectType.TypeId, 1231TargetTypeId = containerType.TypeId, 1243AtsTypeId = projectType.TypeId, 1248AtsTypeId = containerType.TypeId,
Aspire.Hosting.CodeGeneration.Rust (31)
AtsRustCodeGenerator.cs (31)
378if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId 379|| IsCancellationTokenTypeId(typeRef.TypeId)) 389AtsTypeCategory.Dto => !dtoTypesById.TryGetValue(typeRef.TypeId, out var dto) 474var hasReturn = capability.ReturnType.TypeId != AtsConstants.Void; 607var wrappedType = MapHandleType(returnTypeRef.TypeId); 611else if (returnTypeRef?.TypeId == AtsConstants.CancellationToken) 860if (targetType.TypeId is null) 865if (!result.TryGetValue(targetType.TypeId, out var list)) 868result[targetType.TypeId] = list; 907if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 914AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId), 915AtsTypeCategory.Enum => MapEnumType(typeRef.TypeId), 916AtsTypeCategory.Handle => MapHandleType(typeRef.TypeId), 917AtsTypeCategory.Dto => MapDtoType(typeRef.TypeId), 945if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 952AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId), 953AtsTypeCategory.Enum => MapEnumType(typeRef.TypeId), 956AtsTypeCategory.Dto => MapDtoType(typeRef.TypeId), 985if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 992AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId), 993AtsTypeCategory.Enum => MapEnumType(typeRef.TypeId), 994AtsTypeCategory.Dto => MapDtoType(typeRef.TypeId), 1039var baseType = typeRef.TypeId switch 1064&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 1068&& typeRef.TypeId != AtsConstants.ReferenceExpressionTypeId 1069&& !IsCancellationTokenTypeId(typeRef.TypeId); 1083IsCancellationTokenTypeId(parameter.Type?.TypeId); 1097if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId 1098|| IsCancellationTokenTypeId(typeRef.TypeId)) 1105handleTypeIds.Add(typeRef.TypeId); 1120typeIds.Add(typeRef.TypeId);
Aspire.Hosting.CodeGeneration.Rust.Tests (2)
AtsRustCodeGeneratorTests.cs (2)
260Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string"); 378.Any(i => i.TypeId.Contains("IResourceWithEnvironment"));
Aspire.Hosting.CodeGeneration.TypeScript (101)
AtsTypeScriptCodeGenerator.cs (47)
136capability.ReturnType.TypeId == AtsConstants.Void ? null : capability.Documentation?.Returns, 137suppressReturns: capability.ReturnType.TypeId == AtsConstants.Void, 388!_projector.DtoTypesById.TryGetValue(typeRef.TypeId, out var dtoType)) 403!_projector.DtoTypesById.TryGetValue(typeRef.TypeId, out var dtoType)) 409if (!visitedDtoTypeIds.Add(typeRef.TypeId)) 420visitedDtoTypeIds.Remove(typeRef.TypeId); 431private static string? GetReturnTypeId(AtsCapabilityInfo capability) => capability.ReturnType?.TypeId; 452capability.ReturnType.TypeId != capability.TargetTypeId))) 950var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void; 953if (capability.ReturnType != null && _projector.TypesWithPromiseWrappers.Contains(capability.ReturnType.TypeId)) 955WriteLine($" {signature.MethodName}({signature.ParameterList}): {_projector.GetPublicPromiseInterfaceName(capability.ReturnType.TypeId)};"); 1141if (capability.ReturnsBuilder && capability.ReturnType?.TypeId != null && 1142!string.Equals(capability.ReturnType.TypeId, builder.TypeId, StringComparison.Ordinal) && 1143!string.Equals(capability.ReturnType.TypeId, capability.TargetTypeId, StringComparison.Ordinal)) 1145returnTypeId = capability.ReturnType.TypeId; 1161var wrappedReturnTypeId = capability.ReturnType!.TypeId; 1227if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 1468if (param.Type is not { TypeId: var dtoTypeId }) 1538if (!visitedDtoTypeIds.Add(dtoProperty.Type.TypeId)) 1554visitedDtoTypeIds.Remove(dtoProperty.Type.TypeId); 1638if (capability.ReturnsBuilder && capability.ReturnType?.TypeId != null && 1639!string.Equals(capability.ReturnType.TypeId, builder.TypeId, StringComparison.Ordinal) && 1640!string.Equals(capability.ReturnType.TypeId, capability.TargetTypeId, StringComparison.Ordinal)) 1642var returnClass = _projector.WrapperClassNames.GetValueOrDefault(capability.ReturnType.TypeId) 1643?? TypeScriptApiProjector.DeriveClassName(capability.ReturnType.TypeId); 1811else if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 1889&& callbackParam.CallbackReturnType.TypeId != AtsConstants.Void; 1924var cbTypeId = callbackParameter.Type.TypeId; 2273if (getter.ReturnType?.TypeId != null && _projector.WrapperClassNames.TryGetValue(getter.ReturnType.TypeId, out var wrapperClassName)) 2287if (getter.ReturnType?.TypeId == AtsConstants.CancellationToken) 2340if (getter.ReturnType?.TypeId != null && _projector.WrapperClassNames.TryGetValue(getter.ReturnType.TypeId, out var wrapperClassName)) 2367if (getter.ReturnType?.TypeId == AtsConstants.CancellationToken) 2388var handleType = _projector.GetConcreteHandleTypeName(getter.ReturnType!.TypeId); 2442var handleType = _projector.GetConcreteHandleTypeName(getter.ReturnType!.TypeId); 2665var returnTypeId = method.ReturnType!.TypeId; 2716else if (method.ReturnType?.TypeId == AtsConstants.CancellationToken) 2778var returnTypeId = capability.ReturnType!.TypeId; 2904var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void; 2909var returnWrapperClass = _projector.WrapperClassNames.GetValueOrDefault(capability.ReturnType!.TypeId) 2910?? TypeScriptApiProjector.DeriveClassName(capability.ReturnType.TypeId); 2913var returnHandleType = _projector.GetConcreteHandleTypeName(capability.ReturnType.TypeId); 3065if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 3130var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void; 3134_projector.WrapperClassNames.GetValueOrDefault(capability.ReturnType!.TypeId) 3135?? TypeScriptApiProjector.DeriveClassName(capability.ReturnType.TypeId));
TypeScriptApiProjector.cs (54)
134.DistinctBy(typeRef => typeRef.TypeId, StringComparer.Ordinal) 135.GroupBy(typeRef => DeriveClassName(typeRef.TypeId), StringComparer.Ordinal) 222_typesWithPromiseWrappers.Add(alias.TypeId); 223_wrapperClassNames[alias.TypeId] = builder.BuilderClassName; 224_concreteTypeIds[alias.TypeId] = builder.TypeId; 225_typeRefsById[alias.TypeId] = builder.TargetType ?? alias; 407return capability.ReturnType is { TypeId: { } returnTypeId } 419if (capability.ReturnType is { } returnType && _typesWithPromiseWrappers.Contains(returnType.TypeId)) 421return GetPublicPromiseInterfaceName(returnType.TypeId); 424if (capability.ReturnType is null || capability.ReturnType.TypeId == AtsConstants.Void) 773AtsTypeCategory.Dto when value is JsonObject obj && _dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoInfo) 1311var returnTypeId = capability.ReturnType?.TypeId; 1663if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 1668if (typeRef.TypeId == InputTypeTypeId) 1673if (typeRef.TypeId == InteractionInputTypeId) 1678if (typeRef.TypeId == InteractionInputCollectionTypeId) 1684if (_wrapperClassNames.TryGetValue(typeRef.TypeId, out var wrapperClassName)) 1691AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId), 1692AtsTypeCategory.Enum => MapEnumType(typeRef.TypeId), 1693AtsTypeCategory.Handle => GetWrapperOrHandleName(typeRef.TypeId), 1694AtsTypeCategory.Dto => GetDtoInterfaceName(typeRef.TypeId), 1715return typeRef.TypeId is AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken 1875if (IsHandleType(typeRef) && _wrapperClassNames.TryGetValue(typeRef!.TypeId, out var className)) 1881if (typeRef?.TypeId == InteractionInputCollectionTypeId) 1959if (!IsAssignableToInterface(candidateTypeRef, typeRef.TypeId) || 1960!_wrapperClassNames.TryGetValue(candidateTypeRef.TypeId, out var wrapperClassName)) 1981if (string.Equals(candidateTypeRef.TypeId, interfaceTypeId, StringComparison.Ordinal)) 2011internal static bool IsCancellationTokenType(AtsTypeRef? typeRef) => typeRef?.TypeId == AtsConstants.CancellationToken; 2327var aTypeId = a.Type?.TypeId; 2328var bTypeId = b.Type?.TypeId; 2352if (!string.Equals(aCallbackParams[i].Type.TypeId, bCallbackParams[i].Type.TypeId, StringComparison.Ordinal)) 2359var aReturnTypeId = a.CallbackReturnType?.TypeId; 2360var bReturnTypeId = b.CallbackReturnType?.TypeId; 2486if (typeRef?.TypeId is { } typeId && _typesWithPromiseWrappers.Contains(typeId)) 2511if (capability.ReturnsBuilder && capability.ReturnType?.TypeId != null && 2512!string.Equals(capability.ReturnType.TypeId, builder.TypeId, StringComparison.Ordinal) && 2513!string.Equals(capability.ReturnType.TypeId, capability.TargetTypeId, StringComparison.Ordinal)) 2515return GetPublicPromiseInterfaceName(capability.ReturnType.TypeId); 2541if (IsHandleType(typeRef) && _wrapperClassNames.ContainsKey(typeRef.TypeId)) 2546if (typeRef.TypeId == InteractionInputCollectionTypeId) 2686if (!capabilitiesByTypeId.TryGetValue(expandedType.TypeId, out var list)) 2689capabilitiesByTypeId[expandedType.TypeId] = list; 2691typeRefsByTypeId[expandedType.TypeId] = expandedType; 2908return IsTypeInHierarchy(retainedType, candidateType.TypeId) || 2909IsTypeInHierarchy(candidateType, retainedType.TypeId); 2915string.Equals(interfaceType.TypeId, typeId, StringComparison.Ordinal) || 2922(string.Equals(baseType.TypeId, typeId, StringComparison.Ordinal) || 2942if (!string.IsNullOrEmpty(typeRef.TypeId) && typeRef.Category == AtsTypeCategory.Handle) 2944typeRefs.TryAdd(typeRef.TypeId, typeRef); 3085if (_typesWithPromiseWrappers.Contains(returnType.TypeId)) 3087var className = _wrapperClassNames.GetValueOrDefault(returnType.TypeId) 3088?? DeriveClassName(returnType.TypeId); 3112var returnType = callbackReturnType == null || callbackReturnType.TypeId == AtsConstants.Void
Aspire.Hosting.CodeGeneration.TypeScript.Tests (52)
AtsTypeScriptCodeGeneratorTests.cs (52)
173Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string"); 299TargetTypeId = targetType.TypeId, 311TargetTypeId = targetType.TypeId, 422Assert.Equal("string", nameGetterCapability.ReturnType?.TypeId); 432Assert.Equal("Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", nameSetterCapability.ReturnType?.TypeId); // Returns context for fluent chaining 440Assert.Equal("number", valueGetterCapability.ReturnType?.TypeId); 523t.TypeId == "Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource"); 659Assert.Equal(AtsConstants.Void, setValue.ReturnType.TypeId); 668Assert.Equal("string", valueParameter.Type.TypeId); 678Assert.Equal("string", tryGetCurrentValue.ReturnType.TypeId); 700Assert.Equal(typeId, capability.ReturnType.TypeId); 713Assert.Contains(withBrowserLogs.Parameters, p => p.Name == "browser" && p.Type?.TypeId == "string" && p.IsOptional); 714Assert.Contains(withBrowserLogs.Parameters, p => p.Name == "profile" && p.Type?.TypeId == "string" && p.IsOptional); 728c.ExpandedTargetTypes.Any(t => t.TypeId.Contains("ContainerResource"))) 733TargetType = c.TargetType != null ? new { c.TargetType.TypeId, c.TargetType.IsInterface } : null, 735.Where(t => t.TypeId.Contains("ContainerResource")) 736.Select(t => new { t.TypeId, t.IsInterface }) 776if (expandedType.TypeId.Contains("ContainerResource")) 779$"Capability '{cap.CapabilityId}' ExpandedTargetType '{expandedType.TypeId}' has IsInterface = true"); 802Assert.Equal("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource", withBindMount.TargetType.TypeId); 831Assert.Contains("IResourceWithConnectionString", withConnectionStringDirect.TargetType.TypeId); 839.FirstOrDefault(t => t.TypeId.Contains("TestRedisResource")); 859Assert.Contains("TestRedisResource", withRedisSpecific.TargetType.TypeId); 867.FirstOrDefault(t => t.TypeId.Contains("TestRedisResource")); 885Assert.Contains("ContainerResource", withBindMount.TargetType.TypeId); 893.FirstOrDefault(t => t.TypeId.Contains("ContainerResource") && !t.TypeId.Contains("IContainer")); 1122$"Expanded type '{expandedType.TypeId}' should be a concrete type, not an interface"); 1146Assert.Contains("IResourceWithEnvironment", testWithEnvironmentCallback.TargetType.TypeId); 1155.FirstOrDefault(t => t.TypeId.Contains("TestRedisResource")); 1339Assert.Equal("string", capability.Parameters.Single().Type?.TypeId); 1373claimParameter.Type?.TypeId); 1459.Any(i => i.TypeId.Contains("IResourceWithEnvironment")); 1571.ReturnType!.TypeId; 2112Assert.Equal(expectedTypes.Select(GetAtsTypeId), parameter.CallbackParameters.Select(p => p.Type?.TypeId)); 2122Assert.Equal(GetAtsTypeId(parameterType), parameter.Type?.TypeId); 2262Assert.Equal("any", valueParam.Type.TypeId); 2410Assert.Equal(AtsConstants.CancellationToken, ctParam.Type.TypeId); 2445Assert.Equal(AtsConstants.CancellationToken, operationParam.CallbackParameters[0].Type?.TypeId); 2464Assert.Equal(AtsConstants.TimeSpan, timeoutParam.Type?.TypeId); 2468Assert.Equal(AtsConstants.CancellationToken, ctParam.Type?.TypeId); 2484Assert.Equal("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource", capability.ReturnType.TypeId); 2508Assert.Equal("Aspire.Hosting.Dotnet/Aspire.Hosting.Dotnet.DotnetProjectOptions", options.Type.TypeId); 2509var dto = Assert.Single(context.DtoTypes, dto => dto.TypeId == options.Type.TypeId); 2524Assert.Equal(legacyTypeId, legacyOptions.Type.TypeId); 2827var expandedTypeIds = withNpm.ExpandedTargetTypes.Select(t => t.TypeId).ToList(); 2858var expandedTypeIds = capability.ExpandedTargetTypes.Select(t => t.TypeId).ToList(); 3037TargetTypeId = targetType.TypeId, 3049TargetTypeId = targetType.TypeId, 3061TargetTypeId = targetType.TypeId, 3073TargetTypeId = targetType.TypeId, 3473TargetTypeId = targetType.TypeId,
Aspire.Hosting.Native.CodeGeneration (48)
NativeCSharpProjection.cs (7)
116callback.CallbackReturnType?.TypeId != "void") 162member.TypeId == "string" 237AtsTypeCategory.Handle when handles.TryGetValue(type.TypeId, out var handle) => handle, 238AtsTypeCategory.Dto when dtos.TryGetValue(type.TypeId, out var dto) => dto, 242AtsTypeCategory.Primitive => type.TypeId switch 249_ => throw new NotSupportedException($"Unsupported native primitive: {type.TypeId} ({type.ClrType}).") 251_ => throw new NotSupportedException($"Unsupported native C# type: {type.TypeId} ({type.Category}).")
NativeProviderTypeScriptProjection.cs (2)
27.Select(type => type.TypeId).Distinct(StringComparer.Ordinal).ToArray(); 89var id = type.TypeId;
Program.cs (9)
101if (handles.Contains(capability.ReturnType.TypeId)) 131if (handles.Contains(capability.ReturnType.TypeId)) 134$" return {(asynchronous ? "connection.PublishCoreHandle" : "handles.Add")}(result, {Literal(capability.ReturnType.TypeId)});"); 136else if (context.DtoTypes.Any(dto => dto.TypeId == capability.ReturnType.TypeId)) 434parameter.CallbackReturnType?.TypeId == "void" && type.IsGenericType && 437return $"connection.CreateAuthoringCallback<{type.GetGenericArguments()[0].Name}>(callbackConnection, RpcArguments.String({node}), {Literal(callbackParameter.Type.TypeId)})"; 440members.Any(member => member.TypeId == "string") && 441members.All(member => member.TypeId == "string" || member.Category == AtsTypeCategory.Handle)) 443return $"RpcArguments.Union({node}, handles, [{string.Join(", ", members.Where(member => member.Category == AtsTypeCategory.Handle).Select(member => Literal(member.TypeId)))}])";
src\Aspire.Hosting.RemoteHost\AtsCapabilityScanner.cs (26)
686enumTypes.TryAdd(typeRef.TypeId, typeRef.ClrType); 768if (typeRef.Category == AtsTypeCategory.Unknown && validTypes.Contains(typeRef.TypeId)) 865return typeRef.TypeId; 974AddToCompatibilityMap(typeToCompatibleTypes, iface.TypeId, concreteTypeRef); 980AddToCompatibilityMap(typeToCompatibleTypes, baseType.TypeId, concreteTypeRef); 1013.SelectMany(c => c.ExpandedTargetTypes.Select(t => (Target: t.TypeId, Capability: c))) 1085.Where(t => !targetIds.Contains(t.TypeId)) 1386AtsTypeCategory.Primitive => typeRef.TypeId != AtsConstants.CancellationToken && typeRef.TypeId != AtsConstants.Void, 1409if (!visitedDtoTypeIds.Add(typeRef.TypeId)) 1439_ = visitedDtoTypeIds.Remove(typeRef.TypeId); 1695TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 1701propertyTypeId = propertyTypeRef.TypeId; 1714propertyTypeId = propertyTypeRef.TypeId; 1719propertyTypeId = propertyTypeRef.TypeId; 2109var firstParamTypeId = extendsTypeRef?.TypeId ?? MapToAtsTypeId(firstParamType, assemblyExportedTypeCache); 2705TypeId = typeRef.TypeId, 2849TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2872TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2894TypeId = AtsConstants.ListTypeId(elementTypeRef.TypeId), 2914TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 2959TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 3418TypeId = string.Join("|", unionTypes.Select(u => u.TypeId)),
src\Shared\NativeProviderContractReader.cs (4)
43capability.Parameters is null || capability.ReturnType is null || string.IsNullOrWhiteSpace(capability.ReturnType.TypeId)) 50string.IsNullOrWhiteSpace(parameter.Type.TypeId)) 55string.IsNullOrWhiteSpace(parameter.CallbackReturnType.TypeId) || 56parameter.CallbackParameters.Any(value => value is null || value.Type is null || string.IsNullOrWhiteSpace(value.Type.TypeId))))
Aspire.Hosting.RemoteHost (42)
Ats\AtsMarshaller.cs (6)
144if (typeRef.TypeId == AtsConstants.CancellationToken && value is CancellationToken cancellationToken) 150if (typeRef.TypeId == TypeSystem.AtsConstants.Any) 157AtsTypeCategory.Handle => _handles.Marshal(value, typeRef.TypeId), 162AtsTypeCategory.List => _handles.Marshal(value, typeRef.TypeId), 163AtsTypeCategory.Dict => _handles.Marshal(value, typeRef.TypeId), 185$"Value of type '{value.GetType()}' does not match any member of union '{typeRef.TypeId}'.");
Ats\ExternalCapabilityRegistry.cs (1)
606.Where(parameter => parameter.Type?.TypeId == AtsConstants.CancellationToken)
AtsCapabilityScanner.cs (26)
686enumTypes.TryAdd(typeRef.TypeId, typeRef.ClrType); 768if (typeRef.Category == AtsTypeCategory.Unknown && validTypes.Contains(typeRef.TypeId)) 865return typeRef.TypeId; 974AddToCompatibilityMap(typeToCompatibleTypes, iface.TypeId, concreteTypeRef); 980AddToCompatibilityMap(typeToCompatibleTypes, baseType.TypeId, concreteTypeRef); 1013.SelectMany(c => c.ExpandedTargetTypes.Select(t => (Target: t.TypeId, Capability: c))) 1085.Where(t => !targetIds.Contains(t.TypeId)) 1386AtsTypeCategory.Primitive => typeRef.TypeId != AtsConstants.CancellationToken && typeRef.TypeId != AtsConstants.Void, 1409if (!visitedDtoTypeIds.Add(typeRef.TypeId)) 1439_ = visitedDtoTypeIds.Remove(typeRef.TypeId); 1695TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 1701propertyTypeId = propertyTypeRef.TypeId; 1714propertyTypeId = propertyTypeRef.TypeId; 1719propertyTypeId = propertyTypeRef.TypeId; 2109var firstParamTypeId = extendsTypeRef?.TypeId ?? MapToAtsTypeId(firstParamType, assemblyExportedTypeCache); 2705TypeId = typeRef.TypeId, 2849TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2872TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2894TypeId = AtsConstants.ListTypeId(elementTypeRef.TypeId), 2914TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 2959TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 3418TypeId = string.Join("|", unionTypes.Select(u => u.TypeId)),
AtsContextFilter.cs (8)
174yield return targetType.TypeId; 179yield return expandedTargetType.TypeId; 394if (typeRef.Category == AtsTypeCategory.Handle && !string.IsNullOrEmpty(typeRef.TypeId)) 396referencedHandleTypes.TryAdd(typeRef.TypeId, typeRef); 426if (handleTypesById.TryGetValue(typeRef.TypeId, out var handleType) && includedHandleTypeIds.Add(handleType.AtsTypeId)) 431if (dtoTypesById.TryGetValue(typeRef.TypeId, out var dtoType) && includedDtoTypeIds.Add(dtoType.TypeId)) 436if (enumTypesById.ContainsKey(typeRef.TypeId)) 438includedEnumTypeIds.Add(typeRef.TypeId);
CodeGeneration\CodeGenerationService.cs (1)
150TypeId = t.TypeId,
Aspire.Hosting.RemoteHost.Tests (24)
AtsCapabilityScannerTests.cs (20)
160Assert.Equal("string[]", itemsType.TypeId); 165Assert.Equal("string[]", enumerableReturnCapability.ReturnType.TypeId); 179Assert.Equal(expectedElementTypeId, typeRef.ElementType.TypeId); 194Assert.Contains(parameter.Type.UnionTypes!, type => type.TypeId == AtsConstants.String); 337Assert.Contains(resourceParameter.Type!.UnionTypes!, type => type.TypeId == "string"); 338Assert.Contains(resourceParameter.Type.UnionTypes!, type => type.TypeId == "Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource"); 426Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(HttpCommandExportOptions)), optionsParameter.Type.TypeId); 441Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(HttpCommandPrepareRequestContext)), callbackParameter.Type.TypeId); 443Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(HttpCommandRequestExportData)), prepareRequestProperty.CallbackReturnType?.TypeId); 472t => t.TypeId == AtsTypeMapping.DeriveTypeId(typeof(DerivedExportedProperties))); 491Assert.Equal(AtsConstants.String, nameGetter.ReturnType.TypeId); 496Assert.Equal(AtsConstants.String, descriptionGetter.ReturnType.TypeId); 517Assert.Equal(AtsConstants.String, nullableString.Type.TypeId); 522Assert.Equal(AtsConstants.String, requiredString.Type.TypeId); 527Assert.Equal(AtsConstants.Number, nullableNumber.Type.TypeId); 532Assert.Equal(AtsConstants.Number, requiredNumber.Type.TypeId); 627Assert.DoesNotContain(genericCapability.ExpandedTargetTypes, t => t.TypeId == shadowedTypeId); 628Assert.Contains(genericCapability.ExpandedTargetTypes, t => t.TypeId == otherTypeId); 629Assert.Contains(specificCapability.ExpandedTargetTypes, t => t.TypeId == shadowedTypeId); 684Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(AssemblyLevelExportedTestType)), parameter.Type.TypeId);
AtsContextFilterTests.cs (2)
230Assert.Equal("Aspire.Hosting/Aspire.Hosting.DistributedApplication", supportParameter.Type?.TypeId); 231Assert.Equal(AtsConstants.Void, filteredSupport.ReturnType.TypeId);
ExternalCapabilityRegistryTests.cs (2)
543Assert.Equal("string", capability.ReturnType!.TypeId); 571Assert.Equal("string", capability.ReturnType!.TypeId);