Skip to content

Commit e00311a

Browse files
committed
better exception handling when updating samples
1 parent b3ac83d commit e00311a

5 files changed

Lines changed: 15 additions & 15 deletions

bin/generate-samples.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ else
6060

6161
# shellcheck disable=SC2086
6262
# shellcheck disable=SC2068
63-
java ${JAVA_OPTS} -jar "$executable" batch ${BATCH_OPTS} --includes-base-dir "${root}" --fail-fast -- ${files[@]}
63+
if java ${JAVA_OPTS} -jar "$executable" batch ${BATCH_OPTS} --includes-base-dir "${root}" --fail-fast -- ${files[@]} 2>&1 | tee /dev/tty | grep -q -i "exception"; then
64+
echo "Found exception(s) when running the generator(s) to update the samples."
65+
export GENERATE_ERROR=1
66+
fi
6467
fi
6568

69+
if [[ -n "$GENERATE_ERROR" ]]; then
70+
echo "Found exception(s) when running the generator(s) to update the samples."
71+
exit 1
72+
fi

modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types-localhost.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,8 +2783,7 @@ components:
27832783
# JsonReader will give back C# System.Double regardless of format.
27842784
- type: number
27852785
format: float32
2786-
- type: object
2787-
$ref: '#/components/schemas/MixedSubId'
2786+
- $ref: '#/components/schemas/MixedSubId'
27882787
description: Mixed oneOf types for testing
27892788
MixedAnyOf:
27902789
properties:
@@ -2798,8 +2797,7 @@ components:
27982797
# JsonReader will give back C# System.Double regardless of format.
27992798
- type: number
28002799
format: float32
2801-
- type: object
2802-
$ref: '#/components/schemas/MixedSubId'
2800+
- $ref: '#/components/schemas/MixedSubId'
28032801

28042802
description: Mixed anyOf types for testing
28052803
MixedSubId:

modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,8 +2781,7 @@ components:
27812781
# JsonReader will give back C# System.Double regardless of format.
27822782
- type: number
27832783
format: float32
2784-
- type: object
2785-
$ref: '#/components/schemas/MixedSubId'
2784+
- $ref: '#/components/schemas/MixedSubId'
27862785
description: Mixed oneOf types for testing
27872786
MixedAnyOf:
27882787
properties:
@@ -2796,8 +2795,7 @@ components:
27962795
# JsonReader will give back C# System.Double regardless of format.
27972796
- type: number
27982797
format: float32
2799-
- type: object
2800-
$ref: '#/components/schemas/MixedSubId'
2798+
- $ref: '#/components/schemas/MixedSubId'
28012799

28022800
description: Mixed anyOf types for testing
28032801
MixedSubId:

modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,8 +2839,7 @@ components:
28392839
# JsonReader will give back C# System.Double regardless of format.
28402840
- type: number
28412841
format: float32
2842-
- type: object
2843-
$ref: '#/components/schemas/MixedSubId'
2842+
- $ref: '#/components/schemas/MixedSubId'
28442843
description: Mixed oneOf types for testing
28452844
MixedAnyOf:
28462845
properties:
@@ -2854,9 +2853,7 @@ components:
28542853
# JsonReader will give back C# System.Double regardless of format.
28552854
- type: number
28562855
format: float32
2857-
- type: object
2858-
$ref: '#/components/schemas/MixedSubId'
2859-
2856+
- $ref: '#/components/schemas/MixedSubId'
28602857
description: Mixed anyOf types for testing
28612858
MixedSubId:
28622859
properties:

modules/openapi-generator/src/test/resources/3_0/oneOf_array.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ components:
2222
type: object
2323
properties:
2424
message1:
25-
type: string
25+
type: string

0 commit comments

Comments
 (0)