2016-10-24 1 views
0
에 대한 자신감

내가 http://editor.swagger.io/에서 유효성을 검사 할 때이하지 유효한 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 

나는이 오류가 다음 spec.yaml 파일이 :

✖ 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 개체의 유효한 속성이 아닙니다.

그러나 Swagger 정의에는 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에 적용되어야합니다.