-
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.
Fix issue with data type when the path segment has parameter
- Loading branch information
Showing
4 changed files
with
136 additions
and
2 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
29 changes: 29 additions & 0 deletions
29
...i-cli/src/test/resources/generators/service/ballerina/multiPathParamWithExtensionType.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,29 @@ | ||
import ballerina/http; | ||
|
||
listener http:Listener ep0 = new (80, config = {host: "petstore.openapi.io"}); | ||
|
||
service /v1 on ep0 { | ||
# Info for a specific pet | ||
# | ||
# + spreadsheetId - The id of the pet to retrieve | ||
# + sheetidCopyto - The id of the pet to retrieve | ||
# + return - returns can be any of following types | ||
# http:Ok (Expected response to a valid request) | ||
# http:Response (unexpected error) | ||
resource function get v4/spreadsheets/[int spreadsheetId]/sheets/[string sheetidCopyto]() returns http:Ok|http:Response|error { | ||
if !sheetidCopyto.endsWith(":copyTo") { | ||
return error("bad URL"); | ||
} | ||
string sheetId = sheetidCopyto.substring(0, sheetidCopyto.length() - 6); | ||
} | ||
# Get the details of the specified field | ||
# | ||
# + idJson - Field ID | ||
# + return - Successful response | ||
resource function get 'field/[string idJson]() returns http:Ok|error { | ||
if !idJson.endsWith(".json") { | ||
return error("bad URL"); | ||
} | ||
string id = idJson.substring(0, idJson.length() - 4); | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
...pi-cli/src/test/resources/generators/service/swagger/multiPathParamWithExtensionType.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,92 @@ | ||
openapi: "3.0.0" | ||
info: | ||
version: 1.0.0 | ||
title: OpenApi Petstore | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://petstore.{host}.io/v1 | ||
description: The production API server | ||
variables: | ||
host: | ||
default: openapi | ||
description: this value is assigned by the service provider | ||
|
||
tags: | ||
- name: pets | ||
description: Pets Tag | ||
- name: list | ||
description: List Tag | ||
|
||
paths: | ||
/v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo: | ||
get: | ||
summary: Info for a specific pet | ||
operationId: showPetById | ||
tags: | ||
- pets | ||
parameters: | ||
- name: spreadsheetId | ||
in: path | ||
required: true | ||
description: The id of the pet to retrieve | ||
schema: | ||
type: integer | ||
- name: sheetId | ||
in: path | ||
required: true | ||
description: The id of the pet to retrieve | ||
schema: | ||
type: integer | ||
responses: | ||
'200': | ||
description: Expected response to a valid request | ||
default: | ||
description: unexpected error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Error" | ||
/field/{id}.json: | ||
get: | ||
tags: | ||
- Field | ||
operationId: getFieldById | ||
description: Get the details of the specified field | ||
parameters: | ||
- description: Field ID | ||
in: path | ||
name: id | ||
schema: | ||
type: number | ||
format: double | ||
required: true | ||
responses: | ||
'200': | ||
description: Successful response | ||
components: | ||
schemas: | ||
Pet: | ||
required: | ||
- id | ||
- name | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
name: | ||
type: string | ||
tag: | ||
type: string | ||
type: | ||
type: string | ||
Error: | ||
required: | ||
- code | ||
- message | ||
properties: | ||
code: | ||
type: integer | ||
format: int32 | ||
message: | ||
type: string |
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