Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@

#nullable enable

namespace AI21
{
public partial class Ai21Api
{
partial void PrepareClarotyProductLookupSolutionsClarotyProductLookupPostArguments(
global::System.Net.Http.HttpClient httpClient);
partial void PrepareClarotyProductLookupSolutionsClarotyProductLookupPostRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage);
partial void ProcessClarotyProductLookupSolutionsClarotyProductLookupPostResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

partial void ProcessClarotyProductLookupSolutionsClarotyProductLookupPostResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);

/// <summary>
/// Claroty Product Lookup
/// </summary>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::AI21.ApiException"></exception>
public async global::System.Threading.Tasks.Task<string> ClarotyProductLookupSolutionsClarotyProductLookupPostAsync(
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
PrepareClarotyProductLookupSolutionsClarotyProductLookupPostArguments(
httpClient: HttpClient);

var __pathBuilder = new global::AI21.PathBuilder(
path: "/solutions/claroty/product-lookup",
baseUri: HttpClient.BaseAddress);
var __path = __pathBuilder.ToString();
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
method: global::System.Net.Http.HttpMethod.Post,
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
#if NET6_0_OR_GREATER
__httpRequest.Version = global::System.Net.HttpVersion.Version11;
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif

foreach (var __authorization in Authorizations)
{
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
parameter: __authorization.Value);
}
else if (__authorization.Type == "ApiKey" &&
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

PrepareRequest(
client: HttpClient,
request: __httpRequest);
PrepareClarotyProductLookupSolutionsClarotyProductLookupPostRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest);

using var __response = await HttpClient.SendAsync(
request: __httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: HttpClient,
response: __response);
ProcessClarotyProductLookupSolutionsClarotyProductLookupPostResponse(
httpClient: HttpClient,
httpResponseMessage: __response);

if (ReadResponseAsString)
{
var __content = await __response.Content.ReadAsStringAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessClarotyProductLookupSolutionsClarotyProductLookupPostResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();

return __content;
}
catch (global::System.Exception __ex)
{
throw new global::AI21.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
}
else
{
try
{
__response.EnsureSuccessStatusCode();

var __content = await __response.Content.ReadAsStringAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

return __content;
}
catch (global::System.Exception __ex)
{
throw new global::AI21.ApiException(
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value),
};
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#nullable enable

namespace AI21
{
public partial interface IAi21Api
{
/// <summary>
/// Claroty Product Lookup
/// </summary>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::AI21.ApiException"></exception>
global::System.Threading.Tasks.Task<string> ClarotyProductLookupSolutionsClarotyProductLookupPostAsync(
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#nullable enable

namespace AI21
{
public sealed partial class ClarotyProductLookupSolutionsClarotyProductLookupPostResponse
{
/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
/// </summary>
public string ToJson(
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
this.GetType(),
jsonSerializerContext);
}

/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public string ToJson(
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerContext.
/// </summary>
public static global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse),
jsonSerializerContext) as global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse;
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public static global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse>(
json,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerContext.
/// </summary>
public static async global::System.Threading.Tasks.ValueTask<global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return (await global::System.Text.Json.JsonSerializer.DeserializeAsync(
jsonStream,
typeof(global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse),
jsonSerializerContext).ConfigureAwait(false)) as global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse;
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public static global::System.Threading.Tasks.ValueTask<global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.DeserializeAsync<global::AI21.ClarotyProductLookupSolutionsClarotyProductLookupPostResponse?>(
jsonStream,
jsonSerializerOptions);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#nullable enable

namespace AI21
{
/// <summary>
///
/// </summary>
public sealed partial class ClarotyProductLookupSolutionsClarotyProductLookupPostResponse
{

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();
}
}
10 changes: 10 additions & 0 deletions src/libs/AI21/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2997,6 +2997,16 @@ paths:
content:
application/json:
schema: { }
/solutions/claroty/product-lookup:
post:
summary: Claroty Product Lookup
operationId: claroty_product_lookup_solutions_claroty_product_lookup_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: { }
Comment on lines +3004 to +3009
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Replace the empty 200 schema with a concrete response model.

Line 3004-Line 3009 currently describe application/json as schema: { }, which already degrades the generated SDK method to Task<string> in src/libs/AI21/Generated/AI21.Ai21Api.ClarotyProductLookupSolutionsClarotyProductLookupPost.g.cs:1-30. For a new public endpoint, that loses the response contract and makes downstream usage brittle. Point the response at a real schema, or use 204 if the operation truly returns no body.

📦 Suggested OpenAPI shape
   /solutions/claroty/product-lookup:
     post:
       summary: Claroty Product Lookup
       operationId: claroty_product_lookup_solutions_claroty_product_lookup_post
       responses:
         '200':
           description: Successful Response
           content:
             application/json:
-              schema: { }
+              schema:
+                $ref: '#/components/schemas/ClarotyProductLookupResponse'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/libs/AI21/openapi.yaml` around lines 3004 - 3009, The 200 response
currently has an empty schema which forces the generated SDK method
(AI21.Ai21Api.ClarotyProductLookupSolutionsClarotyProductLookupPost.*) to return
Task<string>; update the OpenAPI response so it points to a concrete model
(e.g., replace schema: { } with schema: { $ref:
'#/components/schemas/ClarotyProductLookupResponse' } and add that schema under
components/schemas) or, if the endpoint truly returns no body, change the
response to 204 with no content; ensure the operation's response references a
real component schema name you add or an existing schema so the generated method
returns the correct typed model.

components:
schemas:
Assistant:
Expand Down
Loading