From 727467406d162b887812f958eb41964c386082db Mon Sep 17 00:00:00 2001 From: HavenDV Date: Sun, 19 May 2024 09:14:42 +0400 Subject: [PATCH] feat: Added trimming support. --- OpenApiGenerator.sln | 7 + src/libs/Directory.Build.props | 2 +- .../Commands/GenerateCommand.cs | 1 + .../Generation/Sources.Methods.cs | 6 +- .../Generators/ClientGeneratorMethods.cs | 1 + .../Json/IJsonSerializer.cs | 4 +- .../Json/NewtonsoftJsonSerializer.cs | 8 +- .../Json/SystemTextJsonSerializer.cs | 12 +- .../OpenApiGenerator.Core/Models/EndPoint.cs | 2 + .../OpenApiGenerator.Core/Models/Settings.cs | 1 + .../OpenApiGenerator/OpenApiGenerator.props | 2 + .../OpenApiGenerator/OptionsExtensions.cs | 1 + ...nApiGenerator.IntegrationTests.Data.csproj | 28 + .../Resources/ipinfo.yaml | 1205 +++++++++++++++++ .../OpenApiGenerator.IntegrationTests.csproj | 6 +- .../SourceGenerationContext.cs | 12 + .../OpenApiGenerator.IntegrationTests/Test.cs | 0 .../OpenApiGenerator.SnapshotTests/Tests.cs | 3 +- .../OpenApiGenerator.UnitTests/CacheTests.cs | 1 + .../OpenApiGenerator.UnitTests/ClientTests.cs | 1 + .../OpenApiGenerator.UnitTests/ModelTests.cs | 1 + .../Snapshots/Clients/Ollama/_.verified.txt | 11 + .../Snapshots/Clients/OpenAi/_.verified.txt | 65 + 23 files changed, 1364 insertions(+), 16 deletions(-) create mode 100644 src/tests/OpenApiGenerator.IntegrationTests.Data/OpenApiGenerator.IntegrationTests.Data.csproj create mode 100644 src/tests/OpenApiGenerator.IntegrationTests.Data/Resources/ipinfo.yaml create mode 100644 src/tests/OpenApiGenerator.IntegrationTests/SourceGenerationContext.cs delete mode 100644 src/tests/OpenApiGenerator.IntegrationTests/Test.cs diff --git a/OpenApiGenerator.sln b/OpenApiGenerator.sln index 76a24a54eb..b5a6d7fb53 100644 --- a/OpenApiGenerator.sln +++ b/OpenApiGenerator.sln @@ -34,6 +34,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenApiGenerator.UnitTests" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenApiGenerator.Cli", "src\libs\OpenApiGenerator.Cli\OpenApiGenerator.Cli.csproj", "{CF8CA4E0-E90D-44FB-A9D5-6296A036BB24}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenApiGenerator.IntegrationTests.Data", "src\tests\OpenApiGenerator.IntegrationTests.Data\OpenApiGenerator.IntegrationTests.Data.csproj", "{522FA7E8-2FF4-4381-83E9-ADB1851AC26E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -68,6 +70,10 @@ Global {CF8CA4E0-E90D-44FB-A9D5-6296A036BB24}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF8CA4E0-E90D-44FB-A9D5-6296A036BB24}.Release|Any CPU.ActiveCfg = Release|Any CPU {CF8CA4E0-E90D-44FB-A9D5-6296A036BB24}.Release|Any CPU.Build.0 = Release|Any CPU + {522FA7E8-2FF4-4381-83E9-ADB1851AC26E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {522FA7E8-2FF4-4381-83E9-ADB1851AC26E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {522FA7E8-2FF4-4381-83E9-ADB1851AC26E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {522FA7E8-2FF4-4381-83E9-ADB1851AC26E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -80,6 +86,7 @@ Global {3A3F5EE3-0076-4822-B3BA-2955EC802E25} = {6E5BF389-3D3F-4D74-9DD0-3B199CB529C5} {88BE4AC5-6E7B-46FA-B656-5CCE8BF9F18E} = {9CAA231D-7BE1-46C9-ACD6-EB2E569CEBEA} {CF8CA4E0-E90D-44FB-A9D5-6296A036BB24} = {6E5BF389-3D3F-4D74-9DD0-3B199CB529C5} + {522FA7E8-2FF4-4381-83E9-ADB1851AC26E} = {9CAA231D-7BE1-46C9-ACD6-EB2E569CEBEA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {1493AEE4-9211-46E9-BFE6-8F629EAC5693} diff --git a/src/libs/Directory.Build.props b/src/libs/Directory.Build.props index a87813daa2..02485a8ca7 100644 --- a/src/libs/Directory.Build.props +++ b/src/libs/Directory.Build.props @@ -39,7 +39,7 @@ - 0.4.0 + 0.5.0 0.1 v dev diff --git a/src/libs/OpenApiGenerator.Cli/Commands/GenerateCommand.cs b/src/libs/OpenApiGenerator.Cli/Commands/GenerateCommand.cs index d5ec0f9b39..2d263af46c 100644 --- a/src/libs/OpenApiGenerator.Cli/Commands/GenerateCommand.cs +++ b/src/libs/OpenApiGenerator.Cli/Commands/GenerateCommand.cs @@ -77,6 +77,7 @@ private static async Task HandleAsync( GenerateMethodsUsingSystemNetHttpJson: false, IncludeOperationIds: [], ExcludeOperationIds: [], + JsonSerializerContext: string.Empty, GenerateModels: false, ModelStyle: default, IncludeModels: [], diff --git a/src/libs/OpenApiGenerator.Core/Generation/Sources.Methods.cs b/src/libs/OpenApiGenerator.Core/Generation/Sources.Methods.cs index cf41f0547b..4f9012dc68 100644 --- a/src/libs/OpenApiGenerator.Core/Generation/Sources.Methods.cs +++ b/src/libs/OpenApiGenerator.Core/Generation/Sources.Methods.cs @@ -116,7 +116,7 @@ public static string GenerateMethod( requestUri: {endPoint.Path}); {(string.IsNullOrWhiteSpace(endPoint.RequestType) ? " " : $@" httpRequest.Content = new global::System.Net.Http.StringContent( - content: {jsonSerializer.GenerateSerializeCall(endPoint.RequestType)}(request), + content: {jsonSerializer.GenerateSerializeCall(endPoint.RequestType, endPoint.JsonSerializerContext)}, encoding: global::System.Text.Encoding.UTF8, mediaType: ""application/json"");")} @@ -129,7 +129,7 @@ public static string GenerateMethod( var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return - {jsonSerializer.GenerateDeserializeCall(endPoint.ResponseType)}(content) ?? + {jsonSerializer.GenerateDeserializeCall(endPoint.ResponseType, endPoint.JsonSerializerContext)} ?? throw new global::System.InvalidOperationException(""Response deserialization failed for \""{{content}}\"" "");")} {(endPoint.Stream ? $@" using var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); @@ -138,7 +138,7 @@ public static string GenerateMethod( while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) {{ var content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = {jsonSerializer.GenerateDeserializeCall(endPoint.ResponseType)}(content) ?? + var streamedResponse = {jsonSerializer.GenerateDeserializeCall(endPoint.ResponseType, endPoint.JsonSerializerContext)} ?? throw new global::System.InvalidOperationException(""Response deserialization failed for \""{{content}}\"" ""); yield return streamedResponse; diff --git a/src/libs/OpenApiGenerator.Core/Generators/ClientGeneratorMethods.cs b/src/libs/OpenApiGenerator.Core/Generators/ClientGeneratorMethods.cs index 258d835e80..6c8b71a9f0 100644 --- a/src/libs/OpenApiGenerator.Core/Generators/ClientGeneratorMethods.cs +++ b/src/libs/OpenApiGenerator.Core/Generators/ClientGeneratorMethods.cs @@ -40,6 +40,7 @@ public static ImmutableArray PrepareData( Path: string.Empty, Properties: ImmutableArray.Empty, JsonSerializerType: settings.JsonSerializerType, + JsonSerializerContext: settings.JsonSerializerContext, HttpMethod: OperationType.Get, Summary: string.Empty, RequestType: string.Empty, diff --git a/src/libs/OpenApiGenerator.Core/Json/IJsonSerializer.cs b/src/libs/OpenApiGenerator.Core/Json/IJsonSerializer.cs index 4fbed869eb..c6cd579a9e 100644 --- a/src/libs/OpenApiGenerator.Core/Json/IJsonSerializer.cs +++ b/src/libs/OpenApiGenerator.Core/Json/IJsonSerializer.cs @@ -5,6 +5,6 @@ public interface IJsonSerializer public string GeneratePropertyAttribute(string id, bool isRequired); string GenerateExtensionDataAttribute(); string GenerateRequiredAttribute(); - string GenerateDeserializeCall(string type); - string GenerateSerializeCall(string type); + string GenerateDeserializeCall(string type, string jsonSerializerContext); + string GenerateSerializeCall(string type, string jsonSerializerContext); } \ No newline at end of file diff --git a/src/libs/OpenApiGenerator.Core/Json/NewtonsoftJsonSerializer.cs b/src/libs/OpenApiGenerator.Core/Json/NewtonsoftJsonSerializer.cs index bea4006bd6..86f2d3dc68 100644 --- a/src/libs/OpenApiGenerator.Core/Json/NewtonsoftJsonSerializer.cs +++ b/src/libs/OpenApiGenerator.Core/Json/NewtonsoftJsonSerializer.cs @@ -20,13 +20,13 @@ public string GenerateRequiredAttribute() return string.Empty; } - public string GenerateSerializeCall(string type) + public string GenerateSerializeCall(string type, string jsonSerializerContext) { - return "global::Newtonsoft.Json.JsonConvert.SerializeObject"; + return "global::Newtonsoft.Json.JsonConvert.SerializeObject(request)"; } - public string GenerateDeserializeCall(string type) + public string GenerateDeserializeCall(string type, string jsonSerializerContext) { - return $"global::Newtonsoft.Json.JsonConvert.DeserializeObject<{type}>"; + return $"global::Newtonsoft.Json.JsonConvert.DeserializeObject<{type}>(content)"; } } \ No newline at end of file diff --git a/src/libs/OpenApiGenerator.Core/Json/SystemTextJsonSerializer.cs b/src/libs/OpenApiGenerator.Core/Json/SystemTextJsonSerializer.cs index 3c5bccb964..c338a65442 100644 --- a/src/libs/OpenApiGenerator.Core/Json/SystemTextJsonSerializer.cs +++ b/src/libs/OpenApiGenerator.Core/Json/SystemTextJsonSerializer.cs @@ -19,13 +19,17 @@ public string GenerateRequiredAttribute() return "[global::System.Text.Json.Serialization.JsonRequired]"; } - public string GenerateSerializeCall(string type) + public string GenerateSerializeCall(string type, string jsonSerializerContext) { - return "global::System.Text.Json.JsonSerializer.Serialize"; + return string.IsNullOrWhiteSpace(jsonSerializerContext) + ? "global::System.Text.Json.JsonSerializer.Serialize(request)" + : $"global::System.Text.Json.JsonSerializer.Serialize(request, global::{jsonSerializerContext}.Default.{type})"; } - public string GenerateDeserializeCall(string type) + public string GenerateDeserializeCall(string type, string jsonSerializerContext) { - return $"global::System.Text.Json.JsonSerializer.Deserialize<{type}>"; + return string.IsNullOrWhiteSpace(jsonSerializerContext) + ? $"global::System.Text.Json.JsonSerializer.Deserialize<{type}>(content)" + : $"global::System.Text.Json.JsonSerializer.Deserialize(content, global::{jsonSerializerContext}.Default.{type})"; } } \ No newline at end of file diff --git a/src/libs/OpenApiGenerator.Core/Models/EndPoint.cs b/src/libs/OpenApiGenerator.Core/Models/EndPoint.cs index 6e571d8241..9c2a4c3f7c 100644 --- a/src/libs/OpenApiGenerator.Core/Models/EndPoint.cs +++ b/src/libs/OpenApiGenerator.Core/Models/EndPoint.cs @@ -14,6 +14,7 @@ public readonly record struct EndPoint( string Path, ImmutableArray Properties, JsonSerializerType JsonSerializerType, + string JsonSerializerContext, OperationType HttpMethod, string Summary, string RequestType, @@ -62,6 +63,7 @@ public static EndPoint FromSchema( Path: preparedPath, Properties: [..parameters.Concat(requestModel.Properties)], JsonSerializerType: settings.JsonSerializerType, + JsonSerializerContext: settings.JsonSerializerContext, HttpMethod: operation.Key, Summary: operation.Value.Summary?.Replace("\n", string.Empty) ?? string.Empty, RequestType: requestSchema?.Reference?.Id ?? string.Empty, diff --git a/src/libs/OpenApiGenerator.Core/Models/Settings.cs b/src/libs/OpenApiGenerator.Core/Models/Settings.cs index f7cda72013..cccfda1c08 100644 --- a/src/libs/OpenApiGenerator.Core/Models/Settings.cs +++ b/src/libs/OpenApiGenerator.Core/Models/Settings.cs @@ -17,6 +17,7 @@ public readonly record struct Settings( bool GenerateMethodsUsingSystemNetHttpJson, ImmutableArray IncludeOperationIds, ImmutableArray ExcludeOperationIds, + string JsonSerializerContext, bool GenerateModels, ModelStyle ModelStyle, diff --git a/src/libs/OpenApiGenerator/OpenApiGenerator.props b/src/libs/OpenApiGenerator/OpenApiGenerator.props index 5ba40ac2ab..5e2ac6c669 100644 --- a/src/libs/OpenApiGenerator/OpenApiGenerator.props +++ b/src/libs/OpenApiGenerator/OpenApiGenerator.props @@ -38,6 +38,8 @@ + + diff --git a/src/libs/OpenApiGenerator/OptionsExtensions.cs b/src/libs/OpenApiGenerator/OptionsExtensions.cs index 841f93d521..65a3756e2f 100644 --- a/src/libs/OpenApiGenerator/OptionsExtensions.cs +++ b/src/libs/OpenApiGenerator/OptionsExtensions.cs @@ -38,6 +38,7 @@ public static Settings GetSettings( []).ToImmutableArray(), ExcludeOperationIds: (options.GetGlobalOption(nameof(Settings.ExcludeOperationIds), prefix)?.Split(';') ?? []).ToImmutableArray(), + JsonSerializerContext: options.GetGlobalOption(nameof(Settings.JsonSerializerContext), prefix) ?? string.Empty, GenerateModels: options.GetBoolGlobalOption(nameof(Settings.GenerateModels), prefix), ModelStyle: options.GetEnumGlobalOption(nameof(Settings.ModelStyle), prefix), diff --git a/src/tests/OpenApiGenerator.IntegrationTests.Data/OpenApiGenerator.IntegrationTests.Data.csproj b/src/tests/OpenApiGenerator.IntegrationTests.Data/OpenApiGenerator.IntegrationTests.Data.csproj new file mode 100644 index 0000000000..6ed853a8ca --- /dev/null +++ b/src/tests/OpenApiGenerator.IntegrationTests.Data/OpenApiGenerator.IntegrationTests.Data.csproj @@ -0,0 +1,28 @@ + + + + net8.0 + + + + + + OpenApiGenerator.IntegrationTests + false + true + + + + + + + + + + + + + + + + diff --git a/src/tests/OpenApiGenerator.IntegrationTests.Data/Resources/ipinfo.yaml b/src/tests/OpenApiGenerator.IntegrationTests.Data/Resources/ipinfo.yaml new file mode 100644 index 0000000000..2490fb02d4 --- /dev/null +++ b/src/tests/OpenApiGenerator.IntegrationTests.Data/Resources/ipinfo.yaml @@ -0,0 +1,1205 @@ +openapi: 3.0.0 +info: + description: | + [https://ipinfo.io](https://ipinfo.io). + version: "1.0.0" + title: ipinfo.io + contact: + email: havendv@gmail.com + license: + name: Apache 2.0 + url: 'https://github.com/ipinfo/csharp/blob/master/LICENSE' + +servers: + - url: 'https://ipinfo.io/' + +tags: + - name: general + description: General API. + + - name: single + description: Single info API. + + - name: privacy detection + description: Privacy Detection API. + externalDocs: + description: Find more info here + url: https://ipinfo.io/developers/privacy + + - name: asn + description: ASN API. + externalDocs: + description: Find more info here + url: https://ipinfo.io/developers/asn + + - name: ranges + description: IP Ranges API. + externalDocs: + description: Find more info here + url: https://ipinfo.io/developers/ranges + + - name: domains + description: Hosted Domains API. + externalDocs: + description: Find more info here + url: https://ipinfo.io/developers/hosted-domains + + - name: abuse + description: Abuse Contact API. + externalDocs: + description: Find more info here + url: https://ipinfo.io/ip-abuse-contact-api + +paths: + /: + get: + tags: + - general + summary: Returns information about the current IP. + description: Returns information about the current IP. + operationId: getCurrentInformation + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + responses: + '200': + $ref: '#/components/responses/FullResponse' + + '404': + $ref: '#/components/responses/NotFound' + + /batch: + post: + tags: + - general + summary: Returns information about the selected values. + description: Returns information about the selected values. + operationId: batch + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + requestBody: + $ref: '#/components/requestBodies/Batch' + + responses: + '200': + $ref: '#/components/responses/Batch' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}': + get: + tags: + - general + summary: Returns information about the selected IP. + description: Returns information about the selected IP. + operationId: getInformationByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/FullResponse' + + '404': + $ref: '#/components/responses/NotFound' + + '/AS{asn}/json': + get: + tags: + - asn + summary: Returns information about an ASN, such as the assigned prefixes, related domain, and more. + description: Returns information about an AS. + operationId: getAsn + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Asn' + + responses: + '200': + $ref: '#/components/responses/Asn' + + '404': + $ref: '#/components/responses/NotFound' + + '/ranges/{domain}': + get: + tags: + - ranges + summary: Our IP address ranges API returns a list of all of the IP addresses ranges assigned to or operated by a company, identified by the provided domain name. + description: Returns information about a domain ranges. + operationId: getRanges + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Domain' + + responses: + '200': + $ref: '#/components/responses/Ranges' + + '404': + $ref: '#/components/responses/NotFound' + + '/domains/{ip}': + get: + tags: + - domains + summary: Our Hosted Domains, or Reverse IP API returns a list of all of the domains hosted on the provided IP address. + description: Returns a list of all of the domains hosted on the provided IP address. + operationId: getDomains + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/Limit' + + responses: + '200': + $ref: '#/components/responses/Domains' + + '404': + $ref: '#/components/responses/NotFound' + + + '/{ip}/abuse': + get: + tags: + - abuse + summary: Our abuse contact API returns data containing information belonging to the abuse contact of every IP address on the Internet. Fields included in this response are the abuse contact's email address, postal/ZIP code, city, state, country, name, network, and phone number. + description: Our abuse contact API returns data containing information belonging to the abuse contact of every IP address on the Internet. Fields included in this response are the abuse contact's email address, postal/ZIP code, city, state, country, name, network, and phone number. + operationId: getAbuse + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Abuse' + + '404': + $ref: '#/components/responses/NotFound' + + + '/{ip}/privacy': + get: + tags: + - privacy detection + summary: Returns privacy information about the selected IP. + description: Returns privacy information about the selected IP. + operationId: getPrivacyInformationByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Privacy' + + '400': + $ref: '#/components/responses/TokenNotPassed' + + '404': + $ref: '#/components/responses/NotFound' + + '/ip': + get: + tags: + - single + summary: Returns the current IP. + description: Returns the current IP. + operationId: getCurrentIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/Ip' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/ip': + get: + tags: + - single + summary: Returns a ip for the selected IP. Yes, I know this is a pointless method. + description: Returns a ip for the selected IP. Yes, I know this is a pointless method. + operationId: getIpByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Ip' + + '404': + $ref: '#/components/responses/NotFound' + + '/hostname': + get: + tags: + - single + summary: Returns the current hostname. + description: Returns the current hostname. + operationId: getCurrentHostname + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/Hostname' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/hostname': + get: + tags: + - single + summary: Returns a hostname for the selected IP. + description: Returns a hostname for the selected IP. + operationId: getHostnameByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Hostname' + + '404': + $ref: '#/components/responses/NotFound' + + '/city': + get: + tags: + - single + summary: Returns the current city. + description: Returns the current city. + operationId: getCurrentCity + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/City' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/city': + get: + tags: + - single + summary: Returns a city for the selected IP. + description: Returns a city for the selected IP. + operationId: getCityByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/City' + + '404': + $ref: '#/components/responses/NotFound' + + '/region': + get: + tags: + - single + summary: Returns the current region. + description: Returns current region. + operationId: getCurrentRegion + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/Region' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/region': + get: + tags: + - single + summary: Returns a region for the selected IP. + description: Returns a region for the selected IP. + operationId: getRegionByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Region' + + '404': + $ref: '#/components/responses/NotFound' + + '/country': + get: + tags: + - single + summary: Returns the current country. + description: Returns the current country. + operationId: getCurrentCountry + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/Country' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/country': + get: + tags: + - single + summary: Returns a country for the selected IP. + description: Returns a country for the selected IP. + operationId: getCountryByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Country' + + '404': + $ref: '#/components/responses/NotFound' + + '/loc': + get: + tags: + - single + summary: Returns the current location. + description: Returns the current location. + operationId: getCurrentLocation + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/Location' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/loc': + get: + tags: + - single + summary: Get a location for the selected IP. + description: Returns a location for the selected IP. + operationId: getLocationByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Location' + + '404': + $ref: '#/components/responses/NotFound' + + '/postal': + get: + tags: + - single + summary: Returns the current postal. + description: Returns the current postal. + operationId: getCurrentPostal + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/Postal' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/postal': + get: + tags: + - single + summary: Returns a postal for the selected IP. + description: Returns a postal for the selected IP. + operationId: getPostalByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Postal' + + '404': + $ref: '#/components/responses/NotFound' + + '/timezone': + get: + tags: + - single + summary: Returns the current timezone. + description: Returns the current timezone. + operationId: getCurrentTimezone + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/Timezone' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/timezone': + get: + tags: + - single + summary: Returns a timezone for the selected IP. + description: Returns a timezone for the selected IP. + operationId: getTimezoneByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Timezone' + + '404': + $ref: '#/components/responses/NotFound' + + '/org': + get: + tags: + - single + summary: Returns the current organization. + description: Returns the current organization. + operationId: getCurrentOrganization + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + responses: + '200': + $ref: '#/components/responses/Organization' + + '404': + $ref: '#/components/responses/NotFound' + + '/{ip}/org': + get: + tags: + - single + summary: Returns a organization for the selected IP. + description: Returns a organization for the selected IP. + operationId: getOrganizationByIp + security: + - BasicAuth: [] + - BearerAuth: [] + - ApiKeyAuth: [] + + parameters: + - $ref: '#/components/parameters/Ip' + + responses: + '200': + $ref: '#/components/responses/Organization' + + '404': + $ref: '#/components/responses/NotFound' + + +externalDocs: + description: Find out more about ipinfo.io + url: 'https://ipinfo.io/developers' + + +components: + schemas: + FullResponse: + type: object + required: + - ip + - city + - country + + properties: + ip: + type: string + example: '66.87.125.72' + + hostname: + type: string + example: 'ip-66-87-125-72.spfdma.spcsdns.net' + + city: + type: string + example: 'Springfield' + + region: + type: string + example: 'Massachusetts' + + country: + type: string + example: 'US' + + loc: + type: string + example: '42.0999,-72.5783' + + postal: + type: string + example: '01105' + + timezone: + type: string + example: 'America/New_York' + + org: + type: string + example: 'AS51501 Khabarovsk home networks Ltd' + + asn: + $ref: '#/components/schemas/AsnResponse' + + company: + $ref: '#/components/schemas/Company' + + carrier: + $ref: '#/components/schemas/Carrier' + + privacy: + $ref: '#/components/schemas/PrivacyResponse' + + domains: + $ref: '#/components/schemas/DomainsResponse' + + AsnResponse: + type: object + required: + - asn + - name + - domain + - type + + properties: + asn: + type: string + example: 'AS10507' + + name: + type: string + example: 'Sprint Personal Communications Systems' + + country: + type: string + example: 'US' + + allocated: + type: string + example: '1997-02-14' + + registry: + type: string + example: 'arin' + + domain: + type: string + example: 'sprint.net' + + num_ips: + type: integer + example: 71224576 + + route: + type: string + example: '66.87.125.0/24' + + type: + type: string + example: 'isp' + enum: + - isp + - business + - education + - hosting + + prefixes: + type: array + items: + $ref: '#/components/schemas/Prefix' + + prefixes6: + type: array + items: + $ref: '#/components/schemas/Prefix6' + + peers: + type: array + items: + type: string + example: '1299' + + upstreams: + type: array + items: + type: string + example: '1299' + + downstreams: + type: array + items: + type: string + example: '109' + + Prefix: + type: object + required: + - netblock + - id + - name + - country + + properties: + netblock: + type: string + example: '104.69.216.0/22' + + id: + type: string + example: 'AKAMAI' + + name: + type: string + example: 'Akamai Technologies, Inc.' + + country: + type: string + example: 'US' + + size: + type: string + example: '256' + + status: + type: string + example: 'ALLOCATION' + + domain: + type: string + nullable: true + example: 'quadranet.com' + + Prefix6: + type: object + required: + - netblock + - id + - name + - country + + properties: + netblock: + type: string + example: '2601::/20' + + id: + type: string + example: 'COMCAST6NET' + + name: + type: string + example: 'Comcast Cable Communications, LLC' + + country: + type: string + example: 'US' + + size: + type: string + example: '20282409603651670423947251286016' + + status: + type: string + example: 'ASSIGNMENT' + + domain: + type: string + example: 'comcast.com' + + RangesResponse: + type: object + required: + - domain + - num_ranges + - ranges + + properties: + domain: + type: string + example: 'comcast.net' + + num_ranges: + type: string + example: '37330' + + ranges: + type: array + items: + type: string + example: '23.24.240.0/29' + + DomainsResponse: + type: object + required: + - total + + properties: + ip: + type: string + example: '1.1.1.1' + + page: + type: integer + example: 1 + + total: + type: integer + example: 17939 + + domains: + type: array + items: + type: string + example: 'udemy.com' + + AbuseResponse: + type: object + + properties: + address: + type: string + example: 'US, CA, Mountain View, 1600 Amphitheatre Parkway, 94043' + + country: + type: string + example: 'US' + + email: + type: string + example: 'network-abuse@google.com' + + name: + type: string + example: 'Abuse' + + network: + type: string + example: '8.8.8.0/24' + + phone: + type: string + example: '+1-650-253-0000' + + Company: + type: object + required: + - name + - domain + - type + + properties: + name: + type: string + example: 'Sprint Springfield POP' + + domain: + type: string + example: 'sprint.com' + + type: + type: string + example: 'isp' + enum: + - isp + - business + - education + - hosting + + Carrier: + type: object + required: + - name + - mcc + - mnc + + properties: + name: + type: string + example: 'Sprint Corporation' + + mcc: + type: string + example: '310' + + mnc: + type: string + example: '120' + + PrivacyResponse: + type: object + required: + - vpn + - proxy + - tor + - hosting + + properties: + vpn: + type: boolean + example: true + + proxy: + type: boolean + example: false + + tor: + type: boolean + example: false + + hosting: + type: boolean + example: false + + Error: + type: object + required: + - error + + properties: + error: + type: object + required: + - title + - message + + properties: + title: + type: string + example: 'Wrong ip' + + message: + type: string + example: 'Please provide a valid IP address' + + requestBodies: + Batch: + description: A JSON array containing values. + required: true + content: + application/json: + schema: + type: array + items: + type: string + + parameters: + Ip: + name: ip + in: path + description: A single IPv4 or IPv6 IP address. + required: true + schema: + type: string + + Asn: + name: asn + in: path + description: an ASN number. + required: true + schema: + type: integer + + Domain: + name: domain + in: path + description: a domain. + required: true + schema: + type: string + + Page: + name: page + in: query + description: The page query parameter can be used to go through paginated records. page starts at 0 and the parameter is part of the response when included in request. + schema: + type: integer + minimum: 0 + + Limit: + name: limit + in: query + description: The API returns 100 domains per page and has a limit of 1000 domains per page. We return up to 10 million results. The limit parameter can be used to control the number of domains per page. + schema: + type: integer + minimum: 1 + maximum: 1000 + default: 100 + + responses: + FullResponse: + description: Full response object. + content: + application/json: + schema: + $ref: '#/components/schemas/FullResponse' + + Asn: + description: ASN response object. + content: + application/json: + schema: + $ref: '#/components/schemas/AsnResponse' + + Ranges: + description: Ranges response object. + content: + application/json: + schema: + $ref: '#/components/schemas/RangesResponse' + + Domains: + description: Domains response object. + content: + application/json: + schema: + $ref: '#/components/schemas/DomainsResponse' + + Abuse: + description: Abuse response object. + content: + application/json: + schema: + $ref: '#/components/schemas/AbuseResponse' + + Privacy: + description: Privacy response. + content: + application/json: + schema: + $ref: '#/components/schemas/PrivacyResponse' + + Batch: + description: Batch response object. + content: + application/json: + schema: + type: object + additionalProperties: + type: object + + example: + 8.8.8.8/city: Mountain View + 8.8.8.8: + ip: 8.8.8.8 + hostname: dns.google + city: Mountain View + region: California + country: US + loc: 37.4056,-122.0775 + org: AS15169 Google LLC + postal: 94043 + timezone: America/Los_Angeles + + + Ip: + description: An ip. + content: + text/plain: + schema: + type: string + example: '66.87.125.72' + + Hostname: + description: A hostname. + content: + text/plain: + schema: + type: string + example: 'ip-66-87-125-72.spfdma.spcsdns.net' + + City: + description: A city. + content: + text/plain: + schema: + type: string + example: 'Springfield' + + Region: + description: A region. + content: + text/plain: + schema: + type: string + example: 'Massachusetts' + + Country: + description: A country. + content: + text/plain: + schema: + type: string + example: 'US' + + Location: + description: A location. + content: + text/plain: + schema: + type: string + example: '42.0999,-72.5783' + + Postal: + description: A postal. + content: + text/plain: + schema: + type: string + example: '01105' + + Timezone: + description: A timezone. + content: + text/plain: + schema: + type: string + example: 'America/New_York' + + Organization: + description: A organization. + content: + text/plain: + schema: + type: string + example: 'AS51501 Khabarovsk home networks Ltd' + + TokenNotPassed: + description: Token not passed. Please pass a valid token to access this module. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + NotFound: + description: Wrong ip. Please provide a valid IP address. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + + securitySchemes: + BasicAuth: + type: http + scheme: basic + + BearerAuth: + type: http + scheme: bearer + + ApiKeyAuth: + type: apiKey + in: query + name: token \ No newline at end of file diff --git a/src/tests/OpenApiGenerator.IntegrationTests/OpenApiGenerator.IntegrationTests.csproj b/src/tests/OpenApiGenerator.IntegrationTests/OpenApiGenerator.IntegrationTests.csproj index 720187b80e..e7a49fa66c 100644 --- a/src/tests/OpenApiGenerator.IntegrationTests/OpenApiGenerator.IntegrationTests.csproj +++ b/src/tests/OpenApiGenerator.IntegrationTests/OpenApiGenerator.IntegrationTests.csproj @@ -7,7 +7,10 @@ - true + false + true + true + OpenApiGenerator.IntegrationTests.SourceGenerationContext @@ -41,6 +44,7 @@ + diff --git a/src/tests/OpenApiGenerator.IntegrationTests/SourceGenerationContext.cs b/src/tests/OpenApiGenerator.IntegrationTests/SourceGenerationContext.cs new file mode 100644 index 0000000000..135ee6ce5c --- /dev/null +++ b/src/tests/OpenApiGenerator.IntegrationTests/SourceGenerationContext.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace OpenApiGenerator.IntegrationTests; + +[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] +[JsonSerializable(typeof(FullResponse))] +[JsonSerializable(typeof(AsnResponse))] +[JsonSerializable(typeof(RangesResponse))] +[JsonSerializable(typeof(DomainsResponse))] +[JsonSerializable(typeof(AbuseResponse))] +[JsonSerializable(typeof(PrivacyResponse))] +internal sealed partial class SourceGenerationContext : JsonSerializerContext; \ No newline at end of file diff --git a/src/tests/OpenApiGenerator.IntegrationTests/Test.cs b/src/tests/OpenApiGenerator.IntegrationTests/Test.cs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/tests/OpenApiGenerator.SnapshotTests/Tests.cs b/src/tests/OpenApiGenerator.SnapshotTests/Tests.cs index d08b3b1b51..02977acbb3 100644 --- a/src/tests/OpenApiGenerator.SnapshotTests/Tests.cs +++ b/src/tests/OpenApiGenerator.SnapshotTests/Tests.cs @@ -64,7 +64,7 @@ public Task LangSmith(JsonSerializerType jsonSerializerType) text: H.Resources.langsmith_yaml.AsString()) ], new Dictionary { - //["build_property.OpenApiGenerator_GenerateConstructors"] = "true", + //["build_property.OpenApiGenerator_JsonSerializerContext"] = "SourceGenerationContext", //["build_property.OpenApiGenerator_GenerateMethods"] = "true", }, additionalGenerators: [new ClientGenerator()]); } @@ -80,6 +80,7 @@ public Task Ollama(JsonSerializerType jsonSerializerType) text: H.Resources.ollamacurated_yaml.AsString()) ], new Dictionary { + //["build_property.OpenApiGenerator_JsonSerializerContext"] = "SourceGenerationContext", //["build_property.OpenApiGenerator_GenerateConstructors"] = "true", //["build_property.OpenApiGenerator_GenerateMethods"] = "true", //["build_property.OpenApiGenerator_IncludeOperationIds"] = "ListModels", diff --git a/src/tests/OpenApiGenerator.UnitTests/CacheTests.cs b/src/tests/OpenApiGenerator.UnitTests/CacheTests.cs index e8cfb3a325..bd443d041a 100644 --- a/src/tests/OpenApiGenerator.UnitTests/CacheTests.cs +++ b/src/tests/OpenApiGenerator.UnitTests/CacheTests.cs @@ -19,6 +19,7 @@ public class CacheTests GenerateMethodsUsingSystemNetHttpJson: false, IncludeOperationIds: ImmutableArray.Create(["123", "456"]), ExcludeOperationIds: [], + JsonSerializerContext: string.Empty, GenerateModels: false, ModelStyle: default, IncludeModels: ImmutableArray.Create(["123", "456"]), diff --git a/src/tests/OpenApiGenerator.UnitTests/ClientTests.cs b/src/tests/OpenApiGenerator.UnitTests/ClientTests.cs index 95ae99a75d..3228c5cb6f 100644 --- a/src/tests/OpenApiGenerator.UnitTests/ClientTests.cs +++ b/src/tests/OpenApiGenerator.UnitTests/ClientTests.cs @@ -22,6 +22,7 @@ public class ClientTests : GenerateMethodsUsingSystemNetHttpJson: false, IncludeOperationIds: [], ExcludeOperationIds: [], + JsonSerializerContext: string.Empty, GenerateModels: false, ModelStyle: default, IncludeModels: [], diff --git a/src/tests/OpenApiGenerator.UnitTests/ModelTests.cs b/src/tests/OpenApiGenerator.UnitTests/ModelTests.cs index 33f1588b56..3fec4334f3 100644 --- a/src/tests/OpenApiGenerator.UnitTests/ModelTests.cs +++ b/src/tests/OpenApiGenerator.UnitTests/ModelTests.cs @@ -22,6 +22,7 @@ public class ModelTests : GenerateMethodsUsingSystemNetHttpJson: false, IncludeOperationIds: [], ExcludeOperationIds: [], + JsonSerializerContext: string.Empty, GenerateModels: false, ModelStyle: default, IncludeModels: [], diff --git a/src/tests/OpenApiGenerator.UnitTests/Snapshots/Clients/Ollama/_.verified.txt b/src/tests/OpenApiGenerator.UnitTests/Snapshots/Clients/Ollama/_.verified.txt index 7bf49e831b..b1413d6f45 100644 --- a/src/tests/OpenApiGenerator.UnitTests/Snapshots/Clients/Ollama/_.verified.txt +++ b/src/tests/OpenApiGenerator.UnitTests/Snapshots/Clients/Ollama/_.verified.txt @@ -228,6 +228,7 @@ How long (in minutes) to keep the model loaded in memory. ArgumentName: keepAlive } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Generate a response for a given prompt with a provided model., RequestType: GenerateCompletionRequest, @@ -388,6 +389,7 @@ How long (in minutes) to keep the model loaded in memory. ArgumentName: keepAlive } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Generate the next message in a chat with a provided model., RequestType: GenerateChatCompletionRequest, @@ -487,6 +489,7 @@ Text to generate embeddings for. ArgumentName: options } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Generate embeddings from a model., RequestType: GenerateEmbeddingRequest, @@ -556,6 +559,7 @@ If `false` the response will be returned as a single response object, otherwise ArgumentName: stream } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create a model from a Modelfile., RequestType: CreateModelRequest, @@ -571,6 +575,7 @@ If `false` the response will be returned as a single response object, otherwise Stream: false, Path: "/tags", Properties: null, + JsonSerializerContext: , Summary: List models that are available locally., RequestType: , ResponseType: ModelsResponse, @@ -605,6 +610,7 @@ Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` a ArgumentName: name } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Show details about a model including modelfile, template, parameters, license, and system prompt., RequestType: ModelInfoRequest, @@ -653,6 +659,7 @@ Name of the new model. ArgumentName: destination } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates a model with another name from an existing model., RequestType: CopyModelRequest, @@ -688,6 +695,7 @@ Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` a ArgumentName: name } ], + JsonSerializerContext: , HttpMethod: Delete, Summary: Delete a model and its data., RequestType: DeleteModelRequest, @@ -761,6 +769,7 @@ If `false` the response will be returned as a single response object, otherwise ArgumentName: stream } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Download a model from the ollama library., RequestType: PullModelRequest, @@ -831,6 +840,7 @@ If `false` the response will be returned as a single response object, otherwise ArgumentName: stream } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Upload a model to a model library., RequestType: PushModelRequest, @@ -846,6 +856,7 @@ If `false` the response will be returned as a single response object, otherwise Stream: false, Path: , Properties: null, + JsonSerializerContext: , Summary: , RequestType: , ResponseType: , diff --git a/src/tests/OpenApiGenerator.UnitTests/Snapshots/Clients/OpenAi/_.verified.txt b/src/tests/OpenApiGenerator.UnitTests/Snapshots/Clients/OpenAi/_.verified.txt index 2da24b8f1a..8dde49b954 100644 --- a/src/tests/OpenApiGenerator.UnitTests/Snapshots/Clients/OpenAi/_.verified.txt +++ b/src/tests/OpenApiGenerator.UnitTests/Snapshots/Clients/OpenAi/_.verified.txt @@ -396,6 +396,7 @@ A list of functions the model may generate JSON inputs for. ArgumentName: functions } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates a model response for the given chat conversation., RequestType: CreateChatCompletionRequest, @@ -762,6 +763,7 @@ A unique identifier representing your end-user, which can help OpenAI to monitor ArgumentName: user } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates a completion for the provided prompt and parameters., RequestType: CreateCompletionRequest, @@ -949,6 +951,7 @@ A unique identifier representing your end-user, which can help OpenAI to monitor ArgumentName: user } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates an image given a prompt., RequestType: CreateImageRequest, @@ -1112,6 +1115,7 @@ A unique identifier representing your end-user, which can help OpenAI to monitor ArgumentName: user } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates an edited or extended image given an original image and a prompt., RequestType: CreateImageEditRequest, @@ -1245,6 +1249,7 @@ A unique identifier representing your end-user, which can help OpenAI to monitor ArgumentName: user } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates a variation of a given image., RequestType: CreateImageVariationRequest, @@ -1352,6 +1357,7 @@ A unique identifier representing your end-user, which can help OpenAI to monitor ArgumentName: user } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates an embedding vector representing the input text., RequestType: CreateEmbeddingRequest, @@ -1474,6 +1480,7 @@ The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is ArgumentName: speed } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Generates audio from the input text., RequestType: CreateSpeechRequest, @@ -1603,6 +1610,7 @@ The sampling temperature, between 0 and 1. Higher values like 0.8 will make the ArgumentName: temperature } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Transcribes audio into the input language., RequestType: CreateTranscriptionRequest, @@ -1704,6 +1712,7 @@ The sampling temperature, between 0 and 1. Higher values like 0.8 will make the ArgumentName: temperature } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Translates audio into English., RequestType: CreateTranslationRequest, @@ -1737,6 +1746,7 @@ The sampling temperature, between 0 and 1. Higher values like 0.8 will make the ArgumentName: purpose } ], + JsonSerializerContext: , Summary: Returns a list of files that belong to the user's organization., RequestType: , ResponseType: ListFilesResponse, @@ -1794,6 +1804,7 @@ Use "assistants" for [Assistants](/docs/api-reference/assistants) and [Message]( ArgumentName: purpose } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Upload a file that can be used across various endpoints. The size of all the files uploaded by one organization can be up to 100 GB.The size of individual files can be a maximum of 512 MB or 2 million tokens for Assistants. See the [Assistants Tools guide](/docs/assistants/tools) to learn more about the types of files supported. The Fine-tuning API only supports `.jsonl` files.Please [contact us](https://help.openai.com/) if you need to increase these storage limits., RequestType: CreateFileRequest, @@ -1827,6 +1838,7 @@ Use "assistants" for [Assistants](/docs/api-reference/assistants) and [Message]( ArgumentName: fileId } ], + JsonSerializerContext: , HttpMethod: Delete, Summary: Delete a file., RequestType: , @@ -1860,6 +1872,7 @@ Use "assistants" for [Assistants](/docs/api-reference/assistants) and [Message]( ArgumentName: fileId } ], + JsonSerializerContext: , Summary: Returns information about a specific file., RequestType: , ResponseType: OpenAIFile, @@ -1892,6 +1905,7 @@ Use "assistants" for [Assistants](/docs/api-reference/assistants) and [Message]( ArgumentName: fileId } ], + JsonSerializerContext: , Summary: Returns the contents of the specified file., RequestType: , ResponseType: , @@ -2039,6 +2053,7 @@ If a seed is not specified, one will be generated for you. ArgumentName: seed } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates a fine-tuning job which begins the process of creating a new model from a given dataset.Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.[Learn more about fine-tuning](/docs/guides/fine-tuning), RequestType: CreateFineTuningJobRequest, @@ -2091,6 +2106,7 @@ If a seed is not specified, one will be generated for you. ArgumentName: limit } ], + JsonSerializerContext: , Summary: List your organization's fine-tuning jobs, RequestType: , ResponseType: ListPaginatedFineTuningJobsResponse, @@ -2124,6 +2140,7 @@ If a seed is not specified, one will be generated for you. ArgumentName: fineTuningJobId } ], + JsonSerializerContext: , Summary: Get info about a fine-tuning job.[Learn more about fine-tuning](/docs/guides/fine-tuning), RequestType: , ResponseType: FineTuningJob, @@ -2193,6 +2210,7 @@ If a seed is not specified, one will be generated for you. ArgumentName: limit } ], + JsonSerializerContext: , Summary: Get status updates for a fine-tuning job., RequestType: , ResponseType: ListFineTuningJobEventsResponse, @@ -2226,6 +2244,7 @@ If a seed is not specified, one will be generated for you. ArgumentName: fineTuningJobId } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Immediately cancel a fine-tune job., RequestType: , @@ -2296,6 +2315,7 @@ If a seed is not specified, one will be generated for you. ArgumentName: limit } ], + JsonSerializerContext: , Summary: List checkpoints for a fine-tuning job., RequestType: , ResponseType: ListFineTuningJobCheckpointsResponse, @@ -2310,6 +2330,7 @@ If a seed is not specified, one will be generated for you. Stream: false, Path: "/models", Properties: null, + JsonSerializerContext: , Summary: Lists the currently available models, and provides basic information about each one such as the owner and availability., RequestType: , ResponseType: ListModelsResponse, @@ -2343,6 +2364,7 @@ If a seed is not specified, one will be generated for you. ArgumentName: model } ], + JsonSerializerContext: , Summary: Retrieves a model instance, providing basic information about the model such as the owner and permissioning., RequestType: , ResponseType: Model, @@ -2376,6 +2398,7 @@ If a seed is not specified, one will be generated for you. ArgumentName: model } ], + JsonSerializerContext: , HttpMethod: Delete, Summary: Delete a fine-tuned model. You must have the Owner role in your organization to delete a model., RequestType: , @@ -2427,6 +2450,7 @@ The default is `text-moderation-latest` which will be automatically upgraded ove ArgumentName: model } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Classifies if text is potentially harmful., RequestType: CreateModerationRequest, @@ -2521,6 +2545,7 @@ The default is `text-moderation-latest` which will be automatically upgraded ove ArgumentName: before } ], + JsonSerializerContext: , Summary: Returns a list of assistants., RequestType: , ResponseType: ListAssistantsResponse, @@ -2711,6 +2736,7 @@ Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the m ArgumentName: responseFormat } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create an assistant with a model and instructions., RequestType: CreateAssistantRequest, @@ -2744,6 +2770,7 @@ Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the m ArgumentName: assistantId } ], + JsonSerializerContext: , Summary: Retrieves an assistant., RequestType: , ResponseType: AssistantObject, @@ -2951,6 +2978,7 @@ Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the m ArgumentName: responseFormat } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Modifies an assistant., RequestType: ModifyAssistantRequest, @@ -2984,6 +3012,7 @@ Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the m ArgumentName: assistantId } ], + JsonSerializerContext: , HttpMethod: Delete, Summary: Delete an assistant., RequestType: , @@ -3046,6 +3075,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: metadata } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create a thread., RequestType: CreateThreadRequest, @@ -3079,6 +3109,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: threadId } ], + JsonSerializerContext: , Summary: Retrieves a thread., RequestType: , ResponseType: ThreadObject, @@ -3143,6 +3174,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: metadata } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Modifies a thread., RequestType: ModifyThreadRequest, @@ -3176,6 +3208,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: threadId } ], + JsonSerializerContext: , HttpMethod: Delete, Summary: Delete a thread., RequestType: , @@ -3304,6 +3337,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: runId } ], + JsonSerializerContext: , Summary: Returns a list of messages for a given thread., RequestType: , ResponseType: ListMessagesResponse, @@ -3404,6 +3438,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: metadata } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create a message., RequestType: CreateMessageRequest, @@ -3454,6 +3489,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: messageId } ], + JsonSerializerContext: , Summary: Retrieve a message., RequestType: , ResponseType: MessageObject, @@ -3519,6 +3555,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: metadata } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Modifies a message., RequestType: ModifyMessageRequest, @@ -3569,6 +3606,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: messageId } ], + JsonSerializerContext: , HttpMethod: Delete, Summary: Deletes a message., RequestType: , @@ -3839,6 +3877,7 @@ Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the m ArgumentName: responseFormat } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create a thread and run it in one request., RequestType: CreateThreadAndRunRequest, @@ -3950,6 +3989,7 @@ Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the m ArgumentName: before } ], + JsonSerializerContext: , Summary: Returns a list of runs belonging to a thread., RequestType: , ResponseType: ListRunsResponse, @@ -4230,6 +4270,7 @@ Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the m ArgumentName: responseFormat } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create a run., RequestType: CreateRunRequest, @@ -4280,6 +4321,7 @@ Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the m ArgumentName: runId } ], + JsonSerializerContext: , Summary: Retrieves a run., RequestType: , ResponseType: RunObject, @@ -4345,6 +4387,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: metadata } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Modifies a run., RequestType: ModifyRunRequest, @@ -4425,6 +4468,7 @@ If `true`, returns a stream of events that happen during the Run as server-sent ArgumentName: stream } ], + JsonSerializerContext: , HttpMethod: Post, Summary: When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request., RequestType: SubmitToolOutputsRunRequest, @@ -4475,6 +4519,7 @@ If `true`, returns a stream of events that happen during the Run as server-sent ArgumentName: runId } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Cancels a run that is `in_progress`., RequestType: , @@ -4603,6 +4648,7 @@ If `true`, returns a stream of events that happen during the Run as server-sent ArgumentName: before } ], + JsonSerializerContext: , Summary: Returns a list of run steps belonging to a run., RequestType: , ResponseType: ListRunStepsResponse, @@ -4669,6 +4715,7 @@ If `true`, returns a stream of events that happen during the Run as server-sent ArgumentName: stepId } ], + JsonSerializerContext: , Summary: Retrieves a run step., RequestType: , ResponseType: RunStepObject, @@ -4762,6 +4809,7 @@ If `true`, returns a stream of events that happen during the Run as server-sent ArgumentName: before } ], + JsonSerializerContext: , Summary: Returns a list of vector stores., RequestType: , ResponseType: ListVectorStoresResponse, @@ -4838,6 +4886,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: metadata } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create a vector store., RequestType: CreateVectorStoreRequest, @@ -4871,6 +4920,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: vectorStoreId } ], + JsonSerializerContext: , Summary: Retrieves a vector store., RequestType: , ResponseType: VectorStoreObject, @@ -4950,6 +5000,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: metadata } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Modifies a vector store., RequestType: UpdateVectorStoreRequest, @@ -4983,6 +5034,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: vectorStoreId } ], + JsonSerializerContext: , HttpMethod: Delete, Summary: Delete a vector store., RequestType: , @@ -5121,6 +5173,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: filter } ], + JsonSerializerContext: , Summary: Returns a list of vector store files., RequestType: , ResponseType: ListVectorStoreFilesResponse, @@ -5168,6 +5221,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: fileId } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object)., RequestType: CreateVectorStoreFileRequest, @@ -5220,6 +5274,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: fileId } ], + JsonSerializerContext: , Summary: Retrieves a vector store file., RequestType: , ResponseType: VectorStoreFileObject, @@ -5269,6 +5324,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: fileId } ], + JsonSerializerContext: , HttpMethod: Delete, Summary: Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](/docs/api-reference/files/delete) endpoint., RequestType: , @@ -5317,6 +5373,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: fileIds } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Create a vector store file batch., RequestType: CreateVectorStoreFileBatchRequest, @@ -5369,6 +5426,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: batchId } ], + JsonSerializerContext: , Summary: Retrieves a vector store file batch., RequestType: , ResponseType: VectorStoreFileBatchObject, @@ -5418,6 +5476,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: batchId } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible., RequestType: , @@ -5573,6 +5632,7 @@ Set of 16 key-value pairs that can be attached to an object. This can be useful ArgumentName: filter } ], + JsonSerializerContext: , Summary: Returns a list of vector store files in a batch., RequestType: , ResponseType: ListVectorStoreFilesResponse, @@ -5660,6 +5720,7 @@ Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/re ArgumentName: metadata } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Creates and executes a batch from an uploaded file of requests, RequestType: , @@ -5712,6 +5773,7 @@ Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/re ArgumentName: limit } ], + JsonSerializerContext: , Summary: List your organization's batches., RequestType: , ResponseType: ListBatchesResponse, @@ -5744,6 +5806,7 @@ Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/re ArgumentName: batchId } ], + JsonSerializerContext: , Summary: Retrieves a batch., RequestType: , ResponseType: Batch, @@ -5776,6 +5839,7 @@ Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/re ArgumentName: batchId } ], + JsonSerializerContext: , HttpMethod: Post, Summary: Cancels an in-progress batch., RequestType: , @@ -5791,6 +5855,7 @@ Your input file must be formatted as a [JSONL file](/docs/api-reference/batch/re Stream: false, Path: , Properties: null, + JsonSerializerContext: , Summary: , RequestType: , ResponseType: ,