Skip to content

V3 multipart encoding property type for content-type isn't supported #308

Closed

Description

Given this spec:

openapi: "3.0.0"
info:
  title: Test
  version: "1.0"
paths:
  /convert:
    post:
      operationId: doWork
      description: Work work work.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              properties:
                options:
                  description: The configuration data.
                  type: object
                  properties:
                    foo:
                      type: string
                      description: A foo.
                  required:
                    - foo
                message:
                  description: Big text file
                  type: string
                  format: binary
              required:
                - options
                - message
            encoding:
              message:
                contentType: text/plain
      responses:
        201:
          description: Request worked.

and given the documentation: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#special-considerations-for-multipart-content

I would not expect any errors or lack of the contentType for message when reading the YAML. I do get a diagnostic error: "encoding is not a valid property at #/paths//convert/post/requestBody/content"

Activity

  1. daniel-white commented on Aug 7, 2018

    @daniel-white
    Author

    Diving into the code a bit, Microsoft.OpenApi.Readers\V3\OpenApiMediaTypeDeserializer.cs / _mediaTypeFixedFields has a comment like a todo for encodings, but its left unimplemented.

  2. daniel-white commented on Aug 7, 2018

    @daniel-white
    Author

    Well it looks like the rest of the plumbing is there; this is what is missing in the _mediaTypeFixedFields

    {
        "encoding", (o, n) =>
        {
            o.Encoding = n.CreateMap(LoadEncoding);
        }
    },
    
  3. PerthCharern commented on Oct 1, 2018

    @PerthCharern
    Contributor

    Based on the PR and the conversation above, I believe this is resolved. Please reopen if that's not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugA broken experience

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions