无效的 Swagger 安全定义
Invalid Swagger Security Definition
有人可以帮我定义 swagger 吗?
它由 swashbuckle (C#) 创建,但安全定义部分有问题
`"securityDefinitions": {
"oauth2": {
"type":"oauth2",
"flow":"implicit",
"authorizationUrl":"https://myserver/core/connect/authorize",
"tokenUrl":"https://myserver/core/connect/token",
"scopes":{
"scopeOne":"Allows access to the service",
"scopeTwo":"Allows access to the service"
}
},
"apiKey":{
"name":"ApiKey",
"in":"header",
"type":"apiKey"
}
}`
验证错误为:
Error: Swagger schema validation failed.
Data does not match any schemas from 'oneOf' at #/securityDefinitions/oauth2
Additional properties not allowed: scopes,tokenUrl,authorizationUrl,flow at #/securityDefinitions/oauth2
Missing required property: in at #/securityDefinitions/oauth2
Additional properties not allowed: tokenUrl at #/securityDefinitions/oauth2
Additional properties not allowed: authorizationUrl at #/securityDefinitions/oauth2
Additional properties not allowed: authorizationUrl at #/securityDefinitions/oauth2
No enum match for: implicit at #/securityDefinitions/oauth2/flow
tokenUrl 似乎是一个无效参数..
有人可以帮我定义 swagger 吗? 它由 swashbuckle (C#) 创建,但安全定义部分有问题
`"securityDefinitions": {
"oauth2": {
"type":"oauth2",
"flow":"implicit",
"authorizationUrl":"https://myserver/core/connect/authorize",
"tokenUrl":"https://myserver/core/connect/token",
"scopes":{
"scopeOne":"Allows access to the service",
"scopeTwo":"Allows access to the service"
}
},
"apiKey":{
"name":"ApiKey",
"in":"header",
"type":"apiKey"
}
}`
验证错误为:
Error: Swagger schema validation failed. Data does not match any schemas from 'oneOf' at #/securityDefinitions/oauth2
Additional properties not allowed: scopes,tokenUrl,authorizationUrl,flow at #/securityDefinitions/oauth2
Missing required property: in at #/securityDefinitions/oauth2
Additional properties not allowed: tokenUrl at #/securityDefinitions/oauth2
Additional properties not allowed: authorizationUrl at #/securityDefinitions/oauth2
Additional properties not allowed: authorizationUrl at #/securityDefinitions/oauth2
No enum match for: implicit at #/securityDefinitions/oauth2/flow
tokenUrl 似乎是一个无效参数..