Skip to content

[FR] OpenAPI schema for images #11246

@martonmiklos

Description

@martonmiklos

Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find a similar feature request

Problem statement

I have been playing with a Qt based implementation generated from the openapi schema with the openapi-generator.

I tried to upload image to a part but I failed to do so.
The image is defined the following way in the schema:

        image:
          type: string
          format: uri
          nullable: true

My first idea was posting base64 image but it was rejected by the server.

Then I moved onto studying the python API and it turned out that images uploaded to objects derived from ImageMixin-s need to be posted separately as a file under the 'image' key, not packaged to the JSON post data.

I tailored my Qt client code to post the raw image as a file and it works just fine.

Suggested solution

I am posting this as a "placeholder", to aid others coming through similar in the future.
To fix I need to do research on openapi schema capabilities to see if it is possible to describe expected files in the post data.
If it is capable to do it I need to understand if the generated schema could be modified for the ImageMixin based objects.

Describe alternatives you've considered

In the case if the file upload cannot be described in the schema, removing the image fields from ImageMixin-s could be a good idea because as I see it there is no way to post image data this way (i.e. the field is useless in this definition format.)

Examples of other systems

Do you want to develop this?

  • I want to develop this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiRelates to the APIbugIdentifies a bug which needs to be addressedenhancementThis is an suggested enhancement or new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions