finatra-swagger icon indicating copy to clipboard operation
finatra-swagger copied to clipboard

Could you add formParam back in open api 3.0

Open chenghsienwen opened this issue 3 years ago • 4 comments

Hi, jakehschwartz:

traced this commit that formParam have been removed https://github.com/jakehschwartz/finatra-swagger/commit/50dc183052473f24f27c1cbdf2da3a97503bd12e

how can we add it back?

chenghsienwen avatar Jun 07 '21 03:06 chenghsienwen

Hey, it was removed because it didnt look like it was supported anymore. If you can show me what it is called in the OpenAPI specification, I can try adding it back. Thanks!

On Sun, Jun 6, 2021 at 11:31 PM chenghsienwen @.***> wrote:

Hi, jakehschwartz:

traced this commit that formParam have been removed 50dc183 https://github.com/jakehschwartz/finatra-swagger/commit/50dc183052473f24f27c1cbdf2da3a97503bd12e

how can we add it back?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jakehschwartz/finatra-swagger/issues/72, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVAOZ2USSGEOV2MXISXQIDTRQ4QNANCNFSM46GXVPQQ .

jakehschwartz avatar Jun 07 '21 16:06 jakehschwartz

I tried to add it at https://github.com/chenghsienwen/finatra-swagger/commit/6f062d2beb278d1c969bd403b10608b261739042

according to swagger spec https://swagger.io/docs/specification/describing-request-body/file-upload/

however, I tried to run examples but no formParam field found but swagger.json contains form-data

       "request_body": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "description": "the student name",
                    "example_set_flag": false
                  },
                  "grade": {
                    "description": "the student grade",
                    "example_set_flag": false
                  }
                },
                "example_set_flag": false
              }
            }
          }

chenghsienwen avatar Jun 08 '21 04:06 chenghsienwen

@chenghsienwen Do you need to register the schema, like in the bodyParam function thats above yours?

jakehschwartz avatar Jun 20 '21 02:06 jakehschwartz

@jakehschwartz thanks for remind, I have tried to register formParam in FinatraSwagger.scala, but it not works, I think form related field should declare in body request with finatra annotation, and bodyParam in FinatraOperation.scala should handle multipart/form-data related content type

chenghsienwen avatar Jun 20 '21 14:06 chenghsienwen