Skip to content

Commit 453b9d2

Browse files
committed
fix: Fixed generation if there is file type with binary format.
1 parent 13d1ff0 commit 453b9d2

File tree

281 files changed

+16180
-6859
lines changed

Some content is hidden

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

281 files changed

+16180
-6859
lines changed

specs/langsmith.json

Lines changed: 2431 additions & 1845 deletions
Large diffs are not rendered by default.

src/libs/AutoSDK/Models/TypeData.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ public static string GetCSharpType(SchemaContext context)
294294
// ("string", "duration") => "global::System.TimeSpan",
295295
// ("string", "uri") => "global::System.Uri",
296296
("string", "uuid") => "global::System.Guid",
297+
298+
// multipart/form-data
299+
("file", "binary") => "byte[]",
300+
(_, "binary") => "byte[]",
297301

298302
(null, "url") => "string",
299303

src/tests/AutoSDK.SnapshotTests/Snapshots/langsmith/NewtonsoftJson/_#G.Models.OptimizePromptRequest.Json.g.verified.cs renamed to src/tests/AutoSDK.SnapshotTests/Snapshots/langsmith/NewtonsoftJson/_#AllOf.2.Json.g.verified.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
//HintName: G.Models.OptimizePromptRequest.Json.g.cs
1+
//HintName: AllOf.2.Json.g.cs
22
#nullable enable
33

