2016-10-24 4 views
0

ため闊歩私は、次のspec.yamlファイルを持っている有効ではありませんsecurityDefinitions定義 - Auth0

swagger: '2.0' 
info: 
    title: Store API 
    version: "0.3.5" 
host: SELF_URL_REPLACED_BY_APP 
schemes: 
    - https 
basePath:/
produces: 
    - application/json 
tags: 
    - name: account 
    - name: transcripts 
security: 
    - auth0: 
    - openid 
    - apiKey: [] 
securityDefinitions: 
    auth0: 
    type: oauth2 
    authorizationUrl: https://store.auth0.com/authorize 
    flow: implicit 
    tokenName: id_token 
    scopes: 
     openid: Grant access to user 
    apiKey: 
    type: apiKey 
    name: Authorization 
    in: header 

私はhttp://editor.swagger.io/でそれを検証しようとしたとき、私はこのエラーを取得:

✖ Swagger Error 
Not a valid securityDefinitions definition 
Jump to line 19 
Details 
Object 
code: "ONE_OF_MISSING" 
params: Array [0] 
message: "Not a valid securityDefinitions definition" 
path: Array [2] 
schemaId: "http://swagger.io/v2/schema.json#" 
inner: Array [6] 
level: 900 
type: "Swagger Error" 
description: "Not a valid securityDefinitions definition" 
lineNumber: 19 

私は何行方不明?私はAuth0を使用してログインすることができ、すべてうまくいくようです。

アドバイスをいただければ幸いです。

答えて

0

tokenNameは、SecurityDefinitionsオブジェクトの有効なプロパティではありません。

スワッガーの定義には、pathsなどの他のエラーがあります。編集中にsecurityDefinitionsについて間違った検証エラーが発生する可能性があります。

例えば以下は細かい検証すべきである:

swagger: '2.0' 
info: 
    title: Store API 
    version: "0.3.5" 
host: SELF_URL_REPLACED_BY_APP 
schemes: 
    - https 
basePath:/
produces: 
    - application/json 
tags: 
    - name: account 
    - name: transcripts 
paths: 
    /pets: 
    get: 
     description: Returns all pets from the system that the user has access to 
     produces: 
     - application/json 
     responses: 
     '200': 
      description: A list of pets. 
      schema: 
      type: array 
      items: 
       type: string 
     security: 
     - auth0: 
      - openid 
     - apiKey: [] 
securityDefinitions: 
    auth0: 
    type: oauth2 
    authorizationUrl: https://store.auth0.com/authorize 
    flow: implicit 
    scopes: 
     openid: Grant access to user 
    apiKey: 
    type: apiKey 
    name: Authorization 
    in: header 

をまたsecurity部がトップレベルに属していないが、各APIメソッドの下に置かれるべきである(例えば、定義上を参照)を指定しますセキュリティ定義をそのAPIに適用する必要があります。

関連する問題