无效的OpenAPI JSON文件-预期的类型对象,但找到用于安全定义的类型字符串

时间:2019-06-11 02:31:09

标签: json google-cloud-platform swagger openapi

我收到以下openApi.json文件的验证错误,我正在尝试配置该文件,以便对Google Cloud上的Endpoints服务使用JWT身份验证。我正在遵循本指南-https://cloud.google.com/endpoints/docs/openapi/service-account-authentication#configure_auth。通过使用Swagger online parser粘贴并验证我的样本,可以很容易地重现该错误。错误消息是:

df %>% group_by(col1, col2) %>% summarise(n=n()) %>% mutate(freq = n / sum(n))
or something along those lines.

我想了解为什么我收到消息Swagger schema validation failed. Expected type object but found type string at #/paths//my/api/get/responses/200/description/securityDefinitions/mySecurityDefinition/x-google-jwks_uri/x-google-issuer/type/flow/authorizationUrl/security/0 JSON_OBJECT_VALIDATION_FAILED 。错误消息看起来好像是在抱怨安全性定义,但我不明白为什么。

openapi.json

Expected type object but found type string

我在做什么错?如果我将{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "my-app-hostname.appspot.com" }, "host": "my-app-hostname.appspot.com", "basePath": "/api", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "security" : [ "mySecurityDefinition" ], "securityDefinitions": { "mySecurityDefinition": { "authorizationUrl": "", "flow": "implicit", "type": "oauth2", "x-google-issuer": "myServiceAccountEmailAddress", "x-google-jwks_uri": "https://www.googleapis.com/robot/v1/metadata/x509/myServiceAccountEmailAddress" } }, "paths": { "/my/api": { "get": { "responses": { "200": { "description": "A successful response" } } } } } } 数组中的第一个对象更改为此,则它不会生效,但是解析器不会给出错误消息:

security

0 个答案:

没有答案