Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Support oneOf for requestBody Schemas in OpenAPI v3#2059

Merged
ubogdan merged 3 commits intoswaggo:v2from
codingcn:feature/requstBody-oneof
Aug 19, 2025
Merged

feat: Support oneOf for requestBody Schemas in OpenAPI v3#2059
ubogdan merged 3 commits intoswaggo:v2from
codingcn:feature/requstBody-oneof

Conversation

@codingcn
Copy link

Describe the PR
Support oneOf for requestBody Schemas in OpenAPI v3

Relation issue
e.g. https://github.com/swaggo/swag/pull/118/files

Additional context

// ChatCompletions godoc
//
// @Summary		ChatCompletions
// @Description	ChatCompletions
// @Produce		json
// @Security		ApiKeyAuth
// @Param openai body model.GeneralOpenAIRequest false "OpenAI Body"
// @Param anthropic body model.AnthropicMessageRequest false "Anthropic Body"
// @Success		200				{object}	model.ChatCompletionsStreamResponse
// @Router		/v1/chat/completions [post]

to

/v1/chat/completions:
  post:
    description: ChatCompletions
    requestBody:
      content:
        application/json:
          schema:
            oneOf:
            - $ref: '#/components/schemas/model.GeneralOpenAIRequest'
              description: OpenAI Body
              summary: openai
            - $ref: '#/components/schemas/model.AnthropicMessageRequest'
              description: Anthropic Body
              summary: anthropic
      description: OpenAI Body | Anthropic Body

Copy link
Contributor

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging, update README.md to reflect his feature

@codingcn
Copy link
Author

Before merging, update README.md to reflect his feature
TBR

@ubogdan
Copy link
Contributor

ubogdan commented Aug 18, 2025

@codingcn Thanks for your contribution

@ubogdan ubogdan merged commit 13ced53 into swaggo:v2 Aug 19, 2025
14 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.

2 participants

Comments