Skip to content

Commit

Permalink
fix: Fixed missing default values for query parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Aug 30, 2024
1 parent a9c4583 commit 462afa7
Show file tree
Hide file tree
Showing 1,472 changed files with 5,172 additions and 5,170 deletions.
4 changes: 3 additions & 1 deletion src/libs/OpenApiGenerator.Core/Generation/Sources.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ public static string GenerateMethod(
/// <exception cref=""global::System.InvalidOperationException""></exception>
{(endPoint.IsDeprecated ? "[global::System.Obsolete(\"This method marked as deprecated.\")]" : " ")}
public async {taskType} {endPoint.MethodName}(
{endPoint.Properties.Where(x => x.ParameterLocation != null).Select(x => $@"
{endPoint.Properties.Where(x => x is { ParameterLocation: not null, IsRequired: true }).Select(x => $@"
{x.Type.CSharpType} {x.ParameterName},").Inject()}
{(string.IsNullOrWhiteSpace(endPoint.RequestType.CSharpType) ? " " : @$"
{endPoint.RequestType.CSharpTypeWithoutNullability} request,")}
{endPoint.Properties.Where(x => x is { ParameterLocation: not null, IsRequired: false }).Select(x => $@"
{x.Type.CSharpType} {x.ParameterName} = {x.ParameterDefaultValue},").Inject()}
{cancellationTokenAttribute}global::System.Threading.CancellationToken cancellationToken = default)
{{
{(string.IsNullOrWhiteSpace(endPoint.RequestType.CSharpType) || endPoint.RequestType.IsAnyOf ? " " : @"
Expand Down
2 changes: 1 addition & 1 deletion src/libs/OpenApiGenerator.Core/Models/TypeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public static string GetCSharpType(SchemaContext context, SchemaContext? additio
("integer", "int64") => ("long", false),
("number", "float") => ("float", false),
("number", "double") => ("double", false),
("string", "byte") => ("byte[]", false),
("string", "byte") => ("byte[]", true),
("string", "binary") => ("byte[]", true),
("string", "date") => ("global::System.DateTime", false),
("string", "date-time") => ("global::System.DateTime", false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2UltraChatResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.ChatResponse> V1J2UltraChatAsync(
string? model,
global::G.LanguageStudioApiServerDataTypesJ2ChatChatRequest request,
string? model = "j2-ultra",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2GrandeCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2GrandeCompleteResponse> V1J2GrandeCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-grande",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2GrandeCustomModelCompleteResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2GrandeCustomModelCompleteResponse> V1J2GrandeCustomModelCompleteAsync(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-grande",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2GrandeInstructCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2GrandeInstructCompleteResponse> V1J2GrandeInstructCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-grande-instruct",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2JumboCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2JumboCompleteResponse> V1J2JumboCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-jumbo",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2JumboComplete2ResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2JumboCompleteResponse2> V1J2JumboComplete2Async(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-jumbo",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2JumboInstructCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2JumboInstructCompleteResponse> V1J2JumboInstructCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-jumbo-instruct",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2LargeCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2LargeCompleteResponse> V1J2LargeCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-large",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2LargeCustomModelCompleteResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2LargeCustomModelCompleteResponse> V1J2LargeCustomModelCompleteAsync(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-large",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2LargeInstructCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2LargeInstructCompleteResponse> V1J2LargeInstructCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-large-instruct",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2LightCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2LightCompleteResponse> V1J2LightCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-light",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2LightCustomModelCompleteResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2LightCustomModelCompleteResponse> V1J2LightCustomModelCompleteAsync(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-light",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2MidCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2MidCompleteResponse> V1J2MidCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-mid",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2MidCustomModelCompleteResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2MidCustomModelCompleteResponse> V1J2MidCustomModelCompleteAsync(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-mid",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2UltraCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2UltraCompleteResponse> V1J2UltraCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-ultra",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2UltraComplete2ResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2UltraCompleteResponse2> V1J2UltraComplete2Async(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-ultra",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ partial void ProcessV1GetCustomModelsResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1GetCustomModelsResponse> V1GetCustomModelsAsync(
bool includeMetadata,
bool includeMetadata = false,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ partial void ProcessV1LibraryManagementResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::System.Collections.Generic.IList<global::G.FileResponse>> V1LibraryManagementAsync(
string? name,
string? path,
global::G.FileStatus? status,
global::System.Collections.Generic.IList<string>? label,
int limit,
int offset,
string? name = default,
string? path = default,
global::G.FileStatus? status = default,
global::System.Collections.Generic.IList<string>? label = default,
int limit = 1000,
int offset = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2UltraChatResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.ChatResponse> V1J2UltraChatAsync(
string? model,
global::G.LanguageStudioApiServerDataTypesJ2ChatChatRequest request,
string? model = "j2-ultra",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2GrandeCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2GrandeCompleteResponse> V1J2GrandeCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-grande",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2GrandeCustomModelCompleteResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2GrandeCustomModelCompleteResponse> V1J2GrandeCustomModelCompleteAsync(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-grande",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2GrandeInstructCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2GrandeInstructCompleteResponse> V1J2GrandeInstructCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-grande-instruct",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2JumboCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2JumboCompleteResponse> V1J2JumboCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-jumbo",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2JumboComplete2ResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2JumboCompleteResponse2> V1J2JumboComplete2Async(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-jumbo",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2JumboInstructCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2JumboInstructCompleteResponse> V1J2JumboInstructCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-jumbo-instruct",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ partial void ProcessV1J2LargeCompleteResponseContent(
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2LargeCompleteResponse> V1J2LargeCompleteAsync(
string? model,
global::G.CompletionBody request,
string? model = "j2-large",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ partial void ProcessV1J2LargeCustomModelCompleteResponseContent(
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::G.V1J2LargeCustomModelCompleteResponse> V1J2LargeCustomModelCompleteAsync(
string customModelName,
string? customModelType,
global::G.CompletionBody request,
string? customModelType = "j2-large",
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
Expand Down
Loading

0 comments on commit 462afa7

Please sign in to comment.