164 writes to TypeId
Aspire.Hosting.CodeGeneration.Java.Tests (44)
AtsJavaCodeGeneratorTests.cs (44)
2698
new AtsTypeRef {
TypeId
= "array", Category = AtsTypeCategory.Array, ElementType = MutableStringDict() });
2713
TypeId
= "list",
2728
var stringType = new AtsTypeRef {
TypeId
= "string", Category = AtsTypeCategory.Primitive };
2729
var innerArray = new AtsTypeRef {
TypeId
= "array", Category = AtsTypeCategory.Array, ElementType = stringType };
2732
new AtsTypeRef {
TypeId
= "array", Category = AtsTypeCategory.Array, ElementType = innerArray });
2775
var resourceType = new AtsTypeRef {
TypeId
= "Tests/ProbeResource", Category = AtsTypeCategory.Handle };
2776
var stringType = new AtsTypeRef {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive };
2777
var innerArray = new AtsTypeRef {
TypeId
= "array", Category = AtsTypeCategory.Array, ElementType = stringType };
2778
var matrixType = new AtsTypeRef {
TypeId
= "array", Category = AtsTypeCategory.Array, ElementType = innerArray };
2783
Type = new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback },
2785
CallbackReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
2792
ReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive },
2813
var resourceType = new AtsTypeRef {
TypeId
= "Tests/ProbeResource", Category = AtsTypeCategory.Handle };
2817
Type = new AtsTypeRef {
TypeId
= AtsConstants.CancellationToken, Category = AtsTypeCategory.Dto }
2824
ReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive },
2841
var resourceType = new AtsTypeRef {
TypeId
= "Tests/ProbeResource", Category = AtsTypeCategory.Handle };
2859
TypeId
= AtsConstants.Number,
2885
TypeId
= "Tests/ProbeResource",
2893
new AtsTypeRef {
TypeId
= AtsConstants.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }),
2897
new AtsTypeRef {
TypeId
= AtsConstants.Number, Category = AtsTypeCategory.Primitive, IsNullable = true }));
3015
var resourceType = new AtsTypeRef {
TypeId
= "Tests/ProbeResource", Category = AtsTypeCategory.Handle };
3018
TypeId
= AtsConstants.Number,
3024
TypeId
= AtsConstants.Boolean,
3030
TypeId
= "numberArray",
3036
TypeId
= "booleanArray",
3042
TypeId
= "booleanMatrix",
3050
Type = new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback },
3056
CallbackReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
3063
ReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive },
3271
var contextType = new AtsTypeRef {
TypeId
= "Tests/MutableContext", Category = AtsTypeCategory.Dto };
3287
Type = new AtsTypeRef {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive }
3300
Type = new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback },
3308
TypeId
= AtsConstants.Void,
3362
var resourceType = new AtsTypeRef {
TypeId
= "Tests/ProbeResource", Category = AtsTypeCategory.Handle };
3363
var contextType = new AtsTypeRef {
TypeId
= "Tests/MutableContext", Category = AtsTypeCategory.Dto };
3368
Type = new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback },
3373
CallbackReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
3380
ReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive },
3402
Type = new AtsTypeRef {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive }
3589
Type = new AtsTypeRef {
TypeId
= "KeywordProbe", Category = AtsTypeCategory.Dto }
3648
new AtsTypeRef {
TypeId
= "string", Category = AtsTypeCategory.Primitive });
3679
TypeId
= "dict",
3682
KeyType = new AtsTypeRef {
TypeId
= "string", Category = AtsTypeCategory.Primitive },
3683
ValueType = new AtsTypeRef {
TypeId
= "string", Category = AtsTypeCategory.Primitive }
Aspire.Hosting.CodeGeneration.Python.Tests (19)
AtsPythonCodeGeneratorTests.cs (19)
498
TypeId
= "Tests/KeywordResource",
523
TypeId
= AtsConstants.String,
554
TypeId
= "Tests/AcronymResource",
579
TypeId
= AtsConstants.String,
613
TypeId
= genericBaseType.AssemblyQualifiedName!,
620
TypeId
= genericInterfaceType.AssemblyQualifiedName!,
628
TypeId
= "Tests/GenericResource",
653
TypeId
= AtsConstants.Void,
693
TypeId
= "Tests/NullableUnion",
699
TypeId
= "Tests/NestedNullableUnion",
705
TypeId
= AtsConstants.Number,
713
TypeId
= AtsConstants.String,
748
TypeId
= "Tests/NullableItems",
752
TypeId
= AtsConstants.Number,
762
TypeId
= AtsConstants.Void,
798
TypeId
= AtsConstants.String,
804
TypeId
= AtsConstants.Boolean,
810
TypeId
= "Tests/CollidingAlphaResource",
817
TypeId
= "Tests/CollidingBetaResource",
Aspire.Hosting.CodeGeneration.TypeScript.Tests (30)
AtsTypeScriptCodeGeneratorTests.cs (30)
275
TypeId
= $"{ApiExportPackageName}/PropertyContext",
280
TypeId
= AtsConstants.String,
889
TypeId
= AtsConstants.Number,
895
TypeId
= $"{AtsConstants.Number}[]",
946
TypeId
= "test/EmptyUnion",
962
TypeId
= "string",
967
TypeId
= "list",
973
TypeId
= "dictionary",
989
TypeId
= AtsConstants.Number,
995
TypeId
= "dictionary",
997
KeyType = new AtsTypeRef {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive },
1000
TypeId
= "list",
1575
TypeId
= $"{resourceType.Assembly.GetName().Name}/{resourceType.FullName}",
1836
TypeId
= GetAtsTypeId(typeof(TResource)),
1849
TypeId
= AtsConstants.Void,
1874
TypeId
= AtsConstants.Void,
2833
TypeId
= $"{ApiExportPackageName}/PromiseContext",
2838
TypeId
= AtsConstants.String,
2843
TypeId
= AtsConstants.Void,
3038
TypeId
= $"{eventHubsPackage}/AzureEventHubsEmulatorResource",
3046
TypeId
= $"{serviceBusPackage}/AzureServiceBusEmulatorResource",
3132
TypeId
= targetTypeId,
3147
TypeId
= AtsConstants.Void,
3250
TypeId
= $"Aspire.Hosting/{targetTypeName}",
3265
TypeId
= "callback",
3280
TypeId
= AtsConstants.Void,
3287
TypeId
= AtsConstants.Void,
3314
TypeId
= AtsConstants.String,
3323
TypeId
= AtsConstants.Number,
3331
TypeId
= AtsConstants.Void,
Aspire.Hosting.RemoteHost (39)
Ats\AtsMarshaller.cs (1)
426
TypeId
= AtsTypeMapping.DeriveTypeId(type),
Ats\ExternalCapabilityRegistry.cs (2)
796
: new AtsTypeRef {
TypeId
= "unknown", Category = AtsTypeCategory.Unknown }
808
TypeId
= typeRef.TypeId,
AtsCapabilityScanner.cs (34)
929
TypeId
= originalTarget,
959
TypeId
= typeInfo.AtsTypeId,
1171
? new AtsTypeRef {
TypeId
= "callback", ClrType = prop.PropertyType, Category = AtsTypeCategory.Callback }
1691
: new AtsTypeRef {
TypeId
= AtsConstants.Any, Category = AtsTypeCategory.Primitive };
1695
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
1718
propertyTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Any, Category = AtsTypeCategory.Primitive };
2231
? new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback }
2288
returnTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
2292
returnTypeRef = 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 }
2334
var voidTypeRef = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive };
2669
TypeId
= AtsConstants.Void,
2684
TypeId
= typeRef.TypeId,
2764
return new AtsTypeRef {
TypeId
= primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive };
2770
return new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive };
2777
TypeId
= AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any),
2780
KeyType = new AtsTypeRef {
TypeId
= AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive },
2781
ValueType = new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive },
2790
TypeId
= AtsConstants.ListTypeId(AtsConstants.Any),
2793
ElementType = new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }
2805
TypeId
= AtsConstants.EnumTypeId(type.FullName ?? type.Name),
2828
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2851
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2873
TypeId
= AtsConstants.ListTypeId(elementTypeRef.TypeId),
2893
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2938
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2954
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2966
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2976
TypeId
= AtsTypeMapping.DeriveTypeId(type),
3071
TypeId
= ifaceTypeId,
3138
TypeId
= typeId,
3397
TypeId
= string.Join("|", unionTypes.Select(u => u.TypeId)),
AtsContextFilter.cs (2)
324
TypeId
= targetTypeId,
344
TypeId
= AtsConstants.Void,
Aspire.Hosting.RemoteHost.Tests (32)
AtsContextFilterTests.cs (17)
191
TypeId
= "Aspire.TypeSystem/AtsContext",
198
TypeId
= "Aspire.Hosting/Aspire.Hosting.DistributedApplication",
204
TypeId
= referencedHandleType.AtsTypeId,
276
TypeId
= foreignEnum.TypeId,
285
Type = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive },
294
TypeId
= foreignCallbackEnum.TypeId,
434
TypeId
= AtsConstants.EnumTypeId(typeof(TestMode).FullName!),
487
TypeId
= exportedValueOnlyEnumType.TypeId,
507
TypeId
= selectedHandleType.AtsTypeId,
517
TypeId
= referencedCoreDtoType.TypeId,
527
TypeId
= referencedCoreEnumType.TypeId,
535
TypeId
= referencedCoreHandleType.AtsTypeId,
543
TypeId
= selectedHandleType.AtsTypeId,
560
TypeId
= unrelatedCoreHandleType.AtsTypeId,
578
TypeId
= "System/String",
591
TypeId
= exportedValueOnlyDtoType.TypeId,
604
TypeId
= "System/String",
AtsMarshallerTests.cs (12)
171
TypeId
= "string|number|boolean",
175
new AtsTypeRef {
TypeId
= AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive },
176
new AtsTypeRef {
TypeId
= AtsConstants.Number, ClrType = typeof(int), Category = AtsTypeCategory.Primitive },
177
new AtsTypeRef {
TypeId
= AtsConstants.Boolean, ClrType = typeof(bool), Category = AtsTypeCategory.Primitive }
194
TypeId
= "string|resource",
198
new AtsTypeRef {
TypeId
= AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive },
199
new AtsTypeRef {
TypeId
= "test/IResource", ClrType = typeof(IResource), Category = AtsTypeCategory.Handle }
216
TypeId
= "string|boolean",
220
new AtsTypeRef {
TypeId
= AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive },
221
new AtsTypeRef {
TypeId
= AtsConstants.Boolean, ClrType = typeof(bool), Category = AtsTypeCategory.Primitive }
293
TypeId
= AtsConstants.CancellationToken,
1021
var typeRef = new AtsTypeRef {
TypeId
= "test/SelfReferencingDto", Category = AtsTypeCategory.Dto };
ExternalCapabilityRegistryTests.cs (3)
894
ReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Boolean, Category = AtsTypeCategory.Primitive }
920
ReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Boolean, Category = AtsTypeCategory.Primitive }
964
Type = new AtsTypeRef {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive },
395 references to TypeId
Aspire.Hosting.CodeGeneration.Go (31)
AtsGoCodeGenerator.cs (31)
184
if (!string.IsNullOrEmpty(expanded.
TypeId
))
186
expansionTargetIds.Add(expanded.
TypeId
);
315
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
316
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
322
set.Add(typeRef.
TypeId
);
432
if (string.IsNullOrEmpty(targetType.
TypeId
))
438
if (!_implNames.ContainsKey(targetType.
TypeId
))
442
if (!result.TryGetValue(targetType.
TypeId
, out var list))
445
result[targetType.
TypeId
] = list;
694
AtsTypeCategory.Enum => $"{MapEnumType(typeRef.
TypeId
)}({value.ToRelaxedJsonString()})",
695
AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoInfo)
710
? MapPrimitiveType(typeRef.
TypeId
)
711
: MapEnumType(typeRef.
TypeId
);
1101
sb.Append(MapDtoType(directOptionsParam.Type!.
TypeId
));
1147
&& p.CallbackReturnType.
TypeId
!= AtsConstants.Void;
1164
var hasReturn = capability.ReturnType is not null && capability.ReturnType.
TypeId
!= AtsConstants.Void;
1181
if (IsSameType(returnType.
TypeId
, capability, currentTypeId))
1277
var isFluent = IsSameType(returnType.
TypeId
, capability, currentTypeId);
1291
var childImplName = returnType.
TypeId
is not null && _implNames.TryGetValue(returnType.
TypeId
, out var implTarget)
1466
var dtoType = MapDtoType(directOptionsParam.Type!.
TypeId
);
1557
&& p.CallbackReturnType.
TypeId
!= AtsConstants.Void;
1908
var hasReturn = capability.ReturnType is not null && capability.ReturnType.
TypeId
!= AtsConstants.Void;
2098
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2105
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
2106
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
2107
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
2108
AtsTypeCategory.Dto => "*" + MapDtoType(typeRef.
TypeId
),
2136
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2166
&& typeRef.
TypeId
is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken);
2212
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
Aspire.Hosting.CodeGeneration.Go.Tests (2)
AtsGoCodeGeneratorTests.cs (2)
326
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
444
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
Aspire.Hosting.CodeGeneration.Java (39)
AtsJavaCodeGenerator.cs (39)
880
AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoInfo)
1013
if (!string.Equals(left.Type?.
TypeId
, right.Type?.
TypeId
, StringComparison.Ordinal))
1037
if (!string.Equals(leftCallbackParameters[i].Type.
TypeId
, rightCallbackParameters[i].Type.
TypeId
, StringComparison.Ordinal))
1043
return string.Equals(left.CallbackReturnType?.
TypeId
, right.CallbackReturnType?.
TypeId
, StringComparison.Ordinal);
1885
var returnsDifferentBuilder = capability.ReturnType?.
TypeId
is { } returnTypeId &&
1890
? new(MapHandleType(capability.ReturnType!.
TypeId
!), HasReturn: true, ReturnsCurrentBuilder: false)
1894
var hasReturn = capability.ReturnType?.
TypeId
!= AtsConstants.Void;
1909
var hasReturnType = callbackReturnType != null && callbackReturnType.
TypeId
!= AtsConstants.Void;
1943
var hasReturnType = callbackParam.CallbackReturnType != null && callbackParam.CallbackReturnType.
TypeId
!= AtsConstants.Void;
1999
var hasReturnType = property.CallbackReturnType != null && property.CallbackReturnType.
TypeId
!= AtsConstants.Void;
2029
if (callbackParameter.Type?.
TypeId
== AtsConstants.CancellationToken)
2049
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2054
if (IsCancellationTokenTypeId(typeRef.
TypeId
))
2062
AtsTypeCategory.Primitive => RenderJavaPrimitiveTransportValueConversion(typeRef.
TypeId
, valueExpression, allowNull),
2063
AtsTypeCategory.Enum => RenderJavaEnumTransportValueConversion(typeRef.
TypeId
, valueExpression, allowNull),
2064
AtsTypeCategory.Dto => RenderJavaDtoTransportValueConversion(typeRef.
TypeId
, valueExpression, allowNull),
2228
if (typeRef.
TypeId
== AtsConstants.CancellationToken)
2481
.FirstOrDefault(baseType => !string.Equals(baseType.
TypeId
, typeId, StringComparison.Ordinal)
2482
&& _classNames.ContainsKey(baseType.
TypeId
));
2486
baseClassName = _classNames[exportedBaseType.
TypeId
];
2520
if (targetType.
TypeId
is null)
2525
if (!result.TryGetValue(targetType.
TypeId
, out var list))
2528
result[targetType.
TypeId
] = list;
2568
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2575
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
, isOptional || useBoxedTypes),
2576
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
2577
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
2578
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
2600
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2622
if (IsCancellationTokenTypeId(typeRef.
TypeId
))
2682
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
2696
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
2697
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
2704
handleTypeIds.Add(typeRef.
TypeId
);
2719
typeIds[typeRef.
TypeId
] = false; // false = List
2726
typeIds[typeRef.
TypeId
] = true; // true = Dict
Aspire.Hosting.CodeGeneration.Java.Tests (13)
AtsJavaCodeGeneratorTests.cs (13)
184
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
326
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
2793
TargetTypeId = resourceType.
TypeId
,
2825
TargetTypeId = resourceType.
TypeId
,
2867
TargetTypeId = resourceType.
TypeId
,
3064
TargetTypeId = resourceType.
TypeId
,
3078
HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.
TypeId
! }],
3281
TypeId = contextType.
TypeId
!,
3381
TargetTypeId = resourceType.
TypeId
,
3390
HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.
TypeId
! }],
3396
TypeId = contextType.
TypeId
!,
3691
HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.
TypeId
! }],
3705
TargetTypeId = resourceType.
TypeId
,
Aspire.Hosting.CodeGeneration.Python (51)
AtsPythonCodeGenerator.cs (51)
173
if (capabilityTargetType.
TypeId
== builderTargetType.
TypeId
)
183
if (capabilityTargetType.
TypeId
== currentBase.
TypeId
)
191
if (currentBase.ImplementedInterfaces.Any(i => i.
TypeId
== capabilityTargetType.
TypeId
))
215
if (_wrapperClassNames.TryGetValue(typeRef.
TypeId
, out var wrapperClassName))
222
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
223
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
224
AtsTypeCategory.Handle => GetWrapperOrHandleName(typeRef.
TypeId
),
225
AtsTypeCategory.Dto => GetDtoClassName(typeRef.
TypeId
),
247
&& typeRef.
TypeId
is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken);
275
if (param.Type?.
TypeId
== AtsConstants.CancellationToken)
288
if (param.Type?.
TypeId
== AtsConstants.CancellationToken)
305
? JsonValue.Create(callbackParameter.Type.
TypeId
)!.ToJsonString()
454
filtered = filtered.Where(p => p.Type?.
TypeId
!= AtsConstants.CancellationToken);
466
if (param.Type?.
TypeId
== AtsConstants.CancellationToken)
528
if (typeRef.Category == AtsTypeCategory.Primitive && typeRef.
TypeId
== AtsConstants.Void)
661
if (param.Type?.
TypeId
== AtsConstants.CancellationToken)
686
private static string? GetReturnTypeId(AtsCapabilityInfo capability) => capability.ReturnType?.
TypeId
;
803
if (IsHandleType(cap.ReturnType) && !dtoTypeIds.Contains(cap.ReturnType!.
TypeId
))
810
if (IsHandleType(param.Type) && !dtoTypeIds.Contains(param.Type!.
TypeId
))
812
typeIds.Add(param.Type!.
TypeId
);
819
if (IsHandleType(cbParam.Type) && !dtoTypeIds.Contains(cbParam.Type.
TypeId
))
821
typeIds.Add(cbParam.Type.
TypeId
);
999
AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoInfo)
1359
var returnsSelf = isDistributedApplicationBuilder && capability.ReturnType?.
TypeId
== capability.TargetTypeId;
1463
.Select(i => i.
TypeId
),
1466
.Where(i => !transitivelyImplemented.Contains(i.
TypeId
))
1468
baseClass = string.Join(", ", implementedInterfaces.Select(i => DeriveClassName(i.
TypeId
)));
1528
baseTypeInterfaces = baseType.ImplementedInterfaces.Select(i => i.
TypeId
).ToList();
1537
var implementedInterfaces = builder.TargetType?.ImplementedInterfaces.Where(i => !baseTypeInterfaces.Contains(i.
TypeId
)).ToList();
1544
.Select(i => i.
TypeId
),
1547
.Where(i => !transitivelyImplemented.Contains(i.
TypeId
))
1664
var returnsBuilder = capability.ReturnsBuilder && capability.ReturnType!.
TypeId
== capability.TargetTypeId;
1665
var returnsChildBuilder = capability.ReturnsBuilder && capability.ReturnType != null && IsHandleType(capability.ReturnType) && capability.ReturnType.
TypeId
!= capability.TargetTypeId;
1945
if (!capabilitiesByTypeId.TryGetValue(expandedType.
TypeId
, out var list))
1948
capabilitiesByTypeId[expandedType.
TypeId
] = list;
1949
typeRefsByTypeId[expandedType.
TypeId
] = expandedType;
2045
.Select(i => i.
TypeId
)
2172
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.Handle)
2174
typeRefs.TryAdd(typeRef.
TypeId
, typeRef);
2176
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.Dict)
2178
_moduleBuilder.HandleRegistrations.TryAdd(typeRef.
TypeId
, "AspireDict");
2180
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.List)
2182
_moduleBuilder.HandleRegistrations.TryAdd(typeRef.
TypeId
, "AspireList");
2261
return DeriveClassName(typeRef.
TypeId
);
2430
var tickIndex = typeRef.
TypeId
.IndexOf('`');
2433
return typeRef.
TypeId
[..tickIndex] + "T";
2436
return typeRef.
TypeId
+ "T";
2439
return typeRef.
TypeId
;
Aspire.Hosting.CodeGeneration.Python.Tests (14)
AtsPythonCodeGeneratorTests.cs (14)
101
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
219
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
529
TargetTypeId = resourceType.
TypeId
,
541
AtsTypeId = resourceType.
TypeId
,
585
TargetTypeId = resourceType.
TypeId
,
597
AtsTypeId = resourceType.
TypeId
,
656
TargetTypeId = resourceType.
TypeId
,
667
AtsTypeId = resourceType.
TypeId
,
674
AtsTypeId = genericBaseTypeRef.
TypeId
,
679
AtsTypeId = genericInterfaceTypeRef.
TypeId
,
840
TargetTypeId = projectType.
TypeId
,
861
TargetTypeId = containerType.
TypeId
,
873
AtsTypeId = projectType.
TypeId
,
878
AtsTypeId = containerType.
TypeId
,
Aspire.Hosting.CodeGeneration.Rust (31)
AtsRustCodeGenerator.cs (31)
375
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
376
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
386
AtsTypeCategory.Dto => !dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dto)
472
var hasReturn = capability.ReturnType.
TypeId
!= AtsConstants.Void;
605
var wrappedType = MapHandleType(returnTypeRef.
TypeId
);
609
else if (returnTypeRef?.
TypeId
== AtsConstants.CancellationToken)
858
if (targetType.
TypeId
is null)
863
if (!result.TryGetValue(targetType.
TypeId
, out var list))
866
result[targetType.
TypeId
] = list;
905
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
912
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
913
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
914
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
915
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
943
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
950
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
951
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
954
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
983
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
990
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
991
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
992
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
1037
var baseType = typeRef.
TypeId
switch
1062
&& typeRef.
TypeId
is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken);
1066
&& typeRef.
TypeId
!= AtsConstants.ReferenceExpressionTypeId
1067
&& !IsCancellationTokenTypeId(typeRef.
TypeId
);
1081
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
1095
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
1096
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
1103
handleTypeIds.Add(typeRef.
TypeId
);
1118
typeIds.Add(typeRef.
TypeId
);
Aspire.Hosting.CodeGeneration.Rust.Tests (2)
AtsRustCodeGeneratorTests.cs (2)
160
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
278
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
Aspire.Hosting.CodeGeneration.TypeScript (100)
AtsTypeScriptCodeGenerator.cs (46)
134
capability.ReturnType.
TypeId
== AtsConstants.Void ? null : capability.Documentation?.Returns,
135
suppressReturns: capability.ReturnType.
TypeId
== AtsConstants.Void,
386
!_projector.DtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoType))
401
!_projector.DtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoType))
407
if (!visitedDtoTypeIds.Add(typeRef.
TypeId
))
418
visitedDtoTypeIds.Remove(typeRef.
TypeId
);
429
private static string? GetReturnTypeId(AtsCapabilityInfo capability) => capability.ReturnType?.
TypeId
;
926
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
929
if (capability.ReturnType != null && _projector.TypesWithPromiseWrappers.Contains(capability.ReturnType.
TypeId
))
931
WriteLine($" {signature.MethodName}({signature.ParameterList}): {_projector.GetPublicPromiseInterfaceName(capability.ReturnType.
TypeId
)};");
1117
if (capability.ReturnsBuilder && capability.ReturnType?.
TypeId
!= null &&
1118
!string.Equals(capability.ReturnType.
TypeId
, builder.TypeId, StringComparison.Ordinal) &&
1119
!string.Equals(capability.ReturnType.
TypeId
, capability.TargetTypeId, StringComparison.Ordinal))
1121
returnTypeId = capability.ReturnType.
TypeId
;
1137
var wrappedReturnTypeId = capability.ReturnType!.
TypeId
;
1203
if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
1444
if (param.Type is not {
TypeId
: var dtoTypeId })
1514
if (!visitedDtoTypeIds.Add(dtoProperty.Type.
TypeId
))
1530
visitedDtoTypeIds.Remove(dtoProperty.Type.
TypeId
);
1614
if (capability.ReturnsBuilder && capability.ReturnType?.
TypeId
!= null &&
1615
!string.Equals(capability.ReturnType.
TypeId
, builder.TypeId, StringComparison.Ordinal) &&
1616
!string.Equals(capability.ReturnType.
TypeId
, capability.TargetTypeId, StringComparison.Ordinal))
1618
var returnClass = _projector.WrapperClassNames.GetValueOrDefault(capability.ReturnType.
TypeId
)
1619
?? TypeScriptApiProjector.DeriveClassName(capability.ReturnType.
TypeId
);
1787
else if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
1865
&& callbackParam.CallbackReturnType.
TypeId
!= AtsConstants.Void;
1900
var cbTypeId = callbackParameter.Type.
TypeId
;
2239
if (getter.ReturnType?.
TypeId
!= null && _projector.WrapperClassNames.TryGetValue(getter.ReturnType.
TypeId
, out var wrapperClassName))
2253
if (getter.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
2306
if (getter.ReturnType?.
TypeId
!= null && _projector.WrapperClassNames.TryGetValue(getter.ReturnType.
TypeId
, out var wrapperClassName))
2333
if (getter.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
2354
var handleType = _projector.GetConcreteHandleTypeName(getter.ReturnType!.
TypeId
);
2408
var handleType = _projector.GetConcreteHandleTypeName(getter.ReturnType!.
TypeId
);
2631
var returnTypeId = method.ReturnType!.
TypeId
;
2682
else if (method.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
2744
var returnTypeId = capability.ReturnType!.
TypeId
;
2870
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
2875
var returnWrapperClass = _projector.WrapperClassNames.GetValueOrDefault(capability.ReturnType!.
TypeId
)
2876
?? TypeScriptApiProjector.DeriveClassName(capability.ReturnType.
TypeId
);
2879
var returnHandleType = _projector.GetConcreteHandleTypeName(capability.ReturnType.
TypeId
);
3012
if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
3077
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
3081
_projector.WrapperClassNames.GetValueOrDefault(capability.ReturnType!.
TypeId
)
3082
?? 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;
407
return capability.ReturnType is {
TypeId
: { } returnTypeId }
419
if (capability.ReturnType is { } returnType && _typesWithPromiseWrappers.Contains(returnType.
TypeId
))
421
return GetPublicPromiseInterfaceName(returnType.
TypeId
);
424
if (capability.ReturnType is null || capability.ReturnType.
TypeId
== AtsConstants.Void)
773
AtsTypeCategory.Dto when value is JsonObject obj && _dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoInfo)
1311
var returnTypeId = capability.ReturnType?.
TypeId
;
1663
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
1668
if (typeRef.
TypeId
== InputTypeTypeId)
1673
if (typeRef.
TypeId
== InteractionInputTypeId)
1678
if (typeRef.
TypeId
== InteractionInputCollectionTypeId)
1684
if (_wrapperClassNames.TryGetValue(typeRef.
TypeId
, out var wrapperClassName))
1691
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
1692
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
1693
AtsTypeCategory.Handle => GetWrapperOrHandleName(typeRef.
TypeId
),
1694
AtsTypeCategory.Dto => GetDtoInterfaceName(typeRef.
TypeId
),
1715
return typeRef.
TypeId
is AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken
1875
if (IsHandleType(typeRef) && _wrapperClassNames.TryGetValue(typeRef!.
TypeId
, out var className))
1881
if (typeRef?.
TypeId
== InteractionInputCollectionTypeId)
1959
if (!IsAssignableToInterface(candidateTypeRef, typeRef.
TypeId
) ||
1960
!_wrapperClassNames.TryGetValue(candidateTypeRef.
TypeId
, out var wrapperClassName))
1981
if (string.Equals(candidateTypeRef.
TypeId
, interfaceTypeId, StringComparison.Ordinal))
2011
internal static bool IsCancellationTokenType(AtsTypeRef? typeRef) => typeRef?.
TypeId
== AtsConstants.CancellationToken;
2327
var aTypeId = a.Type?.
TypeId
;
2328
var bTypeId = b.Type?.
TypeId
;
2352
if (!string.Equals(aCallbackParams[i].Type.
TypeId
, bCallbackParams[i].Type.
TypeId
, StringComparison.Ordinal))
2359
var aReturnTypeId = a.CallbackReturnType?.
TypeId
;
2360
var bReturnTypeId = b.CallbackReturnType?.
TypeId
;
2486
if (typeRef?.
TypeId
is { } typeId && _typesWithPromiseWrappers.Contains(typeId))
2511
if (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))
2515
return GetPublicPromiseInterfaceName(capability.ReturnType.
TypeId
);
2541
if (IsHandleType(typeRef) && _wrapperClassNames.ContainsKey(typeRef.
TypeId
))
2546
if (typeRef.
TypeId
== InteractionInputCollectionTypeId)
2686
if (!capabilitiesByTypeId.TryGetValue(expandedType.
TypeId
, out var list))
2689
capabilitiesByTypeId[expandedType.
TypeId
] = list;
2691
typeRefsByTypeId[expandedType.
TypeId
] = expandedType;
2908
return IsTypeInHierarchy(retainedType, candidateType.
TypeId
) ||
2909
IsTypeInHierarchy(candidateType, retainedType.
TypeId
);
2915
string.Equals(interfaceType.
TypeId
, typeId, StringComparison.Ordinal) ||
2922
(string.Equals(baseType.
TypeId
, typeId, StringComparison.Ordinal) ||
2942
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.Handle)
2944
typeRefs.TryAdd(typeRef.
TypeId
, typeRef);
3085
if (_typesWithPromiseWrappers.Contains(returnType.
TypeId
))
3087
var className = _wrapperClassNames.GetValueOrDefault(returnType.
TypeId
)
3088
?? DeriveClassName(returnType.
TypeId
);
3112
var returnType = callbackReturnType == null || callbackReturnType.
TypeId
== AtsConstants.Void
Aspire.Hosting.CodeGeneration.TypeScript.Tests (46)
AtsTypeScriptCodeGeneratorTests.cs (46)
165
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
291
TargetTypeId = targetType.
TypeId
,
303
TargetTypeId = targetType.
TypeId
,
414
Assert.Equal("string", nameGetterCapability.ReturnType?.
TypeId
);
424
Assert.Equal("Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", nameSetterCapability.ReturnType?.
TypeId
); // Returns context for fluent chaining
432
Assert.Equal("number", valueGetterCapability.ReturnType?.
TypeId
);
515
t.
TypeId
== "Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource");
651
Assert.Contains(withBrowserLogs.Parameters, p => p.Name == "browser" && p.Type?.
TypeId
== "string" && p.IsOptional);
652
Assert.Contains(withBrowserLogs.Parameters, p => p.Name == "profile" && p.Type?.
TypeId
== "string" && p.IsOptional);
666
c.ExpandedTargetTypes.Any(t => t.
TypeId
.Contains("ContainerResource")))
671
TargetType = c.TargetType != null ? new { c.TargetType.
TypeId
, c.TargetType.IsInterface } : null,
673
.Where(t => t.
TypeId
.Contains("ContainerResource"))
674
.Select(t => new { t.
TypeId
, t.IsInterface })
714
if (expandedType.
TypeId
.Contains("ContainerResource"))
717
$"Capability '{cap.CapabilityId}' ExpandedTargetType '{expandedType.
TypeId
}' has IsInterface = true");
740
Assert.Equal("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource", withBindMount.TargetType.
TypeId
);
769
Assert.Contains("IResourceWithConnectionString", withConnectionStringDirect.TargetType.
TypeId
);
777
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
797
Assert.Contains("TestRedisResource", withRedisSpecific.TargetType.
TypeId
);
805
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
823
Assert.Contains("ContainerResource", withBindMount.TargetType.
TypeId
);
831
.FirstOrDefault(t => t.
TypeId
.Contains("ContainerResource") && !t.
TypeId
.Contains("IContainer"));
1060
$"Expanded type '{expandedType.
TypeId
}' should be a concrete type, not an interface");
1084
Assert.Contains("IResourceWithEnvironment", testWithEnvironmentCallback.TargetType.
TypeId
);
1093
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
1243
Assert.Equal("string", capability.Parameters.Single().Type?.
TypeId
);
1300
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
1412
.ReturnType!.
TypeId
;
1953
Assert.Equal(expectedTypes.Select(GetAtsTypeId), parameter.CallbackParameters.Select(p => p.Type?.
TypeId
));
1963
Assert.Equal(GetAtsTypeId(parameterType), parameter.Type?.
TypeId
);
2103
Assert.Equal("any", valueParam.Type.
TypeId
);
2251
Assert.Equal(AtsConstants.CancellationToken, ctParam.Type.
TypeId
);
2286
Assert.Equal(AtsConstants.CancellationToken, operationParam.CallbackParameters[0].Type?.
TypeId
);
2305
Assert.Equal(AtsConstants.TimeSpan, timeoutParam.Type?.
TypeId
);
2309
Assert.Equal(AtsConstants.CancellationToken, ctParam.Type?.
TypeId
);
2325
Assert.Equal("Aspire.Hosting.Dotnet/Aspire.Hosting.Dotnet.DotnetProjectOptions", options.Type.
TypeId
);
2326
var dto = Assert.Single(context.DtoTypes, dto => dto.TypeId == options.Type.
TypeId
);
2341
Assert.Equal(legacyTypeId, legacyOptions.Type.
TypeId
);
2644
var expandedTypeIds = withNpm.ExpandedTargetTypes.Select(t => t.
TypeId
).ToList();
2675
var expandedTypeIds = capability.ExpandedTargetTypes.Select(t => t.
TypeId
).ToList();
2854
TargetTypeId = targetType.
TypeId
,
2866
TargetTypeId = targetType.
TypeId
,
2878
TargetTypeId = targetType.
TypeId
,
2890
TargetTypeId = targetType.
TypeId
,
3290
TargetTypeId = targetType.
TypeId
,
Aspire.Hosting.RemoteHost (42)
Ats\AtsMarshaller.cs (6)
144
if (typeRef.
TypeId
== AtsConstants.CancellationToken && value is CancellationToken cancellationToken)
150
if (typeRef.
TypeId
== TypeSystem.AtsConstants.Any)
157
AtsTypeCategory.Handle => _handles.Marshal(value, typeRef.
TypeId
),
162
AtsTypeCategory.List => _handles.Marshal(value, typeRef.
TypeId
),
163
AtsTypeCategory.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)
686
enumTypes.TryAdd(typeRef.
TypeId
, typeRef.ClrType);
768
if (typeRef.Category == AtsTypeCategory.Unknown && validTypes.Contains(typeRef.
TypeId
))
865
return typeRef.
TypeId
;
974
AddToCompatibilityMap(typeToCompatibleTypes, iface.
TypeId
, concreteTypeRef);
980
AddToCompatibilityMap(typeToCompatibleTypes, baseType.
TypeId
, concreteTypeRef);
1013
.SelectMany(c => c.ExpandedTargetTypes.Select(t => (Target: t.
TypeId
, Capability: c)))
1085
.Where(t => !targetIds.Contains(t.
TypeId
))
1386
AtsTypeCategory.Primitive => typeRef.
TypeId
!= AtsConstants.CancellationToken && typeRef.
TypeId
!= AtsConstants.Void,
1409
if (!visitedDtoTypeIds.Add(typeRef.
TypeId
))
1439
_ = visitedDtoTypeIds.Remove(typeRef.
TypeId
);
1695
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
1701
propertyTypeId = propertyTypeRef.
TypeId
;
1714
propertyTypeId = propertyTypeRef.
TypeId
;
1719
propertyTypeId = propertyTypeRef.
TypeId
;
2109
var firstParamTypeId = extendsTypeRef?.
TypeId
?? MapToAtsTypeId(firstParamType, assemblyExportedTypeCache);
2684
TypeId = typeRef.
TypeId
,
2828
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2851
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2873
TypeId = AtsConstants.ListTypeId(elementTypeRef.
TypeId
),
2893
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
2938
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
3397
TypeId = string.Join("|", unionTypes.Select(u => u.
TypeId
)),
AtsContextFilter.cs (8)
174
yield return targetType.
TypeId
;
179
yield return expandedTargetType.
TypeId
;
394
if (typeRef.Category == AtsTypeCategory.Handle && !string.IsNullOrEmpty(typeRef.
TypeId
))
396
referencedHandleTypes.TryAdd(typeRef.
TypeId
, typeRef);
426
if (handleTypesById.TryGetValue(typeRef.
TypeId
, out var handleType) && includedHandleTypeIds.Add(handleType.AtsTypeId))
431
if (dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoType) && includedDtoTypeIds.Add(dtoType.TypeId))
436
if (enumTypesById.ContainsKey(typeRef.
TypeId
))
438
includedEnumTypeIds.Add(typeRef.
TypeId
);
CodeGeneration\CodeGenerationService.cs (1)
150
TypeId = t.
TypeId
,
Aspire.Hosting.RemoteHost.Tests (24)
AtsCapabilityScannerTests.cs (20)
160
Assert.Equal("string[]", itemsType.
TypeId
);
165
Assert.Equal("string[]", enumerableReturnCapability.ReturnType.
TypeId
);
179
Assert.Equal(expectedElementTypeId, typeRef.ElementType.
TypeId
);
194
Assert.Contains(parameter.Type.UnionTypes!, type => type.
TypeId
== AtsConstants.String);
337
Assert.Contains(resourceParameter.Type!.UnionTypes!, type => type.
TypeId
== "string");
338
Assert.Contains(resourceParameter.Type.UnionTypes!, type => type.
TypeId
== "Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource");
426
Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(HttpCommandExportOptions)), optionsParameter.Type.
TypeId
);
441
Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(HttpCommandPrepareRequestContext)), callbackParameter.Type.
TypeId
);
443
Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(HttpCommandRequestExportData)), prepareRequestProperty.CallbackReturnType?.
TypeId
);
472
t => t.
TypeId
== AtsTypeMapping.DeriveTypeId(typeof(DerivedExportedProperties)));
491
Assert.Equal(AtsConstants.String, nameGetter.ReturnType.
TypeId
);
496
Assert.Equal(AtsConstants.String, descriptionGetter.ReturnType.
TypeId
);
517
Assert.Equal(AtsConstants.String, nullableString.Type.
TypeId
);
522
Assert.Equal(AtsConstants.String, requiredString.Type.
TypeId
);
527
Assert.Equal(AtsConstants.Number, nullableNumber.Type.
TypeId
);
532
Assert.Equal(AtsConstants.Number, requiredNumber.Type.
TypeId
);
627
Assert.DoesNotContain(genericCapability.ExpandedTargetTypes, t => t.
TypeId
== shadowedTypeId);
628
Assert.Contains(genericCapability.ExpandedTargetTypes, t => t.
TypeId
== otherTypeId);
629
Assert.Contains(specificCapability.ExpandedTargetTypes, t => t.
TypeId
== shadowedTypeId);
684
Assert.Equal(AtsTypeMapping.DeriveTypeId(typeof(AssemblyLevelExportedTestType)), parameter.Type.
TypeId
);
AtsContextFilterTests.cs (2)
230
Assert.Equal("Aspire.Hosting/Aspire.Hosting.DistributedApplication", supportParameter.Type?.
TypeId
);
231
Assert.Equal(AtsConstants.Void, filteredSupport.ReturnType.
TypeId
);
ExternalCapabilityRegistryTests.cs (2)
543
Assert.Equal("string", capability.ReturnType!.
TypeId
);
571
Assert.Equal("string", capability.ReturnType!.
TypeId
);