223 writes to TypeId
Aspire.Hosting.CodeGeneration.Go.Tests (24)
AtsGoDerivedBuilderTests.cs (10)
489
private static readonly AtsTypeRef s_builder = new() {
TypeId
= AtsConstants.BuilderTypeId, Category = AtsTypeCategory.Handle, IsInterface = true };
496
private static readonly AtsTypeRef s_string = new() {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive };
497
private static readonly AtsTypeRef s_poolSettings = new() {
TypeId
= PoolSettingsId, Category = AtsTypeCategory.Dto };
614
private static AtsTypeRef Handle(string typeId) => new() {
TypeId
= typeId, Category = AtsTypeCategory.Handle };
618
TypeId
= AtsConstants.ArrayTypeId(element.TypeId),
626
TypeId
= AtsConstants.ListTypeId(element.TypeId),
633
TypeId
= AtsConstants.DictTypeId(key.TypeId, value.TypeId),
642
TypeId
= string.Join("|", members.Select(member => member.TypeId)),
654
Type = new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback },
657
CallbackReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
GoDocCommentTests.cs (6)
361
var resourceType = new AtsTypeRef {
TypeId
= ResourceTypeId, Category = AtsTypeCategory.Handle };
362
var settingsType = new AtsTypeRef {
TypeId
= SettingsTypeId, Category = AtsTypeCategory.Dto };
363
var statusType = new AtsTypeRef {
TypeId
= StatusTypeId, Category = AtsTypeCategory.Enum };
364
var tagsType = new AtsTypeRef {
TypeId
= "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType };
475
private static AtsTypeRef Primitive(string typeId) => new() {
TypeId
= typeId, Category = AtsTypeCategory.Primitive };
496
var resourceType = new AtsTypeRef {
TypeId
= ResourceTypeId, Category = AtsTypeCategory.Handle };
GoGeneratorEscapingTests.cs (8)
95
var tagsType = new AtsTypeRef {
TypeId
= "Tests/List<string>", Category = AtsTypeCategory.List, ElementType = stringType };
96
var unionType = new AtsTypeRef {
TypeId
= "Tests/Union", Category = AtsTypeCategory.Union, UnionTypes = [stringType, numberType] };
97
var callbackType = new AtsTypeRef {
TypeId
= "Tests/Callback", Category = AtsTypeCategory.Callback };
98
var enumType = new AtsTypeRef {
TypeId
= StatusTypeId, Category = AtsTypeCategory.Enum };
99
var lookupType = new AtsTypeRef {
TypeId
= "Tests/Dict<string,string>", Category = AtsTypeCategory.Dict, KeyType = stringType, ValueType = stringType, IsReadOnly = true };
100
var unknownType = new AtsTypeRef {
TypeId
= "Tests/Unknown", Category = AtsTypeCategory.Unknown };
197
private static AtsTypeRef Primitive(string typeId) => new() {
TypeId
= typeId, Category = AtsTypeCategory.Primitive };
199
private static AtsTypeRef Handle(string typeId) => new() {
TypeId
= typeId, Category = AtsTypeCategory.Handle };
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,
2887
TypeId
= "Tests/ProbeResource",
2895
new AtsTypeRef {
TypeId
= AtsConstants.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }),
2899
new AtsTypeRef {
TypeId
= AtsConstants.Number, Category = AtsTypeCategory.Primitive, IsNullable = true }),
3025
var resourceType = new AtsTypeRef {
TypeId
= "Tests/ProbeResource", Category = AtsTypeCategory.Handle };
3028
TypeId
= AtsConstants.Number,
3034
TypeId
= AtsConstants.Boolean,
3040
TypeId
= "numberArray",
3046
TypeId
= "booleanArray",
3052
TypeId
= "booleanMatrix",
3060
Type = new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback },
3066
CallbackReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
3073
ReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive },
3315
var contextType = new AtsTypeRef {
TypeId
= "Tests/MutableContext", Category = AtsTypeCategory.Dto };
3331
Type = new AtsTypeRef {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive }
3344
Type = new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback },
3352
TypeId
= AtsConstants.Void,
3406
var resourceType = new AtsTypeRef {
TypeId
= "Tests/ProbeResource", Category = AtsTypeCategory.Handle };
3407
var contextType = new AtsTypeRef {
TypeId
= "Tests/MutableContext", Category = AtsTypeCategory.Dto };
3412
Type = new AtsTypeRef {
TypeId
= "callback", Category = AtsTypeCategory.Callback },
3417
CallbackReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive }
3424
ReturnType = new AtsTypeRef {
TypeId
= AtsConstants.Void, Category = AtsTypeCategory.Primitive },
3446
Type = new AtsTypeRef {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive }
3633
Type = new AtsTypeRef {
TypeId
= "KeywordProbe", Category = AtsTypeCategory.Dto }
3692
new AtsTypeRef {
TypeId
= "string", Category = AtsTypeCategory.Primitive });
3723
TypeId
= "dict",
3726
KeyType = new AtsTypeRef {
TypeId
= "string", Category = AtsTypeCategory.Primitive },
3727
ValueType = new AtsTypeRef {
TypeId
= "string", Category = AtsTypeCategory.Primitive }
Aspire.Hosting.CodeGeneration.Python.Tests (20)
AtsPythonCodeGeneratorTests.cs (20)
392
TypeId
= context.DtoTypes.Single(t => t.Name == "TerminalOptions").TypeId,
868
TypeId
= "Tests/KeywordResource",
893
TypeId
= AtsConstants.String,
924
TypeId
= "Tests/AcronymResource",
949
TypeId
= AtsConstants.String,
983
TypeId
= genericBaseType.AssemblyQualifiedName!,
990
TypeId
= genericInterfaceType.AssemblyQualifiedName!,
998
TypeId
= "Tests/GenericResource",
1023
TypeId
= AtsConstants.Void,
1063
TypeId
= "Tests/NullableUnion",
1069
TypeId
= "Tests/NestedNullableUnion",
1075
TypeId
= AtsConstants.Number,
1083
TypeId
= AtsConstants.String,
1118
TypeId
= "Tests/NullableItems",
1122
TypeId
= AtsConstants.Number,
1132
TypeId
= AtsConstants.Void,
1168
TypeId
= AtsConstants.String,
1174
TypeId
= AtsConstants.Boolean,
1180
TypeId
= "Tests/CollidingAlphaResource",
1187
TypeId
= "Tests/CollidingBetaResource",
Aspire.Hosting.CodeGeneration.TypeScript.Tests (30)
AtsTypeScriptCodeGeneratorTests.cs (30)
283
TypeId
= $"{ApiExportPackageName}/PropertyContext",
288
TypeId
= AtsConstants.String,
951
TypeId
= AtsConstants.Number,
957
TypeId
= $"{AtsConstants.Number}[]",
1008
TypeId
= "test/EmptyUnion",
1024
TypeId
= "string",
1029
TypeId
= "list",
1035
TypeId
= "dictionary",
1051
TypeId
= AtsConstants.Number,
1057
TypeId
= "dictionary",
1059
KeyType = new AtsTypeRef {
TypeId
= AtsConstants.String, Category = AtsTypeCategory.Primitive },
1062
TypeId
= "list",
1734
TypeId
= $"{resourceType.Assembly.GetName().Name}/{resourceType.FullName}",
1995
TypeId
= GetAtsTypeId(typeof(TResource)),
2008
TypeId
= AtsConstants.Void,
2033
TypeId
= AtsConstants.Void,
3016
TypeId
= $"{ApiExportPackageName}/PromiseContext",
3021
TypeId
= AtsConstants.String,
3026
TypeId
= AtsConstants.Void,
3221
TypeId
= $"{eventHubsPackage}/AzureEventHubsEmulatorResource",
3229
TypeId
= $"{serviceBusPackage}/AzureServiceBusEmulatorResource",
3315
TypeId
= targetTypeId,
3330
TypeId
= AtsConstants.Void,
3433
TypeId
= $"Aspire.Hosting/{targetTypeName}",
3448
TypeId
= "callback",
3463
TypeId
= AtsConstants.Void,
3470
TypeId
= AtsConstants.Void,
3497
TypeId
= AtsConstants.String,
3506
TypeId
= AtsConstants.Number,
3514
TypeId
= AtsConstants.Void,
Aspire.Hosting.Native.CodeGeneration (34)
src\Aspire.Hosting.RemoteHost\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,
2705
TypeId
= typeRef.TypeId,
2785
return new AtsTypeRef {
TypeId
= primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive };
2791
return new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive };
2798
TypeId
= AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any),
2801
KeyType = new AtsTypeRef {
TypeId
= AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive },
2802
ValueType = new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive },
2811
TypeId
= AtsConstants.ListTypeId(AtsConstants.Any),
2814
ElementType = new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }
2826
TypeId
= AtsConstants.EnumTypeId(type.FullName ?? type.Name),
2849
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2872
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2894
TypeId
= AtsConstants.ListTypeId(elementTypeRef.TypeId),
2914
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2959
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2975
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2987
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2997
TypeId
= AtsTypeMapping.DeriveTypeId(type),
3092
TypeId
= ifaceTypeId,
3159
TypeId
= typeId,
3418
TypeId
= string.Join("|", unionTypes.Select(u => u.TypeId)),
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,
2705
TypeId
= typeRef.TypeId,
2785
return new AtsTypeRef {
TypeId
= primitiveTypeId, ClrType = type, Category = AtsTypeCategory.Primitive };
2791
return new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive };
2798
TypeId
= AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any),
2801
KeyType = new AtsTypeRef {
TypeId
= AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive },
2802
ValueType = new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive },
2811
TypeId
= AtsConstants.ListTypeId(AtsConstants.Any),
2814
ElementType = new AtsTypeRef {
TypeId
= AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }
2826
TypeId
= AtsConstants.EnumTypeId(type.FullName ?? type.Name),
2849
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2872
TypeId
= AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2894
TypeId
= AtsConstants.ListTypeId(elementTypeRef.TypeId),
2914
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2959
TypeId
= AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
2975
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2987
TypeId
= AtsTypeMapping.DeriveTypeId(type),
2997
TypeId
= AtsTypeMapping.DeriveTypeId(type),
3092
TypeId
= ifaceTypeId,
3159
TypeId
= typeId,
3418
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 },
477 references to TypeId
aspire-managed (6)
AppHostServerV2CodeGeneration.cs (2)
116
handles.TryAdd(type.
TypeId
, new AtsTypeInfo { AtsTypeId = type.
TypeId
});
src\Shared\NativeProviderContractReader.cs (4)
43
capability.Parameters is null || capability.ReturnType is null || string.IsNullOrWhiteSpace(capability.ReturnType.
TypeId
))
50
string.IsNullOrWhiteSpace(parameter.Type.
TypeId
))
55
string.IsNullOrWhiteSpace(parameter.CallbackReturnType.
TypeId
) ||
56
parameter.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
))
723
var hasReturn = returnType is not null && returnType.
TypeId
!= AtsConstants.Void;
730
? new GoApiOptions { TypeName = MapDtoType(directOptionsParameter.Type!.
TypeId
), IsDirect = true }
746
ReturnsReceiver = returnsHandle && IsSameType(returnType!.
TypeId
, capability, typeId)
1118
_typeOwners.TryAdd(typeRef.
TypeId
, GetOwningAssemblyName(typeRef.
TypeId
, clrType.Assembly.GetName().Name));
AtsGoCodeGenerator.cs (36)
220
if (!string.IsNullOrEmpty(expanded.
TypeId
))
222
expansionTargetIds.Add(expanded.
TypeId
);
384
.Select(baseType => baseType.
TypeId
)
447
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
448
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
454
set.Add(typeRef.
TypeId
);
564
if (string.IsNullOrEmpty(targetType.
TypeId
))
570
if (!_implNames.ContainsKey(targetType.
TypeId
))
574
if (!result.TryGetValue(targetType.
TypeId
, out var list))
577
result[targetType.
TypeId
] = list;
689
? directOptionsParam.Documentation?.Summary ?? $"Optional parameters; see {RenderTypeLink(MapDtoType(directOptionsParam.Type!.
TypeId
))}."
694
var returnsValue = capability.ReturnType is not null && capability.ReturnType.
TypeId
!= AtsConstants.Void;
988
AtsTypeCategory.Enum => $"{MapEnumType(typeRef.
TypeId
)}({RenderGoJsonValue(value)})",
989
AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoInfo)
1004
? MapPrimitiveType(typeRef.
TypeId
)
1005
: MapEnumType(typeRef.
TypeId
);
1533
sb.Append(MapDtoType(directOptionsParam.Type!.
TypeId
));
1579
&& p.CallbackReturnType.
TypeId
!= AtsConstants.Void;
1596
var hasReturn = capability.ReturnType is not null && capability.ReturnType.
TypeId
!= AtsConstants.Void;
1613
if (IsSameType(returnType.
TypeId
, capability, currentTypeId))
1701
var isFluent = IsSameType(returnType.
TypeId
, capability, currentTypeId);
1715
var childImplName = returnType.
TypeId
is not null && _implNames.TryGetValue(returnType.
TypeId
, out var implTarget)
1890
var dtoType = MapDtoType(directOptionsParam.Type!.
TypeId
);
1983
&& p.CallbackReturnType.
TypeId
!= AtsConstants.Void;
2048
&& _implNames.ContainsKey(type.
TypeId
))
2050
return $"callbackHandleArg({clientExpression}, args, {index}, new{_interfaceNames[type.
TypeId
]}FromHandle)";
2387
var hasReturn = capability.ReturnType is not null && capability.ReturnType.
TypeId
!= AtsConstants.Void;
2601
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2611
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
2612
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
2613
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
, asInput),
2614
AtsTypeCategory.Dto => "*" + MapDtoType(typeRef.
TypeId
),
2642
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2676
&& typeRef.
TypeId
is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken);
2727
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
Aspire.Hosting.CodeGeneration.Go.Tests (10)
AtsGoCodeGeneratorTests.cs (2)
1327
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
1445
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
AtsGoDerivedBuilderTests.cs (6)
618
TypeId = AtsConstants.ArrayTypeId(element.
TypeId
),
626
TypeId = AtsConstants.ListTypeId(element.
TypeId
),
633
TypeId = AtsConstants.DictTypeId(key.
TypeId
, value.
TypeId
),
642
TypeId = string.Join("|", members.Select(member => member.
TypeId
)),
675
TargetTypeId = target.
TypeId
,
GoDocCommentTests.cs (1)
512
ReturnsBuilder = returnType.
TypeId
== ResourceTypeId,
GoGeneratorEscapingTests.cs (1)
247
ReturnsBuilder = returnType.
TypeId
== ResourceTypeId,
Aspire.Hosting.CodeGeneration.Java (39)
AtsJavaCodeGenerator.cs (39)
881
AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoInfo)
1014
if (!string.Equals(left.Type?.
TypeId
, right.Type?.
TypeId
, StringComparison.Ordinal))
1038
if (!string.Equals(leftCallbackParameters[i].Type.
TypeId
, rightCallbackParameters[i].Type.
TypeId
, StringComparison.Ordinal))
1044
return string.Equals(left.CallbackReturnType?.
TypeId
, right.CallbackReturnType?.
TypeId
, StringComparison.Ordinal);
1886
var returnsDifferentBuilder = capability.ReturnType?.
TypeId
is { } returnTypeId &&
1891
? new(MapHandleType(capability.ReturnType!.
TypeId
!), HasReturn: true, ReturnsCurrentBuilder: false)
1895
var hasReturn = capability.ReturnType?.
TypeId
!= AtsConstants.Void;
1910
var hasReturnType = callbackReturnType != null && callbackReturnType.
TypeId
!= AtsConstants.Void;
1944
var hasReturnType = callbackParam.CallbackReturnType != null && callbackParam.CallbackReturnType.
TypeId
!= AtsConstants.Void;
2000
var hasReturnType = property.CallbackReturnType != null && property.CallbackReturnType.
TypeId
!= AtsConstants.Void;
2030
if (callbackParameter.Type?.
TypeId
== AtsConstants.CancellationToken)
2050
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2055
if (IsCancellationTokenTypeId(typeRef.
TypeId
))
2063
AtsTypeCategory.Primitive => RenderJavaPrimitiveTransportValueConversion(typeRef.
TypeId
, valueExpression, allowNull),
2064
AtsTypeCategory.Enum => RenderJavaEnumTransportValueConversion(typeRef.
TypeId
, valueExpression, allowNull),
2065
AtsTypeCategory.Dto => RenderJavaDtoTransportValueConversion(typeRef.
TypeId
, valueExpression, allowNull),
2229
if (typeRef.
TypeId
== AtsConstants.CancellationToken)
2482
.FirstOrDefault(baseType => !string.Equals(baseType.
TypeId
, typeId, StringComparison.Ordinal)
2483
&& _classNames.ContainsKey(baseType.
TypeId
));
2487
baseClassName = _classNames[exportedBaseType.
TypeId
];
2521
if (targetType.
TypeId
is null)
2526
if (!result.TryGetValue(targetType.
TypeId
, out var list))
2529
result[targetType.
TypeId
] = list;
2569
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2576
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
, isOptional || useBoxedTypes),
2577
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
2578
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
2579
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
2601
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
2623
if (IsCancellationTokenTypeId(typeRef.
TypeId
))
2683
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
2697
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
2698
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
2705
handleTypeIds.Add(typeRef.
TypeId
);
2720
typeIds[typeRef.
TypeId
] = false; // false = List
2727
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
,
3074
TargetTypeId = resourceType.
TypeId
,
3088
HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.
TypeId
! }],
3325
TypeId = contextType.
TypeId
!,
3425
TargetTypeId = resourceType.
TypeId
,
3434
HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.
TypeId
! }],
3440
TypeId = contextType.
TypeId
!,
3735
HandleTypes = [new AtsTypeInfo { AtsTypeId = resourceType.
TypeId
! }],
3749
TargetTypeId = resourceType.
TypeId
,
Aspire.Hosting.CodeGeneration.Python (53)
AtsPythonCodeGenerator.cs (53)
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)
297
var writeback = parameter.CallbackReturnType?.
TypeId
== AtsConstants.Void &&
298
parameter.CallbackParameters?.Any(p => p.Type.Category == AtsTypeCategory.Dto && p.Type.
TypeId
!= AtsConstants.CancellationToken) == true
310
? JsonValue.Create(callbackParameter.Type.
TypeId
)!.ToJsonString()
459
filtered = filtered.Where(p => p.Type?.
TypeId
!= AtsConstants.CancellationToken);
471
if (param.Type?.
TypeId
== AtsConstants.CancellationToken)
533
if (typeRef.Category == AtsTypeCategory.Primitive && typeRef.
TypeId
== AtsConstants.Void)
666
if (param.Type?.
TypeId
== AtsConstants.CancellationToken)
691
private static string? GetReturnTypeId(AtsCapabilityInfo capability) => capability.ReturnType?.
TypeId
;
808
if (IsHandleType(cap.ReturnType) && !dtoTypeIds.Contains(cap.ReturnType!.
TypeId
))
815
if (IsHandleType(param.Type) && !dtoTypeIds.Contains(param.Type!.
TypeId
))
817
typeIds.Add(param.Type!.
TypeId
);
824
if (IsHandleType(cbParam.Type) && !dtoTypeIds.Contains(cbParam.Type.
TypeId
))
826
typeIds.Add(cbParam.Type.
TypeId
);
1016
AtsTypeCategory.Dto when value is JsonObject obj && dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoInfo)
1376
var returnsSelf = isDistributedApplicationBuilder && capability.ReturnType?.
TypeId
== capability.TargetTypeId;
1480
.Select(i => i.
TypeId
),
1483
.Where(i => !transitivelyImplemented.Contains(i.
TypeId
))
1485
baseClass = string.Join(", ", implementedInterfaces.Select(i => DeriveClassName(i.
TypeId
)));
1545
baseTypeInterfaces = baseType.ImplementedInterfaces.Select(i => i.
TypeId
).ToList();
1554
var implementedInterfaces = builder.TargetType?.ImplementedInterfaces.Where(i => !baseTypeInterfaces.Contains(i.
TypeId
)).ToList();
1561
.Select(i => i.
TypeId
),
1564
.Where(i => !transitivelyImplemented.Contains(i.
TypeId
))
1681
var returnsBuilder = capability.ReturnsBuilder && capability.ReturnType!.
TypeId
== capability.TargetTypeId;
1682
var returnsChildBuilder = capability.ReturnsBuilder && capability.ReturnType != null && IsHandleType(capability.ReturnType) && capability.ReturnType.
TypeId
!= capability.TargetTypeId;
1962
if (!capabilitiesByTypeId.TryGetValue(expandedType.
TypeId
, out var list))
1965
capabilitiesByTypeId[expandedType.
TypeId
] = list;
1966
typeRefsByTypeId[expandedType.
TypeId
] = expandedType;
2062
.Select(i => i.
TypeId
)
2189
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.Handle)
2191
typeRefs.TryAdd(typeRef.
TypeId
, typeRef);
2193
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.Dict)
2195
_moduleBuilder.HandleRegistrations.TryAdd(typeRef.
TypeId
, "AspireDict");
2197
if (!string.IsNullOrEmpty(typeRef.
TypeId
) && typeRef.Category == AtsTypeCategory.List)
2199
_moduleBuilder.HandleRegistrations.TryAdd(typeRef.
TypeId
, "AspireList");
2278
return DeriveClassName(typeRef.
TypeId
);
2447
var tickIndex = typeRef.
TypeId
.IndexOf('`');
2450
return typeRef.
TypeId
[..tickIndex] + "T";
2453
return typeRef.
TypeId
+ "T";
2456
return typeRef.
TypeId
;
Aspire.Hosting.CodeGeneration.Python.Tests (14)
AtsPythonCodeGeneratorTests.cs (14)
102
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
220
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
899
TargetTypeId = resourceType.
TypeId
,
911
AtsTypeId = resourceType.
TypeId
,
955
TargetTypeId = resourceType.
TypeId
,
967
AtsTypeId = resourceType.
TypeId
,
1026
TargetTypeId = resourceType.
TypeId
,
1037
AtsTypeId = resourceType.
TypeId
,
1044
AtsTypeId = genericBaseTypeRef.
TypeId
,
1049
AtsTypeId = genericInterfaceTypeRef.
TypeId
,
1210
TargetTypeId = projectType.
TypeId
,
1231
TargetTypeId = containerType.
TypeId
,
1243
AtsTypeId = projectType.
TypeId
,
1248
AtsTypeId = containerType.
TypeId
,
Aspire.Hosting.CodeGeneration.Rust (31)
AtsRustCodeGenerator.cs (31)
378
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
379
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
389
AtsTypeCategory.Dto => !dtoTypesById.TryGetValue(typeRef.
TypeId
, out var dto)
474
var hasReturn = capability.ReturnType.
TypeId
!= AtsConstants.Void;
607
var wrappedType = MapHandleType(returnTypeRef.
TypeId
);
611
else if (returnTypeRef?.
TypeId
== AtsConstants.CancellationToken)
860
if (targetType.
TypeId
is null)
865
if (!result.TryGetValue(targetType.
TypeId
, out var list))
868
result[targetType.
TypeId
] = list;
907
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
914
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
915
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
916
AtsTypeCategory.Handle => MapHandleType(typeRef.
TypeId
),
917
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
945
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
952
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
953
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
956
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
985
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId)
992
AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.
TypeId
),
993
AtsTypeCategory.Enum => MapEnumType(typeRef.
TypeId
),
994
AtsTypeCategory.Dto => MapDtoType(typeRef.
TypeId
),
1039
var 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
);
1083
IsCancellationTokenTypeId(parameter.Type?.
TypeId
);
1097
if (typeRef.
TypeId
== AtsConstants.ReferenceExpressionTypeId
1098
|| IsCancellationTokenTypeId(typeRef.
TypeId
))
1105
handleTypeIds.Add(typeRef.
TypeId
);
1120
typeIds.Add(typeRef.
TypeId
);
Aspire.Hosting.CodeGeneration.Rust.Tests (2)
AtsRustCodeGeneratorTests.cs (2)
260
Assert.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)
136
capability.ReturnType.
TypeId
== AtsConstants.Void ? null : capability.Documentation?.Returns,
137
suppressReturns: capability.ReturnType.
TypeId
== AtsConstants.Void,
388
!_projector.DtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoType))
403
!_projector.DtoTypesById.TryGetValue(typeRef.
TypeId
, out var dtoType))
409
if (!visitedDtoTypeIds.Add(typeRef.
TypeId
))
420
visitedDtoTypeIds.Remove(typeRef.
TypeId
);
431
private static string? GetReturnTypeId(AtsCapabilityInfo capability) => capability.ReturnType?.
TypeId
;
452
capability.ReturnType.
TypeId
!= capability.TargetTypeId)))
950
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
953
if (capability.ReturnType != null && _projector.TypesWithPromiseWrappers.Contains(capability.ReturnType.
TypeId
))
955
WriteLine($" {signature.MethodName}({signature.ParameterList}): {_projector.GetPublicPromiseInterfaceName(capability.ReturnType.
TypeId
)};");
1141
if (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))
1145
returnTypeId = capability.ReturnType.
TypeId
;
1161
var wrappedReturnTypeId = capability.ReturnType!.
TypeId
;
1227
if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
1468
if (param.Type is not {
TypeId
: var dtoTypeId })
1538
if (!visitedDtoTypeIds.Add(dtoProperty.Type.
TypeId
))
1554
visitedDtoTypeIds.Remove(dtoProperty.Type.
TypeId
);
1638
if (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))
1642
var returnClass = _projector.WrapperClassNames.GetValueOrDefault(capability.ReturnType.
TypeId
)
1643
?? TypeScriptApiProjector.DeriveClassName(capability.ReturnType.
TypeId
);
1811
else if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
1889
&& callbackParam.CallbackReturnType.
TypeId
!= AtsConstants.Void;
1924
var cbTypeId = callbackParameter.Type.
TypeId
;
2273
if (getter.ReturnType?.
TypeId
!= null && _projector.WrapperClassNames.TryGetValue(getter.ReturnType.
TypeId
, out var wrapperClassName))
2287
if (getter.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
2340
if (getter.ReturnType?.
TypeId
!= null && _projector.WrapperClassNames.TryGetValue(getter.ReturnType.
TypeId
, out var wrapperClassName))
2367
if (getter.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
2388
var handleType = _projector.GetConcreteHandleTypeName(getter.ReturnType!.
TypeId
);
2442
var handleType = _projector.GetConcreteHandleTypeName(getter.ReturnType!.
TypeId
);
2665
var returnTypeId = method.ReturnType!.
TypeId
;
2716
else if (method.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
2778
var returnTypeId = capability.ReturnType!.
TypeId
;
2904
var isVoid = capability.ReturnType == null || capability.ReturnType.
TypeId
== AtsConstants.Void;
2909
var returnWrapperClass = _projector.WrapperClassNames.GetValueOrDefault(capability.ReturnType!.
TypeId
)
2910
?? TypeScriptApiProjector.DeriveClassName(capability.ReturnType.
TypeId
);
2913
var returnHandleType = _projector.GetConcreteHandleTypeName(capability.ReturnType.
TypeId
);
3065
if (capability.ReturnType?.
TypeId
== AtsConstants.CancellationToken)
3130
var 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;
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 (52)
AtsTypeScriptCodeGeneratorTests.cs (52)
173
Assert.Contains(addTestRedis.Parameters, p => p.Name == "name" && p.Type?.
TypeId
== "string");
299
TargetTypeId = targetType.
TypeId
,
311
TargetTypeId = targetType.
TypeId
,
422
Assert.Equal("string", nameGetterCapability.ReturnType?.
TypeId
);
432
Assert.Equal("Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", nameSetterCapability.ReturnType?.
TypeId
); // Returns context for fluent chaining
440
Assert.Equal("number", valueGetterCapability.ReturnType?.
TypeId
);
523
t.
TypeId
== "Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource");
659
Assert.Equal(AtsConstants.Void, setValue.ReturnType.
TypeId
);
668
Assert.Equal("string", valueParameter.Type.
TypeId
);
678
Assert.Equal("string", tryGetCurrentValue.ReturnType.
TypeId
);
700
Assert.Equal(typeId, capability.ReturnType.
TypeId
);
713
Assert.Contains(withBrowserLogs.Parameters, p => p.Name == "browser" && p.Type?.
TypeId
== "string" && p.IsOptional);
714
Assert.Contains(withBrowserLogs.Parameters, p => p.Name == "profile" && p.Type?.
TypeId
== "string" && p.IsOptional);
728
c.ExpandedTargetTypes.Any(t => t.
TypeId
.Contains("ContainerResource")))
733
TargetType = 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 })
776
if (expandedType.
TypeId
.Contains("ContainerResource"))
779
$"Capability '{cap.CapabilityId}' ExpandedTargetType '{expandedType.
TypeId
}' has IsInterface = true");
802
Assert.Equal("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource", withBindMount.TargetType.
TypeId
);
831
Assert.Contains("IResourceWithConnectionString", withConnectionStringDirect.TargetType.
TypeId
);
839
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
859
Assert.Contains("TestRedisResource", withRedisSpecific.TargetType.
TypeId
);
867
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
885
Assert.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");
1146
Assert.Contains("IResourceWithEnvironment", testWithEnvironmentCallback.TargetType.
TypeId
);
1155
.FirstOrDefault(t => t.
TypeId
.Contains("TestRedisResource"));
1339
Assert.Equal("string", capability.Parameters.Single().Type?.
TypeId
);
1373
claimParameter.Type?.
TypeId
);
1459
.Any(i => i.
TypeId
.Contains("IResourceWithEnvironment"));
1571
.ReturnType!.
TypeId
;
2112
Assert.Equal(expectedTypes.Select(GetAtsTypeId), parameter.CallbackParameters.Select(p => p.Type?.
TypeId
));
2122
Assert.Equal(GetAtsTypeId(parameterType), parameter.Type?.
TypeId
);
2262
Assert.Equal("any", valueParam.Type.
TypeId
);
2410
Assert.Equal(AtsConstants.CancellationToken, ctParam.Type.
TypeId
);
2445
Assert.Equal(AtsConstants.CancellationToken, operationParam.CallbackParameters[0].Type?.
TypeId
);
2464
Assert.Equal(AtsConstants.TimeSpan, timeoutParam.Type?.
TypeId
);
2468
Assert.Equal(AtsConstants.CancellationToken, ctParam.Type?.
TypeId
);
2484
Assert.Equal("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource", capability.ReturnType.
TypeId
);
2508
Assert.Equal("Aspire.Hosting.Dotnet/Aspire.Hosting.Dotnet.DotnetProjectOptions", options.Type.
TypeId
);
2509
var dto = Assert.Single(context.DtoTypes, dto => dto.TypeId == options.Type.
TypeId
);
2524
Assert.Equal(legacyTypeId, legacyOptions.Type.
TypeId
);
2827
var expandedTypeIds = withNpm.ExpandedTargetTypes.Select(t => t.
TypeId
).ToList();
2858
var expandedTypeIds = capability.ExpandedTargetTypes.Select(t => t.
TypeId
).ToList();
3037
TargetTypeId = targetType.
TypeId
,
3049
TargetTypeId = targetType.
TypeId
,
3061
TargetTypeId = targetType.
TypeId
,
3073
TargetTypeId = targetType.
TypeId
,
3473
TargetTypeId = targetType.
TypeId
,
Aspire.Hosting.Native.CodeGeneration (48)
NativeCSharpProjection.cs (7)
116
callback.CallbackReturnType?.
TypeId
!= "void")
162
member.
TypeId
== "string"
237
AtsTypeCategory.Handle when handles.TryGetValue(type.
TypeId
, out var handle) => handle,
238
AtsTypeCategory.Dto when dtos.TryGetValue(type.
TypeId
, out var dto) => dto,
242
AtsTypeCategory.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();
89
var id = type.
TypeId
;
Program.cs (9)
101
if (handles.Contains(capability.ReturnType.
TypeId
))
131
if (handles.Contains(capability.ReturnType.
TypeId
))
134
$" return {(asynchronous ? "connection.PublishCoreHandle" : "handles.Add")}(result, {Literal(capability.ReturnType.
TypeId
)});");
136
else if (context.DtoTypes.Any(dto => dto.TypeId == capability.ReturnType.
TypeId
))
434
parameter.CallbackReturnType?.
TypeId
== "void" && type.IsGenericType &&
437
return $"connection.CreateAuthoringCallback<{type.GetGenericArguments()[0].Name}>(callbackConnection, RpcArguments.String({node}), {Literal(callbackParameter.Type.
TypeId
)})";
440
members.Any(member => member.
TypeId
== "string") &&
441
members.All(member => member.
TypeId
== "string" || member.Category == AtsTypeCategory.Handle))
443
return $"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)
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);
2705
TypeId = typeRef.
TypeId
,
2849
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2872
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2894
TypeId = AtsConstants.ListTypeId(elementTypeRef.
TypeId
),
2914
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
2959
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
3418
TypeId = string.Join("|", unionTypes.Select(u => u.
TypeId
)),
src\Shared\NativeProviderContractReader.cs (4)
43
capability.Parameters is null || capability.ReturnType is null || string.IsNullOrWhiteSpace(capability.ReturnType.
TypeId
))
50
string.IsNullOrWhiteSpace(parameter.Type.
TypeId
))
55
string.IsNullOrWhiteSpace(parameter.CallbackReturnType.
TypeId
) ||
56
parameter.CallbackParameters.Any(value => value is null || value.Type is null || string.IsNullOrWhiteSpace(value.Type.
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);
2705
TypeId = typeRef.
TypeId
,
2849
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2872
TypeId = AtsConstants.DictTypeId(keyTypeRef.
TypeId
, valueTypeRef.
TypeId
),
2894
TypeId = AtsConstants.ListTypeId(elementTypeRef.
TypeId
),
2914
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
2959
TypeId = AtsConstants.ArrayTypeId(elementTypeRef.
TypeId
),
3418
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
);