44
namespace G
55
{
6-
public sealed partial class OptimizePromptRequest
6+
public readonly partial struct AllOf<T1, T2>
77
{
88
/// <summary>
99
/// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
@@ -27,11 +27,11 @@ public string ToJson(
2727
[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.")]
2828
[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.")]
2929
#endif
30-
public static global::G.OptimizePromptRequest? FromJson(
30+
public static global::G.AllOf<T1, T2>? FromJson(
3131
string json,
3232
global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null)
3333
{
34-
return global::Newtonsoft.Json.JsonConvert.DeserializeObject<global::G.OptimizePromptRequest>(
34+
return global::Newtonsoft.Json.JsonConvert.DeserializeObject<global::G.AllOf<T1, T2>>(
3535
json,
3636
jsonSerializerOptions);
3737
}
@@ -43,14 +43,14 @@ public string ToJson(
4343
[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.")]
4444
[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.")]
4545
#endif
46-
public static global::System.Threading.Tasks.ValueTask<global::G.OptimizePromptRequest?> FromJsonStreamAsync(
46+
public static global::System.Threading.Tasks.ValueTask<global::G.AllOf<T1, T2>?> FromJsonStreamAsync(
4747
global::System.IO.Stream jsonStream,
4848
global::Newtonsoft.Json.JsonSerializerSettings? jsonSerializerOptions = null)
4949
{
5050
using var streamReader = new global::System.IO.StreamReader(jsonStream);
5151
using var jsonReader = new global::Newtonsoft.Json.JsonTextReader(streamReader);
5252
var serializer = global::Newtonsoft.Json.JsonSerializer.Create(jsonSerializerOptions);
53-
return new global::System.Threading.Tasks.ValueTask<global::G.OptimizePromptRequest?>(serializer.Deserialize<global::G.OptimizePromptRequest>(jsonReader));
53+
return new global::System.Threading.Tasks.ValueTask<global::G.AllOf<T1, T2>?>(serializer.Deserialize<global::G.AllOf<T1, T2>>(jsonReader));
5454
}
5555
}
5656
}
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
//HintName: AllOf.2.g.cs
2+
3+
#nullable enable
4+
5+
namespace G
6+
{
7+
/// <summary>
8+
///
9+
/// </summary>
10+
public readonly partial struct AllOf<T1, T2> : global::System.IEquatable<AllOf<T1, T2>>
11+
{
12+
/// <summary>
13+
///
14+
/// </summary>
15+
#if NET6_0_OR_GREATER
16+
public T1? Value1 { get; init; }
17+
#else
18+
public T1? Value1 { get; }
19+
#endif
20+
21+
/// <summary>
22+
///
23+
/// </summary>
24+
#if NET6_0_OR_GREATER
25+
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value1))]
26+
#endif
27+
public bool IsValue1 => Value1 != null;
28+
29+
/// <summary>
30+
///
31+
/// </summary>
32+
public static implicit operator AllOf<T1, T2>(T1 value) => new AllOf<T1, T2>((T1?)value);
33+
34+
/// <summary>
35+
///
36+
/// </summary>
37+
public static implicit operator T1?(AllOf<T1, T2> @this) => @this.Value1;
38+
39+
/// <summary>
40+
///
41+
/// </summary>
42+
public AllOf(T1? value)
43+
{
44+
Value1 = value;
45+
}
46+
47+
/// <summary>
48+
///
49+
/// </summary>
50+
#if NET6_0_OR_GREATER
51+
public T2? Value2 { get; init; }
52+
#else
53+
public T2? Value2 { get; }
54+
#endif
55+
56+
/// <summary>
57+
///
58+
/// </summary>
59+
#if NET6_0_OR_GREATER
60+
[global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))]
61+
#endif
62+
public bool IsValue2 => Value2 != null;
63+
64+
/// <summary>
65+
///
66+
/// </summary>
67+
public static implicit operator AllOf<T1, T2>(T2 value) => new AllOf<T1, T2>((T2?)value);
68+
69+
/// <summary>
70+
///
71+
/// </summary>
72+
public static implicit operator T2?(AllOf<T1, T2> @this) => @this.Value2;
73+
74+
/// <summary>
75+
///
76+
/// </summary>
77+
public AllOf(T2? value)
78+
{
79+
Value2 = value;
80+
}
81+
82+
/// <summary>
83+
///
84+
/// </summary>
85+
public AllOf(
86+
T1? value1,
87+
T2? value2
88+
)
89+
{
90+
Value1 = value1;
91+
Value2 = value2;
92+
}
93+
94+
/// <summary>
95+
///
96+
/// </summary>
97+
public object? Object =>
98+
Value2 as object ??
99+
Value1 as object
100+
;
101+
102+
/// <summary>
103+
///
104+
/// </summary>
105+
public override string? ToString() =>
106+
Value1?.ToString() ??
107+
Value2?.ToString()
108+
;
109+
110+
/// <summary>
111+
///
112+
/// </summary>
113+
public bool Validate()
114+
{
115+
return IsValue1 && IsValue2;
116+
}
117+
118+
/// <summary>
119+
///
120+
/// </summary>
121+
public TResult? Match<TResult>(
122+
global::System.Func<T1, TResult>? value1 = null,
123+
global::System.Func<T2, TResult>? value2 = null,
124+
bool validate = true)
125+
{
126+
if (validate)
127+
{
128+
Validate();
129+
}
130+
131+
if (IsValue1 && value1 != null)
132+
{
133+
return value1(Value1!);
134+
}
135+
else if (IsValue2 && value2 != null)
136+
{
137+
return value2(Value2!);
138+
}
139+
140+
return default(TResult);
141+
}
142+
143+
/// <summary>
144+
///
145+
/// </summary>
146+
public void Match(
147+
global::System.Action<T1>? value1 = null,
148+
global::System.Action<T2>? value2 = null,
149+
bool validate = true)
150+
{
151+
if (validate)
152+
{
153+
Validate();
154+
}
155+
156+
if (IsValue1)
157+
{
158+
value1?.Invoke(Value1!);
159+
}
160+
else if (IsValue2)
161+
{
162+
value2?.Invoke(Value2!);
163+
}
164+
}
165+
166+
/// <summary>
167+
///
168+
/// </summary>
169+
public override int GetHashCode()
170+
{
171+
var fields = new object?[]
172+
{
173+
Value1,
174+
typeof(T1),
175+
Value2,
176+
typeof(T2),
177+
};
178+
const int offset = unchecked((int)2166136261);
179+
const int prime = 16777619;
180+
static int HashCodeAggregator(int hashCode, object? value) => value == null
181+
? (hashCode ^ 0) * prime
182+
: (hashCode ^ value.GetHashCode()) * prime;
183+
184+
return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator);
185+
}
186+
187+
/// <summary>
188+
///
189+
/// </summary>
190+
public bool Equals(AllOf<T1, T2> other)
191+
{
192+
return
193+
global::System.Collections.Generic.EqualityComparer<T1?>.Default.Equals(Value1, other.Value1) &&
194+
global::System.Collections.Generic.EqualityComparer<T2?>.Default.Equals(Value2, other.Value2)
195+
;
196+
}
197+
198+
/// <summary>
199+
///
200+
/// </summary>
201+
public static bool operator ==(AllOf<T1, T2> obj1, AllOf<T1, T2> obj2)
202+
{
203+
return global::System.Collections.Generic.EqualityComparer<AllOf<T1, T2>>.Default.Equals(obj1, obj2);
204+
}
205+
206+
/// <summary>
207+
///
208+
/// </summary>
209+
public static bool operator !=(AllOf<T1, T2> obj1, AllOf<T1, T2> obj2)
210+
{
211+
return !(obj1 == obj2);
212+
}
213+
214+
/// <summary>
215+
///
216+
/// </summary>
217+
public override bool Equals(object? obj)
218+
{
219+
return obj is AllOf<T1, T2> o && Equals(o);
220+
}
221+
}
222+
}

src/tests/AutoSDK.SnapshotTests/Snapshots/langsmith/NewtonsoftJson/_#G.Api.g.verified.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,15 @@ public sealed partial class Api : global::G.IApi, global::System.IDisposable
316316
JsonSerializerOptions = JsonSerializerOptions,
317317
};
318318

319+
/// <summary>
320+
///
321+
/// </summary>
322+
public RunsClient Runs => new RunsClient(HttpClient, authorizations: Authorizations)
323+
{
324+
ReadResponseAsString = ReadResponseAsString,
325+
JsonSerializerOptions = JsonSerializerOptions,
326+
};
327+
319328
/// <summary>
320329
/// Creates a new instance of the Api.
321330
/// If no httpClient is provided, a new one will be created.

src/tests/AutoSDK.SnapshotTests/Snapshots/langsmith/NewtonsoftJson/_#G.ChartsClient.OrgReadCharts.g.verified.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,19 @@ partial void ProcessOrgReadChartsResponseContent(
207207
/// <param name="stride">
208208
/// Timedelta input.
209209
/// </param>
210+
/// <param name="omitData">
211+
/// Default Value: false
212+
/// </param>
210213
/// <param name="afterIndex"></param>
211214
/// <param name="tagValueId"></param>
212215
/// <param name="cancellationToken">The token to cancel the operation with</param>
213216
/// <exception cref="global::System.InvalidOperationException"></exception>
214217
public async global::System.Threading.Tasks.Task<global::G.CustomChartsResponse> OrgReadChartsAsync(
215-
global::System.DateTime startTime,
216218
string? timezone = default,
219+
global::System.DateTime? startTime = default,
217220
global::System.DateTime? endTime = default,
218221
global::G.TimedeltaInput? stride = default,
222+
bool? omitData = default,
219223
int? afterIndex = default,
220224
global::System.Collections.Generic.IList<global::System.Guid>? tagValueId = default,
221225
global::System.Threading.CancellationToken cancellationToken = default)
@@ -226,6 +230,7 @@ partial void ProcessOrgReadChartsResponseContent(
226230
StartTime = startTime,
227231
EndTime = endTime,
228232
Stride = stride,
233+
OmitData = omitData,
229234
AfterIndex = afterIndex,
230235
TagValueId = tagValueId,
231236
};

src/tests/AutoSDK.SnapshotTests/Snapshots/langsmith/NewtonsoftJson/_#G.ChartsClient.OrgReadSingleChart.g.verified.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,20 @@ partial void ProcessOrgReadSingleChartResponseContent(
214214
/// <param name="stride">
215215
/// Timedelta input.
216216
/// </param>
217+
/// <param name="omitData">
218+
/// Default Value: false
219+
/// </param>
217220
/// <param name="afterIndex"></param>
218221
/// <param name="tagValueId"></param>
219222
/// <param name="cancellationToken">The token to cancel the operation with</param>
220223
/// <exception cref="global::System.InvalidOperationException"></exception>
221224
public async global::System.Threading.Tasks.Task<global::G.SingleCustomChartResponse> OrgReadSingleChartAsync(
222225
global::System.Guid chartId,
223-
global::System.DateTime startTime,
224226
string? timezone = default,
227+
global::System.DateTime? startTime = default,
225228
global::System.DateTime? endTime = default,
226229
global::G.TimedeltaInput? stride = default,
230+
bool? omitData = default,
227231
int? afterIndex = default,
228232
global::System.Collections.Generic.IList<global::System.Guid>? tagValueId = default,
229233
global::System.Threading.CancellationToken cancellationToken = default)
@@ -234,6 +238,7 @@ partial void ProcessOrgReadSingleChartResponseContent(
234238
StartTime = startTime,
235239
EndTime = endTime,
236240
Stride = stride,
241+
OmitData = omitData,
237242
AfterIndex = afterIndex,
238243
TagValueId = tagValueId,
239244
};

src/tests/AutoSDK.SnapshotTests/Snapshots/langsmith/NewtonsoftJson/_#G.ChartsClient.OrgReadSingleSection.g.verified.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,18 @@ partial void ProcessOrgReadSingleSectionResponseContent(
214214
/// <param name="stride">
215215
/// Timedelta input.
216216
/// </param>
217+
/// <param name="omitData">
218+
/// Default Value: false
219+
/// </param>
217220
/// <param name="cancellationToken">The token to cancel the operation with</param>
218221
/// <exception cref="global::System.InvalidOperationException"></exception>
219222
public async global::System.Threading.Tasks.Task<global::G.CustomChartsSection> OrgReadSingleSectionAsync(
220223
global::System.Guid sectionId,
221-
global::System.DateTime startTime,
222224
string? timezone = default,
225+
global::System.DateTime? startTime = default,
223226
global::System.DateTime? endTime = default,
224227
global::G.TimedeltaInput? stride = default,
228+
bool? omitData = default,
225229
global::System.Threading.CancellationToken cancellationToken = default)
226230
{
227231
var __request = new global::G.CustomChartsRequestBase
@@ -230,6 +234,7 @@ partial void ProcessOrgReadSingleSectionResponseContent(
230234
StartTime = startTime,
231235
EndTime = endTime,
232236
Stride = stride,
237+
OmitData = omitData,
233238
};
234239

235240
return await OrgReadSingleSectionAsync(

0 commit comments

Comments
 (0)