larshp / ABAP-Swagger

Expose ABAP REST services with Swagger/openapi spec
MIT License
97 stars 40 forks source link

Option to remove DATA from reply option, fixed tests #56

Closed xinitrc86 closed 4 years ago

xinitrc86 commented 4 years ago

Hello Lars, Good afternoon. This is to fix issue #24, my idea was to be the least disruptive and keep syntax to old elements. This also fix #45 (broken tests) and adds a new one for this feature.

Basically I added a new structure to the meta.

TYPES:
  BEGIN OF sty_response,
    remove_data_object TYPE abap_bool,
  END OF sty_response.
TYPES:
  BEGIN OF ty_meta,
    ...
    response_settings TYPE sty_response,
  END OF ty_meta .

And calling a handle_response on json_reply that will eventually:

DATA lv_length TYPE i. DATA lv_minus_data TYPE i. lv_length = strlen( cv_data_as_string ). lv_minus_data = lv_length - 9.

IF lv_minus_data <= 0. RETURN. ENDIF. "start has |{"DATA":| (8) end has |}| (1) cv_data_as_string = cv_data_as_string+8(lv_minus_data). Regards, Felipe

xinitrc86 commented 4 years ago

This is the one ;)

larshp commented 4 years ago

overall looks good to me, more options for the users are good, when its non-breaking

larshp commented 4 years ago

@xinitrc86 thanks, sorry about the delay, just ping me if I take too long time

if I merge this, do you have time for questions if someone runs into trouble?

xinitrc86 commented 4 years ago

Hi Lars, Sure thing, specially if I'm mentioned ;)

Regards, Felipe

larshp commented 4 years ago

thanks 👍