Skip to content

Commit

Permalink
fix: Fixed issue with trimming for guid support.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Sep 10, 2024
1 parent e4253d6 commit d52e8b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/libs/AutoSDK/Models/TypeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ Default with
.ToImmutableArray();
}

var type = GetCSharpType(context);

return new TypeData(
CSharpType: GetCSharpType(context),
CSharpType: type,
IsValueType: ContextIsValueType(context),
IsArray: context.Schema.IsArray(),
IsEnum: context.Schema.IsEnum(),
Expand All @@ -169,7 +171,9 @@ Default with
Properties: properties,
EnumValues: enumValues,
SubTypes: subTypes,
Namespace: context.Settings.Namespace,
Namespace: type.StartsWith("global::System.", StringComparison.Ordinal)
? "System"
: context.Settings.Namespace,
IsDeprecated: context.Schema.Deprecated,
JsonSerializerType: context.Settings.JsonSerializerType,
GenerateJsonSerializerContextTypes: context.Settings.GenerateJsonSerializerContextTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ TypeData.Default with
],
}, makeNullableRootIfValueType: true).Should().Be("IListIListString");

GetContextType(TypeData.Default with
{
Namespace = "System.Collections.Generic",
CSharpType = "global::System.Collections.Generic.IList<global::System.Guid>",
IsArray = true,
SubTypes = [
TypeData.Default with {
Namespace = "System",
CSharpType = "global::System.Guid" }
],
}, makeNullableRootIfValueType: true).Should().Be("IListGuid");

GetContextType(TypeData.Default with
{
CSharpType = "byte[]",
Expand Down Expand Up @@ -88,9 +100,9 @@ TypeData.Default with

GetContextType(TypeData.Default with
{
Namespace = "System",
Namespace = "G",
IsValueType = true,
CSharpType = "global::System.AllOf<Integration?, AppsCreateFromManifestResponse>",
CSharpType = "global::G.AllOf<Integration?, AppsCreateFromManifestResponse>",
SubTypes = [
TypeData.Default with
{
Expand All @@ -105,9 +117,9 @@ TypeData.Default with

GetContextType(TypeData.Default with
{
Namespace = "System",
Namespace = "Cohere",
IsValueType = true,
CSharpType = "global::System.OneOf<global::Cohere.NonStreamedChatResponse, global::Cohere.StreamedChatResponse?>",
CSharpType = "global::Cohere.OneOf<global::Cohere.NonStreamedChatResponse, global::Cohere.StreamedChatResponse?>",
SubTypes = [
TypeData.Default with
{
Expand Down

0 comments on commit d52e8b3

Please sign in to comment.