-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1e28a9
commit e8b5663
Showing
3 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...pi-cli/src/test/resources/ballerina-to-openapi/data_type/built_in_sub_types_in_record.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import ballerina/http; | ||
|
||
public type BalSignedInts record {| | ||
int:Signed32 signed32; | ||
int:Signed16 signed16; | ||
int:Signed8 signed8; | ||
|}; | ||
|
||
public type BalUnsignedInts record {| | ||
int:Unsigned32 unsigned32; | ||
int:Unsigned16 unsigned16; | ||
int:Unsigned8 unsigned8; | ||
|}; | ||
|
||
public type BalInts record {| | ||
BalSignedInts signed; | ||
BalUnsignedInts unsigned; | ||
|}; | ||
|
||
public type BalXmls record {| | ||
xml:Comment comment; | ||
xml:Element element; | ||
xml:ProcessingInstruction processingInstruction; | ||
xml:Text text; | ||
|}; | ||
|
||
public type BalSubTypes record {| | ||
string:Char char; | ||
BalInts ints; | ||
BalXmls xmls; | ||
|}; | ||
|
||
service /payloadV on new http:Listener(9090) { | ||
|
||
resource function get path() returns BalSubTypes { | ||
return { | ||
char: "a", | ||
ints: { | ||
signed: { | ||
signed32: 32, | ||
signed16: 16, | ||
signed8: 8 | ||
}, | ||
unsigned: { | ||
unsigned32: 32, | ||
unsigned16: 16, | ||
unsigned8: 8 | ||
} | ||
}, | ||
xmls: { | ||
comment: xml`<!-- comment -->`, | ||
element: xml`<element>element</element>`, | ||
processingInstruction: xml`<?processing instruction?>`, | ||
text: xml`text` | ||
} | ||
}; | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
...t/resources/ballerina-to-openapi/expected_gen/data_type/built_in_sub_types_in_record.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: PayloadV | ||
version: 0.0.0 | ||
servers: | ||
- url: "{server}:{port}/payloadV" | ||
variables: | ||
server: | ||
default: http://localhost | ||
port: | ||
default: "9090" | ||
paths: | ||
/path: | ||
get: | ||
operationId: getPath | ||
responses: | ||
"200": | ||
description: Ok | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/BalSubTypes' | ||
components: | ||
schemas: | ||
BalSubTypes: | ||
required: | ||
- char | ||
- ints | ||
- xmls | ||
type: object | ||
properties: | ||
char: | ||
type: string | ||
ints: | ||
$ref: '#/components/schemas/BalInts' | ||
xmls: | ||
$ref: '#/components/schemas/BalXmls' | ||
BalUnsignedInts: | ||
required: | ||
- unsigned16 | ||
- unsigned32 | ||
- unsigned8 | ||
type: object | ||
properties: | ||
unsigned32: | ||
type: integer | ||
unsigned16: | ||
type: integer | ||
unsigned8: | ||
type: integer | ||
BalXmls: | ||
required: | ||
- comment | ||
- element | ||
- processingInstruction | ||
- text | ||
type: object | ||
properties: | ||
comment: | ||
type: object | ||
element: | ||
type: object | ||
processingInstruction: | ||
type: object | ||
text: | ||
type: object | ||
BalInts: | ||
required: | ||
- signed | ||
- unsigned | ||
type: object | ||
properties: | ||
signed: | ||
$ref: '#/components/schemas/BalSignedInts' | ||
unsigned: | ||
$ref: '#/components/schemas/BalUnsignedInts' | ||
BalSignedInts: | ||
required: | ||
- signed16 | ||
- signed32 | ||
- signed8 | ||
type: object | ||
properties: | ||
signed32: | ||
type: integer | ||
format: int32 | ||
signed16: | ||
type: integer | ||
signed8: | ||
type: integer |