Skip to content

Commit

Permalink
fix: Removed usage of AutoSDK namespace in generated code.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Sep 14, 2024
1 parent a02dd4e commit d76a664
Show file tree
Hide file tree
Showing 8,672 changed files with 17,550 additions and 17,554 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 1 addition & 2 deletions src/libs/AutoSDK/Models/SchemaContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ PropertyData.Value with
Type = Models.TypeData.Default with
{
CSharpType = PropertyData.Value.IsRequired ? "string" : "string?",
JsonSerializerType = Settings.JsonSerializerType,
GenerateJsonSerializerContextTypes = Settings.GenerateJsonSerializerContextTypes,
Settings = Settings,
},
Settings = Settings,
}
Expand Down
19 changes: 8 additions & 11 deletions src/libs/AutoSDK/Models/TypeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public readonly record struct TypeData(
ImmutableArray<TypeData> SubTypes,
string Namespace,
bool IsDeprecated,
JsonSerializerType JsonSerializerType,
bool GenerateJsonSerializerContextTypes)
Settings Settings)
{
public static TypeData Default => new(
CSharpType: string.Empty,
Expand All @@ -46,8 +45,7 @@ public readonly record struct TypeData(
SubTypes: [],
Namespace: string.Empty,
IsDeprecated: false,
JsonSerializerType: JsonSerializerType.SystemTextJson,
GenerateJsonSerializerContextTypes: false);
Settings: Settings.Default);

public string CSharpTypeWithoutNullability => CSharpType.TrimEnd('?');
public string CSharpTypeWithNullability => CSharpTypeWithoutNullability + "?";
Expand All @@ -66,15 +64,15 @@ CSharpTypeWithoutNullability is "string" ||

public string ConverterType =>
IsUnixTimestamp
? "global::AutoSDK.JsonConverters.UnixTimestampJsonConverter"
? $"global::{Settings.Namespace}.JsonConverters.UnixTimestampJsonConverter"
: IsEnum || ((AnyOfCount > 0 || OneOfCount > 0 || AllOfCount > 0) && IsComponent)
? $"global::AutoSDK.JsonConverters.{ShortCSharpTypeWithoutNullability}JsonConverter"
? $"global::{Settings.Namespace}.JsonConverters.{ShortCSharpTypeWithoutNullability}JsonConverter"
: AnyOfCount > 0
? $"global::AutoSDK.JsonConverters.AnyOfJsonConverterFactory{AnyOfCount}"
? $"global::{Settings.Namespace}.JsonConverters.AnyOfJsonConverterFactory{AnyOfCount}"
: OneOfCount > 0
? $"global::AutoSDK.JsonConverters.OneOfJsonConverterFactory{OneOfCount}"
? $"global::{Settings.Namespace}.JsonConverters.OneOfJsonConverterFactory{OneOfCount}"
: AllOfCount > 0
? $"global::AutoSDK.JsonConverters.AllOfJsonConverterFactory{AllOfCount}"
? $"global::{Settings.Namespace}.JsonConverters.AllOfJsonConverterFactory{AllOfCount}"
: string.Empty;

public static TypeData FromSchemaContext(SchemaContext context)
Expand Down Expand Up @@ -175,8 +173,7 @@ Default with
? "System"
: context.Settings.Namespace,
IsDeprecated: context.Schema.Deprecated,
JsonSerializerType: context.Settings.JsonSerializerType,
GenerateJsonSerializerContextTypes: context.Settings.GenerateJsonSerializerContextTypes);
Settings: context.Settings);
}

