路径参数未从 UI 填充

问题描述 投票:0回答:1

我正在使用 Swashbuckle.AspNetCore 6.5.0

视图类型=完整 widgetguid=940FFD66-A7C2-42F5-AAA2-153CBF9136EE

在 Swagger UI 中,当我执行填充了两个路径参数的 API 调用时,它会生成以下内容:

https://localhost:7168/api/widget/{viewtype}/940FFD66-A7C2-42F5-AAA2-153CBF9136EE

即它替换一个标记,但不替换视图类型标记

我不明白为什么,浏览器控制台中也没有错误。


    "/api/widget/{viewtype}/{widgetGuid}": {
                "get": {
                    "tags": [
                        "widget"
                    ],
                    "parameters": [
                        {
                            "name": "viewType",
                            "in": "path",
                            "required": true,
                            "schema": {
                                "type": "string"
                            }
                        },
                        {
                            "name": "widgetGuid",
                            "in": "path",
                            "required": true,
                            "schema": {
                                "type": "string",
                                "format": "uuid"
                            }
                        }
                    ],
                    "responses": {
                        "200": {
                            "description": "Success",
                            "content": {
                                "text/plain": {
                                    "schema": {
                                        "$ref": "#/components/schemas/widgetDtoFull"
                                    }
                                },
                                "application/json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/widgetDtoFull"
                                    }
                                },
                                "text/json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/widgetDtoFull"
                                    }
                                }
                            }
                        }
                    }
                }
            },

openapi swagger-ui swashbuckle
1个回答
0
投票

Helen 正确指出了大小写不匹配的情况 - TY

viewtype 与 viewType

© www.soinside.com 2019 - 2024. All rights reserved.