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

@io.swagger.v3.oas.annotations.parameters.RequestBody 似乎不支持 #831

Open
suiyueqiannian opened this issue Aug 26, 2024 · 0 comments

Comments

@suiyueqiannian
Copy link

suiyueqiannian commented Aug 26, 2024

代码:

@Operation(summary = "创建新用户", description = "创建一个新的用户账户")
@io.swagger.v3.oas.annotations.parameters.RequestBody(
    description = "用户信息",
    required = true,
    content = @Content(
        mediaType = "application/json",
        schema = @Schema(implementation = User.class),
        examples = {
            @ExampleObject(
                name = "标准用户",
                summary = "创建标准用户的示例",
                value = "{\n" +
                        "  \"username\": \"john_doe\",\n" +
                        "  \"email\": \"john@example.com\"\n" +
                        "}"
            )
        }
    )
)
public ResponseEntity<User> createUser(@org.springframework.web.bind.annotation.RequestBody User user) {
    // 方法实现
    return ResponseEntity.ok(user);
}

这种配置,原生的支持,knife4j似乎不支持

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

1 participant