Swagger eiffel:fix (#6674)

* 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.
This commit is contained in:
Javier Velilla 2017-10-16 00:02:19 -03:00 committed by wing328
parent 3f7f6b8599
commit 3067da2877
30 changed files with 198 additions and 126 deletions

View File

@ -232,6 +232,10 @@ feature -- Query Parameter Helpers
-- TODO improve to support
-- dateTime string date-time As defined by date-time - RFC3339
Result := date_time.date.debug_output
elseif attached {STRING_32} a_param as str_32 then
Result := str_32
elseif attached {STRING_8} a_param as str_8 then
Result := str_8
else
-- Unsupported Object type.
Result := ""

View File

@ -1,6 +1,6 @@
# Eiffel API client for swagger
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.
## Overview
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
@ -17,19 +17,10 @@ Add the library into your Eiffel configuration file.
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FAKE_API* | [**fake_outer_boolean_serialize**](docs/FAKE_API.md#fake_outer_boolean_serialize) | **Post** /fake/outer/boolean |
*FAKE_API* | [**fake_outer_composite_serialize**](docs/FAKE_API.md#fake_outer_composite_serialize) | **Post** /fake/outer/composite |
*FAKE_API* | [**fake_outer_number_serialize**](docs/FAKE_API.md#fake_outer_number_serialize) | **Post** /fake/outer/number |
*FAKE_API* | [**fake_outer_string_serialize**](docs/FAKE_API.md#fake_outer_string_serialize) | **Post** /fake/outer/string |
*FAKE_API* | [**test_client_model**](docs/FAKE_API.md#test_client_model) | **Patch** /fake | To test \"client\" model
*FAKE_API* | [**test_endpoint_parameters**](docs/FAKE_API.md#test_endpoint_parameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FAKE_API* | [**test_enum_parameters**](docs/FAKE_API.md#test_enum_parameters) | **Get** /fake | To test enum parameters
*FAKE_API* | [**test_json_form_data**](docs/FAKE_API.md#test_json_form_data) | **Get** /fake/jsonFormData | test json serialization of form data
*FAKE_CLASSNAME_TAGS123_API* | [**test_classname**](docs/FAKE_CLASSNAME_TAGS123_API.md#test_classname) | **Patch** /fake_classname_test | To test class name in snake case
*PET_API* | [**add_pet**](docs/PET_API.md#add_pet) | **Post** /pet | Add a new pet to the store
*PET_API* | [**delete_pet**](docs/PET_API.md#delete_pet) | **Delete** /pet/{petId} | Deletes a pet
*PET_API* | [**find_pets_by_status**](docs/PET_API.md#find_pets_by_status) | **Get** /pet/findByStatus | Finds Pets by status
@ -38,9 +29,9 @@ Class | Method | HTTP request | Description
*PET_API* | [**update_pet**](docs/PET_API.md#update_pet) | **Put** /pet | Update an existing pet
*PET_API* | [**update_pet_with_form**](docs/PET_API.md#update_pet_with_form) | **Post** /pet/{petId} | Updates a pet in the store with form data
*PET_API* | [**upload_file**](docs/PET_API.md#upload_file) | **Post** /pet/{petId}/uploadImage | uploads an image
*STORE_API* | [**delete_order**](docs/STORE_API.md#delete_order) | **Delete** /store/order/{order_id} | Delete purchase order by ID
*STORE_API* | [**delete_order**](docs/STORE_API.md#delete_order) | **Delete** /store/order/{orderId} | Delete purchase order by ID
*STORE_API* | [**inventory**](docs/STORE_API.md#inventory) | **Get** /store/inventory | Returns pet inventories by status
*STORE_API* | [**order_by_id**](docs/STORE_API.md#order_by_id) | **Get** /store/order/{order_id} | Find purchase order by ID
*STORE_API* | [**order_by_id**](docs/STORE_API.md#order_by_id) | **Get** /store/order/{orderId} | Find purchase order by ID
*STORE_API* | [**place_order**](docs/STORE_API.md#place_order) | **Post** /store/order | Place an order for a pet
*USER_API* | [**create_user**](docs/USER_API.md#create_user) | **Post** /user | Create user
*USER_API* | [**create_users_with_array_input**](docs/USER_API.md#create_users_with_array_input) | **Post** /user/createWithArray | Creates list of users with given input array
@ -54,41 +45,12 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [ADDITIONAL_PROPERTIES_CLASS](docs/ADDITIONAL_PROPERTIES_CLASS.md)
- [ANIMAL](docs/ANIMAL.md)
- [ANIMAL_FARM](docs/ANIMAL_FARM.md)
- [API_RESPONSE](docs/API_RESPONSE.md)
- [ARRAY_OF_ARRAY_OF_NUMBER_ONLY](docs/ARRAY_OF_ARRAY_OF_NUMBER_ONLY.md)
- [ARRAY_OF_NUMBER_ONLY](docs/ARRAY_OF_NUMBER_ONLY.md)
- [ARRAY_TEST](docs/ARRAY_TEST.md)
- [CAPITALIZATION](docs/CAPITALIZATION.md)
- [CATEGORY](docs/CATEGORY.md)
- [CLASS_MODEL](docs/CLASS_MODEL.md)
- [CLIENT](docs/CLIENT.md)
- [ENUM_ARRAYS](docs/ENUM_ARRAYS.md)
- [ENUM_CLASS](docs/ENUM_CLASS.md)
- [ENUM_TEST](docs/ENUM_TEST.md)
- [FORMAT_TEST](docs/FORMAT_TEST.md)
- [HAS_ONLY_READ_ONLY](docs/HAS_ONLY_READ_ONLY.md)
- [MAP_TEST](docs/MAP_TEST.md)
- [MIXED_PROPERTIES_AND_ADDITIONAL_PROPERTIES_CLASS](docs/MIXED_PROPERTIES_AND_ADDITIONAL_PROPERTIES_CLASS.md)
- [MODEL_200_RESPONSE](docs/MODEL_200_RESPONSE.md)
- [NAME](docs/NAME.md)
- [NUMBER_ONLY](docs/NUMBER_ONLY.md)
- [ORDER](docs/ORDER.md)
- [OUTER_BOOLEAN](docs/OUTER_BOOLEAN.md)
- [OUTER_COMPOSITE](docs/OUTER_COMPOSITE.md)
- [OUTER_ENUM](docs/OUTER_ENUM.md)
- [OUTER_NUMBER](docs/OUTER_NUMBER.md)
- [OUTER_STRING](docs/OUTER_STRING.md)
- [PET](docs/PET.md)
- [READ_ONLY_FIRST](docs/READ_ONLY_FIRST.md)
- [RETURN](docs/RETURN.md)
- [SPECIAL_MODEL_NAME](docs/SPECIAL_MODEL_NAME.md)
- [TAG](docs/TAG.md)
- [USER](docs/USER.md)
- [CAT](docs/CAT.md)
- [DOG](docs/DOG.md)
## Documentation For Authorization
@ -100,10 +62,6 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key
- **Location**: HTTP header
## http_basic_test
- **Type**: HTTP basic authentication
## petstore_auth
- **Type**: OAuth

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="swagger_eiffel_client" uuid="e892c29a-3caa-456b-bc97-f488bba434b9" library_target="swagger_eiffel_client">
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="swagger_eiffel_client" uuid="fb819818-bd09-421e-84e6-a6b7ce8ecb39" library_target="swagger_eiffel_client">
<target name="swagger_eiffel_client">
<root all_classes="true"/>
<file_rule>

View File

@ -1,6 +1,6 @@
# PET_API
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *http://petstore.swagger.io/v2*
Feature | HTTP request | Description
------------- | ------------- | -------------

View File

@ -1,12 +1,12 @@
# STORE_API
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *http://petstore.swagger.io/v2*
Feature | HTTP request | Description
------------- | ------------- | -------------
[**delete_order**](STORE_API.md#delete_order) | **Delete** /store/order/{order_id} | Delete purchase order by ID
[**delete_order**](STORE_API.md#delete_order) | **Delete** /store/order/{orderId} | Delete purchase order by ID
[**inventory**](STORE_API.md#inventory) | **Get** /store/inventory | Returns pet inventories by status
[**order_by_id**](STORE_API.md#order_by_id) | **Get** /store/order/{order_id} | Find purchase order by ID
[**order_by_id**](STORE_API.md#order_by_id) | **Get** /store/order/{orderId} | Find purchase order by ID
[**place_order**](STORE_API.md#place_order) | **Post** /store/order | Place an order for a pet
@ -54,7 +54,7 @@ This endpoint does not need any parameter.
### Return type
[**STRING_TABLE[INTEGER_32]**](STRING_TABLE.md)
**STRING_TABLE[INTEGER_32]**
### Authorization

View File

@ -1,6 +1,6 @@
# USER_API
All URIs are relative to *http://petstore.swagger.io:80/v2*
All URIs are relative to *http://petstore.swagger.io/v2*
Feature | HTTP request | Description
------------- | ------------- | -------------

View File

@ -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: apiteam@swagger.io
@ -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

View File

@ -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: apiteam@swagger.io
@ -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

View File

@ -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: apiteam@swagger.io
@ -31,6 +31,7 @@ feature -- API Access
-- argument: body Created user object (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 := "/user"
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then
l_request.add_header(l_accept,"Accept");
end
@ -59,6 +61,7 @@ feature -- API Access
-- argument: body List of user object (required)
--
--
require
local
l_path: STRING
l_request: API_CLIENT_REQUEST
@ -69,6 +72,7 @@ feature -- API Access
l_request.set_body(body)
l_path := "/user/createWithArray"
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then
l_request.add_header(l_accept,"Accept");
end
@ -87,6 +91,7 @@ feature -- API Access
-- argument: body List of user object (required)
--
--
require
local
l_path: STRING
l_request: API_CLIENT_REQUEST
@ -97,6 +102,7 @@ feature -- API Access
l_request.set_body(body)
l_path := "/user/createWithList"
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then
l_request.add_header(l_accept,"Accept");
end
@ -115,6 +121,7 @@ feature -- API Access
-- argument: username The name that needs to be deleted (required)
--
--
require
local
l_path: STRING
l_request: API_CLIENT_REQUEST
@ -126,6 +133,7 @@ feature -- API Access
l_path := "/user/{username}"
l_path.replace_substring_all ("{"+"username"+"}", api_client.url_encode (username.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
@ -147,6 +155,7 @@ feature -- API Access
--
--
-- Result STRING_32
require
local
l_path: STRING
l_request: API_CLIENT_REQUEST
@ -159,6 +168,7 @@ feature -- API Access
l_request.fill_query_params(api_client.parameter_to_tuple("", "username", username));
l_request.fill_query_params(api_client.parameter_to_tuple("", "password", password));
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then
l_request.add_header(l_accept,"Accept");
end
@ -179,6 +189,7 @@ feature -- API Access
--
--
--
require
local
l_path: STRING
l_request: API_CLIENT_REQUEST
@ -189,6 +200,7 @@ feature -- API Access
l_path := "/user/logout"
if attached {STRING} api_client.select_header_accept (<<"application/xml", "application/json">>) as l_accept then
l_request.add_header(l_accept,"Accept");
end
@ -209,6 +221,7 @@ feature -- API Access
-- argument: body Updated user object (required)
--
--
require
local
l_path: STRING
l_request: API_CLIENT_REQUEST
@ -220,6 +233,7 @@ feature -- API Access
l_path := "/user/{username}"
l_path.replace_substring_all ("{"+"username"+"}", api_client.url_encode (username.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
@ -239,6 +253,7 @@ feature -- API Access
--
--
-- Result USER
require
local
l_path: STRING
l_request: API_CLIENT_REQUEST
@ -250,6 +265,7 @@ feature -- API Access
l_path := "/user/{username}"
l_path.replace_substring_all ("{"+"username"+"}", api_client.url_encode (username.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

View File

@ -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: apiteam@swagger.io
@ -32,15 +32,13 @@ feature {NONE} -- Initialization
create authentications.make (3)
authentications.force (create {API_KEY_AUTH}.make ("header", "api_key"), "api_key")
is_api_key_configured := True
authentications.force (create {HTTP_BASIC_AUTH}, "http_basic_test")
is_basic_auth_configured := True
authentications.force (create {OAUTH},"petstore_auth")
is_oauth_configured := True
end
feature -- Access
default_base_path: STRING = "http://petstore.swagger.io:80/v2"
default_base_path: STRING = "http://petstore.swagger.io/v2"
-- default base path.
base_path: STRING
@ -136,7 +134,7 @@ feature -- Helper: OAuth Authentication
feature -- Query Parameter Helpers
parameter_to_tuple (a_collection_format, a_name: STRING; a_value: ANY): LIST [TUPLE [name: STRING; value: STRING]]
parameter_to_tuple (a_collection_format, a_name: STRING; a_value: detachable ANY): LIST [TUPLE [name: STRING; value: STRING]]
-- A list of tuples with name and valule.
-- collectionFormat collection format (e.g. csv, tsv)
-- name Name
@ -148,7 +146,7 @@ feature -- Query Parameter Helpers
l_delimiter: STRING
l_value: STRING
do
if attached {LIST [STRING_32]} a_value as a_list then
if attached {LIST [ANY]} a_value as a_list then
-- Collection
if a_list.is_empty then
-- Return an empty list
@ -163,7 +161,7 @@ feature -- Query Parameter Helpers
end
if l_format.is_case_insensitive_equal ("multi") then
across a_list as ic loop
Result.force ([a_name, ic.item.as_string_8])
Result.force ([a_name, parameter_to_string (ic.item)])
end
else
if l_format.is_case_insensitive_equal ("csv") then
@ -179,7 +177,7 @@ feature -- Query Parameter Helpers
end
across a_list as ic from create l_value.make_empty
loop
l_value.append (ic.item)
l_value.append (parameter_to_string (ic.item))
l_value.append (l_delimiter)
end
l_value.remove_tail (1)
@ -188,7 +186,71 @@ feature -- Query Parameter Helpers
end
else
create {ARRAYED_LIST [TUPLE [name: STRING; value: STRING]]} Result.make (1)
if attached a_value then
Result.force ([a_name,a_value.out])
else
Result.force ([a_name,""])
end
end
end
parameter_to_string (a_param: detachable ANY): STRING
-- return the string representation of the givien object `a_param'.
do
if a_param = Void then
Result := ""
else
if attached {BOOLEAN} a_param as bool then
Result := bool.out
elseif attached {NUMERIC} a_param as num then
if attached {INTEGER_64} num as i64 then
Result := i64.out
elseif attached {INTEGER_32} num as i32 then
Result := i32.out
elseif attached {INTEGER_16} num as i16 then
Result := i16.out
elseif attached {INTEGER_8} num as i8 then
Result := i8.out
elseif attached {NATURAL_64} num as n64 then
Result := n64.out
elseif attached {NATURAL_32} num as n32 then
Result := n32.out
elseif attached {NATURAL_16} num as n16 then
Result := n16.out
elseif attached {NATURAL_8} num as n8 then
Result := n8.out
elseif attached {REAL_64} num as r64 then
Result := r64.out
elseif attached {REAL_32} num as r32 then
Result := r32.out
else
check is_basic_numeric_type: False end
end
Result := num.out
elseif attached {CHARACTER_8} a_param as ch8 then
Result := ch8.out
elseif attached {CHARACTER_32} a_param as ch32 then
Result := ch32.out
elseif attached {POINTER} a_param as ptr then
Result := ptr.to_integer_32.out
elseif attached {DATE} a_param as date then
--TODO improve to support
-- date string As defined by full-date - RFC3339
Result := date.debug_output
elseif attached {DATE_TIME} a_param as date_time then
-- TODO improve to support
-- dateTime string date-time As defined by date-time - RFC3339
Result := date_time.date.debug_output
elseif attached {STRING_32} a_param as str_32 then
Result := str_32
elseif attached {STRING_8} a_param as str_8 then
Result := str_8
else
-- Unsupported Object type.
Result := ""
end
end
end

View File

@ -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: apiteam@swagger.io
@ -12,7 +12,6 @@ note
date: "$Date$"
revision: "$Revision$"
EIS:"Eiffel swagger codegen", "src=https://github.com/swagger-api/swagger-codegen.git", "protocol=uri"
class API_RESPONSE
inherit
@ -67,19 +66,21 @@ feature -- Change Element
create Result.make_empty
Result.append("%Nclass API_RESPONSE%N")
if attached code as l_code then
Result.append ("%N")
Result.append ("%Ncode:")
Result.append (l_code.out)
Result.append ("%N")
end
if attached type as l_type then
Result.append ("%N")
Result.append ("%Ntype:")
Result.append (l_type.out)
Result.append ("%N")
end
if attached message as l_message then
Result.append ("%N")
Result.append ("%Nmessage:")
Result.append (l_message.out)
Result.append ("%N")
end
end
end

View File

@ -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: apiteam@swagger.io
@ -12,7 +12,6 @@ note
date: "$Date$"
revision: "$Revision$"
EIS:"Eiffel swagger codegen", "src=https://github.com/swagger-api/swagger-codegen.git", "protocol=uri"
class CATEGORY
inherit
@ -57,14 +56,16 @@ feature -- Change Element
create Result.make_empty
Result.append("%Nclass CATEGORY%N")
if attached id as l_id then
Result.append ("%N")
Result.append ("%Nid:")
Result.append (l_id.out)
Result.append ("%N")
end
if attached name as l_name then
Result.append ("%N")
Result.append ("%Nname:")
Result.append (l_name.out)
Result.append ("%N")
end
end
end

View File

@ -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: apiteam@swagger.io
@ -12,7 +12,6 @@ note
date: "$Date$"
revision: "$Revision$"
EIS:"Eiffel swagger codegen", "src=https://github.com/swagger-api/swagger-codegen.git", "protocol=uri"
class ORDER
inherit
@ -97,34 +96,36 @@ feature -- Change Element
create Result.make_empty
Result.append("%Nclass ORDER%N")
if attached id as l_id then
Result.append ("%N")
Result.append ("%Nid:")
Result.append (l_id.out)
Result.append ("%N")
end
if attached pet_id as l_pet_id then
Result.append ("%N")
Result.append ("%Npet_id:")
Result.append (l_pet_id.out)
Result.append ("%N")
end
if attached quantity as l_quantity then
Result.append ("%N")
Result.append ("%Nquantity:")
Result.append (l_quantity.out)
Result.append ("%N")
end
if attached ship_date as l_ship_date then
Result.append ("%N")
Result.append ("%Nship_date:")
Result.append (l_ship_date.out)
Result.append ("%N")
end
if attached status as l_status then
Result.append ("%N")
Result.append ("%Nstatus:")
Result.append (l_status.out)
Result.append ("%N")
end
if attached complete as l_complete then
Result.append ("%N")
Result.append ("%Ncomplete:")
Result.append (l_complete.out)
Result.append ("%N")
end
end
end

View File

@ -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: apiteam@swagger.io
@ -12,7 +12,6 @@ note
date: "$Date$"
revision: "$Revision$"
EIS:"Eiffel swagger codegen", "src=https://github.com/swagger-api/swagger-codegen.git", "protocol=uri"
class PET
inherit
@ -97,38 +96,40 @@ feature -- Change Element
create Result.make_empty
Result.append("%Nclass PET%N")
if attached id as l_id then
Result.append ("%N")
Result.append ("%Nid:")
Result.append (l_id.out)
Result.append ("%N")
end
if attached category as l_category then
Result.append ("%N")
Result.append ("%Ncategory:")
Result.append (l_category.out)
Result.append ("%N")
end
if attached name as l_name then
Result.append ("%N")
Result.append ("%Nname:")
Result.append (l_name.out)
Result.append ("%N")
end
if attached photo_urls as l_photo_urls then
across l_photo_urls as ic loop
Result.append ("%N")
Result.append ("%N photo_urls:")
Result.append (ic.item.out)
Result.append ("%N")
end
end
if attached tags as l_tags then
across l_tags as ic loop
Result.append ("%N")
Result.append ("%N tags:")
Result.append (ic.item.out)
Result.append ("%N")
end
end
if attached status as l_status then
Result.append ("%N")
Result.append ("%Nstatus:")
Result.append (l_status.out)
Result.append ("%N")
end
end
end

View File

@ -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: apiteam@swagger.io
@ -12,7 +12,6 @@ note
date: "$Date$"
revision: "$Revision$"
EIS:"Eiffel swagger codegen", "src=https://github.com/swagger-api/swagger-codegen.git", "protocol=uri"
class TAG
inherit
@ -57,14 +56,16 @@ feature -- Change Element
create Result.make_empty
Result.append("%Nclass TAG%N")
if attached id as l_id then
Result.append ("%N")
Result.append ("%Nid:")
Result.append (l_id.out)
Result.append ("%N")
end
if attached name as l_name then
Result.append ("%N")
Result.append ("%Nname:")
Result.append (l_name.out)
Result.append ("%N")
end
end
end

View File

@ -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: apiteam@swagger.io
@ -12,7 +12,6 @@ note
date: "$Date$"
revision: "$Revision$"
EIS:"Eiffel swagger codegen", "src=https://github.com/swagger-api/swagger-codegen.git", "protocol=uri"
class USER
inherit
@ -117,44 +116,46 @@ feature -- Change Element
create Result.make_empty
Result.append("%Nclass USER%N")
if attached id as l_id then
Result.append ("%N")
Result.append ("%Nid:")
Result.append (l_id.out)
Result.append ("%N")
end
if attached username as l_username then
Result.append ("%N")
Result.append ("%Nusername:")
Result.append (l_username.out)
Result.append ("%N")
end
if attached first_name as l_first_name then
Result.append ("%N")
Result.append ("%Nfirst_name:")
Result.append (l_first_name.out)
Result.append ("%N")
end
if attached last_name as l_last_name then
Result.append ("%N")
Result.append ("%Nlast_name:")
Result.append (l_last_name.out)
Result.append ("%N")
end
if attached email as l_email then
Result.append ("%N")
Result.append ("%Nemail:")
Result.append (l_email.out)
Result.append ("%N")
end
if attached password as l_password then
Result.append ("%N")
Result.append ("%Npassword:")
Result.append (l_password.out)
Result.append ("%N")
end
if attached phone as l_phone then
Result.append ("%N")
Result.append ("%Nphone:")
Result.append (l_phone.out)
Result.append ("%N")
end
if attached user_status as l_user_status then
Result.append ("%N")
Result.append ("%Nuser_status:")
Result.append (l_user_status.out)
Result.append ("%N")
end
end
end

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -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: apiteam@swagger.io

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="test" uuid="28bb8709-c181-416f-8c3e-9eea7157da9f">
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="test" uuid="ec47481a-42b3-4117-89a8-ccdc0ce2bdb5">
<target name="test">
<root feature="make" class="APPLICATION"/>
<file_rule>