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

Incorrect body for PutObject in Amazon S3 #23

Open
kennyjwilli opened this issue May 20, 2019 · 3 comments
Open

Incorrect body for PutObject in Amazon S3 #23

kennyjwilli opened this issue May 20, 2019 · 3 comments

Comments

@kennyjwilli
Copy link

According to the PutObject operation documented in the AWS S3 Swagger doc here, the body takes the following format:

- name: body
          in: body
          required: true
          schema:
            type: object
            properties:
              Body:
                description: Object data.
                type: string
              x-amz-meta-:
                description: A map of metadata to store with the object in S3.
                type: object
                additionalProperties:
                  $ref: '#/definitions/MetadataValue'

According the the Amazon HTML REST API reference, the x-amz-meta- should be included in the request header. The Swagger doc states it is a body parameter. The Swagger doc is incorrect.

@MikeRalphson
Copy link
Contributor

Again, would appreciate thoughts from @pimterry

@pimterry
Copy link
Contributor

This happens mainly because we don't understand the headers location used in the S3 SDK definition: https://github.com/aws/aws-sdk-js/blob/master/apis/s3-2006-03-01.normal.json#L2168-L2173. For parameters with no location (or no understood location), we assume they're part of the body parameter. Logic is here, note that it only includes header, not headers.

To be clear though, this isn't just a header that's in the wrong place. This field is actually a header prefix. The docs use the example of x-amz-meta-author: Janet to set author: janet as metadata on an S3 object.

That makes this much harder, because I don't think there is any clear way to describe this parameter in OpenAPI v2, or even in v3. It looks like wildcard parameter support like this (i.e. x-amz-meta-*) just isn't possible: OAI/OpenAPI-Specification#1017.

Any idea on ways to work around or describe this @MikeRalphson? Was there a specific format for this you were expecting @kennyjwilli?

@MikeRalphson MikeRalphson transferred this issue from APIs-guru/openapi-directory Jun 11, 2019
@Xuanwo
Copy link

Xuanwo commented Aug 8, 2020

Maybe we could move x-amz-meta- to header and let tools to handle an object in header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants