diff --git a/packages/http-client-csharp/eng/scripts/Check-GitChanges.ps1 b/packages/http-client-csharp/eng/scripts/Check-GitChanges.ps1 index c4bde91a49e..90ce6f8b80c 100644 --- a/packages/http-client-csharp/eng/scripts/Check-GitChanges.ps1 +++ b/packages/http-client-csharp/eng/scripts/Check-GitChanges.ps1 @@ -20,3 +20,11 @@ Invoke-LoggedCommand "git -c core.safecrlf=false diff --ignore-space-at-eol --ex if($LastExitCode -ne 0) { throw "Changes detected" } + +# Check for untracked files that should have been committed (e.g. newly generated files) +$untrackedOutput = Invoke-LoggedCommand "git ls-files --others --exclude-standard -- $packageRoot" +if ($untrackedOutput) { + Write-Host "Untracked files detected:" + Write-Host $untrackedOutput + throw "Untracked files detected" +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ConfigurationSchemaGenerator.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ConfigurationSchemaGenerator.cs new file mode 100644 index 00000000000..99b581fe6d2 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ConfigurationSchemaGenerator.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Nodes; +using Microsoft.TypeSpec.Generator.ClientModel.Providers; +using Microsoft.TypeSpec.Generator.Input.Extensions; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; + +namespace Microsoft.TypeSpec.Generator.ClientModel +{ + /// + /// Generates a ConfigurationSchema.json file for JSON IntelliSense support in appsettings.json. + /// The schema defines well-known client names and their configuration properties. + /// Common definitions (credential, options) are inherited from the System.ClientModel base schema + /// and not duplicated here. Only additional types specific to the generated client (e.g., enums, + /// custom models) are defined locally. + /// + internal static class ConfigurationSchemaGenerator + { + internal const string DefaultSectionName = "Clients"; + internal const string DefaultOptionsRef = "options"; + + private static readonly JsonSerializerOptions s_jsonOptions = new() + { + WriteIndented = true + }; + + /// + /// Generates the ConfigurationSchema.json content based on the output library's type providers. + /// Returns null if no clients with are found. + /// + internal static string? Generate(OutputLibrary output, string sectionName = DefaultSectionName, string optionsRef = DefaultOptionsRef) + { + var clientsWithSettings = output.TypeProviders + .OfType() + .Where(c => c.ClientSettings != null) + .ToList(); + + if (clientsWithSettings.Count == 0) + { + return null; + } + + var schema = BuildSchema(clientsWithSettings, sectionName, optionsRef); + return JsonSerializer.Serialize(schema, s_jsonOptions).ReplaceLineEndings("\n") + "\n"; + } + + private static JsonObject BuildSchema( + List clients, + string sectionName, + string optionsRef) + { + // Collect local definitions for non-base types during schema generation + var localDefinitions = new Dictionary(); + var clientProperties = new JsonObject(); + + foreach (var client in clients) + { + var clientEntry = BuildClientEntry(client, optionsRef, localDefinitions); + clientProperties[client.Name] = clientEntry; + } + + var schema = new JsonObject + { + ["$schema"] = "http://json-schema.org/draft-07/schema#", + ["type"] = "object", + ["properties"] = new JsonObject + { + [sectionName] = new JsonObject + { + ["type"] = "object", + ["properties"] = clientProperties, + ["additionalProperties"] = new JsonObject + { + ["type"] = "object", + ["description"] = "Configuration for a named client instance." + } + } + } + }; + + // Add local definitions only for types not covered by the base schema + if (localDefinitions.Count > 0) + { + var definitions = new JsonObject(); + foreach (var (name, definition) in localDefinitions.OrderBy(kvp => kvp.Key)) + { + definitions[name] = definition; + } + schema["definitions"] = definitions; + } + + return schema; + } + + private static JsonObject BuildClientEntry(ClientProvider client, string optionsRef, Dictionary localDefinitions) + { + var settings = client.ClientSettings!; + var properties = new JsonObject(); + + // Add endpoint property (Name is already transformed by PropertyProvider construction) + if (settings.EndpointProperty != null) + { + properties[settings.EndpointProperty.Name] = BuildPropertySchema(settings.EndpointProperty, localDefinitions); + } + + // Add other required parameters (raw param names need ToIdentifierName() for PascalCase) + foreach (var param in settings.OtherRequiredParams) + { + var propName = param.Name.ToIdentifierName(); + properties[propName] = GetJsonSchemaForType(param.Type, localDefinitions); + } + + // Add credential reference (defined in System.ClientModel base schema) + properties["Credential"] = new JsonObject + { + ["$ref"] = "#/definitions/credential" + }; + + // Add options + properties["Options"] = BuildOptionsSchema(client, optionsRef, localDefinitions); + + return new JsonObject + { + ["type"] = "object", + ["description"] = $"Configuration for {client.Name}.", + ["properties"] = properties + }; + } + + private static JsonObject BuildOptionsSchema(ClientProvider client, string optionsRef, Dictionary localDefinitions) + { + var clientOptions = client.EffectiveClientOptions; + if (clientOptions == null) + { + return new JsonObject + { + ["$ref"] = $"#/definitions/{optionsRef}" + }; + } + + // Build a named local definition for this client's options type that inherits from the base options. + // This follows the same pattern used in the Azure emitter where client options types extend the + // core options type using allOf. + var optionsTypeName = clientOptions.Name; + var definitionName = optionsTypeName.Length > 1 + ? char.ToLowerInvariant(optionsTypeName[0]) + optionsTypeName.Substring(1) + : optionsTypeName.ToLowerInvariant(); + + if (!localDefinitions.ContainsKey(definitionName)) + { + // Get client-specific option properties (public, non-version properties) + var customProperties = clientOptions.Properties + .Where(p => p.Modifiers.HasFlag(MethodSignatureModifiers.Public)) + .ToList(); + + var allOfArray = new JsonArray + { + new JsonObject { ["$ref"] = $"#/definitions/{optionsRef}" } + }; + + if (customProperties.Count > 0) + { + var extensionProperties = new JsonObject(); + foreach (var prop in customProperties) + { + extensionProperties[prop.Name] = GetJsonSchemaForType(prop.Type, localDefinitions); + } + + allOfArray.Add(new JsonObject + { + ["type"] = "object", + ["properties"] = extensionProperties + }); + } + + localDefinitions[definitionName] = new JsonObject + { + ["allOf"] = allOfArray + }; + } + + return new JsonObject + { + ["$ref"] = $"#/definitions/{definitionName}" + }; + } + + private static JsonObject BuildPropertySchema(PropertyProvider property, Dictionary localDefinitions) + { + var schema = GetJsonSchemaForType(property.Type, localDefinitions); + + if (property.Description != null) + { + var descriptionText = property.Description.ToString(); + if (!string.IsNullOrEmpty(descriptionText)) + { + schema["description"] = descriptionText; + } + } + + return schema; + } + + internal static JsonObject GetJsonSchemaForType(CSharpType type, Dictionary? localDefinitions = null) + { + // Unwrap nullable types + var effectiveType = type.IsNullable ? type.WithNullable(false) : type; + + // Handle non-framework types + if (!effectiveType.IsFrameworkType) + { + if (effectiveType.IsEnum) + { + return GetJsonSchemaForEnum(effectiveType, localDefinitions); + } + + return GetJsonSchemaForModel(effectiveType, localDefinitions); + } + + // Handle collection types + if (effectiveType.IsList) + { + return BuildArraySchema(effectiveType, localDefinitions); + } + + var frameworkType = effectiveType.FrameworkType; + + if (frameworkType == typeof(string)) + { + return new JsonObject { ["type"] = "string" }; + } + if (frameworkType == typeof(bool)) + { + return new JsonObject { ["type"] = "boolean" }; + } + if (frameworkType == typeof(int) || frameworkType == typeof(long)) + { + return new JsonObject { ["type"] = "integer" }; + } + if (frameworkType == typeof(float) || frameworkType == typeof(double)) + { + return new JsonObject { ["type"] = "number" }; + } + if (frameworkType == typeof(Uri)) + { + return new JsonObject { ["type"] = "string", ["format"] = "uri" }; + } + if (frameworkType == typeof(TimeSpan)) + { + return new JsonObject { ["type"] = "string" }; + } + + return new JsonObject { ["type"] = "object" }; + } + + private static JsonObject GetJsonSchemaForEnum(CSharpType enumType, Dictionary? localDefinitions) + { + // Search both top-level and nested types (e.g., service version enums nested in options) in a single pass + var enumProvider = CodeModelGenerator.Instance.OutputLibrary.TypeProviders + .SelectMany(t => new[] { t }.Concat(t.NestedTypes)) + .OfType() + .FirstOrDefault(e => e.Type.Equals(enumType)); + + if (enumProvider != null) + { + var values = new JsonArray(); + foreach (var member in enumProvider.EnumValues) + { + values.Add(JsonValue.Create(member.Value?.ToString())); + } + + JsonObject enumSchema; + if (enumType.IsStruct) + { + // Extensible enum — use anyOf to allow known values + custom strings + enumSchema = new JsonObject + { + ["anyOf"] = new JsonArray + { + new JsonObject { ["enum"] = values }, + new JsonObject { ["type"] = "string" } + } + }; + } + else + { + // Fixed enum + enumSchema = new JsonObject { ["enum"] = values }; + } + + // Register as a local definition if we're collecting them + if (localDefinitions != null) + { + var name = enumProvider.Name; + var definitionName = name.Length > 1 + ? char.ToLowerInvariant(name[0]) + name.Substring(1) + : name.ToLowerInvariant(); + if (!localDefinitions.ContainsKey(definitionName)) + { + localDefinitions[definitionName] = enumSchema; + } + return new JsonObject { ["$ref"] = $"#/definitions/{definitionName}" }; + } + + return enumSchema; + } + + // Fallback: just string + return new JsonObject { ["type"] = "string" }; + } + + private static JsonObject GetJsonSchemaForModel(CSharpType modelType, Dictionary? localDefinitions) + { + // Search for the model provider in the output library + var modelProvider = CodeModelGenerator.Instance.OutputLibrary.TypeProviders + .SelectMany(t => new[] { t }.Concat(t.NestedTypes)) + .FirstOrDefault(m => m is ModelProvider && m.Type.Equals(modelType)); + + if (modelProvider != null) + { + var name = modelProvider.Name; + var definitionName = name.Length > 1 + ? char.ToLowerInvariant(name[0]) + name.Substring(1) + : name.ToLowerInvariant(); + + if (localDefinitions != null && !localDefinitions.ContainsKey(definitionName)) + { + var modelProperties = new JsonObject(); + foreach (var prop in modelProvider.Properties + .Where(p => p.Modifiers.HasFlag(MethodSignatureModifiers.Public))) + { + modelProperties[prop.Name] = GetJsonSchemaForType(prop.Type, localDefinitions); + } + + var modelSchema = new JsonObject { ["type"] = "object" }; + if (modelProperties.Count > 0) + { + modelSchema["properties"] = modelProperties; + } + + localDefinitions[definitionName] = modelSchema; + } + + if (localDefinitions != null) + { + return new JsonObject { ["$ref"] = $"#/definitions/{definitionName}" }; + } + } + + return new JsonObject { ["type"] = "object" }; + } + + private static JsonObject BuildArraySchema(CSharpType listType, Dictionary? localDefinitions) + { + if (listType.Arguments.Count > 0) + { + return new JsonObject + { + ["type"] = "array", + ["items"] = GetJsonSchemaForType(listType.Arguments[0], localDefinitions) + }; + } + + return new JsonObject + { + ["type"] = "array", + ["items"] = new JsonObject { ["type"] = "string" } + }; + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs index 2751a397773..a2420740832 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientOptionsProvider.cs @@ -10,9 +10,9 @@ using Microsoft.TypeSpec.Generator.Input.Extensions; using Microsoft.TypeSpec.Generator.Primitives; using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Shared; using Microsoft.TypeSpec.Generator.Snippets; using Microsoft.TypeSpec.Generator.Statements; -using Microsoft.TypeSpec.Generator.Shared; using Microsoft.TypeSpec.Generator.Utilities; using static Microsoft.TypeSpec.Generator.Snippets.Snippet; @@ -20,7 +20,6 @@ namespace Microsoft.TypeSpec.Generator.ClientModel.Providers { public class ClientOptionsProvider : TypeProvider { - private const string ServicePrefix = "Service"; private const string VersionSuffix = "Version"; private const string ApiVersionSuffix = "ApiVersion"; private const string LatestPrefix = "Latest"; @@ -124,7 +123,7 @@ private static bool UseSingletonInstance(InputClient inputClient) internal IReadOnlyDictionary? VersionProperties => field ??= BuildVersionProperties(); - private Dictionary? BuildVersionProperties() + private Dictionary? BuildVersionProperties() { if (_serviceVersionsEnums is null) { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmCodeModelGenerator.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmCodeModelGenerator.cs index 0d9f0b3a36e..89dfdf1a03e 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmCodeModelGenerator.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/ScmCodeModelGenerator.cs @@ -4,7 +4,9 @@ using System; using System.ClientModel; using System.ComponentModel.Composition; +using System.IO; using System.Text.Json; +using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.TypeSpec.Generator.ClientModel.Providers; @@ -44,5 +46,21 @@ protected override void Configure() AddMetadataReference(MetadataReference.CreateFromFile(typeof(JsonSerializer).Assembly.Location)); AddTypeToKeep(ModelReaderWriterContextDefinition.s_name, isRoot: false); } + + public override async Task WriteAdditionalFiles(string outputPath) + { + var schemaContent = ConfigurationSchemaGenerator.Generate(OutputLibrary); + if (schemaContent != null) + { + var schemaPath = Path.Combine(outputPath, "schema", "ConfigurationSchema.json"); + var schemaDir = Path.GetDirectoryName(schemaPath); + if (schemaDir != null) + { + Directory.CreateDirectory(schemaDir); + } + Emitter.Info($"Writing {Path.GetFullPath(schemaPath)}"); + await File.WriteAllTextAsync(schemaPath, schemaContent); + } + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ConfigurationSchemaGeneratorTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ConfigurationSchemaGeneratorTests.cs new file mode 100644 index 00000000000..3cba27b4b63 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/ConfigurationSchemaGeneratorTests.cs @@ -0,0 +1,768 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Text.Json; +using System.Text.Json.Nodes; +using Microsoft.TypeSpec.Generator.ClientModel.Providers; +using Microsoft.TypeSpec.Generator.Input; +using Microsoft.TypeSpec.Generator.Primitives; +using Microsoft.TypeSpec.Generator.Providers; +using Microsoft.TypeSpec.Generator.Tests.Common; +using NUnit.Framework; + +namespace Microsoft.TypeSpec.Generator.ClientModel.Tests +{ + public class ConfigurationSchemaGeneratorTests + { + [SetUp] + public void SetUp() + { + // Reset the singleton instance before each test + var singletonField = typeof(ClientOptionsProvider).GetField("_singletonInstance", BindingFlags.Static | BindingFlags.NonPublic); + singletonField?.SetValue(null, null); + + MockHelpers.LoadMockGenerator(); + } + + private static string GetExpectedJsonFromFile([CallerMemberName] string method = "", [CallerFilePath] string filePath = "") + { + var callingClass = Path.GetFileName(filePath).Split('.').First(); + var path = Path.Combine(Path.GetDirectoryName(filePath)!, "TestData", callingClass, $"{method}.json"); + return File.ReadAllText(path); + } + + [Test] + public void Generate_ReturnsNull_WhenNoClientsWithSettings() + { + var output = new TestOutputLibrary([]); + var result = ConfigurationSchemaGenerator.Generate(output); + Assert.IsNull(result); + } + + [Test] + public void Generate_ReturnsSchema_ForClientWithSettings() + { + var client = InputFactory.Client("TestService"); + var clientProvider = new ClientProvider(client); + + Assert.IsNotNull(clientProvider.ClientSettings, "ClientSettings should not be null for individually-initialized client"); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + + var doc = JsonNode.Parse(result!)!; + Assert.AreEqual("http://json-schema.org/draft-07/schema#", doc["$schema"]?.GetValue()); + Assert.AreEqual("object", doc["type"]?.GetValue()); + + // Since the default generator uses SCM (System.ClientModel), the section should be "Clients" + var clients = doc["properties"]?["Clients"]; + Assert.IsNotNull(clients, "Schema should have a 'Clients' section for SCM clients"); + Assert.AreEqual("object", clients!["type"]?.GetValue()); + + var testClient = clients["properties"]?["TestService"]; + Assert.IsNotNull(testClient, "Schema should have a well-known 'TestService' entry"); + Assert.AreEqual("object", testClient!["type"]?.GetValue()); + + var expected = GetExpectedJsonFromFile(); + Assert.AreEqual(expected, result); + } + + [Test] + public void Generate_IncludesCredentialReference() + { + var client = InputFactory.Client("TestService"); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var credential = clientEntry?["properties"]?["Credential"]; + Assert.IsNotNull(credential, "Client entry should have a Credential property"); + Assert.AreEqual("#/definitions/credential", credential!["$ref"]?.GetValue()); + } + + [Test] + public void Generate_IncludesOptionsReference() + { + var client = InputFactory.Client("TestService"); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var options = clientEntry?["properties"]?["Options"]; + Assert.IsNotNull(options, "Client entry should have an Options property"); + + // Options should reference a local named definition that inherits from the base options + var optionsRef = options!["$ref"]?.GetValue(); + Assert.IsNotNull(optionsRef, "Options should be a $ref"); + Assert.That(optionsRef, Does.StartWith("#/definitions/"), "Options $ref should point to a local definition"); + + // Verify the local definition exists and inherits from base options via allOf + var defName = optionsRef!.Replace("#/definitions/", ""); + var optionsDef = doc["definitions"]?[defName]; + Assert.IsNotNull(optionsDef, $"Local definition '{defName}' should exist"); + + var allOf = optionsDef!["allOf"]; + Assert.IsNotNull(allOf, "Options definition should use allOf to inherit from base options"); + Assert.AreEqual("#/definitions/options", allOf!.AsArray()[0]?["$ref"]?.GetValue()); + } + + [Test] + public void Generate_IncludesOptionsDefinition_InheritingFromBase() + { + var client = InputFactory.Client("TestService"); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + // The options type should always be defined as a local definition that inherits from base options. + // Common definitions (credential, base options) are provided by System.ClientModel base schema. + var definitions = doc["definitions"]; + Assert.IsNotNull(definitions, "Schema should include local definitions for the options type"); + + // Find the options definition and verify it inherits from the base options + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var optionsRef = clientEntry?["properties"]?["Options"]?["$ref"]?.GetValue(); + Assert.IsNotNull(optionsRef, "Options should reference a local definition"); + var defName = optionsRef!.Replace("#/definitions/", ""); + var optionsDef = definitions![defName]; + Assert.IsNotNull(optionsDef, $"Options definition '{defName}' should exist"); + + var allOf = optionsDef!["allOf"]; + Assert.IsNotNull(allOf, "Options definition should use allOf to inherit from base options"); + Assert.AreEqual("#/definitions/options", allOf!.AsArray()[0]?["$ref"]?.GetValue(), + "First allOf element should reference the base options type"); + } + + [Test] + public void Generate_IncludesLocalDefinitions_ForEnumTypes() + { + // Create a non-api-version enum type + var retryModeEnum = InputFactory.StringEnum( + "RetryMode", + [("Fixed", "Fixed"), ("Exponential", "Exponential")], + isExtensible: false); + + // Reset and reload mock with the enum registered + var singletonField = typeof(ClientOptionsProvider).GetField("_singletonInstance", BindingFlags.Static | BindingFlags.NonPublic); + singletonField?.SetValue(null, null); + MockHelpers.LoadMockGenerator(inputEnums: () => [retryModeEnum]); + + InputParameter[] inputParameters = + [ + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.QueryParameter( + "retryMode", + retryModeEnum, + isRequired: false, + defaultValue: new InputConstant("Exponential", retryModeEnum), + scope: InputParameterScope.Client, + isApiVersion: false) + ]; + var client = InputFactory.Client("TestService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + // Verify local definitions contain the enum + var definitions = doc["definitions"]; + Assert.IsNotNull(definitions, "Schema should include local definitions for non-base types"); + + var retryModeDef = definitions!["retryMode"]; + Assert.IsNotNull(retryModeDef, "Definitions should include 'retryMode' enum"); + + // Fixed enum should have enum values + var enumValues = retryModeDef!["enum"]; + Assert.IsNotNull(enumValues, "Enum definition should have 'enum' values"); + + // Verify the option property references the local definition via $ref + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var options = clientEntry?["properties"]?["Options"]; + var optionsRef = options?["$ref"]?.GetValue(); + Assert.IsNotNull(optionsRef, "Options should reference a local definition"); + var optionsDefName = optionsRef!.Replace("#/definitions/", ""); + + // The options definition should use allOf with custom properties + var optionsDef = definitions![optionsDefName]; + Assert.IsNotNull(optionsDef, $"Options definition '{optionsDefName}' should exist"); + var allOf = optionsDef!["allOf"]; + Assert.IsNotNull(allOf, "Options definition should use allOf"); + + var extensionProperties = allOf!.AsArray()[1]?["properties"]; + var retryModeProp = extensionProperties!["RetryMode"]; + Assert.IsNotNull(retryModeProp, "Custom option property should exist"); + Assert.AreEqual("#/definitions/retryMode", retryModeProp!["$ref"]?.GetValue()); + } + + [Test] + public void Generate_IncludesEndpointProperty_ForStringEndpoint() + { + var inputParameters = new[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true) + }; + var client = InputFactory.Client("TestService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var endpoint = clientEntry?["properties"]?["Endpoint"]; + Assert.IsNotNull(endpoint, "Client entry should have an Endpoint property"); + Assert.AreEqual("string", endpoint!["type"]?.GetValue()); + } + + [Test] + public void Generate_IncludesEndpointProperty_ForUriEndpoint() + { + var inputParameters = new[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.Url, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true) + }; + var client = InputFactory.Client("TestService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var endpoint = clientEntry?["properties"]?["Endpoint"]; + Assert.IsNotNull(endpoint, "Client entry should have an Endpoint property"); + Assert.AreEqual("string", endpoint!["type"]?.GetValue()); + Assert.AreEqual("uri", endpoint!["format"]?.GetValue()); + } + + [Test] + public void Generate_IncludesOptionsAllOf_WhenClientHasCustomOptions() + { + InputParameter[] inputParameters = + [ + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.QueryParameter( + "enableTenantDiscovery", + InputPrimitiveType.Boolean, + isRequired: false, + defaultValue: new InputConstant(false, InputPrimitiveType.Boolean), + scope: InputParameterScope.Client, + isApiVersion: false) + ]; + var client = InputFactory.Client("BlobService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["BlobService"]; + var options = clientEntry?["properties"]?["Options"]; + Assert.IsNotNull(options, "Client entry should have an Options property"); + + // Options should reference a named local definition + var optionsRef = options!["$ref"]?.GetValue(); + Assert.IsNotNull(optionsRef, "Options should be a $ref to a local definition"); + var defName = optionsRef!.Replace("#/definitions/", ""); + + // Verify the local definition uses allOf to inherit from base options with custom properties + var optionsDef = doc["definitions"]?[defName]; + Assert.IsNotNull(optionsDef, $"Options definition '{defName}' should exist"); + + var allOf = optionsDef!["allOf"]; + Assert.IsNotNull(allOf, "Options definition should use allOf"); + + var allOfArray = allOf!.AsArray(); + Assert.AreEqual(2, allOfArray.Count, + "allOf should have base options ref + custom properties extension"); + Assert.AreEqual("#/definitions/options", allOfArray[0]?["$ref"]?.GetValue()); + Assert.AreEqual("object", allOfArray[1]?["type"]?.GetValue()); + + // Verify the custom property is included + var extensionProperties = allOfArray[1]?["properties"]; + Assert.IsNotNull(extensionProperties); + var enableTenantDiscovery = extensionProperties!["EnableTenantDiscovery"]; + Assert.IsNotNull(enableTenantDiscovery, "Custom option property should be included"); + Assert.AreEqual("boolean", enableTenantDiscovery!["type"]?.GetValue()); + } + + [Test] + public void Generate_OptionsDefinition_IncludesStringProperty() + { + InputParameter[] inputParameters = + [ + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.QueryParameter( + "audience", + InputPrimitiveType.String, + isRequired: false, + defaultValue: new InputConstant("https://api.example.com", InputPrimitiveType.String), + scope: InputParameterScope.Client, + isApiVersion: false) + ]; + var client = InputFactory.Client("TestService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var optionsRef = clientEntry?["properties"]?["Options"]?["$ref"]?.GetValue(); + Assert.IsNotNull(optionsRef); + var defName = optionsRef!.Replace("#/definitions/", ""); + + var optionsDef = doc["definitions"]?[defName]; + Assert.IsNotNull(optionsDef); + + var allOf = optionsDef!["allOf"]!.AsArray(); + Assert.AreEqual(2, allOf.Count, "allOf should have base options + extension"); + Assert.AreEqual("#/definitions/options", allOf[0]?["$ref"]?.GetValue()); + + var extensionProperties = allOf[1]?["properties"]; + Assert.IsNotNull(extensionProperties); + var audienceProp = extensionProperties!["Audience"]; + Assert.IsNotNull(audienceProp, "String option property should exist"); + Assert.AreEqual("string", audienceProp!["type"]?.GetValue()); + } + + [Test] + public void Generate_OptionsDefinition_IncludesIntegerProperty() + { + InputParameter[] inputParameters = + [ + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.QueryParameter( + "maxRetries", + InputPrimitiveType.Int32, + isRequired: false, + defaultValue: new InputConstant(3, InputPrimitiveType.Int32), + scope: InputParameterScope.Client, + isApiVersion: false) + ]; + var client = InputFactory.Client("TestService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var optionsRef = clientEntry?["properties"]?["Options"]?["$ref"]?.GetValue(); + Assert.IsNotNull(optionsRef); + var defName = optionsRef!.Replace("#/definitions/", ""); + + var optionsDef = doc["definitions"]?[defName]; + Assert.IsNotNull(optionsDef); + + var allOf = optionsDef!["allOf"]!.AsArray(); + Assert.AreEqual(2, allOf.Count, "allOf should have base options + extension"); + + var extensionProperties = allOf[1]?["properties"]; + Assert.IsNotNull(extensionProperties); + var maxRetriesProp = extensionProperties!["MaxRetries"]; + Assert.IsNotNull(maxRetriesProp, "Integer option property should exist"); + Assert.AreEqual("integer", maxRetriesProp!["type"]?.GetValue()); + } + + [Test] + public void Generate_OptionsDefinition_IncludesMultipleMixedProperties() + { + InputParameter[] inputParameters = + [ + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.QueryParameter( + "audience", + InputPrimitiveType.String, + isRequired: false, + defaultValue: new InputConstant("https://api.example.com", InputPrimitiveType.String), + scope: InputParameterScope.Client, + isApiVersion: false), + InputFactory.QueryParameter( + "enableCaching", + InputPrimitiveType.Boolean, + isRequired: false, + defaultValue: new InputConstant(true, InputPrimitiveType.Boolean), + scope: InputParameterScope.Client, + isApiVersion: false), + InputFactory.QueryParameter( + "maxRetries", + InputPrimitiveType.Int32, + isRequired: false, + defaultValue: new InputConstant(3, InputPrimitiveType.Int32), + scope: InputParameterScope.Client, + isApiVersion: false) + ]; + var client = InputFactory.Client("TestService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var optionsRef = clientEntry?["properties"]?["Options"]?["$ref"]?.GetValue(); + Assert.IsNotNull(optionsRef); + var defName = optionsRef!.Replace("#/definitions/", ""); + + var optionsDef = doc["definitions"]?[defName]; + Assert.IsNotNull(optionsDef); + + var allOf = optionsDef!["allOf"]!.AsArray(); + Assert.AreEqual(2, allOf.Count, "allOf should have base options + extension with multiple properties"); + Assert.AreEqual("#/definitions/options", allOf[0]?["$ref"]?.GetValue()); + Assert.AreEqual("object", allOf[1]?["type"]?.GetValue()); + + var extensionProperties = allOf[1]?["properties"]; + Assert.IsNotNull(extensionProperties); + + // Verify all three additional properties are present with correct types + var audienceProp = extensionProperties!["Audience"]; + Assert.IsNotNull(audienceProp, "String option property should exist"); + Assert.AreEqual("string", audienceProp!["type"]?.GetValue()); + + var enableCachingProp = extensionProperties!["EnableCaching"]; + Assert.IsNotNull(enableCachingProp, "Boolean option property should exist"); + Assert.AreEqual("boolean", enableCachingProp!["type"]?.GetValue()); + + var maxRetriesProp = extensionProperties!["MaxRetries"]; + Assert.IsNotNull(maxRetriesProp, "Integer option property should exist"); + Assert.AreEqual("integer", maxRetriesProp!["type"]?.GetValue()); + } + + [Test] + public void Generate_OptionsDefinition_IncludesModelProperty() + { + // Create a model type with properties + var retryPolicyModel = InputFactory.Model( + "RetryPolicyConfig", + properties: + [ + InputFactory.Property("MaxRetries", InputPrimitiveType.Int32), + InputFactory.Property("Delay", InputPrimitiveType.String) + ]); + + // Reset and reload mock with the model registered + var singletonField = typeof(ClientOptionsProvider).GetField("_singletonInstance", BindingFlags.Static | BindingFlags.NonPublic); + singletonField?.SetValue(null, null); + MockHelpers.LoadMockGenerator(inputModels: () => [retryPolicyModel]); + + InputParameter[] inputParameters = + [ + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.QueryParameter( + "retryPolicy", + retryPolicyModel, + isRequired: false, + defaultValue: new InputConstant(null, retryPolicyModel), + scope: InputParameterScope.Client, + isApiVersion: false) + ]; + var client = InputFactory.Client("TestService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + // Verify local definitions contain the model + var definitions = doc["definitions"]; + Assert.IsNotNull(definitions, "Schema should include local definitions"); + + var retryPolicyDef = definitions!["retryPolicyConfig"]; + Assert.IsNotNull(retryPolicyDef, "Definitions should include 'retryPolicyConfig' model"); + Assert.AreEqual("object", retryPolicyDef!["type"]?.GetValue()); + + // Verify the model definition has its properties + var modelProperties = retryPolicyDef["properties"]; + Assert.IsNotNull(modelProperties, "Model definition should have properties"); + Assert.IsNotNull(modelProperties!["MaxRetries"], "Model should have MaxRetries property"); + Assert.AreEqual("integer", modelProperties["MaxRetries"]!["type"]?.GetValue()); + Assert.IsNotNull(modelProperties["Delay"], "Model should have Delay property"); + Assert.AreEqual("string", modelProperties["Delay"]!["type"]?.GetValue()); + + // Verify the options definition references the model via $ref + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + var optionsRef = clientEntry?["properties"]?["Options"]?["$ref"]?.GetValue(); + Assert.IsNotNull(optionsRef); + var optionsDefName = optionsRef!.Replace("#/definitions/", ""); + + var optionsDef = definitions[optionsDefName]; + Assert.IsNotNull(optionsDef); + var allOf = optionsDef!["allOf"]!.AsArray(); + Assert.AreEqual(2, allOf.Count, "allOf should have base options + extension"); + + var extensionProperties = allOf[1]?["properties"]; + Assert.IsNotNull(extensionProperties); + var retryPolicyProp = extensionProperties!["RetryPolicy"]; + Assert.IsNotNull(retryPolicyProp, "Model option property should exist"); + Assert.AreEqual("#/definitions/retryPolicyConfig", retryPolicyProp!["$ref"]?.GetValue()); + } + + [Test] + public void Generate_ConstructorParameter_IncludesModelDefinition() + { + // Create a model type with properties to use as a required constructor parameter + var connectionConfigModel = InputFactory.Model( + "ConnectionConfig", + properties: + [ + InputFactory.Property("Host", InputPrimitiveType.String), + InputFactory.Property("Port", InputPrimitiveType.Int32) + ]); + + // Reset and reload mock with the model registered + var singletonField = typeof(ClientOptionsProvider).GetField("_singletonInstance", BindingFlags.Static | BindingFlags.NonPublic); + singletonField?.SetValue(null, null); + MockHelpers.LoadMockGenerator(inputModels: () => [connectionConfigModel]); + + InputParameter[] inputParameters = + [ + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.String, + defaultValue: InputFactory.Constant.String("https://default.endpoint.io"), + scope: InputParameterScope.Client, + isEndpoint: true), + InputFactory.QueryParameter( + "connectionConfig", + connectionConfigModel, + isRequired: true, + scope: InputParameterScope.Client, + isApiVersion: false) + ]; + var client = InputFactory.Client("TestService", parameters: inputParameters); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + // Verify local definitions contain the model + var definitions = doc["definitions"]; + Assert.IsNotNull(definitions, "Schema should include local definitions"); + + var connectionConfigDef = definitions!["connectionConfig"]; + Assert.IsNotNull(connectionConfigDef, "Definitions should include 'connectionConfig' model"); + Assert.AreEqual("object", connectionConfigDef!["type"]?.GetValue()); + + // Verify the model definition has its properties + var modelProperties = connectionConfigDef["properties"]; + Assert.IsNotNull(modelProperties, "Model definition should have properties"); + Assert.IsNotNull(modelProperties!["Host"], "Model should have Host property"); + Assert.AreEqual("string", modelProperties["Host"]!["type"]?.GetValue()); + Assert.IsNotNull(modelProperties["Port"], "Model should have Port property"); + Assert.AreEqual("integer", modelProperties["Port"]!["type"]?.GetValue()); + + // Verify the model appears as a top-level constructor parameter property (not under Options) + var clientEntry = doc["properties"]?["Clients"]?["properties"]?["TestService"]; + Assert.IsNotNull(clientEntry); + var connectionConfigProp = clientEntry!["properties"]?["ConnectionConfig"]; + Assert.IsNotNull(connectionConfigProp, "Constructor parameter model should appear as top-level client property"); + Assert.AreEqual("#/definitions/connectionConfig", connectionConfigProp!["$ref"]?.GetValue()); + + var expected = GetExpectedJsonFromFile(); + Assert.AreEqual(expected, result); + } + + [Test] + public void Generate_HandlesMultipleClients() + { + var client1 = InputFactory.Client("ServiceA"); + var client2 = InputFactory.Client("ServiceB"); + var provider1 = new ClientProvider(client1); + var provider2 = new ClientProvider(client2); + + var output = new TestOutputLibrary([provider1, provider2]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientsSection = doc["properties"]?["Clients"]?["properties"]; + Assert.IsNotNull(clientsSection?["ServiceA"], "Should include ServiceA"); + Assert.IsNotNull(clientsSection?["ServiceB"], "Should include ServiceB"); + + var expected = GetExpectedJsonFromFile(); + Assert.AreEqual(expected, result); + } + + [Test] + public void Generate_IncludesAdditionalPropertiesOnSection() + { + var client = InputFactory.Client("TestService"); + var clientProvider = new ClientProvider(client); + + var output = new TestOutputLibrary([clientProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + + Assert.IsNotNull(result); + var doc = JsonNode.Parse(result!)!; + + var clientsSection = doc["properties"]?["Clients"]; + var additionalProperties = clientsSection?["additionalProperties"]; + Assert.IsNotNull(additionalProperties, "Section should have additionalProperties for custom-named instances"); + Assert.AreEqual("object", additionalProperties!["type"]?.GetValue()); + } + + [Test] + public void Generate_ReturnsNull_WhenClientIsParentOnlyInitialized() + { + // Create a sub-client initialized by parent only + var parentClient = InputFactory.Client("ParentService"); + var subClient = InputFactory.Client( + "SubService", + parent: parentClient, + initializedBy: InputClientInitializedBy.Parent); + var subProvider = new ClientProvider(subClient); + + // Sub-client with Parent initialization should NOT have ClientSettings + Assert.IsNull(subProvider.ClientSettings); + + var output = new TestOutputLibrary([subProvider]); + var result = ConfigurationSchemaGenerator.Generate(output); + Assert.IsNull(result, "Should return null when no clients have settings"); + } + + [Test] + public void GetJsonSchemaForType_ReturnsCorrectSchema_ForPrimitiveTypes() + { + // String + var stringSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(string))); + Assert.AreEqual("string", stringSchema["type"]?.GetValue()); + + // Boolean + var boolSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(bool))); + Assert.AreEqual("boolean", boolSchema["type"]?.GetValue()); + + // Integer types + var intSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(int))); + Assert.AreEqual("integer", intSchema["type"]?.GetValue()); + + var longSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(long))); + Assert.AreEqual("integer", longSchema["type"]?.GetValue()); + + // Float types + var floatSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(float))); + Assert.AreEqual("number", floatSchema["type"]?.GetValue()); + + var doubleSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(double))); + Assert.AreEqual("number", doubleSchema["type"]?.GetValue()); + + // Uri + var uriSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(Uri))); + Assert.AreEqual("string", uriSchema["type"]?.GetValue()); + Assert.AreEqual("uri", uriSchema["format"]?.GetValue()); + + // TimeSpan + var timeSpanSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(TimeSpan))); + Assert.AreEqual("string", timeSpanSchema["type"]?.GetValue()); + } + + [Test] + public void GetJsonSchemaForType_ReturnsCorrectSchema_ForNullableTypes() + { + var nullableStringSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(string), isNullable: true)); + Assert.AreEqual("string", nullableStringSchema["type"]?.GetValue()); + + var nullableBoolSchema = ConfigurationSchemaGenerator.GetJsonSchemaForType(new CSharpType(typeof(bool), isNullable: true)); + Assert.AreEqual("boolean", nullableBoolSchema["type"]?.GetValue()); + } + + /// + /// Test output library that wraps provided TypeProviders. + /// + private class TestOutputLibrary : OutputLibrary + { + private readonly TypeProvider[] _types; + + public TestOutputLibrary(TypeProvider[] types) + { + _types = types; + } + + protected override TypeProvider[] BuildTypeProviders() => _types; + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_ConstructorParameter_IncludesModelDefinition.json b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_ConstructorParameter_IncludesModelDefinition.json new file mode 100644 index 00000000000..ee992634728 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_ConstructorParameter_IncludesModelDefinition.json @@ -0,0 +1,54 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "TestService": { + "type": "object", + "description": "Configuration for TestService.", + "properties": { + "Endpoint": { + "type": "string", + "description": "Gets or sets the Endpoint." + }, + "ConnectionConfig": { + "$ref": "#/definitions/connectionConfig" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/testServiceOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "connectionConfig": { + "type": "object", + "properties": { + "Host": { + "type": "string" + }, + "Port": { + "type": "integer" + } + } + }, + "testServiceOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_HandlesMultipleClients.json b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_HandlesMultipleClients.json new file mode 100644 index 00000000000..b3c782f6645 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_HandlesMultipleClients.json @@ -0,0 +1,55 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ServiceA": { + "type": "object", + "description": "Configuration for ServiceA.", + "properties": { + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/serviceAOptions" + } + } + }, + "ServiceB": { + "type": "object", + "description": "Configuration for ServiceB.", + "properties": { + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/serviceBOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "serviceAOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + }, + "serviceBOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_ReturnsSchema_ForClientWithSettings.json b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_ReturnsSchema_ForClientWithSettings.json new file mode 100644 index 00000000000..d579da072a4 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/TestData/ConfigurationSchemaGeneratorTests/Generate_ReturnsSchema_ForClientWithSettings.json @@ -0,0 +1,36 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "TestService": { + "type": "object", + "description": "Configuration for TestService.", + "properties": { + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/testServiceOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "testServiceOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/CSharpGen.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/CSharpGen.cs index 777c96bf558..ecaae65ad09 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/CSharpGen.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/CSharpGen.cs @@ -118,6 +118,9 @@ await customCodeWorkspace.GetCompilationAsync(), await CodeModelGenerator.Instance.TypeFactory.CreateNewProjectScaffolding().Execute(); } + // Write additional output files (e.g. configuration schemas) + await CodeModelGenerator.Instance.WriteAdditionalFiles(outputPath); + LoggingHelpers.LogElapsedTime("All files have been written to disk"); } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/CodeModelGenerator.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/CodeModelGenerator.cs index 6fc87d7ced9..d44b2b49305 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/CodeModelGenerator.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/CodeModelGenerator.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.ComponentModel.Composition; using System.Diagnostics; +using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.TypeSpec.Generator.EmitterRpc; using Microsoft.TypeSpec.Generator.Input; @@ -182,5 +183,12 @@ public void AddTypeToKeep(string typeName, bool isRoot = true) /// Whether to treat the type as a root type. Any dependencies of root types will /// not have their accessibility changed regardless of the 'unreferenced-types-handling' value. public void AddTypeToKeep(TypeProvider type, bool isRoot = true) => AddTypeToKeep(type.Type.FullyQualifiedName, isRoot); + + /// + /// Writes additional output files (e.g. configuration schemas) after the main code generation is complete. + /// Override this method to generate non-C# output files. + /// + /// The root output directory. + public virtual Task WriteAdditionalFiles(string outputPath) => Task.CompletedTask; } } diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..bc29b86e3a4 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/schema/ConfigurationSchema.json @@ -0,0 +1,81 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "Notebooks": { + "type": "object", + "description": "Configuration for Notebooks.", + "properties": { + "SampleTypeSpecUrl": { + "type": "string", + "format": "uri", + "description": "Gets or sets the SampleTypeSpecUrl." + }, + "Notebook": { + "type": "string" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/sampleTypeSpecClientOptions" + } + } + }, + "Metrics": { + "type": "object", + "description": "Configuration for Metrics.", + "properties": { + "SampleTypeSpecUrl": { + "type": "string", + "format": "uri", + "description": "Gets or sets the SampleTypeSpecUrl." + }, + "MetricsNamespace": { + "type": "string" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/sampleTypeSpecClientOptions" + } + } + }, + "SampleTypeSpecClient": { + "type": "object", + "description": "Configuration for SampleTypeSpecClient.", + "properties": { + "SampleTypeSpecUrl": { + "type": "string", + "format": "uri", + "description": "Gets or sets the SampleTypeSpecUrl." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/sampleTypeSpecClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "sampleTypeSpecClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..37b4fa51a24 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/api-key/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ApiKeyClient": { + "type": "object", + "description": "Configuration for ApiKeyClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/apiKeyClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "apiKeyClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..f4c9617ea23 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/http/custom/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "CustomClient": { + "type": "object", + "description": "Configuration for CustomClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/customClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "customClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..59219d51321 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/oauth2/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "OAuth2Client": { + "type": "object", + "description": "Configuration for OAuth2Client.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/oAuth2ClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "oAuth2ClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..7a0faa5b319 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/authentication/union/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "UnionClient": { + "type": "object", + "description": "Configuration for UnionClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/unionClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "unionClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..83d725695ff --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/client-operation-group/schema/ConfigurationSchema.json @@ -0,0 +1,80 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "FirstClient": { + "type": "object", + "description": "Configuration for FirstClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Client": { + "$ref": "#/definitions/clientType" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/firstClientOptions" + } + } + }, + "SubNamespaceSecondClient": { + "type": "object", + "description": "Configuration for SubNamespaceSecondClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Client": { + "$ref": "#/definitions/clientType" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/subNamespaceSecondClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "clientType": { + "enum": [ + "default", + "multi-client", + "renamed-operation", + "two-operation-group", + "client-operation-group" + ] + }, + "firstClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + }, + "subNamespaceSecondClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..be6a13f54e2 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/default/schema/ConfigurationSchema.json @@ -0,0 +1,53 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ServiceClient": { + "type": "object", + "description": "Configuration for ServiceClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Client": { + "$ref": "#/definitions/clientType" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/serviceClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "clientType": { + "enum": [ + "default", + "multi-client", + "renamed-operation", + "two-operation-group", + "client-operation-group" + ] + }, + "serviceClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..7acfb2b9b60 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/multi-client/schema/ConfigurationSchema.json @@ -0,0 +1,80 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ClientAClient": { + "type": "object", + "description": "Configuration for ClientAClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Client": { + "$ref": "#/definitions/clientType" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/clientAClientOptions" + } + } + }, + "ClientBClient": { + "type": "object", + "description": "Configuration for ClientBClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Client": { + "$ref": "#/definitions/clientType" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/clientBClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "clientAClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + }, + "clientBClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + }, + "clientType": { + "enum": [ + "default", + "multi-client", + "renamed-operation", + "two-operation-group", + "client-operation-group" + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..8ead5b65f21 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/renamed-operation/schema/ConfigurationSchema.json @@ -0,0 +1,53 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RenamedOperationClient": { + "type": "object", + "description": "Configuration for RenamedOperationClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Client": { + "$ref": "#/definitions/clientType" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/renamedOperationClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "clientType": { + "enum": [ + "default", + "multi-client", + "renamed-operation", + "two-operation-group", + "client-operation-group" + ] + }, + "renamedOperationClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..bf7ec3b7d69 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/client/structure/two-operation-group/schema/ConfigurationSchema.json @@ -0,0 +1,53 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "TwoOperationGroupClient": { + "type": "object", + "description": "Configuration for TwoOperationGroupClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Client": { + "$ref": "#/definitions/clientType" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/twoOperationGroupClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "clientType": { + "enum": [ + "default", + "multi-client", + "renamed-operation", + "two-operation-group", + "client-operation-group" + ] + }, + "twoOperationGroupClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..90714bfbfab --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/documentation/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "DocumentationClient": { + "type": "object", + "description": "Configuration for DocumentationClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/documentationClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "documentationClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..72dff95a876 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/array/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ArrayClient": { + "type": "object", + "description": "Configuration for ArrayClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/arrayClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "arrayClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..2d04b8428a5 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/bytes/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "BytesClient": { + "type": "object", + "description": "Configuration for BytesClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/bytesClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "bytesClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..29980d6598e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/datetime/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "DatetimeClient": { + "type": "object", + "description": "Configuration for DatetimeClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/datetimeClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "datetimeClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..b85d9776ede --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/duration/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "DurationClient": { + "type": "object", + "description": "Configuration for DurationClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/durationClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "durationClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..d08206d9334 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/encode/numeric/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "NumericClient": { + "type": "object", + "description": "Configuration for NumericClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/numericClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "numericClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..e8788897ec0 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/basic/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "BasicClient": { + "type": "object", + "description": "Configuration for BasicClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/basicClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "basicClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..0ee1f7fae53 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/body-optionality/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "BodyOptionalityClient": { + "type": "object", + "description": "Configuration for BodyOptionalityClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/bodyOptionalityClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "bodyOptionalityClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..26b778a43e0 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/collection-format/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "CollectionFormatClient": { + "type": "object", + "description": "Configuration for CollectionFormatClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/collectionFormatClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "collectionFormatClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..5fbae3a7742 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/path/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "PathClient": { + "type": "object", + "description": "Configuration for PathClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/pathClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "pathClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..937db2228be --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/query/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "QueryClient": { + "type": "object", + "description": "Configuration for QueryClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/queryClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "queryClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..ed5a51f2527 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/parameters/spread/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "SpreadClient": { + "type": "object", + "description": "Configuration for SpreadClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/spreadClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "spreadClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..ad470e50c4f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/content-negotiation/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ContentNegotiationClient": { + "type": "object", + "description": "Configuration for ContentNegotiationClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/contentNegotiationClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "contentNegotiationClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..53ba08e2b5a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/json-merge-patch/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "JsonMergePatchClient": { + "type": "object", + "description": "Configuration for JsonMergePatchClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/jsonMergePatchClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "jsonMergePatchClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..876feaa09c6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/media-type/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "MediaTypeClient": { + "type": "object", + "description": "Configuration for MediaTypeClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/mediaTypeClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "mediaTypeClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..8651edd2e13 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/multipart/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "MultiPartClient": { + "type": "object", + "description": "Configuration for MultiPartClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/multiPartClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "multiPartClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..e456e7a9406 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/pageable/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "PageableClient": { + "type": "object", + "description": "Configuration for PageableClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/pageableClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "pageableClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..bca382d92f7 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/payload/xml/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "XmlClient": { + "type": "object", + "description": "Configuration for XmlClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/xmlClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "xmlClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..23122ac2d72 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v1/schema/ConfigurationSchema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ResiliencyServiceDrivenClient": { + "type": "object", + "description": "Configuration for ResiliencyServiceDrivenClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "ServiceDeploymentVersion": { + "type": "string" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/resiliencyServiceDrivenClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "resiliencyServiceDrivenClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..23122ac2d72 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/resiliency/srv-driven/v2/schema/ConfigurationSchema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ResiliencyServiceDrivenClient": { + "type": "object", + "description": "Configuration for ResiliencyServiceDrivenClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "ServiceDeploymentVersion": { + "type": "string" + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/resiliencyServiceDrivenClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "resiliencyServiceDrivenClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..a0fada94e23 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/response/status-code-range/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "StatusCodeRangeClient": { + "type": "object", + "description": "Configuration for StatusCodeRangeClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/statusCodeRangeClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "statusCodeRangeClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..ea5d97352d1 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/routes/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RoutesClient": { + "type": "object", + "description": "Configuration for RoutesClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/routesClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "routesClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..315f9a258ad --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/serialization/encoded-name/json/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "JsonClient": { + "type": "object", + "description": "Configuration for JsonClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/jsonClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "jsonClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..e25aa2955fb --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/endpoint/not-defined/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "NotDefinedClient": { + "type": "object", + "description": "Configuration for NotDefinedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/notDefinedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "notDefinedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..06e40a208f6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/multiple/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "MultipleClient": { + "type": "object", + "description": "Configuration for MultipleClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/multipleClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "multipleClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..ab4fa243bd0 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/path/single/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "SingleClient": { + "type": "object", + "description": "Configuration for SingleClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/singleClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "singleClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..405fadedd28 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/not-versioned/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "NotVersionedClient": { + "type": "object", + "description": "Configuration for NotVersionedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/notVersionedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "notVersionedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..bc53de5ef84 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/server/versions/versioned/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "VersionedClient": { + "type": "object", + "description": "Configuration for VersionedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/versionedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "versionedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..a12672e3e81 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/conditional-request/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ConditionalRequestClient": { + "type": "object", + "description": "Configuration for ConditionalRequestClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/conditionalRequestClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "conditionalRequestClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..6fd7c6d0ab0 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-headers/repeatability/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RepeatabilityClient": { + "type": "object", + "description": "Configuration for RepeatabilityClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/repeatabilityClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "repeatabilityClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..0cf8a38a663 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/special-words/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "SpecialWordsClient": { + "type": "object", + "description": "Configuration for SpecialWordsClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/specialWordsClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "specialWordsClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..72dff95a876 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/array/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ArrayClient": { + "type": "object", + "description": "Configuration for ArrayClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/arrayClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "arrayClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..84f4fa17474 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/dictionary/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "DictionaryClient": { + "type": "object", + "description": "Configuration for DictionaryClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/dictionaryClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "dictionaryClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..3ba566e6b63 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/extensible/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ExtensibleClient": { + "type": "object", + "description": "Configuration for ExtensibleClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/extensibleClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "extensibleClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..4b97bbfa581 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/enum/fixed/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "FixedClient": { + "type": "object", + "description": "Configuration for FixedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/fixedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "fixedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..1c20a7e0fb6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/empty/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "EmptyClient": { + "type": "object", + "description": "Configuration for EmptyClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/emptyClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "emptyClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..ad77d0a85f1 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/enum-discriminator/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "EnumDiscriminatorClient": { + "type": "object", + "description": "Configuration for EnumDiscriminatorClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/enumDiscriminatorClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "enumDiscriminatorClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..dcf75e99dd9 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/nested-discriminator/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "NestedDiscriminatorClient": { + "type": "object", + "description": "Configuration for NestedDiscriminatorClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/nestedDiscriminatorClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "nestedDiscriminatorClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..6a0a8bb7128 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/not-discriminated/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "NotDiscriminatedClient": { + "type": "object", + "description": "Configuration for NotDiscriminatedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/notDiscriminatedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "notDiscriminatedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..14aec039364 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/recursive/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RecursiveClient": { + "type": "object", + "description": "Configuration for RecursiveClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/recursiveClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "recursiveClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..a5c58e83a36 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/inheritance/single-discriminator/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "SingleDiscriminatorClient": { + "type": "object", + "description": "Configuration for SingleDiscriminatorClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/singleDiscriminatorClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "singleDiscriminatorClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..22b21c1ed09 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/usage/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "UsageClient": { + "type": "object", + "description": "Configuration for UsageClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/usageClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "usageClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..f9461c9c735 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/model/visibility/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "VisibilityClient": { + "type": "object", + "description": "Configuration for VisibilityClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/visibilityClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "visibilityClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..aadffeda192 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/additional-properties/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "AdditionalPropertiesClient": { + "type": "object", + "description": "Configuration for AdditionalPropertiesClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/additionalPropertiesClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "additionalPropertiesClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..733407ff801 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/nullable/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "NullableClient": { + "type": "object", + "description": "Configuration for NullableClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/nullableClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "nullableClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..5f0a8b87cbd --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/optionality/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "OptionalClient": { + "type": "object", + "description": "Configuration for OptionalClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/optionalClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "optionalClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..df7e3ab06df --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/property/value-types/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ValueTypesClient": { + "type": "object", + "description": "Configuration for ValueTypesClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/valueTypesClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "valueTypesClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..e430479ecc6 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/scalar/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ScalarClient": { + "type": "object", + "description": "Configuration for ScalarClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/scalarClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "scalarClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..7a0faa5b319 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/type/union/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "UnionClient": { + "type": "object", + "description": "Configuration for UnionClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/unionClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "unionClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..86e4835b095 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v1/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "AddedClient": { + "type": "object", + "description": "Configuration for AddedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/addedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "addedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..86e4835b095 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/added/v2/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "AddedClient": { + "type": "object", + "description": "Configuration for AddedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/addedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "addedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..69ef03580f4 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v1/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "MadeOptionalClient": { + "type": "object", + "description": "Configuration for MadeOptionalClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/madeOptionalClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "madeOptionalClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..69ef03580f4 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/madeOptional/v2/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "MadeOptionalClient": { + "type": "object", + "description": "Configuration for MadeOptionalClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/madeOptionalClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "madeOptionalClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..e8719df179a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v1/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RemovedClient": { + "type": "object", + "description": "Configuration for RemovedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/removedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "removedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..e8719df179a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RemovedClient": { + "type": "object", + "description": "Configuration for RemovedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/removedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "removedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..e8719df179a --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/removed/v2Preview/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RemovedClient": { + "type": "object", + "description": "Configuration for RemovedClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/removedClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "removedClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..1a0b56eec4e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v1/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RenamedFromClient": { + "type": "object", + "description": "Configuration for RenamedFromClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/renamedFromClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "renamedFromClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..1a0b56eec4e --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/renamedFrom/v2/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "RenamedFromClient": { + "type": "object", + "description": "Configuration for RenamedFromClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/renamedFromClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "renamedFromClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..fdbaa95dfb9 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v1/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ReturnTypeChangedFromClient": { + "type": "object", + "description": "Configuration for ReturnTypeChangedFromClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/returnTypeChangedFromClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "returnTypeChangedFromClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..fdbaa95dfb9 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/returnTypeChangedFrom/v2/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "ReturnTypeChangedFromClient": { + "type": "object", + "description": "Configuration for ReturnTypeChangedFromClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/returnTypeChangedFromClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "returnTypeChangedFromClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..d3cf32f8da1 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v1/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "TypeChangedFromClient": { + "type": "object", + "description": "Configuration for TypeChangedFromClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/typeChangedFromClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "typeChangedFromClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..d3cf32f8da1 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/versioning/typeChangedFrom/v2/schema/ConfigurationSchema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "TypeChangedFromClient": { + "type": "object", + "description": "Configuration for TypeChangedFromClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/typeChangedFromClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "typeChangedFromClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +}