Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No 'request' in openapi when using SkipRequestBodyEncodeDecode #3189

Closed
maxott opened this issue Nov 2, 2022 · 3 comments
Closed

No 'request' in openapi when using SkipRequestBodyEncodeDecode #3189

maxott opened this issue Nov 2, 2022 · 3 comments

Comments

@maxott
Copy link

maxott commented Nov 2, 2022

I'm using SkipRequestBodyEncodeDecode very similar to the Upload/Download example.

I've been using one of the code generators using openapi files as input and it was not creating any code for the body portion of the respective command. When looking at the generated openapi section, there is no "requestBody" declared similar to when I would declare one in Payload.

I'm not an expert on openapi, and don't really know what exactly I would be expecting.

However, I have two use cases I would like to define:

  1. The HTTP body is some unspecified json (required Content-Type json and maybe yaml)
  2. The body could be anything as long as Content-Type is provided

In both case I would like to get a Reader on the content, exactly as it happens now when using SkipRequestBodyEncodeDecode, but have the right info included in openapi(3).json which would allow code generators to do the right thing.

Thanks

@maxott
Copy link
Author

maxott commented Nov 2, 2022

I should have added that I expected something similar to what I get now when I declare a Field and then refer to that with Body(filedName) in HTTP:

            "requestBody" : {
               "content" : {
                  "application/json" : {
                     "example" : "Sapiente possimus commodi qui sint aut.",
                     "schema" : {
                        "description" : "Metadata content",
                        "example" : "Ipsa autem non sapiente labore iste voluptas.",
                        "type" : "string"
                     }
                  }
               },
               "description" : "Metadata content",
               "required" : true
            },

At the moment I seem to get around by defining a Field with type Byte, but specifically for usecase 2) above, I would really prefer a Reader as the payload can be rather large

Also using Goa version v3.10.2

@raphael
Copy link
Member

raphael commented Nov 5, 2022

Hello, I am not sure how best to enable this. Obviously not all use of SkipResponseBodyEncodeDecode result in responses being sent in JSON format (most don't in my experience). So, there would have to be a mechanism to tell Goa that this is the case here. This mechanism would probably need to be fairly generic to make it possible to support other content types. It might be possible to add a new special key to Meta that could be used to do this, I'd gladly welcome a contribution that did that.

@github-actions
Copy link

github-actions bot commented Jan 5, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants