-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated api client, Required parameters {{#required}} .. {{/required}}, are mapped to Eiffel Void Safety Rules, optional parameters are translated to detachable TYPE. Validation Rules are mapped to preconditions, at the moment maximun and minimun validation has been added. Improved API_CLIENT.parameter_to_tuple feature to accept a LIST [ANY] instead of LIST [STRING_32]. Improved model template to generate the model output. * Updated API_CLIENT.parameter_to_string feature, missing STRING representation. * Updating sample using the latest modifications.
- Loading branch information
Showing
30 changed files
with
198 additions
and
126 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
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
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
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
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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
note | ||
description:"[ | ||
Swagger Petstore | ||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. | ||
OpenAPI spec version: 1.0.0 | ||
Contact: [email protected] | ||
|
@@ -31,6 +31,7 @@ feature -- API Access | |
-- argument: body Pet object that needs to be added to the store (required) | ||
-- | ||
-- | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -41,6 +42,7 @@ feature -- API Access | |
l_request.set_body(body) | ||
l_path := "/pet" | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
end | ||
|
@@ -52,7 +54,7 @@ feature -- API Access | |
end | ||
end | ||
|
||
delete_pet (pet_id: INTEGER_64; api_key: detachable STRING_32) | ||
delete_pet (pet_id: INTEGER_64; api_key: STRING_32) | ||
-- Deletes a pet | ||
-- | ||
-- | ||
|
@@ -61,6 +63,7 @@ feature -- API Access | |
-- argument: api_key (optional) | ||
-- | ||
-- | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -71,6 +74,7 @@ feature -- API Access | |
|
||
l_path := "/pet/{petId}" | ||
l_path.replace_substring_all ("{"+"petId"+"}", api_client.url_encode (pet_id.out)) | ||
|
||
if attached api_key as l_api_key then | ||
l_request.add_header(l_api_key.out,"api_key"); | ||
end | ||
|
@@ -94,6 +98,7 @@ feature -- API Access | |
-- | ||
-- | ||
-- Result LIST [PET] | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -105,6 +110,7 @@ feature -- API Access | |
l_path := "/pet/findByStatus" | ||
l_request.fill_query_params(api_client.parameter_to_tuple("csv", "status", status)); | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
end | ||
|
@@ -128,6 +134,7 @@ feature -- API Access | |
-- | ||
-- | ||
-- Result LIST [PET] | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -139,6 +146,7 @@ feature -- API Access | |
l_path := "/pet/findByTags" | ||
l_request.fill_query_params(api_client.parameter_to_tuple("csv", "tags", tags)); | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
end | ||
|
@@ -162,6 +170,7 @@ feature -- API Access | |
-- | ||
-- | ||
-- Result PET | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -173,6 +182,7 @@ feature -- API Access | |
l_path := "/pet/{petId}" | ||
l_path.replace_substring_all ("{"+"petId"+"}", api_client.url_encode (pet_id.out)) | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
end | ||
|
@@ -195,6 +205,7 @@ feature -- API Access | |
-- argument: body Pet object that needs to be added to the store (required) | ||
-- | ||
-- | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -205,6 +216,7 @@ feature -- API Access | |
l_request.set_body(body) | ||
l_path := "/pet" | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
end | ||
|
@@ -216,7 +228,7 @@ feature -- API Access | |
end | ||
end | ||
|
||
update_pet_with_form (pet_id: INTEGER_64; name: detachable STRING_32; status: detachable STRING_32) | ||
update_pet_with_form (pet_id: INTEGER_64; name: STRING_32; status: STRING_32) | ||
-- Updates a pet in the store with form data | ||
-- | ||
-- | ||
|
@@ -227,6 +239,7 @@ feature -- API Access | |
-- argument: status Updated status of the pet (optional) | ||
-- | ||
-- | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -237,6 +250,7 @@ feature -- API Access | |
|
||
l_path := "/pet/{petId}" | ||
l_path.replace_substring_all ("{"+"petId"+"}", api_client.url_encode (pet_id.out)) | ||
|
||
if attached name as l_name then | ||
l_request.add_form(l_name,"name"); | ||
end | ||
|
@@ -255,7 +269,7 @@ feature -- API Access | |
end | ||
end | ||
|
||
upload_file (pet_id: INTEGER_64; additional_metadata: detachable STRING_32; file: detachable FILE): detachable API_RESPONSE | ||
upload_file (pet_id: INTEGER_64; additional_metadata: STRING_32; file: detachable FILE): detachable API_RESPONSE | ||
-- uploads an image | ||
-- | ||
-- | ||
|
@@ -267,6 +281,7 @@ feature -- API Access | |
-- | ||
-- | ||
-- Result API_RESPONSE | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -277,6 +292,7 @@ feature -- API Access | |
|
||
l_path := "/pet/{petId}/uploadImage" | ||
l_path.replace_substring_all ("{"+"petId"+"}", api_client.url_encode (pet_id.out)) | ||
|
||
if attached additional_metadata as l_additional_metadata then | ||
l_request.add_form(l_additional_metadata,"additionalMetadata"); | ||
end | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
note | ||
description:"[ | ||
Swagger Petstore | ||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ | ||
This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. | ||
OpenAPI spec version: 1.0.0 | ||
Contact: [email protected] | ||
|
@@ -31,6 +31,7 @@ feature -- API Access | |
-- argument: order_id ID of the order that needs to be deleted (required) | ||
-- | ||
-- | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -39,8 +40,9 @@ feature -- API Access | |
reset_error | ||
create l_request | ||
|
||
l_path := "/store/order/{order_id}" | ||
l_path.replace_substring_all ("{"+"order_id"+"}", api_client.url_encode (order_id.out)) | ||
l_path := "/store/order/{orderId}" | ||
l_path.replace_substring_all ("{"+"orderId"+"}", api_client.url_encode (order_id.out)) | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
|
@@ -59,6 +61,7 @@ feature -- API Access | |
-- | ||
-- | ||
-- Result STRING_TABLE[INTEGER_32] | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -69,6 +72,7 @@ feature -- API Access | |
|
||
l_path := "/store/inventory" | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
end | ||
|
@@ -92,6 +96,9 @@ feature -- API Access | |
-- | ||
-- | ||
-- Result ORDER | ||
require | ||
order_id_is_less_or_equal_than: order_id <= 5 | ||
order_id_is_greater_or_equal_than: order_id >= 1 | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -100,8 +107,9 @@ feature -- API Access | |
reset_error | ||
create l_request | ||
|
||
l_path := "/store/order/{order_id}" | ||
l_path.replace_substring_all ("{"+"order_id"+"}", api_client.url_encode (order_id.out)) | ||
l_path := "/store/order/{orderId}" | ||
l_path.replace_substring_all ("{"+"orderId"+"}", api_client.url_encode (order_id.out)) | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
|
@@ -126,6 +134,7 @@ feature -- API Access | |
-- | ||
-- | ||
-- Result ORDER | ||
require | ||
local | ||
l_path: STRING | ||
l_request: API_CLIENT_REQUEST | ||
|
@@ -136,6 +145,7 @@ feature -- API Access | |
l_request.set_body(body) | ||
l_path := "/store/order" | ||
|
||
|
||
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then | ||
l_request.add_header(l_accept,"Accept"); | ||
end | ||
|
Oops, something went wrong.