Skip to content

无法正常设置SecuritySchemes #14

Description

@Lu-Lucifer

Describe the bug

无法在Service下设置SecuritySchemes,甚至在修改一部分源码后还是设置不完全

To Reproduce

Steps to reproduce the behavior:

  1. 使用的是thrift,在文件中设置如下
    service SwaggerDocService {}
    (
    openapi.document = '{
    info: {
    title: "自定义Swagger文档",
    version: "1.0.0",
    description: "这是一个使用thrift-gen-http-swagger生成的Swagger文档示例"
    },
    components: {
    security_schemes: {
    additional_properties: [
    {
    name: "bearerAuth"
    value: {
    security_scheme: {
    _type: "http"
    scheme: "bearer"
    }
    }
    },
    {
    name: "jwtAuth"
    value: {
    security_scheme: {
    _type: "http"
    scheme: "JWT"
    }
    }
    }
    ]
    }
    },
    security: {
    additional_properties: [
    {
    name: "bearerAuth"
    value: {
    value: []
    }
    }
    ]
    }

    }'
    )
    这个在生成的时候直接报错rror merging document option: document:failed to parse option:no [] when parse list

  2. 修改thrift-gen-http-swagger源码open_api.go下方法BuildDocument,增加默认SecuritySchemes,但是里边有个字段_Type无法正常赋值,我查看protoc-gen-http-swagger中相同代码,使用的Type没有下划线,2个项目不统一是不是有问题啊。

Image

希望能够有设置SecuritySchemes配置的地方,并且能够设置为全局需要验证,不用验证的接口单独进行设置。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions