diff --git a/src/libs/AutoSDK/Helpers/OpenApi31Support.cs b/src/libs/AutoSDK/Helpers/OpenApi31Support.cs index 85dbf717dc..b57c1d780c 100644 --- a/src/libs/AutoSDK/Helpers/OpenApi31Support.cs +++ b/src/libs/AutoSDK/Helpers/OpenApi31Support.cs @@ -330,6 +330,14 @@ private static void ConvertYamlNode(Dictionary node) node.Remove(keyString); } + if (keyString == "enum" && + entry.Value is List { Count: > 0 } enumItems && + enumItems.Contains(null)) + { + node[new string("enum".ToCharArray())] = enumItems.Where(v => v != null).ToList(); + node[new string("nullable".ToCharArray())] = true; + } + // Remove "prefixItems" if (keyString == "prefixItems" && entry.Value is List { Count: > 0 } prefixItemsList) { diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/together.yaml/ValidationTests.Validation_NewWarnings.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/together.yaml/ValidationTests.Validation_NewWarnings.verified.txt index 8ed7b6e1ac..ad47dbb93f 100644 --- a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/together.yaml/ValidationTests.Validation_NewWarnings.verified.txt +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/together.yaml/ValidationTests.Validation_NewWarnings.verified.txt @@ -1,12 +1 @@ -[ - { - RuleName: SchemaMismatchedDataType, - Message: Data and type mismatch found., - Pointer: #/components/schemas/FineTuneEvent/properties/level/enum/0 - }, - { - RuleName: SchemaMismatchedDataType, - Message: Data and type mismatch found., - Pointer: #/components/schemas/FinetuneEventLevels/enum/0 - } -] \ No newline at end of file +[] \ No newline at end of file diff --git a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/together.yaml/_.verified.txt b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/together.yaml/_.verified.txt index 6f5f9b3979..8dfb9ff5d6 100644 --- a/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/together.yaml/_.verified.txt +++ b/src/tests/AutoSDK.UnitTests/Snapshots/Validation/ConvertedSpecs/together.yaml/_.verified.txt @@ -823,13 +823,13 @@ type: string level: enum: - - null - info - warning - error - legacy_info - legacy_iwarning - legacy_ierror + nullable: true type: string message: type: string @@ -904,8 +904,8 @@ type: string object: enum: - - null - local + nullable: true size: type: integer type: object @@ -935,13 +935,13 @@ type: object FinetuneEventLevels: enum: - - null - info - warning - error - legacy_info - legacy_iwarning - legacy_ierror + nullable: true type: string FinetuneEventType: enum: