Skip to content

Commit f386944

Browse files
committed
fix: Fixed Vectara spec issues.
1 parent 96a92ea commit f386944

File tree

2,481 files changed

+217480
-20751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,481 files changed

+217480
-20751
lines changed

specs/vectara.yaml

Lines changed: 15402 additions & 3936 deletions
Large diffs are not rendered by default.

src/libs/AutoSDK/Extensions/OpenApiSchemaExtensions.cs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static bool IsOneOf(
107107

108108
return
109109
(schema.OneOf?.Any() ?? false) &&
110-
(schema.Properties?.Count ?? 0) == 0; // OneOf with properties is not supported
110+
((schema.Properties?.Count ?? 0) == 0 || HasOnlySharedBaseDiscriminatorWrapperProperty(schema));
111111
}
112112

113113
public static bool IsAnyOf(
@@ -135,6 +135,41 @@ public static bool IsAllOf(
135135
(schema.AllOf?.Any() ?? false) &&
136136
(schema.Properties?.Count ?? 0) == 0; // AllOf with properties is not supported
137137
}
138+
139+
// Some specs wrap a shared-base discriminated oneOf in a discriminator-only property bag.
140+
// That wrapper should still be treated as a named union instead of collapsing to a base class.
141+
private static bool HasOnlySharedBaseDiscriminatorWrapperProperty(IOpenApiSchema schema)
142+
{
143+
if (schema.Discriminator?.PropertyName is not { Length: > 0 } discriminatorPropertyName ||
144+
schema.Properties is not { Count: 1 } properties ||
145+
!properties.ContainsKey(discriminatorPropertyName))
146+
{
147+
return false;
148+
}
149+
150+
var sharedBaseReferenceIds = (schema.OneOf ?? [])
151+
.Select(GetSharedBaseReferenceId)
152+
.Where(static x => !string.IsNullOrWhiteSpace(x))
153+
.Distinct(StringComparer.Ordinal)
154+
.ToArray();
155+
156+
return sharedBaseReferenceIds.Length == 1;
157+
}
158+
159+
private static string? GetSharedBaseReferenceId(IOpenApiSchema schema)
160+
{
161+
var resolvedSchema = schema.ResolveIfRequired();
162+
var baseReferenceIds = (resolvedSchema.AllOf ?? [])
163+
.Where(static x => x.IsSchemaReference())
164+
.Select(static x => x.GetReferenceId())
165+
.Where(static x => !string.IsNullOrWhiteSpace(x))
166+
.Distinct(StringComparer.Ordinal)
167+
.ToArray();
168+
169+
return baseReferenceIds.Length == 1
170+
? baseReferenceIds[0]
171+
: null;
172+
}
138173

139174
public static bool IsArray(
140175
this IOpenApiSchema schema)
@@ -320,4 +355,4 @@ null or
320355
"int32" &&
321356
schema.Description?.ToUpperInvariant().Contains("UNIX TIMESTAMP") == true);
322357
}
323-
}
358+
}

src/tests/AutoSDK.SnapshotTests/Snapshots/vectara/NewtonsoftJson/_#G.APIKeysClient.CreateApiKey.g.verified.cs

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ partial void ProcessCreateApiKeyResponseContent(
2828

2929
/// <summary>
3030
/// Create an API key<br/>
31-
/// An API key is to authenticate when calling Vectara APIs.
31+
/// The Create API Key API lets you create new API keys, which you can bind to one or multiple corpora. You can also decide whether to designate each key for specific access like personal API keys, only querying (read-only) or both querying and indexing (read-write).<br/>
32+
/// This capability is useful in scenarios where you have applications that require different levels of access to corpora data. For example, you might create a read-only API key for an application that only needs to query data.<br/>
33+
/// :::note<br/>
34+
/// For more information about the different types of API keys, see [API Key Management](/docs/deploy-and-scale/authentication/api-key-management).<br/>
35+
/// :::
3236
/// </summary>
3337
/// <param name="requestTimeout"></param>
3438
/// <param name="requestTimeoutMillis"></param>
@@ -266,39 +270,49 @@ partial void ProcessCreateApiKeyResponseContent(
266270

267271
/// <summary>
268272
/// Create an API key<br/>
269-
/// An API key is to authenticate when calling Vectara APIs.
273+
/// The Create API Key API lets you create new API keys, which you can bind to one or multiple corpora. You can also decide whether to designate each key for specific access like personal API keys, only querying (read-only) or both querying and indexing (read-write).<br/>
274+
/// This capability is useful in scenarios where you have applications that require different levels of access to corpora data. For example, you might create a read-only API key for an application that only needs to query data.<br/>
275+
/// :::note<br/>
276+
/// For more information about the different types of API keys, see [API Key Management](/docs/deploy-and-scale/authentication/api-key-management).<br/>
277+
/// :::
270278
/// </summary>
271279
/// <param name="requestTimeout"></param>
272280
/// <param name="requestTimeoutMillis"></param>
273281
/// <param name="name">
274282
/// The human-readable name of the API key.
275283
/// </param>
284+
/// <param name="apiRoles">
285+
/// Customer-level roles for this API key.
286+
/// </param>
276287
/// <param name="apiKeyRole">
277-
/// Role of the API key. <br/>
278-
/// A serving API key can only perform query type requests on its corpora. A serving and<br/>
279-
/// indexing key can perform both indexing and query type requests on its corpora.<br/>
288+
/// Role of the API key. A serving API key can only perform query type requests on its corpora. A serving and indexing key can perform both indexing and query type requests on its corpora.<br/>
280289
/// A personal API key has all the same permissions as the creator of the API key.
281290
/// </param>
282-
/// <param name="corpusKeys">
283-
/// Corpora this API key has roles on if it is not a Personal API key.<br/>
284-
/// This property should be null or missing if this `api_key_role` is<br/>
285-
/// `personal`.
291+
/// <param name="corpusRoles">
292+
/// Corpus-specific role assignments for this API key.
293+
/// </param>
294+
/// <param name="agentRoles">
295+
/// Agent-specific role assignments for this API key.
286296
/// </param>
287297
/// <param name="cancellationToken">The token to cancel the operation with</param>
288298
/// <exception cref="global::System.InvalidOperationException"></exception>
289299
public async global::System.Threading.Tasks.Task<global::G.ApiKey> CreateApiKeyAsync(
290300
string name,
291-
global::G.ApiKeyRole apiKeyRole,
292301
int? requestTimeout = default,
293302
int? requestTimeoutMillis = default,
294-
global::System.Collections.Generic.IList<string>? corpusKeys = default,
303+
global::System.Collections.Generic.IList<global::G.ApiRole>? apiRoles = default,
304+
global::G.ApiKeyRole? apiKeyRole = default,
305+
global::System.Collections.Generic.IList<global::G.CorpusRole>? corpusRoles = default,
306+
global::System.Collections.Generic.IList<global::G.AgentRole>? agentRoles = default,
295307
global::System.Threading.CancellationToken cancellationToken = default)
296308
{
297309
var __request = new global::G.CreateApiKeyRequest
298310
{
299311
Name = name,
312+
ApiRoles = apiRoles,
300313
ApiKeyRole = apiKeyRole,
301-
CorpusKeys = corpusKeys,
314+
CorpusRoles = corpusRoles,
315+
AgentRoles = agentRoles,
302316
};
303317

304318
return await CreateApiKeyAsync(

src/tests/AutoSDK.SnapshotTests/Snapshots/vectara/NewtonsoftJson/_#G.APIKeysClient.DeleteApiKey.g.verified.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ partial void ProcessDeleteApiKeyResponse(
2323

2424
/// <summary>
2525
/// Delete an API key<br/>
26-
/// Delete API keys to help you manage the security and lifecycle of API keys in your application.
26+
/// The Delete API Key API lets you delete one or more existing API keys. <br/>
27+
/// This capability is useful for managing the lifecycle and security of <br/>
28+
/// API keys such as when they are no longer needed or when a key is compromised.
2729
/// </summary>
2830
/// <param name="requestTimeout"></param>
2931
/// <param name="requestTimeoutMillis"></param>

src/tests/AutoSDK.SnapshotTests/Snapshots/vectara/NewtonsoftJson/_#G.APIKeysClient.GetApiKey.g.verified.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ partial void ProcessGetApiKeyResponseContent(
2828

2929
/// <summary>
3030
/// Get an API key<br/>
31-
/// Retrieve details of a specific API key by its ID.
31+
/// The Get API Key API lists all existing API keys for a customer ID. It also shows what corpora are accessed by these keys and with what permissions.<br/>
32+
/// This capability can provide insights into key usage and status and help you manage the lifecycle and security of your API keys.
3233
/// </summary>
3334
/// <param name="requestTimeout"></param>
3435
/// <param name="requestTimeoutMillis"></param>

src/tests/AutoSDK.SnapshotTests/Snapshots/vectara/NewtonsoftJson/_#G.APIKeysClient.ListApiKeys.g.verified.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ partial void ProcessListApiKeysResponseContent(
3434

3535
/// <summary>
3636
/// List API keys<br/>
37-
/// Retrieve a list of API keys for the customer account with optional filtering.
37+
/// The List API Keys API lists all existing API keys for a customer ID. It also shows what corpora are accessed by these keys and with what permissions. This capability can provide insights into key usage and status and help you manage the lifecycle and security of your API keys.
3838
/// </summary>
3939
/// <param name="requestTimeout"></param>
4040
/// <param name="requestTimeoutMillis"></param>
@@ -47,9 +47,7 @@ partial void ProcessListApiKeysResponseContent(
4747
/// Example: my-corpus
4848
/// </param>
4949
/// <param name="apiKeyRole">
50-
/// Role of the API key. <br/>
51-
/// A serving API key can only perform query type requests on its corpora. A serving and<br/>
52-
/// indexing key can perform both indexing and query type requests on its corpora.<br/>
50+
/// Role of the API key. A serving API key can only perform query type requests on its corpora. A serving and indexing key can perform both indexing and query type requests on its corpora.<br/>
5351
/// A personal API key has all the same permissions as the creator of the API key.
5452
/// </param>
5553
/// <param name="cancellationToken">The token to cancel the operation with</param>

src/tests/AutoSDK.SnapshotTests/Snapshots/vectara/NewtonsoftJson/_#G.APIKeysClient.UpdateApiKey.g.verified.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ partial void ProcessUpdateApiKeyResponseContent(
3030

3131
/// <summary>
3232
/// Update an API key<br/>
33-
/// Update an API key such as the roles attached to the key.
33+
/// The Update API Key API lets you enable or disable specific API keys. You can use this endpoint to temporarily disable access without deleting the key.<br/>
34+
/// This capability is useful for scenarios like maintenance windows, or when your team no longer requires access to a specific corpus.
3435
/// </summary>
3536
/// <param name="requestTimeout"></param>
3637
/// <param name="requestTimeoutMillis"></param>
@@ -235,7 +236,8 @@ partial void ProcessUpdateApiKeyResponseContent(
235236

236237
/// <summary>
237238
/// Update an API key<br/>
238-
/// Update an API key such as the roles attached to the key.
239+
/// The Update API Key API lets you enable or disable specific API keys. You can use this endpoint to temporarily disable access without deleting the key.<br/>
240+
/// This capability is useful for scenarios like maintenance windows, or when your team no longer requires access to a specific corpus.
239241
/// </summary>
240242
/// <param name="requestTimeout"></param>
241243
/// <param name="requestTimeoutMillis"></param>

src/tests/AutoSDK.SnapshotTests/Snapshots/vectara/NewtonsoftJson/_#G.APIKeysClient.g.verified.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace G
66
{
77
/// <summary>
8-
/// Create, manage, and revoke API keys for secure access to the platform<br/>
8+
/// Create, manage, and revoke API keys for secure access to the platform.<br/>
99
/// If no httpClient is provided, a new one will be created.<br/>
1010
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
1111
/// </summary>
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
//HintName: G.AgentConnectorsClient.g.cs
2+
3+
#nullable enable
4+
5+
namespace G
6+
{
7+
/// <summary>
8+
/// Create and manage connectors that allow agents to receive events from external platforms like Slack.<br/>
9+
/// If no httpClient is provided, a new one will be created.<br/>
10+
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
11+
/// </summary>
12+
public sealed partial class AgentConnectorsClient : global::G.IAgentConnectorsClient, global::System.IDisposable
13+
{
14+
/// <summary>
15+
///
16+
/// </summary>
17+
public const string DefaultBaseUrl = "https://api.vectara.io";
18+
19+
private bool _disposeHttpClient = true;
20+
21+
/// <inheritdoc/>
22+
public global::System.Net.Http.HttpClient HttpClient { get; }
23+
24+
/// <inheritdoc/>
25+
public System.Uri? BaseUri => HttpClient.BaseAddress;
26+
27+
/// <inheritdoc/>
28+
public global::System.Collections.Generic.List<global::G.EndPointAuthorization> Authorizations { get; }
29+
30+
/// <inheritdoc/>
31+
public bool ReadResponseAsString { get; set; }
32+
#if DEBUG
33+
= true;
34+
#endif
35+
/// <summary>
36+
///
37+
/// </summary>
38+
public global::Newtonsoft.Json.JsonSerializerSettings JsonSerializerOptions { get; set; } = new global::Newtonsoft.Json.JsonSerializerSettings();
39+
40+
41+
/// <summary>
42+
/// Creates a new instance of the AgentConnectorsClient.
43+
/// If no httpClient is provided, a new one will be created.
44+
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
45+
/// </summary>
46+
/// <param name="httpClient">The HttpClient instance. If not provided, a new one will be created.</param>
47+
/// <param name="baseUri">The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.</param>
48+
/// <param name="authorizations">The authorizations to use for the requests.</param>
49+
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
50+
public AgentConnectorsClient(
51+
global::System.Net.Http.HttpClient? httpClient = null,
52+
global::System.Uri? baseUri = null,
53+
global::System.Collections.Generic.List<global::G.EndPointAuthorization>? authorizations = null,
54+
bool disposeHttpClient = true)
55+
{
56+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
57+
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
58+
Authorizations = authorizations ?? new global::System.Collections.Generic.List<global::G.EndPointAuthorization>();
59+
_disposeHttpClient = disposeHttpClient;
60+
61+
Initialized(HttpClient);
62+
}
63+
64+
/// <inheritdoc/>
65+
public void Dispose()
66+
{
67+
if (_disposeHttpClient)
68+
{
69+
HttpClient.Dispose();
70+
}
71+
}
72+
73+
partial void Initialized(
74+
global::System.Net.Http.HttpClient client);
75+
partial void PrepareArguments(
76+
global::System.Net.Http.HttpClient client);
77+
partial void PrepareRequest(
78+
global::System.Net.Http.HttpClient client,
79+
global::System.Net.Http.HttpRequestMessage request);
80+
partial void ProcessResponse(
81+
global::System.Net.Http.HttpClient client,
82+
global::System.Net.Http.HttpResponseMessage response);
83+
partial void ProcessResponseContent(
84+
global::System.Net.Http.HttpClient client,
85+
global::System.Net.Http.HttpResponseMessage response,
86+
ref string content);
87+
}
88+
}

0 commit comments

Comments
 (0)