Closed thesourav123 closed 5 years ago
yes, not implemented, see https://github.com/larshp/ABAP-Swagger/issues/33
@larshp, In PARAMETERS method inside ZCL_SWAG_SPEC, it looks simple to fix it.
LOOP AT is_meta-parameters ASSIGNING <ls_parameter>
WHERE pardecltyp = zcl_swag=>c_parm_kind-importing.
APPEND '{' TO lt_string.
CONCATENATE '"name":"' <ls_parameter>-sconame '",' INTO ls_string.
APPEND ls_string TO lt_string.
READ TABLE is_meta-meta-url-group_names FROM <ls_parameter>-sconame
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
APPEND '"in":"path",' TO lt_string.
ELSEIF is_meta-meta-method = zcl_swag=>c_method-get.
APPEND '"in":"query",' TO lt_string.
ELSE.
APPEND '"in":"body",' TO lt_string.
ENDIF.
APPEND '"description":"",' TO lt_string.
CREATE OBJECT lo_map
EXPORTING
is_param = <ls_parameter>.
lv_type = lo_map->map( ).
CONCATENATE lv_type ',' INTO ls_string.
APPEND ls_string TO lt_string.
""""""""""""" APPEND '"required":true' TO lt_string.
*********************************************************************************
IF <LS_PARAMETER>-PAROPTIONL = 'X'.
APPEND '"required":false' TO lt_string.
ELSE.
APPEND '"required":true' TO lt_string.
ENDIF.
********************************************************************************
APPEND '},' TO lt_string.
ENDLOOP.
yeah, that will change the spec, but does the code also work if not supplying the parameter?
You mean will it work without any importing parameter?
try calling the REST service without supplying TICKETNO
Yup, it calls SAP, My method and executes successfully.
If i have optional parameters then it is still showing as "Required"
Now, in output