125 writes to
Aspire.Dashboard (1)
Otlp\Model\OtlpHelpers.cs (1)
141o[item.Key] = ConvertAnyValue(item.Value);
Aspire.Hosting (4)
Devcontainers\DevcontainerSettingsWriter.cs (3)
63portAttributes["label"] = label; 64portAttributes["protocol"] = protocol; 65portAttributes["onAutoForward"] = "notify";
src\Shared\SecretsStore.cs (1)
57contents[secret.Key] = secret.Value;
Aspire.Hosting.Azure (5)
Provisioning\Provisioners\BicepProvisioner.cs (5)
281az["Tenant"] = context.Tenant.Data.DefaultDomain; 292resourceConfig["Id"] = deployment.Id.ToString(); 295resourceConfig["Parameters"] = parameters.ToJsonString(); 300resourceConfig["Outputs"] = outputObj.ToJsonString(); 304resourceConfig["CheckSum"] = GetChecksum(resource, parameters);
ConfigurationSchemaGenerator (22)
ConfigSchemaEmitter.cs (22)
63categoryNode["$ref"] = "#/definitions/logLevelThreshold"; 67parent["definitions"] = new JsonObject 120currentNode["type"] = "object"; 126currentNode[propertiesName] = propertiesNode; 241currentNode["type"] = "object"; 247currentNode["properties"] = propertiesNode; 318currentNode["type"] = typeName; 320currentNode[containerName] = containerNode; 445propertyNode["description"] = description; 459propertyNode["default"] = true; 463propertyNode["default"] = false; 591propertyNode["type"] = "string"; 592propertyNode["pattern"] = TimeSpanRegex; 608propertyNode["enum"] = enumNode; 612propertyNode["type"] = "string"; 613propertyNode["format"] = "uri"; 620propertyNode["type"] = new JsonArray { "number", "string" }; 624propertyNode["type"] = "string"; 625propertyNode["format"] = "uuid"; 630propertyNode["oneOf"] = new JsonArray 649propertyNode["type"] = GetParsableTypeName(parsable); 730jsonObject[key] = value;
dotnet-user-jwts (2)
Helpers\JwtAuthenticationSchemeSettings.cs (2)
34schemes[SchemeName] = settingsObject; 46config[AuthenticationKey] = new JsonObject
Microsoft.AspNetCore.OpenApi (53)
Extensions\JsonNodeSchemaExtensions.cs (52)
89schema[OpenApiSchemaKeywords.TypeKeyword] = "string"; 90schema[OpenApiSchemaKeywords.FormatKeyword] = "byte"; 105schema[OpenApiSchemaKeywords.MinimumKeyword] = minDecimal; 109schema[OpenApiSchemaKeywords.MaximumKeyword] = maxDecimal; 114schema[OpenApiSchemaKeywords.PatternKeyword] = regularExpressionAttribute.Pattern; 119schema[targetKey] = maxLengthAttribute.Length; 124schema[targetKey] = minLengthAttribute.Length; 129schema[$"min{targetKeySuffix}"] = lengthAttribute.MinimumLength; 130schema[$"max{targetKeySuffix}"] = lengthAttribute.MaximumLength; 134schema[OpenApiSchemaKeywords.TypeKeyword] = "string"; 135schema[OpenApiSchemaKeywords.FormatKeyword] = "uri"; 139schema[OpenApiSchemaKeywords.MinLengthKeyword] = stringLengthAttribute.MinimumLength; 140schema[OpenApiSchemaKeywords.MaxLengthKeyword] = stringLengthAttribute.MaximumLength; 160schema[OpenApiSchemaKeywords.DefaultKeyword] = null; 164schema[OpenApiSchemaKeywords.DefaultKeyword] = JsonSerializer.SerializeToNode(defaultValue, jsonTypeInfo); 194schema[OpenApiSchemaKeywords.NullableKeyword] = openApiSchema.Nullable || (schema[OpenApiSchemaKeywords.TypeKeyword] is JsonArray schemaType && schemaType.GetValues<string>().Contains("null")); 195schema[OpenApiSchemaKeywords.TypeKeyword] = openApiSchema.Type; 196schema[OpenApiSchemaKeywords.FormatKeyword] = openApiSchema.Format; 197schema[OpenApiConstants.SchemaId] = createSchemaReferenceId(context.TypeInfo); 198schema[OpenApiSchemaKeywords.NullableKeyword] = underlyingType != null; 201schema[OpenApiSchemaKeywords.PatternKeyword] = null; 218schema[OpenApiSchemaKeywords.MinimumKeyword] = minRouteConstraint.Min; 222schema[OpenApiSchemaKeywords.MaximumKeyword] = maxRouteConstraint.Max; 226schema[OpenApiSchemaKeywords.MinLengthKeyword] = minLengthRouteConstraint.MinLength; 230schema[OpenApiSchemaKeywords.MaxLengthKeyword] = maxLengthRouteConstraint.MaxLength; 234schema[OpenApiSchemaKeywords.MinimumKeyword] = rangeRouteConstraint.Min; 235schema[OpenApiSchemaKeywords.MaximumKeyword] = rangeRouteConstraint.Max; 239schema[OpenApiSchemaKeywords.TypeKeyword] = "string"; 240schema[OpenApiSchemaKeywords.FormatKeyword] = null; 241schema[OpenApiSchemaKeywords.PatternKeyword] = regexRouteConstraint.Constraint.ToString(); 245schema[OpenApiSchemaKeywords.MinLengthKeyword] = lengthRouteConstraint.MinLength; 246schema[OpenApiSchemaKeywords.MaxLengthKeyword] = lengthRouteConstraint.MaxLength; 250schema[OpenApiSchemaKeywords.TypeKeyword] = "number"; 251schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is FloatRouteConstraint ? "float" : "double"; 255schema[OpenApiSchemaKeywords.TypeKeyword] = "integer"; 256schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is LongRouteConstraint ? "int64" : "int32"; 260schema[OpenApiSchemaKeywords.TypeKeyword] = "string"; 261schema[OpenApiSchemaKeywords.FormatKeyword] = constraint is GuidRouteConstraint ? "uuid" : null; 265schema[OpenApiSchemaKeywords.TypeKeyword] = "boolean"; 266schema[OpenApiSchemaKeywords.FormatKeyword] = null; 270schema[OpenApiSchemaKeywords.TypeKeyword] = "string"; 271schema[OpenApiSchemaKeywords.FormatKeyword] = null; 275schema[OpenApiSchemaKeywords.TypeKeyword] = "string"; 276schema[OpenApiSchemaKeywords.FormatKeyword] = "date-time"; 339schema[OpenApiSchemaKeywords.NullableKeyword] = false; 384mappings[$"{discriminator}"] = $"#/components/schemas/{createSchemaReferenceId(context.TypeInfo)}{createSchemaReferenceId(jsonDerivedType)}"; 387schema[OpenApiSchemaKeywords.DiscriminatorKeyword] = polymorphismOptions.TypeDiscriminatorPropertyName; 388schema[OpenApiSchemaKeywords.DiscriminatorMappingKeyword] = mappings; 402schema[OpenApiConstants.SchemaId] = schemaReferenceId; 408schema[OpenApiConstants.SchemaId] = "Base"; 440schema[OpenApiSchemaKeywords.NullableKeyword] = true; 455schema[OpenApiSchemaKeywords.NullableKeyword] = true;
Services\Schemas\OpenApiSchemaService.cs (1)
121schema[OpenApiSchemaKeywords.DescriptionKeyword] = descriptionAttribute.Description;
Microsoft.Extensions.AI.Abstractions (4)
Utilities\AIJsonUtilities.Schema.cs (4)
269objSchema[RefPropertyName] = (JsonNode)refUri; 295objSchema[RequiredPropertyName] = requiredArray; 314obj[TypePropertyName] = "integer"; 415jsonObject[entry.Key] = entry.Value;
Microsoft.Extensions.AI.Abstractions.Tests (2)
test\Shared\JsonSchemaExporter\TestTypes.cs (2)
781jObj["default"] = JsonSerializer.SerializeToNode(attr.Value); 786jObj["pattern"] = regexAttr.Pattern;
Microsoft.ML.AutoML (9)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (2)
27jsonObject["schema"] = value.Schema.ToString(); 28jsonObject["estimators"] = JsonValue.Create(value.Estimators);
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
30jObject["estimatorType"] = JsonValue.Create(value.EstimatorType); 31jObject["parameter"] = JsonValue.Create(value.Parameter);
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (2)
30jNode["parameter"] = JsonValue.Create(parameter); 31jNode["estimators"] = JsonValue.Create(estimators);
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
28jsonObject["schema"] = value.Schema.ToString(); 29jsonObject["currentSchema"] = value.CurrentParameter["_SCHEMA_"].AsType<string>(); 30jsonObject["estimators"] = JsonValue.Create(value.Estimators);
MSBuild (18)
JsonOutputFormatter.cs (17)
40propertiesNode[property] = getProperty(property); 43_topLevelNode["Properties"] = propertiesNode; 62jsonItem["Identity"] = item.GetMetadataValue("Identity"); 70jsonItem[metadatumName] = item.GetMetadataValue(metadatumName); 76itemsNode[itemName] = itemArray; 79_topLevelNode["Items"] = itemsNode; 98jsonItem["Identity"] = item.GetMetadataValue("Identity"); 101jsonItem[metadatum.Name] = metadatum.EvaluatedValue; 111jsonItem[metadatumName] = item.GetMetadataValue(metadatumName); 117itemsNode[itemName] = itemArray; 120_topLevelNode["Items"] = itemsNode; 137targetResults["Result"] = targetResult.ResultCode.ToString(); 142jsonItem["Identity"] = item.GetMetadata("Identity"); 150jsonItem[metadatumName] = item.GetMetadata(metadatumName); 156targetResults["Items"] = outputArray; 157targetResultsNode[targetName] = targetResults; 160_topLevelNode["TargetResults"] = targetResultsNode;
XMake.cs (1)
4642jsonNode[featureName] = Features.CheckFeatureAvailability(featureName).ToString();
Shared.Tests (2)
JsonSchemaExporter\TestTypes.cs (2)
781jObj["default"] = JsonSerializer.SerializeToNode(attr.Value); 786jObj["pattern"] = regexAttr.Pattern;
System.Text.Json (1)
System\Text\Json\Serialization\Converters\Node\JsonObjectConverter.cs (1)
34jObject[propertyName] = jNodeValue;
TestProject.AppHost (2)
TestProgram.cs (2)
150root[project.Name] = projectJson; 153projectJson["Endpoints"] = endpointsJsonArray;
114 references to
Aspire.Hosting.Azure (1)
Provisioning\JsonExtensions.cs (1)
12var node = obj[key];
Aspire.Hosting.Azure.Tests (19)
AzureBicepProvisionerTests.cs (9)
27Assert.Equal("david", parameters["name"]?["value"]?.ToString()); 63Assert.Equal("john", parameters["name"]?["value"]?.ToString()); 64Assert.Equal(20, parameters["age"]?["value"]?.GetValue<int>()); 65Assert.Equal(["a", "b", "c"], parameters["values"]?["value"]?.AsArray()?.Select(v => v?.ToString()) ?? []); 66Assert.Equal("connection string", parameters["conn"]?["value"]?.ToString()); 67Assert.Equal("value", parameters["jsonObj"]?["value"]?["key"]?.ToString()); 68Assert.Equal("paramValue", parameters["param"]?["value"]?.ToString()); 69Assert.Equal("paramValue/1", parameters["expr"]?["value"]?.ToString()); 70Assert.Equal("http://localhost:1023", parameters["endpoint"]?["value"]?.ToString());
AzureBicepResourceTests.cs (8)
750Assert.Equal("azure.bicep.v0", manifest["type"]?.ToString()); 751Assert.Equal("infrastructure1.module.bicep", manifest["path"]?.ToString()); 2632Assert.Equal("{ai.value}", aiManifest["connectionString"]?.ToString()); 2633Assert.Equal("parameter.v0", aiManifest["type"]?.ToString()); 2636Assert.Equal("{servicebus.value}", serviceBusManifest["connectionString"]?.ToString()); 2637Assert.Equal("parameter.v0", serviceBusManifest["type"]?.ToString()); 2640Assert.Equal("{ai.connectionString}", serviceManifest["env"]?["APPLICATIONINSIGHTS_CONNECTION_STRING"]?.ToString()); 2641Assert.Equal("{servicebus.connectionString}", serviceManifest["env"]?["ConnectionStrings__servicebus"]?.ToString());
AzureEventHubsExtensionsTests.cs (1)
369document["UserConfig"]!["LoggingConfig"] = new JsonObject { ["Type"] = "Console" };
AzureServiceBusExtensionsTests.cs (1)
606document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };
Aspire.Hosting.Redis.Tests (5)
RedisFunctionalTests.cs (5)
672var agreements = jo["agreements"]; 675Assert.False(agreements["analytics"]!.GetValue<bool>()); 676Assert.False(agreements["notifications"]!.GetValue<bool>()); 677Assert.False(agreements["encryption"]!.GetValue<bool>()); 678Assert.True(agreements["eula"]!.GetValue<bool>());
Aspire.Hosting.Tests (4)
KestrelConfigTests.cs (1)
305Assert.Equal(expectedEnv, manifest["env"]!.ToString());
Utils\ManifestUtils.cs (2)
35var resourceNode = obj[resource.Name]; 57var resourceNode = obj[r.Name];
WithEndpointTests.cs (1)
550Assert.Equal(expectedEnv, manifest["env"]!.ToString());
ConfigurationSchemaGenerator (11)
ConfigSchemaEmitter.cs (11)
119var backupTypeNode = currentNode["type"]; 123if (currentNode[propertiesName] is not JsonObject propertiesNode) 132if (propertiesNode[pathSegment] is not JsonObject pathSegmentNode) 147backupCasingOfPathSegmentName = propertiesNode[pathSegment].GetPropertyName(); 174var existingValue = propertiesNode[pathSegment]; 240var backupTypeNode = currentNode["type"]; 244if (currentNode["properties"] is not JsonObject propertiesNode) 284var backupPropertyNode = currentNode[property.ConfigurationKeyName]; 315var backupTypeNode = currentNode["type"]; 316var backupContainerNode = currentNode[containerName]; 449var propertyNodeType = propertyNode["type"];
dotnet-user-jwts (6)
Helpers\JwtAuthenticationSchemeSettings.cs (4)
28if (config[AuthenticationKey] is JsonObject authentication) 30if (authentication[SchemesKey] is JsonObject schemes) 70if (config[AuthenticationKey] is JsonObject authentication && 71authentication[SchemesKey] is JsonObject schemes)
Helpers\SigningKeysHandler.cs (2)
82var signingKeys = secrets[signkingKeysPropertyName].AsArray(); 85var toRemove = signingKeys.SingleOrDefault(key => key["Issuer"].GetValue<string>() == issuer);
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (28)
UserJwtsTests.cs (28)
113Assert.Equal("dotnet-user-jwts", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue<string>()); 116Assert.Equal("new-issuer", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue<string>()); 130Assert.Equal("dotnet-user-jwts", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue<string>()); 133Assert.Equal("new-issuer", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue<string>()); 304Assert.Equal("baz", fooField["Bar"].GetValue<string>()); 521var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray()); 522Assert.Equal(32, signingKey["Length"].GetValue<int>()); 523Assert.True(Convert.TryFromBase64String(signingKey["Value"].GetValue<string>(), new byte[32], out var _)); 525Assert.Equal("baz", fooField["Bar"].GetValue<string>()); 549var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName(DevJwtsDefaults.Scheme)].AsArray()); 550Assert.Equal(32, signingKey["Length"].GetValue<int>()); 551Assert.True(Convert.TryFromBase64String(signingKey["Value"].GetValue<string>(), new byte[32], out var _)); 553Assert.Equal("baz", fooField["Bar"].GetValue<string>()); 588var signingKey = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray()); 589Assert.Equal(32, signingKey["Length"].GetValue<int>()); 590Assert.True(Convert.TryFromBase64String(signingKey["Value"].GetValue<string>(), new byte[32], out var _)); 591Assert.Equal("test-issuer", signingKey["Issuer"].GetValue<string>()); 610var signingKeys = secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray(); 612Assert.NotNull(signingKeys.SingleOrDefault(signingKey => signingKey["Issuer"].GetValue<string>() == "test-issuer")); 613Assert.NotNull(signingKeys.SingleOrDefault(signingKey => signingKey["Issuer"].GetValue<string>() == "test-issuer-2")); 631var signingKey1 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme")].AsArray()); 632Assert.Equal("test-issuer", signingKey1["Issuer"].GetValue<string>()); 633Assert.Equal(32, signingKey1["Length"].GetValue<int>()); 634Assert.True(Convert.TryFromBase64String(signingKey1["Value"].GetValue<string>(), new byte[32], out var _)); 635var signingKey2 = Assert.Single(secretsJson[SigningKeysHandler.GetSigningKeyPropertyName("test-scheme-2")].AsArray()); 636Assert.Equal("test-issuer", signingKey2["Issuer"].GetValue<string>()); 637Assert.Equal(32, signingKey2["Length"].GetValue<int>()); 638Assert.True(Convert.TryFromBase64String(signingKey2["Value"].GetValue<string>(), new byte[32], out var _));
Microsoft.AspNetCore.Http.Extensions.Tests (4)
RequestDelegateFactoryTests.cs (2)
1390Assert.NotNull(deserializedResponseBody["$type"]); 1391Assert.Equal(nameof(JsonTodoChild), deserializedResponseBody["$type"]!.GetValue<string>());
RequestDelegateGenerator\RequestDelegateCreationTests.Responses.cs (2)
679Assert.NotNull(node["$type"]); 680Assert.Equal(nameof(JsonTodoChild), node["$type"]!.GetValue<string>());
Microsoft.AspNetCore.OpenApi (4)
Extensions\JsonNodeSchemaExtensions.cs (4)
118var targetKey = schema[OpenApiSchemaKeywords.TypeKeyword]?.GetValue<string>() == "array" ? OpenApiSchemaKeywords.MaxItemsKeyword : OpenApiSchemaKeywords.MaxLengthKeyword; 123var targetKey = schema[OpenApiSchemaKeywords.TypeKeyword]?.GetValue<string>() == "array" ? OpenApiSchemaKeywords.MinItemsKeyword : OpenApiSchemaKeywords.MinLengthKeyword; 128var targetKeySuffix = schema[OpenApiSchemaKeywords.TypeKeyword]?.GetValue<string>() == "array" ? "Items" : "Length"; 194schema[OpenApiSchemaKeywords.NullableKeyword] = openApiSchema.Nullable || (schema[OpenApiSchemaKeywords.TypeKeyword] is JsonArray schemaType && schemaType.GetValues<string>().Contains("null"));
Microsoft.Extensions.AI.Abstractions (1)
Utilities\AIJsonUtilities.Schema.cs (1)
385if (ctx.TypeInfo.NumberHandling is not JsonNumberHandling.Strict && schema["type"] is JsonArray typeArray)
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAISerializationTests.cs (2)
352Assert.Equal("The person whose age is being requested", (string)parameterSchema["description"]!); 353Assert.Equal("string", (string)parameterSchema["type"]!);
Microsoft.ML.AutoML (9)
SweepableEstimator\Converter\MultiModelPipelineConverter.cs (2)
18var schema = jValue["schema"].GetValue<string>(); 19var estimators = jValue["estimator"].GetValue<Dictionary<string, SweepableEstimator>>();
SweepableEstimator\Converter\SweepableEstimatorConverter.cs (2)
19var estimatorType = jsonObject["estimatorType"].GetValue<EstimatorType>(); 20var parameter = jsonObject["parameter"].GetValue<Parameter>();
SweepableEstimator\Converter\SweepableEstimatorPipelineConverter.cs (2)
18var parameter = jNode["parameter"].GetValue<Parameter>(); 19var estimators = jNode["estimators"].GetValue<SweepableEstimator[]>();
SweepableEstimator\Converter\SweepablePipelineConverter.cs (3)
18var currentSchema = jValue["currentSchema"].GetValue<string>(); 19var schema = jValue["schema"].GetValue<string>(); 20var estimators = jValue["estimator"].GetValue<Dictionary<string, SweepableEstimator>>();
Microsoft.ML.AutoML.SourceGenerator (10)
SearchSpaceGenerator.cs (10)
39var className = Utils.ToTitleCase(jNode["name"].GetValue<string>()); 40var searchSpaceJArray = jNode["search_space"].AsArray(); 43var optionName = Utils.ToTitleCase(t["name"].GetValue<string>()); 44string optionTypeName = t["type"].GetValue<string>() switch 65var defaultToken = t.AsObject().ContainsKey("default") ? t["default"] : null; 86var searchSpaceNode = t.AsObject().ContainsKey("search_space") ? t["search_space"] : null; 96var minToken = searchSpaceNode["min"]; 97var minValue = searchSpaceNode["min"].GetValue<double>(); 98var maxValue = searchSpaceNode["max"].GetValue<double>(); 99var logBase = searchSpaceObject.ContainsKey("log_base") is false ? "false" : searchSpaceNode["log_base"].GetValue<bool>() ? "true" : "false";
MSBuild (4)
JsonOutputFormatter.cs (4)
35ErrorUtilities.VerifyThrow(_topLevelNode["Properties"] is null, "Should not add multiple lists of properties to the json format."); 53ErrorUtilities.VerifyThrow(_topLevelNode["Items"] is null, "Should not add multiple lists of items to the json format."); 89ErrorUtilities.VerifyThrow(_topLevelNode["Items"] is null, "Should not add multiple lists of items to the json format."); 130ErrorUtilities.VerifyThrow(_topLevelNode["TargetResults"] is null, "Should not add multiple lists of target results to the json format.");
Roslyn.VisualStudio.Next.UnitTests (3)
UnifiedSettings\UnifiedSettingsTests.cs (3)
134var categories = jsonDocument!.Root["categories"]!.AsObject(); 236var categories = jsonDocument!.Root["categories"]!.AsObject(); 261var properties = jsonDocument!.Root["properties"]!.AsObject()
ServiceBus.AppHost (1)
Program.cs (1)
41document["UserConfig"]!["Logging"] = new JsonObject { ["Type"] = "Console" };
Shared.Tests (2)
JsonSchemaExporter\JsonSchemaExporterTests.cs (2)
61JsonValue type = Assert.IsAssignableFrom<JsonValue>(schema["type"]); 77JsonValue value = Assert.IsAssignableFrom<JsonValue>(schema["type"]);