318 references to AtsConstants
Aspire.Hosting.CodeGeneration.Go (37)
AtsGoCodeGenerator.cs (37)
137if (dto.TypeId == AtsConstants.ReferenceExpressionTypeId) 151if (handleType.AtsTypeId == AtsConstants.ReferenceExpressionTypeId 315if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId 536if (dto.TypeId == AtsConstants.ReferenceExpressionTypeId) 922if (string.Equals(typeId, AtsConstants.BuilderTypeId, StringComparison.Ordinal)) 924var appInterface = _interfaceNames.TryGetValue(AtsConstants.ApplicationTypeId, out var appName) 1147&& p.CallbackReturnType.TypeId != AtsConstants.Void; 1164var hasReturn = capability.ReturnType is not null && capability.ReturnType.TypeId != AtsConstants.Void; 1557&& p.CallbackReturnType.TypeId != AtsConstants.Void; 1908var hasReturn = capability.ReturnType is not null && capability.ReturnType.TypeId != AtsConstants.Void; 1932WriteLine("\tc.registerHandleWrapper(\"" + AtsConstants.ReferenceExpressionTypeId + "\", func(h *handle, c *client) any {"); 1950var builderTypeId = AtsConstants.BuilderTypeId; 1957var appTypeId = AtsConstants.ApplicationTypeId; 2007WriteLine($"\tresult, err := b.client.invokeCapability(context.Background(), \"{AtsConstants.BuildCapability}\", map[string]any{{"); 2065WriteLine($"\tresult, err := c.invokeCapability(context.Background(), \"{AtsConstants.CreateBuilderCapability}\", map[string]any{{\"argsOrOptions\": resolved}})"); 2098if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2136if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2166&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 2189AtsConstants.String or AtsConstants.Char => "string", 2190AtsConstants.Number => "float64", 2191AtsConstants.Boolean => "bool", 2192AtsConstants.Void => "", 2193AtsConstants.Any => "any", 2194AtsConstants.DateTime or AtsConstants.DateTimeOffset or 2195AtsConstants.DateOnly or AtsConstants.TimeOnly => "string", 2196AtsConstants.TimeSpan => "float64", 2197AtsConstants.Guid or AtsConstants.Uri => "string", 2198AtsConstants.CancellationToken => "*CancellationToken", 2208string.Equals(capabilityId, AtsConstants.BuildCapability, StringComparison.Ordinal) 2209|| string.Equals(capabilityId, AtsConstants.CreateBuilderCapability, StringComparison.Ordinal); 2215string.Equals(typeId, AtsConstants.CancellationToken, StringComparison.Ordinal)
Aspire.Hosting.CodeGeneration.Java (41)
AtsJavaCodeGenerator.cs (41)
732if (dto.TypeId == AtsConstants.ReferenceExpressionTypeId) 1336var builderClassName = _classNames.TryGetValue(AtsConstants.BuilderTypeId, out var name) 1894var hasReturn = capability.ReturnType?.TypeId != AtsConstants.Void; 1909var hasReturnType = callbackReturnType != null && callbackReturnType.TypeId != AtsConstants.Void; 1943var hasReturnType = callbackParam.CallbackReturnType != null && callbackParam.CallbackReturnType.TypeId != AtsConstants.Void; 1999var hasReturnType = property.CallbackReturnType != null && property.CallbackReturnType.TypeId != AtsConstants.Void; 2029if (callbackParameter.Type?.TypeId == AtsConstants.CancellationToken) 2049if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2171AtsConstants.String or AtsConstants.Char or 2172AtsConstants.DateTime or AtsConstants.DateTimeOffset or 2173AtsConstants.DateOnly or AtsConstants.TimeOnly or 2174AtsConstants.Guid or AtsConstants.Uri => $"(String) {valueExpression}", 2175AtsConstants.Number or AtsConstants.TimeSpan => $"((Number) {valueExpression}).doubleValue()", 2176AtsConstants.Boolean => $"(Boolean) {valueExpression}", 2177AtsConstants.Void => "null", 2228if (typeRef.TypeId == AtsConstants.CancellationToken) 2338var builderClassName = _classNames.TryGetValue(AtsConstants.BuilderTypeId, out var name) 2417if (handleType.AtsTypeId == AtsConstants.ReferenceExpressionTypeId 2568if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2600if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 2658AtsConstants.String or AtsConstants.Char => "String", 2667AtsConstants.Number => useBoxedTypes ? "Number" : "double", 2668AtsConstants.Boolean => useBoxedTypes ? "Boolean" : "boolean", 2669AtsConstants.Void => "void", 2670AtsConstants.Any => "Object", 2671AtsConstants.DateTime or AtsConstants.DateTimeOffset or 2672AtsConstants.DateOnly or AtsConstants.TimeOnly => "String", 2673AtsConstants.TimeSpan => useBoxedTypes ? "Number" : "double", 2674AtsConstants.Guid or AtsConstants.Uri => "String", 2675AtsConstants.CancellationToken => "CancellationToken", 2685string.Equals(typeId, AtsConstants.CancellationToken, StringComparison.Ordinal) 2696if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId
Aspire.Hosting.CodeGeneration.Java.Tests (17)
AtsJavaCodeGeneratorTests.cs (17)
2776var stringType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }; 2785CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2792ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 2817Type = new AtsTypeRef { TypeId = AtsConstants.CancellationToken, Category = AtsTypeCategory.Dto } 2824ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 2859TypeId = AtsConstants.Number, 2893new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive, IsNullable = true }), 2897new AtsTypeRef { TypeId = AtsConstants.Number, Category = AtsTypeCategory.Primitive, IsNullable = true })); 3018TypeId = AtsConstants.Number, 3024TypeId = AtsConstants.Boolean, 3056CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3063ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3287Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive } 3308TypeId = AtsConstants.Void, 3373CallbackReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 3380ReturnType = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 3402Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }
Aspire.Hosting.CodeGeneration.Python (24)
AtsPythonCodeGenerator.cs (24)
148AtsConstants.ReferenceExpressionTypeId, 247&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 254AtsConstants.String or AtsConstants.Char => "str", 255AtsConstants.Number => "int", 256AtsConstants.Boolean => "bool", 257AtsConstants.Void => "None", 258AtsConstants.Any => "typing.Any", 259AtsConstants.DateTime => "datetime.datetime", 260AtsConstants.DateTimeOffset => "datetime.datetime", 261AtsConstants.DateOnly => "datetime.date", 262AtsConstants.TimeOnly => "datetime.time", 263AtsConstants.TimeSpan => "float", 264AtsConstants.Guid or AtsConstants.Uri => "str", 265AtsConstants.CancellationToken => "CancellationToken", 275if (param.Type?.TypeId == AtsConstants.CancellationToken) 288if (param.Type?.TypeId == AtsConstants.CancellationToken) 454filtered = filtered.Where(p => p.Type?.TypeId != AtsConstants.CancellationToken); 466if (param.Type?.TypeId == AtsConstants.CancellationToken) 528if (typeRef.Category == AtsTypeCategory.Primitive && typeRef.TypeId == AtsConstants.Void) 661if (param.Type?.TypeId == AtsConstants.CancellationToken)
Aspire.Hosting.CodeGeneration.Python.Tests (9)
AtsPythonCodeGeneratorTests.cs (9)
523TypeId = AtsConstants.String, 579TypeId = AtsConstants.String, 653TypeId = AtsConstants.Void, 705TypeId = AtsConstants.Number, 713TypeId = AtsConstants.String, 752TypeId = AtsConstants.Number, 762TypeId = AtsConstants.Void, 798TypeId = AtsConstants.String, 804TypeId = AtsConstants.Boolean,
Aspire.Hosting.CodeGeneration.Rust (43)
AtsRustCodeGenerator.cs (43)
207if (dto.TypeId == AtsConstants.ReferenceExpressionTypeId) 375if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId 472var hasReturn = capability.ReturnType.TypeId != AtsConstants.Void; 609else if (returnTypeRef?.TypeId == AtsConstants.CancellationToken) 713var builderStructName = _structNames.TryGetValue(AtsConstants.BuilderTypeId, out var name) 781if (handleType.AtsTypeId == AtsConstants.ReferenceExpressionTypeId 905if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 943if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 983if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 1013AtsConstants.String or AtsConstants.Char => "String", 1014AtsConstants.Number => "f64", 1015AtsConstants.Boolean => "bool", 1016AtsConstants.Void => "()", 1017AtsConstants.Any => "Value", 1018AtsConstants.DateTime or AtsConstants.DateTimeOffset or 1019AtsConstants.DateOnly or AtsConstants.TimeOnly => "String", 1020AtsConstants.TimeSpan => "f64", 1021AtsConstants.Guid or AtsConstants.Uri => "String", 1022AtsConstants.CancellationToken => "CancellationToken", 1039AtsConstants.String or AtsConstants.Char => "&str", 1040AtsConstants.Number => "f64", 1041AtsConstants.Boolean => "bool", 1042AtsConstants.Void => "()", 1043AtsConstants.Any => "&Value", 1044AtsConstants.DateTime or AtsConstants.DateTimeOffset or 1045AtsConstants.DateOnly or AtsConstants.TimeOnly => "&str", 1046AtsConstants.TimeSpan => "f64", 1047AtsConstants.Guid or AtsConstants.Uri => "&str", 1048AtsConstants.CancellationToken => "&CancellationToken", 1062&& typeRef.TypeId is not (AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken); 1066&& typeRef.TypeId != AtsConstants.ReferenceExpressionTypeId 1084string.Equals(typeId, AtsConstants.CancellationToken, StringComparison.Ordinal) 1095if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId
Aspire.Hosting.CodeGeneration.TypeScript (36)
AtsTypeScriptCodeGenerator.cs (14)
134capability.ReturnType.TypeId == AtsConstants.Void ? null : capability.Documentation?.Returns, 135suppressReturns: capability.ReturnType.TypeId == AtsConstants.Void, 926var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void; 1203if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 1787else if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 1865&& callbackParam.CallbackReturnType.TypeId != AtsConstants.Void; 1902if (cbTypeId == AtsConstants.CancellationToken) 1929var builderHandle = TypeScriptApiProjector.GetHandleTypeName(AtsConstants.BuilderTypeId); 2253if (getter.ReturnType?.TypeId == AtsConstants.CancellationToken) 2333if (getter.ReturnType?.TypeId == AtsConstants.CancellationToken) 2682else if (method.ReturnType?.TypeId == AtsConstants.CancellationToken) 2870var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void; 3012if (capability.ReturnType?.TypeId == AtsConstants.CancellationToken) 3077var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void;
TypeScriptApiProjector.cs (22)
424if (capability.ReturnType is null || capability.ReturnType.TypeId == AtsConstants.Void) 1663if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) 1715return typeRef.TypeId is AtsConstants.Void or AtsConstants.Any or AtsConstants.CancellationToken 1764AtsConstants.String or AtsConstants.Char => "string", 1765AtsConstants.Number => "number", 1766AtsConstants.Boolean => "boolean", 1767AtsConstants.Void => "void", 1768AtsConstants.Any => "any", 1769AtsConstants.DateTime or AtsConstants.DateTimeOffset or 1770AtsConstants.DateOnly or AtsConstants.TimeOnly => "string", 1771AtsConstants.TimeSpan => "number", 1772AtsConstants.Guid or AtsConstants.Uri => "string", 1773AtsConstants.CancellationToken => GetCancellationTokenInterfaceName(), 2011internal static bool IsCancellationTokenType(AtsTypeRef? typeRef) => typeRef?.TypeId == AtsConstants.CancellationToken; 2674if (targetTypeId is AtsConstants.ReferenceExpressionTypeId or InteractionInputCollectionTypeId) 3112var returnType = callbackReturnType == null || callbackReturnType.TypeId == AtsConstants.Void
Aspire.Hosting.CodeGeneration.TypeScript.Tests (20)
AtsTypeScriptCodeGeneratorTests.cs (20)
280TypeId = AtsConstants.String, 889TypeId = AtsConstants.Number, 895TypeId = $"{AtsConstants.Number}[]", 989TypeId = AtsConstants.Number, 997KeyType = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive }, 1849TypeId = AtsConstants.Void, 1874TypeId = AtsConstants.Void, 2159c.TargetTypeId == AtsConstants.ReferenceExpressionTypeId); 2251Assert.Equal(AtsConstants.CancellationToken, ctParam.Type.TypeId); 2286Assert.Equal(AtsConstants.CancellationToken, operationParam.CallbackParameters[0].Type?.TypeId); 2305Assert.Equal(AtsConstants.TimeSpan, timeoutParam.Type?.TypeId); 2309Assert.Equal(AtsConstants.CancellationToken, ctParam.Type?.TypeId); 2838TypeId = AtsConstants.String, 2843TypeId = AtsConstants.Void, 3147TypeId = AtsConstants.Void, 3280TypeId = AtsConstants.Void, 3287TypeId = AtsConstants.Void, 3314TypeId = AtsConstants.String, 3323TypeId = AtsConstants.Number, 3331TypeId = AtsConstants.Void,
Aspire.Hosting.RemoteHost (55)
Ats\AtsMarshaller.cs (2)
144if (typeRef.TypeId == AtsConstants.CancellationToken && value is CancellationToken cancellationToken) 150if (typeRef.TypeId == TypeSystem.AtsConstants.Any)
Ats\ExternalCapabilityRegistry.cs (2)
606.Where(parameter => parameter.Type?.TypeId == AtsConstants.CancellationToken) 760$"Integration capability '{capability.Id}' must declare returnType; use '{AtsConstants.Void}' for a void method.");
AtsCapabilityScanner.cs (50)
98var typeId = AtsConstants.EnumTypeId(fullName); 1386AtsTypeCategory.Primitive => typeRef.TypeId != AtsConstants.CancellationToken && typeRef.TypeId != AtsConstants.Void, 1691: new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 1695TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 1718propertyTypeRef = new AtsTypeRef { TypeId = AtsConstants.Any, Category = AtsTypeCategory.Primitive }; 2288returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2292returnTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2300?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2301: new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2306?? new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive } 2334var voidTypeRef = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }; 2452if (AtsConstants.IsPrimitiveType(type)) 2460return AtsConstants.Any; 2465return AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any); 2470return AtsConstants.ListTypeId(AtsConstants.Any); 2476return AtsConstants.EnumTypeId(type.FullName ?? type.Name); 2498return AtsConstants.DictTypeId(keyTypeName, valueTypeName); 2514return AtsConstants.ListTypeId(elementTypeName); 2585return AtsConstants.String; 2589return AtsConstants.Char; 2593return AtsConstants.Boolean; 2602return AtsConstants.Number; 2608return AtsConstants.DateTime; 2612return AtsConstants.DateTimeOffset; 2616return AtsConstants.DateOnly; 2620return AtsConstants.TimeOnly; 2624return AtsConstants.TimeSpan; 2630return AtsConstants.Guid; 2634return AtsConstants.Uri; 2638return AtsConstants.CancellationToken; 2669TypeId = AtsConstants.Void, 2770return new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = type, Category = AtsTypeCategory.Primitive }; 2777TypeId = AtsConstants.DictTypeId(AtsConstants.String, AtsConstants.Any), 2780KeyType = new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 2781ValueType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive }, 2790TypeId = AtsConstants.ListTypeId(AtsConstants.Any), 2793ElementType = new AtsTypeRef { TypeId = AtsConstants.Any, ClrType = typeof(object), Category = AtsTypeCategory.Primitive } 2805TypeId = AtsConstants.EnumTypeId(type.FullName ?? type.Name), 2828TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2851TypeId = AtsConstants.DictTypeId(keyTypeRef.TypeId, valueTypeRef.TypeId), 2873TypeId = AtsConstants.ListTypeId(elementTypeRef.TypeId), 2893TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId), 2938TypeId = AtsConstants.ArrayTypeId(elementTypeRef.TypeId),
AtsContextFilter.cs (1)
344TypeId = AtsConstants.Void,
Aspire.Hosting.RemoteHost.Tests (34)
AtsCapabilityScannerTests.cs (9)
170[InlineData(typeof(double?[]), AtsConstants.Number)] 171[InlineData(typeof(bool?[]), AtsConstants.Boolean)] 194Assert.Contains(parameter.Type.UnionTypes!, type => type.TypeId == AtsConstants.String); 491Assert.Equal(AtsConstants.String, nameGetter.ReturnType.TypeId); 496Assert.Equal(AtsConstants.String, descriptionGetter.ReturnType.TypeId); 517Assert.Equal(AtsConstants.String, nullableString.Type.TypeId); 522Assert.Equal(AtsConstants.String, requiredString.Type.TypeId); 527Assert.Equal(AtsConstants.Number, nullableNumber.Type.TypeId); 532Assert.Equal(AtsConstants.Number, requiredNumber.Type.TypeId);
AtsContextFilterTests.cs (11)
136type => Assert.Equal(AtsConstants.EnumTypeId(typeof(TestMode).FullName!), type.TypeId)); 163Assert.Contains(filteredContext.EnumTypes, type => type.TypeId == AtsConstants.EnumTypeId(typeof(DistributedApplicationOperation).FullName!)); 164Assert.Contains(filteredContext.EnumTypes, type => type.TypeId == AtsConstants.EnumTypeId("Aspire.TypeSystem.ExportedValueMode")); 231Assert.Equal(AtsConstants.Void, filteredSupport.ReturnType.TypeId); 248TypeId = AtsConstants.EnumTypeId("Some.Foreign.Dependency.ForeignMode"), 256TypeId = AtsConstants.EnumTypeId("Some.Foreign.Dependency.ForeignCallbackMode"), 285Type = new AtsTypeRef { TypeId = AtsConstants.Void, Category = AtsTypeCategory.Primitive }, 434TypeId = AtsConstants.EnumTypeId(typeof(TestMode).FullName!), 453TypeId = AtsConstants.EnumTypeId(typeof(TestMode).FullName!), 461TypeId = AtsConstants.EnumTypeId("Aspire.TypeSystem.ExportedValueMode"), 469TypeId = AtsConstants.EnumTypeId(typeof(DistributedApplicationOperation).FullName!),
AtsMarshallerTests.cs (10)
175new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 176new AtsTypeRef { TypeId = AtsConstants.Number, ClrType = typeof(int), Category = AtsTypeCategory.Primitive }, 177new AtsTypeRef { TypeId = AtsConstants.Boolean, ClrType = typeof(bool), Category = AtsTypeCategory.Primitive } 198new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 220new AtsTypeRef { TypeId = AtsConstants.String, ClrType = typeof(string), Category = AtsTypeCategory.Primitive }, 221new AtsTypeRef { TypeId = AtsConstants.Boolean, ClrType = typeof(bool), Category = AtsTypeCategory.Primitive } 293TypeId = AtsConstants.CancellationToken, 1394var conditionHandleId = registry.Register(condition, AtsConstants.ReferenceExpressionTypeId); 1436var conditionHandleId = registry.Register(condition, AtsConstants.ReferenceExpressionTypeId); 1478var conditionHandleId = registry.Register(condition, AtsConstants.ReferenceExpressionTypeId);
ExternalCapabilityRegistryTests.cs (3)
894ReturnType = new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive } 920ReturnType = new AtsTypeRef { TypeId = AtsConstants.Boolean, Category = AtsTypeCategory.Primitive } 964Type = new AtsTypeRef { TypeId = AtsConstants.String, Category = AtsTypeCategory.Primitive },
HandleRegistryTests.cs (1)
350var typeId = AtsConstants.ReferenceExpressionTypeId;
Aspire.TypeSystem (2)
AtsCapabilityInfo.cs (1)
314/// Use <see cref="AtsConstants.Void"/> TypeId for void return types.
AtsContext.cs (1)
110if (AtsConstants.IsPrimitiveType(type))