59 writes to Type
Aspire.Hosting.CodeGeneration.Go (1)
AtsGoCodeGenerator.cs (1)
1969Type = property.Type,
Aspire.Hosting.CodeGeneration.Go.Tests (6)
AtsGoDerivedBuilderTests.cs (3)
647private static AtsParameterInfo Required(string name, AtsTypeRef type) => new() { Name = name, Type = type }; 649private static AtsParameterInfo Optional(string name, AtsTypeRef type) => new() { Name = name, Type = type, IsOptional = true, IsNullable = true }; 654Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback },
GoDocCommentTests.cs (1)
480Type = type,
GoGeneratorEscapingTests.cs (2)
204Type = type, 212Type = type,
Aspire.Hosting.CodeGeneration.Java.Tests (6)
AtsJavaCodeGeneratorTests.cs (6)
2783Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 2817Type = new AtsTypeRef { TypeId = AtsConstants.CancellationToken, Category = AtsTypeCategory.Dto } 2851Type = resourceType, 2857Type = new AtsTypeRef 3060Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback }, 3412Type = new AtsTypeRef { TypeId = "callback", Category = AtsTypeCategory.Callback },
Aspire.Hosting.CodeGeneration.Python (1)
AtsPythonCodeGenerator.cs (1)
391Type = p.Type,
Aspire.Hosting.CodeGeneration.Python.Tests (17)
AtsPythonCodeGeneratorTests.cs (17)
886Type = resourceType 891Type = new AtsTypeRef 942Type = resourceType 947Type = new AtsTypeRef 1018Type = resourceType 1102Type = unionType, 1108Type = unionType, 1116Type = new AtsTypeRef 1203new AtsParameterInfo { Name = "builder", Type = projectType }, 1204new AtsParameterInfo { Name = "target", Type = stringType }, 1205new AtsParameterInfo { Name = "name", Type = stringType }, 1206new AtsParameterInfo { Name = "env", Type = stringType }, 1207new AtsParameterInfo { Name = "isReadOnly", Type = boolType, IsOptional = true } 1225new AtsParameterInfo { Name = "builder", Type = containerType }, 1226new AtsParameterInfo { Name = "target", Type = stringType }, 1227new AtsParameterInfo { Name = "name", Type = stringType, IsOptional = true }, 1228new AtsParameterInfo { Name = "isReadOnly", Type = boolType, IsOptional = true }
Aspire.Hosting.CodeGeneration.TypeScript (1)
AtsTypeScriptCodeGenerator.cs (1)
1562Type = callbackProperty.Type,
Aspire.Hosting.CodeGeneration.TypeScript.Tests (9)
AtsTypeScriptCodeGeneratorTests.cs (9)
309Parameters = [new AtsParameterInfo { Name = "value", Type = stringType }], 966Type = nullableNumberArrayType 1483Type = CreateResourceTypeRef<TestMarkerResource>() 2758Type = CreateResourceTypeRef<TestPromiseNameCollisionResource>() 2763Type = CreateResourceTypeRef<TestPromiseNameCollisionResourcePromise>() 3059Parameters = [new AtsParameterInfo { Name = "value", Type = stringType }], 3446Type = new AtsTypeRef 3495Type = new AtsTypeRef 3504Type = new AtsTypeRef
Aspire.Hosting.Native.CodeGeneration (6)
src\Aspire.Hosting.RemoteHost\AtsCapabilityScanner.cs (6)
1768Type = contextTypeRef, 1811Type = contextTypeRef, 1820Type = setterTypeRef, 1933Type = instanceContextTypeRef, 2194Type = unionTypeRef, 2237Type = finalTypeRef,
Aspire.Hosting.RemoteHost (8)
Ats\ExternalCapabilityRegistry.cs (1)
786Type = parameter.Type is not null ? CreateTypeRef(parameter.Type) : null,
AtsCapabilityScanner.cs (6)
1768Type = contextTypeRef, 1811Type = contextTypeRef, 1820Type = setterTypeRef, 1933Type = instanceContextTypeRef, 2194Type = unionTypeRef, 2237Type = finalTypeRef,
AtsContextFilter.cs (1)
383Type = pair.Value
Aspire.Hosting.RemoteHost.Tests (4)
AtsContextFilterTests.cs (4)
189Type = new AtsTypeRef 505Type = new AtsTypeRef 515Type = new AtsTypeRef 525Type = new AtsTypeRef
166 references to Type
aspire-managed (3)
AppHostServerV2CodeGeneration.cs (1)
48foreach (var type in capability.Parameters.Select(parameter => parameter.Type)
src\Shared\NativeProviderContractReader.cs (2)
49if (parameter is null || string.IsNullOrWhiteSpace(parameter.Name) || parameter.Type is null || 50string.IsNullOrWhiteSpace(parameter.Type.TypeId))
Aspire.Hosting.CodeGeneration.Go (21)
AtsGoCodeGenerator.ApiProjection.cs (3)
730? new GoApiOptions { TypeName = MapDtoType(directOptionsParameter.Type!.TypeId), IsDirect = true } 803AllowedTypes = unionParameters.Contains(parameter) ? GetUnionMemberTypes(parameter.Type!) : [] 1068RegisterTypeOwners(parameter.Type);
AtsGoCodeGenerator.cs (17)
208CollectHandleTypeIds(handleTypeIds, parameter.Type); 689? directOptionsParam.Documentation?.Summary ?? $"Optional parameters; see {RenderTypeLink(MapDtoType(directOptionsParam.Type!.TypeId))}." 1533sb.Append(MapDtoType(directOptionsParam.Type!.TypeId)); 1553return MapInputTypeRefToGo(p.Type, p.IsOptional); 1822if (p.Type?.Category != AtsTypeCategory.Handle) { continue; } 1868var type = MapTypeRefToGo(p.Type, isOptional: false); 1872if (IsNilableGoType(type) && (p.Type is null || !ShouldApplyNullableType(p.Type))) 1890var dtoType = MapDtoType(directOptionsParam.Type!.TypeId); 2166var fieldType = MapTypeRefToGo(p.Type, isOptional: true); 2197return MapInputTypeRefToGo(p.Type, isOptional: true); 2284if (p.Type?.Category == AtsTypeCategory.Union) 2308var allowed = GetUnionAllowedTypes(p.Type!); 2310WriteLine($"{indent}case {GetUnionTypeSwitchCases(p.Type!)}:"); 2336var allowed = GetUnionAllowedTypes(p.Type!); 2337var numericNote = AllowsGoNumericTypes(GetUnionMemberTypes(p.Type!)) ? " (float64 accepts any built-in Go numeric type)" : ""; 2727IsCancellationTokenTypeId(parameter.Type?.TypeId);
src\Shared\CodeGeneration\AtsOptionsFlattening.cs (1)
54if (candidate.Type?.Category != AtsTypeCategory.Dto)
Aspire.Hosting.CodeGeneration.Go.Tests (1)
AtsGoCodeGeneratorTests.cs (1)
1327Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string");
Aspire.Hosting.CodeGeneration.Java (15)
AtsJavaCodeGenerator.cs (15)
1014if (!string.Equals(left.Type?.TypeId, right.Type?.TypeId, StringComparison.Ordinal)) 1139if (parameter.IsCallback || parameter.Type?.Category != AtsTypeCategory.Handle) 1144var wrapperType = MapInputTypeToJava(parameter.Type, parameter.IsOptional || parameter.IsNullable); 1397var unionParameters = parameters.Where(p => IsUnionType(p.Type)).ToList(); 1417var unionTypes = unionParameter.Type?.UnionTypes; 1475.Select(up => up.Type?.UnionTypes? 1590return IsUnionType(parameter.Type) ? "(AspireUnion) null" : "null"; 1599var unionParameters = requiredParameters.Where(p => IsUnionType(p.Type)).ToList(); 1606var unionTypes = unionParameter.Type?.UnionTypes; 2432AddHandleTypeIfNeeded(handleTypeIds, parameter.Type); 2548AddListOrDictTypeIfNeeded(typeIds, parameter.Type); 2644parameter.Type, 2645parameter.IsOptional || parameter.IsNullable || parameter.Type?.IsNullable == true); 2683IsCancellationTokenTypeId(parameter.Type?.TypeId);
Aspire.Hosting.CodeGeneration.Java.Tests (1)
AtsJavaCodeGeneratorTests.cs (1)
184Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string");
Aspire.Hosting.CodeGeneration.Python (14)
AtsPythonCodeGenerator.cs (14)
275if (param.Type?.TypeId == AtsConstants.CancellationToken) 288if (param.Type?.TypeId == AtsConstants.CancellationToken) 391Type = p.Type, 459filtered = filtered.Where(p => p.Type?.TypeId != AtsConstants.CancellationToken); 471if (param.Type?.TypeId == AtsConstants.CancellationToken) 507(param.IsNullable || AllowsNoneAtTopLevel(param.Type)); 516return AllowsNoneAtTopLevel(param.Type) ? type : $"{type} | None"; 666if (param.Type?.TypeId == AtsConstants.CancellationToken) 671var baseType = MapTypeRefToPython(param.Type); 815if (IsHandleType(param.Type) && !dtoTypeIds.Contains(param.Type!.TypeId)) 817typeIds.Add(param.Type!.TypeId); 1329var valueType = MapTypeRefToPython(valueParam.Type); 2228CollectFromTypeRef(param.Type);
Aspire.Hosting.CodeGeneration.Python.Tests (1)
AtsPythonCodeGeneratorTests.cs (1)
102Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string");
Aspire.Hosting.CodeGeneration.Rust (9)
AtsRustCodeGenerator.cs (9)
491else if (IsHandleType(parameter.Type)) 494var handleTypeName = MapTypeRefToRust(parameter.Type, false); 500paramType = MapParameterTypeToRust(parameter.Type, parameter.IsOptional); 537if (IsHandleType(parameter.Type)) 553if (IsAspireListOrDictParam(parameter.Type)) 569if (IsCollectionOfHandleTypes(parameter.Type)) 797AddHandleTypeIfNeeded(handleTypeIds, parameter.Type); 886AddListOrDictTypeIfNeeded(typeIds, parameter.Type); 1083IsCancellationTokenTypeId(parameter.Type?.TypeId);
Aspire.Hosting.CodeGeneration.Rust.Tests (1)
AtsRustCodeGeneratorTests.cs (1)
260Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string");
Aspire.Hosting.CodeGeneration.TypeScript (32)
AtsTypeScriptCodeGenerator.cs (24)
357return GetRpcArgumentValueExpression(localParameterName, param.Type); 375if (TryGetDtoCallbackMarshallingProperties(param.Type, out _)) 832var valueType = _projector.MapInputTypeToTypeScript(valueParam.Type); 1175WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 1211WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 1299WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 1348if (_projector.IsWidenedHandleType(param.Type)) 1463if (!TryGetDtoCallbackMarshallingProperties(param.Type, out var marshallingProperties)) 1468if (param.Type is not { TypeId: var dtoTypeId }) 1757if (!param.IsCallback && _projector.IsWidenedHandleType(param.Type)) 1793if (!param.IsCallback && _projector.IsWidenedHandleType(param.Type)) 2311var valueType = _projector.MapInputTypeToTypeScript(valueParam.Type); 2313GeneratePromiseResolutionForParam("value", valueParam.Type, " "); 2316WriteLine($" {{ context: this._handle, {GetRpcArgumentEntry("value", valueParam.Type)} }}"); 2475var valueType = _projector.MapInputTypeToTypeScript(valueParam.Type); 2477GeneratePromiseResolutionForParam("value", valueParam.Type, " "); 2480WriteLine($" {{ context: this._handle, {GetRpcArgumentEntry("value", valueParam.Type)} }}"); 2679WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 2706WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 2792WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 2819WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 2971WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 3029WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};"); 3049WriteLine($" {(_projector.IsWidenedHandleType(param.Type) ? "let" : "const")} {localParameterName} = {publicOptionsParamName}?.{param.Name};");
src\Shared\CodeGeneration\AtsOptionsFlattening.cs (1)
54if (candidate.Type?.Category != AtsTypeCategory.Dto)
TypeScriptApiProjector.cs (7)
1208accessors.Add($"set: (value: {MapInputTypeToTypeScript(valueParam.Type)}) => Promise<void>"); 1950return MapInputTypeToTypeScript(param.Type); 2133p => IsCancellationTokenType(p.Type), 2150return optionalParams.FirstOrDefault(p => IsCancellationTokenType(p.Type)); 2327var aTypeId = a.Type?.TypeId; 2328var bTypeId = b.Type?.TypeId; 2968CollectFromTypeRef(param.Type);
Aspire.Hosting.CodeGeneration.TypeScript.Tests (28)
AtsTypeScriptCodeGeneratorTests.cs (28)
173Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.TypeId == "string"); 667Assert.NotNull(valueParameter.Type); 668Assert.Equal("string", valueParameter.Type.TypeId); 670Assert.NotEqual(true, valueParameter.Type.IsNullable); 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); 915Assert.NotNull(dependencyParam.Type); 916Assert.Equal(AtsTypeCategory.Handle, dependencyParam.Type.Category); 917Assert.True(dependencyParam.Type.IsInterface, "IResourceWithConnectionString is an interface"); 1339Assert.Equal("string", capability.Parameters.Single().Type?.TypeId); 1391Assert.True(Assert.Single(propertySetter.Parameters, p => p.Name == "value").Type?.IsNullable); 2122Assert.Equal(GetAtsTypeId(parameterType), parameter.Type?.TypeId); 2261Assert.NotNull(valueParam.Type); 2262Assert.Equal("any", valueParam.Type.TypeId); 2409Assert.NotNull(ctParam.Type); 2410Assert.Equal(AtsConstants.CancellationToken, ctParam.Type.TypeId); 2411Assert.Equal(AtsTypeCategory.Primitive, ctParam.Type.Category); 2464Assert.Equal(AtsConstants.TimeSpan, timeoutParam.Type?.TypeId); 2468Assert.Equal(AtsConstants.CancellationToken, ctParam.Type?.TypeId); 2506Assert.NotNull(options.Type); 2507Assert.Equal(AtsTypeCategory.Dto, options.Type.Category); 2508Assert.Equal("Aspire.Hosting.Dotnet/Aspire.Hosting.Dotnet.DotnetProjectOptions", options.Type.TypeId); 2509var dto = Assert.Single(context.DtoTypes, dto => dto.TypeId == options.Type.TypeId); 2522Assert.NotNull(legacyOptions.Type); 2523Assert.Equal(AtsTypeCategory.Handle, legacyOptions.Type.Category); 2524Assert.Equal(legacyTypeId, legacyOptions.Type.TypeId); 2663Assert.NotNull(param.Type); 2664Assert.NotEqual(AtsTypeCategory.Unknown, param.Type.Category);
Aspire.Hosting.Native.CodeGeneration (15)
NativeCSharpProjection.cs (7)
100inputs.Any(parameter => parameter.Type is null || parameter.Type.IsNullable == true)) 123var parameters = inputs.Select(parameter => $"{(parameter.IsCallback ? $"Func<{TypeName(parameter.CallbackParameters![0].Type)}, Task>" : TypeName(parameter.Type!))} @{parameter.Name}"); 155var parameterType = TypeName(parameter.Type!); 160var value = parameter.Type!.Category == AtsTypeCategory.Union 161? $"@{parameter.Name} switch {{ {string.Join(", ", parameter.Type.UnionTypes!.Select(member => 165: parameter.Type.Category == AtsTypeCategory.Handle
NativeProviderTypeScriptProjection.cs (2)
25var types = methods.SelectMany(method => method.Parameters.Select(parameter => parameter.Type) 67TypeName(parameter.Type ?? throw new InvalidDataException("Provider parameters require a type."))));
Program.cs (1)
439if (parameter.Type is { Category: AtsTypeCategory.Union, UnionTypes: { } members } &&
src\Aspire.Hosting.RemoteHost\AtsCapabilityScanner.cs (3)
615CollectEnumClrTypes(param.Type, enumTypes); 717ResolveTypeRef(param.Type, validTypes); 820var result = FindUnknownType(param.Type);
src\Shared\NativeProviderContractReader.cs (2)
49if (parameter is null || string.IsNullOrWhiteSpace(parameter.Name) || parameter.Type is null || 50string.IsNullOrWhiteSpace(parameter.Type.TypeId))
Aspire.Hosting.RemoteHost (9)
Ats\CapabilityDispatcher.cs (1)
940if (parameter?.Type?.UnionTypes is not { Count: > 0 } unionTypes)
Ats\ExternalCapabilityRegistry.cs (1)
606.Where(parameter => parameter.Type?.TypeId == AtsConstants.CancellationToken)
AtsCapabilityScanner.cs (3)
615CollectEnumClrTypes(param.Type, enumTypes); 717ResolveTypeRef(param.Type, validTypes); 820var result = FindUnknownType(param.Type);
AtsContextFilter.cs (2)
259CollectReferencedType(parameter.Type, handleTypesById, dtoTypesById, enumTypesById, includedHandleTypeIds, includedDtoTypeIds, includedEnumTypeIds); 366CollectHandleTypes(parameter.Type);
CodeGeneration\CodeGenerationService.cs (2)
133Type = p.Type != null ? MapTypeRef(p.Type) : null,
Aspire.Hosting.RemoteHost.Tests (16)
AtsCapabilityScannerTests.cs (15)
159var itemsType = Assert.IsType<AtsTypeRef>(itemsParameter.Type); 192Assert.Equal(AtsTypeCategory.Union, parameter.Type?.Category); 193Assert.Contains(parameter.Type!.UnionTypes!, type => type.ClrType == typeof(TestUnionEnum)); 194Assert.Contains(parameter.Type.UnionTypes!, type => type.TypeId == AtsConstants.String); 336Assert.Equal(AtsTypeCategory.Union, resourceParameter.Type?.Category); 337Assert.Contains(resourceParameter.Type!.UnionTypes!, type => type.TypeId == "string"); 338Assert.Contains(resourceParameter.Type.UnionTypes!, type => type.TypeId == "Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource"); 342Assert.Equal(AtsTypeCategory.Dict, argumentsParameter.Type?.Category); 343Assert.True(argumentsParameter.Type?.IsReadOnly); 424Assert.NotNull(optionsParameter.Type); 425Assert.Equal(AtsTypeCategory.Dto, optionsParameter.Type.Category); 426Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(HttpCommandExportOptions)), optionsParameter.Type.TypeId); 682Assert.NotNull(parameter.Type); 683Assert.Equal(AtsTypeCategory.Handle, parameter.Type.Category); 684Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(AssemblyLevelExportedTestType)), parameter.Type.TypeId);
AtsContextFilterTests.cs (1)
230Assert.Equal("Aspire.Hosting/Aspire.Hosting.DistributedApplication", supportParameter.Type?.TypeId);