Skip to content

Conversation

@GamerGirlandCo
Copy link
Contributor

@GamerGirlandCo GamerGirlandCo commented Oct 20, 2025

details (copied from #34)

From the openapi specification website:

Complex Serialization in Form Data

[...] For more complex scenarios, such as nested arrays or JSON in form data, you need to use the contentType keyword to specify the media type for encoding the value of a complex field. Consider Slack incoming webhooks for an example. A message can be sent directly as JSON, or the JSON data can be sent inside a form field named payload like so (before URL-encoding is applied):

payload={"text":"Swagger is awesome"}

This can be described as:

openapi: 3.0.0
info:
  version: 1.0.0
  title: Slack Incoming Webhook
externalDocs:
  url: https://api.slack.com/incoming-webhooks

servers:
  - url: https://hooks.slack.com

paths:
  /services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX:
    post:
      summary: Post a message to Slack
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Message"

          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                payload: # <--- form field that contains the JSON message
                  $ref: "#/components/schemas/Message"
            encoding:
              payload:
                contentType: application/json

      responses:
        "200":
          description: OK

components:
  schemas:
    Message:
      title: A Slack message
      type: object
      properties:
        text:
          type: string
          description: Message text
      required:
        - text
closes #34

@akfaiz
Copy link
Member

akfaiz commented Oct 20, 2025

Thanks for your contribution, but there has some error at linter, please check it.

@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 59.37500% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
operation.go 70.37% 6 Missing and 2 partials ⚠️
option/content.go 0.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@akfaiz akfaiz merged commit 25bfc1c into oaswrap:main Oct 25, 2025
5 of 6 checks passed
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

Successfully merging this pull request may close these issues.

enhancement: add ability to define encoding option on operations with complex serialization

2 participants