larshp / ABAP-Swagger

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

Remove DATA from reply option, fixed tests #55

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

I will lint int and push again

larshp commented 4 years ago

also feel free to push more commits to the branch

xinitrc86 commented 4 years ago

Yeah, sorry. Ended up doing another pull instead...