From 39bf860e990f5b91302913057ef231634fb66016 Mon Sep 17 00:00:00 2001 From: TharmiganK Date: Fri, 15 Dec 2023 16:26:53 +0530 Subject: [PATCH] Update test case --- .../built_in_sub_types_in_record.bal | 23 ++++++- .../built_in_sub_types_in_record.yaml | 66 +++++++++++++++---- 2 files changed, 77 insertions(+), 12 deletions(-) diff --git a/openapi-cli/src/test/resources/ballerina-to-openapi/data_type/built_in_sub_types_in_record.bal b/openapi-cli/src/test/resources/ballerina-to-openapi/data_type/built_in_sub_types_in_record.bal index eec64f131..a35a0e93a 100644 --- a/openapi-cli/src/test/resources/ballerina-to-openapi/data_type/built_in_sub_types_in_record.bal +++ b/openapi-cli/src/test/resources/ballerina-to-openapi/data_type/built_in_sub_types_in_record.bal @@ -30,9 +30,22 @@ public type BalSubTypes record {| BalXmls xmls; |}; +type Unsigned8 int:Unsigned8; +type Unsigned16 int:Unsigned16; +type Unsigned32 int:Unsigned32; +type Signed8 int:Signed8; +type Signed16 int:Signed16; +type Signed32 int:Signed32; +type Char string:Char; +type XmlElement xml:Element; +type XmlComment xml:Comment; +type XmlText xml:Text; +type XmlProcessingInstruction xml:ProcessingInstruction; + + service /payloadV on new http:Listener(9090) { - resource function get path() returns BalSubTypes { + resource function get path1() returns BalSubTypes { return { char: "a", ints: { @@ -55,4 +68,12 @@ service /payloadV on new http:Listener(9090) { } }; } + + resource function get path2() returns Unsigned8|Unsigned16|Unsigned32| + Signed8|Signed16|Signed32| + XmlElement|XmlComment|XmlText|XmlProcessingInstruction| + Char { + + return 32; + } } diff --git a/openapi-cli/src/test/resources/ballerina-to-openapi/expected_gen/data_type/built_in_sub_types_in_record.yaml b/openapi-cli/src/test/resources/ballerina-to-openapi/expected_gen/data_type/built_in_sub_types_in_record.yaml index 6d5b23773..6d5e24c57 100644 --- a/openapi-cli/src/test/resources/ballerina-to-openapi/expected_gen/data_type/built_in_sub_types_in_record.yaml +++ b/openapi-cli/src/test/resources/ballerina-to-openapi/expected_gen/data_type/built_in_sub_types_in_record.yaml @@ -10,9 +10,9 @@ servers: port: default: "9090" paths: - /path: + /path1: get: - operationId: getPath + operationId: getPath1 responses: "200": description: Ok @@ -20,8 +20,44 @@ paths: application/json: schema: $ref: '#/components/schemas/BalSubTypes' + /path2: + get: + operationId: getPath2 + responses: + "200": + description: Ok + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Unsigned8' + - $ref: '#/components/schemas/Unsigned16' + - $ref: '#/components/schemas/Unsigned32' + - $ref: '#/components/schemas/Signed8' + - $ref: '#/components/schemas/Signed16' + - $ref: '#/components/schemas/Signed32' + - $ref: '#/components/schemas/XmlElement' + - $ref: '#/components/schemas/XmlComment' + - $ref: '#/components/schemas/XmlText' + - $ref: '#/components/schemas/XmlProcessingInstruction' + - $ref: '#/components/schemas/Char' components: schemas: + BalInts: + required: + - signed + - unsigned + type: object + properties: + signed: + $ref: '#/components/schemas/BalSignedInts' + unsigned: + $ref: '#/components/schemas/BalUnsignedInts' + Signed32: + type: integer + format: int32 + Signed8: + type: integer BalSubTypes: required: - char @@ -35,6 +71,10 @@ components: $ref: '#/components/schemas/BalInts' xmls: $ref: '#/components/schemas/BalXmls' + Unsigned8: + type: integer + Signed16: + type: integer BalUnsignedInts: required: - unsigned16 @@ -48,6 +88,10 @@ components: type: integer unsigned8: type: integer + XmlProcessingInstruction: + type: object + Unsigned32: + type: integer BalXmls: required: - comment @@ -60,16 +104,12 @@ components: element: {} processingInstruction: {} text: {} - BalInts: - required: - - signed - - unsigned + Char: + type: string + XmlComment: + type: object + XmlElement: type: object - properties: - signed: - $ref: '#/components/schemas/BalSignedInts' - unsigned: - $ref: '#/components/schemas/BalUnsignedInts' BalSignedInts: required: - signed16 @@ -84,3 +124,7 @@ components: type: integer signed8: type: integer + Unsigned16: + type: integer + XmlText: + type: object