larshp / ABAP-Swagger

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

DATA: in definitions/model #65

Closed BlackmanCC closed 3 years ago

BlackmanCC commented 3 years ago

The current implementation builds definitions/models as following:

definitions: {
    TY_STRUCTURE: {
          type: "object",
          properties: {
              DATA: {
                  type: "object",
                  properties: {
                      FOO: {
                           type: "string"
                      },
                      BAR: {
                           type: "string"
                      }
                  }
             }
          }
    }
}

There ist always a bracket with "DATA:", then "type: "object""

When I look at the swagger specification https://swagger.io/specification/v2/

and the swagger petstore sample, i cannot find any DATA bracket.

Would it be better it it was like this?

definitions: {
    TY_STRUCTURE: {
          type: "object",
          properties: {
                      FOO: {
                           type: "string"
                      },
                      BAR: {
                           type: "string"
                      }
                  }
             }
          }
    }
}

What do you think?

larshp commented 3 years ago

see https://docs.github.com/en/free-pro-team@latest/github/writing-on-github/basic-writing-and-formatting-syntax#quoting-code, formatting will make above easier to read

BlackmanCC commented 3 years ago

@larshp Thanks for the hint. I think it is m ore readable now.

BlackmanCC commented 3 years ago

@larshp The coding where DATA is added can be found in ZCL_SWAG_SPEC->REPSPONSE

      lv_string = |"{ <ls_parameter>-type }":\{"type": "object","properties": \{"DATA": \{{ lv_type }\}\}\}|.
BlackmanCC commented 3 years ago

I think this is quite similar to #24 . I close this issue and continue with #24.