Skip to content

Commit b672dfd

Browse files
Copilotalexaka1
andcommitted
test: use actual int64 values for LongEnum test spec
Use 2147483648 (int32 max + 1) and 9223372036854775807 (int64 max) to ensure the int64 branch is properly exercised with values that exceed int32 range. Co-authored-by: alexaka1 <22166651+alexaka1@users.noreply.github.com>
1 parent 45f833b commit b672dfd

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

modules/openapi-generator/src/test/java/org/openapitools/codegen/csharpnetcore/CSharpClientCodegenTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public void testIntegerEnumJsonConverterUsesNumericOperations() throws IOExcepti
294294
"writer.WriteStringValue("
295295
);
296296

297-
// Verify long enum uses int64 reader
297+
// Verify long enum uses int64 reader with actual int64 values
298298
File longEnumFile = files.get(Paths
299299
.get(output.getAbsolutePath(), "src", "Org.OpenAPITools", "Model", "LongEnum.cs")
300300
.toString()
@@ -303,7 +303,9 @@ public void testIntegerEnumJsonConverterUsesNumericOperations() throws IOExcepti
303303
assertFileContains(longEnumFile.toPath(),
304304
"reader.GetInt64()",
305305
"writer.WriteNumberValue(",
306-
"public static long ToJsonValue(LongEnum value)"
306+
"public static long ToJsonValue(LongEnum value)",
307+
"AboveInt32Max = 2147483648",
308+
"Int64Max = 9223372036854775807"
307309
);
308310
assertFileNotContains(longEnumFile.toPath(),
309311
"reader.GetString()",

modules/openapi-generator/src/test/resources/3_0/csharp/integer-enum.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ components:
2828
- Some
2929
LongEnum:
3030
enum:
31-
- 0
32-
- 1
31+
- 2147483648
32+
- 9223372036854775807
3333
type: integer
3434
format: int64
3535
x-enum-varnames:
36-
- None
37-
- Some
36+
- AboveInt32Max
37+
- Int64Max
3838
DoubleEnum:
3939
enum:
4040
- 1.1

0 commit comments

Comments
 (0)