304 references to AtsConstants
Aspire.Hosting.CodeGeneration.Go (37)
AtsGoCodeGenerator.cs (37)
137
if (dto.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
151
if (handleType.AtsTypeId ==
AtsConstants
.ReferenceExpressionTypeId
315
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId
536
if (dto.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
922
if (string.Equals(typeId,
AtsConstants
.BuilderTypeId, StringComparison.Ordinal))
924
var appInterface = _interfaceNames.TryGetValue(
AtsConstants
.ApplicationTypeId, out var appName)
1147
&& p.CallbackReturnType.TypeId !=
AtsConstants
.Void;
1164
var hasReturn = capability.ReturnType is not null && capability.ReturnType.TypeId !=
AtsConstants
.Void;
1557
&& p.CallbackReturnType.TypeId !=
AtsConstants
.Void;
1908
var hasReturn = capability.ReturnType is not null && capability.ReturnType.TypeId !=
AtsConstants
.Void;
1932
WriteLine("\tc.registerHandleWrapper(\"" +
AtsConstants
.ReferenceExpressionTypeId + "\", func(h *handle, c *client) any {");
1950
var builderTypeId =
AtsConstants
.BuilderTypeId;
1957
var appTypeId =
AtsConstants
.ApplicationTypeId;
2007
WriteLine($"\tresult, err := b.client.invokeCapability(context.Background(), \"{
AtsConstants
.BuildCapability}\", map[string]any{{");
2065
WriteLine($"\tresult, err := c.invokeCapability(context.Background(), \"{
AtsConstants
.CreateBuilderCapability}\", map[string]any{{\"argsOrOptions\": resolved}})");
2098
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
2136
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
2166
&& typeRef.TypeId is not (
AtsConstants
.Void or
AtsConstants
.Any or
AtsConstants
.CancellationToken);
2189
AtsConstants
.String or
AtsConstants
.Char => "string",
2190
AtsConstants
.Number => "float64",
2191
AtsConstants
.Boolean => "bool",
2192
AtsConstants
.Void => "",
2193
AtsConstants
.Any => "any",
2194
AtsConstants
.DateTime or
AtsConstants
.DateTimeOffset or
2195
AtsConstants
.DateOnly or
AtsConstants
.TimeOnly => "string",
2196
AtsConstants
.TimeSpan => "float64",
2197
AtsConstants
.Guid or
AtsConstants
.Uri => "string",
2198
AtsConstants
.CancellationToken => "*CancellationToken",
2208
string.Equals(capabilityId,
AtsConstants
.BuildCapability, StringComparison.Ordinal)
2209
|| string.Equals(capabilityId,
AtsConstants
.CreateBuilderCapability, StringComparison.Ordinal);
2215
string.Equals(typeId,
AtsConstants
.CancellationToken, StringComparison.Ordinal)
Aspire.Hosting.CodeGeneration.Java (41)
AtsJavaCodeGenerator.cs (41)
717
if (dto.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
1317
var builderClassName = _classNames.TryGetValue(
AtsConstants
.BuilderTypeId, out var name)
1875
var hasReturn = capability.ReturnType?.TypeId !=
AtsConstants
.Void;
1890
var hasReturnType = callbackReturnType != null && callbackReturnType.TypeId !=
AtsConstants
.Void;
1924
var hasReturnType = callbackParam.CallbackReturnType != null && callbackParam.CallbackReturnType.TypeId !=
AtsConstants
.Void;
1980
var hasReturnType = property.CallbackReturnType != null && property.CallbackReturnType.TypeId !=
AtsConstants
.Void;
2010
if (callbackParameter.Type?.TypeId ==
AtsConstants
.CancellationToken)
2030
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
2152
AtsConstants
.String or
AtsConstants
.Char or
2153
AtsConstants
.DateTime or
AtsConstants
.DateTimeOffset or
2154
AtsConstants
.DateOnly or
AtsConstants
.TimeOnly or
2155
AtsConstants
.Guid or
AtsConstants
.Uri => $"(String) {valueExpression}",
2156
AtsConstants
.Number or
AtsConstants
.TimeSpan => $"((Number) {valueExpression}).doubleValue()",
2157
AtsConstants
.Boolean => $"(Boolean) {valueExpression}",
2158
AtsConstants
.Void => "null",
2209
if (typeRef.TypeId ==
AtsConstants
.CancellationToken)
2319
var builderClassName = _classNames.TryGetValue(
AtsConstants
.BuilderTypeId, out var name)
2398
if (handleType.AtsTypeId ==
AtsConstants
.ReferenceExpressionTypeId
2549
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
2581
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
2639
AtsConstants
.String or
AtsConstants
.Char => "String",
2648
AtsConstants
.Number => useBoxedTypes ? "Number" : "double",
2649
AtsConstants
.Boolean => useBoxedTypes ? "Boolean" : "boolean",
2650
AtsConstants
.Void => "void",
2651
AtsConstants
.Any => "Object",
2652
AtsConstants
.DateTime or
AtsConstants
.DateTimeOffset or
2653
AtsConstants
.DateOnly or
AtsConstants
.TimeOnly => "String",
2654
AtsConstants
.TimeSpan => useBoxedTypes ? "Number" : "double",
2655
AtsConstants
.Guid or
AtsConstants
.Uri => "String",
2656
AtsConstants
.CancellationToken => "CancellationToken",
2666
string.Equals(typeId,
AtsConstants
.CancellationToken, StringComparison.Ordinal)
2677
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId
Aspire.Hosting.CodeGeneration.Java.Tests (17)
AtsJavaCodeGeneratorTests.cs (17)
2724
var stringType = new AtsTypeRef { TypeId =
AtsConstants
.String, Category = AtsTypeCategory.Primitive };
2733
CallbackReturnType = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive }
2740
ReturnType = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive },
2765
Type = new AtsTypeRef { TypeId =
AtsConstants
.CancellationToken, Category = AtsTypeCategory.Dto }
2772
ReturnType = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive },
2807
TypeId =
AtsConstants
.Number,
2841
new AtsTypeRef { TypeId =
AtsConstants
.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }),
2845
new AtsTypeRef { TypeId =
AtsConstants
.Number, Category = AtsTypeCategory.Primitive, IsNullable = true }));
2966
TypeId =
AtsConstants
.Number,
2972
TypeId =
AtsConstants
.Boolean,
3004
CallbackReturnType = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive }
3011
ReturnType = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive },
3235
Type = new AtsTypeRef { TypeId =
AtsConstants
.String, Category = AtsTypeCategory.Primitive }
3256
TypeId =
AtsConstants
.Void,
3321
CallbackReturnType = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive }
3328
ReturnType = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive },
3350
Type = new AtsTypeRef { TypeId =
AtsConstants
.String, Category = AtsTypeCategory.Primitive }
Aspire.Hosting.CodeGeneration.Python (24)
AtsPythonCodeGenerator.cs (24)
148
AtsConstants
.ReferenceExpressionTypeId,
247
&& typeRef.TypeId is not (
AtsConstants
.Void or
AtsConstants
.Any or
AtsConstants
.CancellationToken);
254
AtsConstants
.String or
AtsConstants
.Char => "str",
255
AtsConstants
.Number => "int",
256
AtsConstants
.Boolean => "bool",
257
AtsConstants
.Void => "None",
258
AtsConstants
.Any => "typing.Any",
259
AtsConstants
.DateTime => "datetime.datetime",
260
AtsConstants
.DateTimeOffset => "datetime.datetime",
261
AtsConstants
.DateOnly => "datetime.date",
262
AtsConstants
.TimeOnly => "datetime.time",
263
AtsConstants
.TimeSpan => "float",
264
AtsConstants
.Guid or
AtsConstants
.Uri => "str",
265
AtsConstants
.CancellationToken => "CancellationToken",
275
if (param.Type?.TypeId ==
AtsConstants
.CancellationToken)
288
if (param.Type?.TypeId ==
AtsConstants
.CancellationToken)
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)
Aspire.Hosting.CodeGeneration.Python.Tests (9)
AtsPythonCodeGeneratorTests.cs (9)
523
TypeId =
AtsConstants
.String,
579
TypeId =
AtsConstants
.String,
653
TypeId =
AtsConstants
.Void,
705
TypeId =
AtsConstants
.Number,
713
TypeId =
AtsConstants
.String,
752
TypeId =
AtsConstants
.Number,
762
TypeId =
AtsConstants
.Void,
798
TypeId =
AtsConstants
.String,
804
TypeId =
AtsConstants
.Boolean,
Aspire.Hosting.CodeGeneration.Rust (43)
AtsRustCodeGenerator.cs (43)
207
if (dto.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
375
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId
472
var hasReturn = capability.ReturnType.TypeId !=
AtsConstants
.Void;
609
else if (returnTypeRef?.TypeId ==
AtsConstants
.CancellationToken)
713
var builderStructName = _structNames.TryGetValue(
AtsConstants
.BuilderTypeId, out var name)
781
if (handleType.AtsTypeId ==
AtsConstants
.ReferenceExpressionTypeId
905
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
943
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
983
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
1013
AtsConstants
.String or
AtsConstants
.Char => "String",
1014
AtsConstants
.Number => "f64",
1015
AtsConstants
.Boolean => "bool",
1016
AtsConstants
.Void => "()",
1017
AtsConstants
.Any => "Value",
1018
AtsConstants
.DateTime or
AtsConstants
.DateTimeOffset or
1019
AtsConstants
.DateOnly or
AtsConstants
.TimeOnly => "String",
1020
AtsConstants
.TimeSpan => "f64",
1021
AtsConstants
.Guid or
AtsConstants
.Uri => "String",
1022
AtsConstants
.CancellationToken => "CancellationToken",
1039
AtsConstants
.String or
AtsConstants
.Char => "&str",
1040
AtsConstants
.Number => "f64",
1041
AtsConstants
.Boolean => "bool",
1042
AtsConstants
.Void => "()",
1043
AtsConstants
.Any => "&Value",
1044
AtsConstants
.DateTime or
AtsConstants
.DateTimeOffset or
1045
AtsConstants
.DateOnly or
AtsConstants
.TimeOnly => "&str",
1046
AtsConstants
.TimeSpan => "f64",
1047
AtsConstants
.Guid or
AtsConstants
.Uri => "&str",
1048
AtsConstants
.CancellationToken => "&CancellationToken",
1062
&& typeRef.TypeId is not (
AtsConstants
.Void or
AtsConstants
.Any or
AtsConstants
.CancellationToken);
1066
&& typeRef.TypeId !=
AtsConstants
.ReferenceExpressionTypeId
1084
string.Equals(typeId,
AtsConstants
.CancellationToken, StringComparison.Ordinal)
1095
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId
Aspire.Hosting.CodeGeneration.TypeScript (36)
AtsTypeScriptCodeGenerator.cs (14)
134
capability.ReturnType.TypeId ==
AtsConstants
.Void ? null : capability.Documentation?.Returns,
135
suppressReturns: capability.ReturnType.TypeId ==
AtsConstants
.Void,
914
var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId ==
AtsConstants
.Void;
1191
if (capability.ReturnType?.TypeId ==
AtsConstants
.CancellationToken)
1775
else if (capability.ReturnType?.TypeId ==
AtsConstants
.CancellationToken)
1853
&& callbackParam.CallbackReturnType.TypeId !=
AtsConstants
.Void;
1890
if (cbTypeId ==
AtsConstants
.CancellationToken)
1917
var builderHandle = TypeScriptApiProjector.GetHandleTypeName(
AtsConstants
.BuilderTypeId);
2241
if (getter.ReturnType?.TypeId ==
AtsConstants
.CancellationToken)
2321
if (getter.ReturnType?.TypeId ==
AtsConstants
.CancellationToken)
2670
else if (method.ReturnType?.TypeId ==
AtsConstants
.CancellationToken)
2858
var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId ==
AtsConstants
.Void;
3000
if (capability.ReturnType?.TypeId ==
AtsConstants
.CancellationToken)
3065
var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId ==
AtsConstants
.Void;
TypeScriptApiProjector.cs (22)
424
if (capability.ReturnType is null || capability.ReturnType.TypeId ==
AtsConstants
.Void)
1659
if (typeRef.TypeId ==
AtsConstants
.ReferenceExpressionTypeId)
1711
return typeRef.TypeId is
AtsConstants
.Void or
AtsConstants
.Any or
AtsConstants
.CancellationToken
1760
AtsConstants
.String or
AtsConstants
.Char => "string",
1761
AtsConstants
.Number => "number",
1762
AtsConstants
.Boolean => "boolean",
1763
AtsConstants
.Void => "void",
1764
AtsConstants
.Any => "any",
1765
AtsConstants
.DateTime or
AtsConstants
.DateTimeOffset or
1766
AtsConstants
.DateOnly or
AtsConstants
.TimeOnly => "string",
1767
AtsConstants
.TimeSpan => "number",
1768
AtsConstants
.Guid or
AtsConstants
.Uri => "string",
1769
AtsConstants
.CancellationToken => GetCancellationTokenInterfaceName(),
2007
internal static bool IsCancellationTokenType(AtsTypeRef? typeRef) => typeRef?.TypeId ==
AtsConstants
.CancellationToken;
2670
if (targetTypeId is
AtsConstants
.ReferenceExpressionTypeId or InteractionInputCollectionTypeId)
3107
var returnType = callbackReturnType == null || callbackReturnType.TypeId ==
AtsConstants
.Void
Aspire.Hosting.CodeGeneration.TypeScript.Tests (17)
AtsTypeScriptCodeGeneratorTests.cs (17)
784
TypeId =
AtsConstants
.Number,
790
TypeId = $"{
AtsConstants
.Number}[]",
1639
TypeId =
AtsConstants
.Void,
1662
TypeId =
AtsConstants
.Void,
1947
c.TargetTypeId ==
AtsConstants
.ReferenceExpressionTypeId);
2039
Assert.Equal(
AtsConstants
.CancellationToken, ctParam.Type.TypeId);
2074
Assert.Equal(
AtsConstants
.CancellationToken, operationParam.CallbackParameters[0].Type?.TypeId);
2093
Assert.Equal(
AtsConstants
.TimeSpan, timeoutParam.Type?.TypeId);
2097
Assert.Equal(
AtsConstants
.CancellationToken, ctParam.Type?.TypeId);
2570
TypeId =
AtsConstants
.String,
2575
TypeId =
AtsConstants
.Void,
2879
TypeId =
AtsConstants
.Void,
3012
TypeId =
AtsConstants
.Void,
3019
TypeId =
AtsConstants
.Void,
3046
TypeId =
AtsConstants
.String,
3055
TypeId =
AtsConstants
.Number,
3063
TypeId =
AtsConstants
.Void,
Aspire.Hosting.RemoteHost (53)
Ats\AtsMarshaller.cs (2)
144
if (typeRef.TypeId ==
AtsConstants
.CancellationToken && value is CancellationToken cancellationToken)
150
if (typeRef.TypeId == TypeSystem.
AtsConstants
.Any)
AtsCapabilityScanner.cs (50)
98
var typeId =
AtsConstants
.EnumTypeId(fullName);
1312
AtsTypeCategory.Primitive => typeRef.TypeId !=
AtsConstants
.CancellationToken && typeRef.TypeId !=
AtsConstants
.Void,
1617
: new AtsTypeRef { TypeId =
AtsConstants
.Any, Category = AtsTypeCategory.Primitive };
1621
TypeId =
AtsConstants
.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
1644
propertyTypeRef = new AtsTypeRef { TypeId =
AtsConstants
.Any, Category = AtsTypeCategory.Primitive };
2207
returnTypeRef = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive };
2211
returnTypeRef = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive };
2219
?? new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive }
2220
: new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive };
2225
?? new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive }
2253
var voidTypeRef = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive };
2371
if (
AtsConstants
.IsPrimitiveType(type))
2379
return
AtsConstants
.Any;
2384
return
AtsConstants
.DictTypeId(
AtsConstants
.String,
AtsConstants
.Any);
2389
return
AtsConstants
.ListTypeId(
AtsConstants
.Any);
2395
return
AtsConstants
.EnumTypeId(type.FullName ?? type.Name);
2417
return
AtsConstants
.DictTypeId(keyTypeName, valueTypeName);
2433
return
AtsConstants
.ListTypeId(elementTypeName);
2504
return
AtsConstants
.String;
2508
return
AtsConstants
.Char;
2512
return
AtsConstants
.Boolean;
2521
return
AtsConstants
.Number;
2527
return
AtsConstants
.DateTime;
2531
return
AtsConstants
.DateTimeOffset;
2535
return
AtsConstants
.DateOnly;
2539
return
AtsConstants
.TimeOnly;
2543
return
AtsConstants
.TimeSpan;
2549
return
AtsConstants
.Guid;
2553
return
AtsConstants
.Uri;
2557
return
AtsConstants
.CancellationToken;
2588
TypeId =
AtsConstants
.Void,
2689
return new AtsTypeRef { TypeId =
AtsConstants
.Any, ClrType = type, Category = AtsTypeCategory.Primitive };
2696
TypeId =
AtsConstants
.DictTypeId(
AtsConstants
.String,
AtsConstants
.Any),
2699
KeyType = new AtsTypeRef { TypeId =
AtsConstants
.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive },
2700
ValueType = new AtsTypeRef { TypeId =
AtsConstants
.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive },
2709
TypeId =
AtsConstants
.ListTypeId(
AtsConstants
.Any),
2712
ElementType = new AtsTypeRef { TypeId =
AtsConstants
.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }
2724
TypeId =
AtsConstants
.EnumTypeId(type.FullName ?? type.Name),
2747
TypeId =
AtsConstants
.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2770
TypeId =
AtsConstants
.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId),
2792
TypeId =
AtsConstants
.ListTypeId(elementTypeRef.TypeId),
2812
TypeId =
AtsConstants
.ArrayTypeId(elementTypeRef.TypeId),
2857
TypeId =
AtsConstants
.ArrayTypeId(elementTypeRef.TypeId),
AtsContextFilter.cs (1)
343
TypeId =
AtsConstants
.Void,
Aspire.Hosting.RemoteHost.Tests (25)
AtsCapabilityScannerTests.cs (9)
169
[InlineData(typeof(double?[]),
AtsConstants
.Number)]
170
[InlineData(typeof(bool?[]),
AtsConstants
.Boolean)]
193
Assert.Contains(parameter.Type.UnionTypes!, type => type.TypeId ==
AtsConstants
.String);
457
Assert.Equal(
AtsConstants
.String, nameGetter.ReturnType.TypeId);
462
Assert.Equal(
AtsConstants
.String, descriptionGetter.ReturnType.TypeId);
483
Assert.Equal(
AtsConstants
.String, nullableString.Type.TypeId);
488
Assert.Equal(
AtsConstants
.String, requiredString.Type.TypeId);
493
Assert.Equal(
AtsConstants
.Number, nullableNumber.Type.TypeId);
498
Assert.Equal(
AtsConstants
.Number, requiredNumber.Type.TypeId);
AtsContextFilterTests.cs (11)
136
type => Assert.Equal(
AtsConstants
.EnumTypeId(typeof(TestMode).FullName!), type.TypeId));
163
Assert.Contains(filteredContext.EnumTypes, type => type.TypeId ==
AtsConstants
.EnumTypeId(typeof(DistributedApplicationOperation).FullName!));
164
Assert.Contains(filteredContext.EnumTypes, type => type.TypeId ==
AtsConstants
.EnumTypeId("Aspire.TypeSystem.ExportedValueMode"));
231
Assert.Equal(
AtsConstants
.Void, filteredSupport.ReturnType.TypeId);
248
TypeId =
AtsConstants
.EnumTypeId("Some.Foreign.Dependency.ForeignMode"),
256
TypeId =
AtsConstants
.EnumTypeId("Some.Foreign.Dependency.ForeignCallbackMode"),
285
Type = new AtsTypeRef { TypeId =
AtsConstants
.Void, Category = AtsTypeCategory.Primitive },
434
TypeId =
AtsConstants
.EnumTypeId(typeof(TestMode).FullName!),
453
TypeId =
AtsConstants
.EnumTypeId(typeof(TestMode).FullName!),
461
TypeId =
AtsConstants
.EnumTypeId("Aspire.TypeSystem.ExportedValueMode"),
469
TypeId =
AtsConstants
.EnumTypeId(typeof(DistributedApplicationOperation).FullName!),
AtsMarshallerTests.cs (4)
225
TypeId =
AtsConstants
.CancellationToken,
1326
var conditionHandleId = registry.Register(condition,
AtsConstants
.ReferenceExpressionTypeId);
1368
var conditionHandleId = registry.Register(condition,
AtsConstants
.ReferenceExpressionTypeId);
1410
var conditionHandleId = registry.Register(condition,
AtsConstants
.ReferenceExpressionTypeId);
HandleRegistryTests.cs (1)
355
var typeId =
AtsConstants
.ReferenceExpressionTypeId;
Aspire.TypeSystem (2)
AtsCapabilityInfo.cs (1)
309
/// Use <see cref="
AtsConstants
.Void"/> TypeId for void return types.
AtsContext.cs (1)
110
if (
AtsConstants
.IsPrimitiveType(type))