public static bool ContextIsValueType(SchemaContext context)
Expand Down
8 changes: 4 additions & 4 deletions src/libs/AutoSDK/Sources/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ .. includedTags.Select(tag => PropertyData.Default with
x.Settings.JsonSerializerType != JsonSerializerType.NewtonsoftJson)
.SelectMany(x => new[]
{
$"global::AutoSDK.JsonConverters.{x.ClassName}JsonConverter",
$"global::AutoSDK.JsonConverters.{x.ClassName}NullableJsonConverter"
$"global::{settings.Namespace}.JsonConverters.{x.ClassName}JsonConverter",
$"global::{settings.Namespace}.JsonConverters.{x.ClassName}NullableJsonConverter"
})
.Concat(anyOfDatas
.Where(x => x.JsonSerializerType == JsonSerializerType.SystemTextJson)
.Select(x => string.IsNullOrWhiteSpace(x.Name)
? $"global::AutoSDK.JsonConverters.{x.SubType}JsonConverterFactory{x.Count}"
: $"global::AutoSDK.JsonConverters.{x.Name}JsonConverter"))
? $"global::{settings.Namespace}.JsonConverters.{x.SubType}JsonConverterFactory{x.Count}"
: $"global::{settings.Namespace}.JsonConverters.{x.Name}JsonConverter"))
.ToImmutableArray();
for (var i = 0; i < methods.Length; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions src/libs/AutoSDK/Sources/Sources.JsonConverters.AnyOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static string GenerateAnyOfJsonConverter(
return $@"#nullable enable
{(fixedTypes.IsEmpty ? "" : @"#pragma warning disable CS0618 // Type or member is obsolete
")}
namespace AutoSDK.JsonConverters
namespace {@namespace}.JsonConverters
{{
/// <inheritdoc />
public class {classNameWithTypes} : global::System.Text.Json.Serialization.JsonConverter<{typeNameWithTypes}>
Expand Down Expand Up @@ -148,7 +148,7 @@ public static string GenerateAnyOfJsonConverterFactory(

return $@"#nullable enable
namespace AutoSDK.JsonConverters
namespace {anyOfData.Namespace}.JsonConverters
{{
/// <inheritdoc />
public sealed class {subType}JsonConverterFactory{count} : global::System.Text.Json.Serialization.JsonConverterFactory
Expand Down
4 changes: 2 additions & 2 deletions src/libs/AutoSDK/Sources/Sources.JsonConverters.Enum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static string GenerateEnumJsonConverter(

return $@"#nullable enable
namespace AutoSDK.JsonConverters
namespace {model.Namespace}.JsonConverters
{{
/// <inheritdoc />
public sealed class {model.ClassName}JsonConverter : global::System.Text.Json.Serialization.JsonConverter<{model.GlobalClassName}>
Expand Down Expand Up @@ -77,7 +77,7 @@ public static string GenerateEnumNullableJsonConverter(

return $@"#nullable enable
namespace AutoSDK.JsonConverters
namespace {model.Namespace}.JsonConverters
{{
/// <inheritdoc />
public sealed class {model.ClassName}NullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<{model.GlobalClassName}?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static string GenerateUnixTimestampJsonConverter(
{
return $@"#nullable enable
namespace AutoSDK.JsonConverters
namespace {settings.Namespace}.JsonConverters
{{
/// <inheritdoc />
public class UnixTimestampJsonConverter : global::Newtonsoft.Json.JsonConverter<global::System.DateTimeOffset>
Expand Down Expand Up @@ -55,7 +55,7 @@ public override void WriteJson(

return $@"#nullable enable
namespace AutoSDK.JsonConverters
namespace {settings.Namespace}.JsonConverters
{{
/// <inheritdoc />
public class UnixTimestampJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::System.DateTimeOffset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public static string GenerateJsonSerializerContextTypes(
CancellationToken cancellationToken = default)
{
if (types.IsEmpty ||
!types[0].GenerateJsonSerializerContextTypes ||
types[0].JsonSerializerType != JsonSerializerType.SystemTextJson)
!types[0].Settings.GenerateJsonSerializerContextTypes ||
types[0].Settings.JsonSerializerType != JsonSerializerType.SystemTextJson)
{
return string.Empty;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libs/AutoSDK/Sources/Sources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public static FileWithName JsonSerializerContextTypes(
CancellationToken cancellationToken = default)
{
if (types.IsEmpty ||
!types[0].GenerateJsonSerializerContextTypes ||
types[0].JsonSerializerType == JsonSerializerType.NewtonsoftJson)
!types[0].Settings.GenerateJsonSerializerContextTypes ||
types[0].Settings.JsonSerializerType == JsonSerializerType.NewtonsoftJson)
{
return FileWithName.Empty;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//HintName: JsonConverters.UnixTimestamp.g.cs
#nullable enable

namespace AutoSDK.JsonConverters
namespace G.JsonConverters
{
/// <inheritdoc />
public class UnixTimestampJsonConverter : global::Newtonsoft.Json.JsonConverter<global::System.DateTimeOffset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,55 +102,55 @@ public Api(
DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
Converters =
{
new global::AutoSDK.JsonConverters.AnswerLengthJsonConverter(),
new global::AutoSDK.JsonConverters.AnswerLengthNullableJsonConverter(),
new global::AutoSDK.JsonConverters.ModeJsonConverter(),
new global::AutoSDK.JsonConverters.ModeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.AssistantMessageRoleJsonConverter(),
new global::AutoSDK.JsonConverters.AssistantMessageRoleNullableJsonConverter(),
new global::AutoSDK.JsonConverters.ToolCallTypeJsonConverter(),
new global::AutoSDK.JsonConverters.ToolCallTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.ChatStreamingFirstDeltaRoleJsonConverter(),
new global::AutoSDK.JsonConverters.ChatStreamingFirstDeltaRoleNullableJsonConverter(),
new global::AutoSDK.JsonConverters.RoleTypeJsonConverter(),
new global::AutoSDK.JsonConverters.RoleTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.MessageRoleJsonConverter(),
new global::AutoSDK.JsonConverters.MessageRoleNullableJsonConverter(),
new global::AutoSDK.JsonConverters.ConversationalRagFlowPublicFieldsRetrievalStrategyJsonConverter(),
new global::AutoSDK.JsonConverters.ConversationalRagFlowPublicFieldsRetrievalStrategyNullableJsonConverter(),
new global::AutoSDK.JsonConverters.CorrectionTypeJsonConverter(),
new global::AutoSDK.JsonConverters.CorrectionTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.CustomModelTypeJsonConverter(),
new global::AutoSDK.JsonConverters.CustomModelTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.DocumentTypeJsonConverter(),
new global::AutoSDK.JsonConverters.DocumentTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.EmbedTypeJsonConverter(),
new global::AutoSDK.JsonConverters.EmbedTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.FileStatusJsonConverter(),
new global::AutoSDK.JsonConverters.FileStatusNullableJsonConverter(),
new global::AutoSDK.JsonConverters.ToolParametersTypeJsonConverter(),
new global::AutoSDK.JsonConverters.ToolParametersTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.RetrievalStrategy3JsonConverter(),
new global::AutoSDK.JsonConverters.RetrievalStrategy3NullableJsonConverter(),
new global::AutoSDK.JsonConverters.ModelNameJsonConverter(),
new global::AutoSDK.JsonConverters.ModelNameNullableJsonConverter(),
new global::AutoSDK.JsonConverters.StyleTypeJsonConverter(),
new global::AutoSDK.JsonConverters.StyleTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.ResponseFormatTypeJsonConverter(),
new global::AutoSDK.JsonConverters.ResponseFormatTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.SummaryMethodJsonConverter(),
new global::AutoSDK.JsonConverters.SummaryMethodNullableJsonConverter(),
new global::AutoSDK.JsonConverters.SystemMessageRoleJsonConverter(),
new global::AutoSDK.JsonConverters.SystemMessageRoleNullableJsonConverter(),
new global::AutoSDK.JsonConverters.ToolDefinitionTypeJsonConverter(),
new global::AutoSDK.JsonConverters.ToolDefinitionTypeNullableJsonConverter(),
new global::AutoSDK.JsonConverters.ToolMessageRoleJsonConverter(),
new global::AutoSDK.JsonConverters.ToolMessageRoleNullableJsonConverter(),
new global::AutoSDK.JsonConverters.UserMessageRoleJsonConverter(),
new global::AutoSDK.JsonConverters.UserMessageRoleNullableJsonConverter(),
new global::AutoSDK.JsonConverters.AnyOfJsonConverterFactory2(),
new global::AutoSDK.JsonConverters.AllOfJsonConverterFactory1(),
new global::AutoSDK.JsonConverters.OneOfJsonConverterFactory4(),
new global::G.JsonConverters.AnswerLengthJsonConverter(),
new global::G.JsonConverters.AnswerLengthNullableJsonConverter(),
new global::G.JsonConverters.ModeJsonConverter(),
new global::G.JsonConverters.ModeNullableJsonConverter(),
new global::G.JsonConverters.AssistantMessageRoleJsonConverter(),
new global::G.JsonConverters.AssistantMessageRoleNullableJsonConverter(),
new global::G.JsonConverters.ToolCallTypeJsonConverter(),
new global::G.JsonConverters.ToolCallTypeNullableJsonConverter(),
new global::G.JsonConverters.ChatStreamingFirstDeltaRoleJsonConverter(),
new global::G.JsonConverters.ChatStreamingFirstDeltaRoleNullableJsonConverter(),
new global::G.JsonConverters.RoleTypeJsonConverter(),
new global::G.JsonConverters.RoleTypeNullableJsonConverter(),
new global::G.JsonConverters.MessageRoleJsonConverter(),
new global::G.JsonConverters.MessageRoleNullableJsonConverter(),
new global::G.JsonConverters.ConversationalRagFlowPublicFieldsRetrievalStrategyJsonConverter(),
new global::G.JsonConverters.ConversationalRagFlowPublicFieldsRetrievalStrategyNullableJsonConverter(),
new global::G.JsonConverters.CorrectionTypeJsonConverter(),
new global::G.JsonConverters.CorrectionTypeNullableJsonConverter(),
new global::G.JsonConverters.CustomModelTypeJsonConverter(),
new global::G.JsonConverters.CustomModelTypeNullableJsonConverter(),
new global::G.JsonConverters.DocumentTypeJsonConverter(),
new global::G.JsonConverters.DocumentTypeNullableJsonConverter(),
new global::G.JsonConverters.EmbedTypeJsonConverter(),
new global::G.JsonConverters.EmbedTypeNullableJsonConverter(),
new global::G.JsonConverters.FileStatusJsonConverter(),
new global::G.JsonConverters.FileStatusNullableJsonConverter(),
new global::G.JsonConverters.ToolParametersTypeJsonConverter(),
new global::G.JsonConverters.ToolParametersTypeNullableJsonConverter(),
new global::G.JsonConverters.RetrievalStrategy3JsonConverter(),
new global::G.JsonConverters.RetrievalStrategy3NullableJsonConverter(),
new global::G.JsonConverters.ModelNameJsonConverter(),
new global::G.JsonConverters.ModelNameNullableJsonConverter(),
new global::G.JsonConverters.StyleTypeJsonConverter(),
new global::G.JsonConverters.StyleTypeNullableJsonConverter(),
new global::G.JsonConverters.ResponseFormatTypeJsonConverter(),
new global::G.JsonConverters.ResponseFormatTypeNullableJsonConverter(),
new global::G.JsonConverters.SummaryMethodJsonConverter(),
new global::G.JsonConverters.SummaryMethodNullableJsonConverter(),
new global::G.JsonConverters.SystemMessageRoleJsonConverter(),
new global::G.JsonConverters.SystemMessageRoleNullableJsonConverter(),
new global::G.JsonConverters.ToolDefinitionTypeJsonConverter(),
new global::G.JsonConverters.ToolDefinitionTypeNullableJsonConverter(),
new global::G.JsonConverters.ToolMessageRoleJsonConverter(),
new global::G.JsonConverters.ToolMessageRoleNullableJsonConverter(),
new global::G.JsonConverters.UserMessageRoleJsonConverter(),
new global::G.JsonConverters.UserMessageRoleNullableJsonConverter(),
new global::G.JsonConverters.AnyOfJsonConverterFactory2(),
new global::G.JsonConverters.AllOfJsonConverterFactory1(),
new global::G.JsonConverters.OneOfJsonConverterFactory4(),
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public sealed partial class AnswerBody
/// An enumeration.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("answerLength")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::AutoSDK.JsonConverters.AnswerLengthJsonConverter))]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::G.JsonConverters.AnswerLengthJsonConverter))]
public global::G.AnswerLength? AnswerLength { get; set; }

/// <summary>
/// An enumeration.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("mode")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::AutoSDK.JsonConverters.ModeJsonConverter))]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::G.JsonConverters.ModeJsonConverter))]
public global::G.Mode? Mode { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public sealed partial class AssistantMessage
/// Default Value: assistant
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("role")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::AutoSDK.JsonConverters.AssistantMessageRoleJsonConverter))]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::G.JsonConverters.AssistantMessageRoleJsonConverter))]
public global::G.AssistantMessageRole? Role { get; set; } = global::G.AssistantMessageRole.Assistant;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public sealed partial class ChatCompletionResponseDeltaChoice
/// - **Subsequent messages** will have an object `{"content": __token__}` with the generated token.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("delta")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::AutoSDK.JsonConverters.AnyOfJsonConverterFactory2))]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::G.JsonConverters.AnyOfJsonConverterFactory2))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::G.AnyOf<global::G.ChatStreamingFirstDelta, global::G.ChatStreamingContentDelta> Delta { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed partial class ChatMessage
/// An enumeration.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("role")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::AutoSDK.JsonConverters.RoleTypeJsonConverter))]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::G.JsonConverters.RoleTypeJsonConverter))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::G.RoleType Role { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public sealed partial class ChatOutput
/// An enumeration.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("role")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::AutoSDK.JsonConverters.RoleTypeJsonConverter))]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::G.JsonConverters.RoleTypeJsonConverter))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::G.RoleType Role { get; set; }

Expand Down
Loading

0 comments on commit d76a664

Please sign in to comment.