diff --git a/modules/swagger-codegen/src/main/resources/Eiffel/api.mustache b/modules/swagger-codegen/src/main/resources/Eiffel/api.mustache index 9c08b336862..53a5edc0698 100644 --- a/modules/swagger-codegen/src/main/resources/Eiffel/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Eiffel/api.mustache @@ -13,7 +13,7 @@ feature -- API Access {{#operation}} - {{operationId}} {{#hasParams}}({{#allParams}}{{paramName}}: {{#required}}{{{dataType}}}{{/required}}{{^required}}detachable {{{dataType}}}{{/required}}{{#hasMore}}; {{/hasMore}}{{/allParams}}){{/hasParams}}{{#returnType}}: detachable {{{returnType}}}{{/returnType}}{{^returnType}}{{/returnType}} + {{operationId}} {{#hasParams}}({{#allParams}}{{paramName}}: {{#required}}{{{dataType}}}{{/required}}{{^required}}{{#isPrimitiveType}}{{{dataType}}}{{/isPrimitiveType}}{{^isPrimitiveType}}detachable {{{dataType}}}{{/isPrimitiveType}}{{/required}}{{#hasMore}}; {{/hasMore}}{{/allParams}}){{/hasParams}}{{#returnType}}: detachable {{{returnType}}}{{/returnType}}{{^returnType}}{{/returnType}} -- {{summary}} -- {{notes}} -- {{#allParams}} @@ -21,6 +21,17 @@ feature -- API Access -- {{/allParams}} -- {{#returnType}} -- Result {{returnType}}{{/returnType}} + require + {{#allParams}} + {{#hasValidation}} + {{#maximum}} + {{{paramName}}}_is_less_or_equal_than: {{{paramName}}} <= {{{maximum}}} + {{/maximum}} + {{#minimum}} + {{{paramName}}}_is_greater_or_equal_than: {{{paramName}}} >= {{{minimum}}} + {{/minimum}} + {{/hasValidation}} + {{/allParams}} local l_path: STRING l_request: API_CLIENT_REQUEST diff --git a/modules/swagger-codegen/src/main/resources/Eiffel/api_client.mustache b/modules/swagger-codegen/src/main/resources/Eiffel/api_client.mustache index 9de50417eb9..9958265883a 100644 --- a/modules/swagger-codegen/src/main/resources/Eiffel/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/Eiffel/api_client.mustache @@ -135,7 +135,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 @@ -150,7 +150,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 @@ -166,7 +166,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) @@ -185,6 +185,61 @@ feature -- Query Parameter Helpers 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 + else + -- Unsupported Object type. + Result := "" + end + end + end + + feature -- Status Report is_valid_uri (a_uri: STRING): BOOLEAN diff --git a/modules/swagger-codegen/src/main/resources/Eiffel/model.mustache b/modules/swagger-codegen/src/main/resources/Eiffel/model.mustache index 64f0c64e467..aa5e906c448 100644 --- a/modules/swagger-codegen/src/main/resources/Eiffel/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Eiffel/model.mustache @@ -74,7 +74,7 @@ feature -- Change Element {{#isListContainer}} if attached {{name}} as l_{{name}} then across l_{{name}} as ic loop - Result.append ("%N") + Result.append ("%N {{name}}:") Result.append (ic.item.out) Result.append ("%N") end @@ -82,6 +82,7 @@ feature -- Change Element {{/isListContainer}} {{#isMapContainer}} if attached {{name}} as l_{{name}} then + Result.append ("%N{{name}}:") across l_{{name}} as ic loop Result.append ("%N") Result.append ("key:") @@ -95,7 +96,7 @@ feature -- Change Element {{/isMapContainer}} {{^isContainer}} if attached {{name}} as l_{{name}} then - Result.append ("%N") + Result.append ("%N{{name}}:") Result.append (l_{{name}}.out) Result.append ("%N") end