2017-06-23 6 views
-2

私は44行で、マッピングエントリの取得構文エラーが

YAML構文エラー不正なインデント、次のエラーを取得していた中でYAMLファイル、 列8を以下している:説明:取得映画リスト^

swagger: "2.0" 
info: 
    version: "0.0.1" 
    title: Hello World App 
# during dev, should point to your local machine 
host: localhost:10010 
# basePath prefixes all resource paths 
basePath:/
# 
schemes: 
    # tip: remove http to make production-grade 
    - http 
    - https 
# format of bodies a client can send (Content-Type) 
consumes: 
    - application/json 
# format of the responses to the client (Accepts) 
produces: 
    - application/json 
paths: 
    /movie: 
    # our controller name 
    x-swagger-router-controller: movie 
    get: 
    post: 
     description: add a new movie to the list 
     # movie info to be stored 
     parameters: 
     - name: title 
      description: Movie properties 
      in: body 
      required: true 
      schema: 
      $ref: "#/definitions/Movie" 
     responses: 
     "200": 
      description: Success 
      schema: 
      $ref: "#/definitions/GeneralResponse" 
     default: 
      description: Error 
      schema: 
      $ref: "#/definitions/ErrorResponse" 
     description: get the movies list 
     # define the type of response for Success "200" and Error 
     responses: 
      "200": 
      description: Success 
      schema: 
      $ref: "#/definitions/GetMoviesListResponse" 
      default: 
      description: Error 
      schema: 
       $ref: "#/definitions/ErrorResponse" 
    /swagger: 
    x-swagger-pipe: swagger_raw 
# complex objects have schema definitions 
definitions: 
    GetMoviesListResponse: 
    required: 
     - movies 
    properties: 
     # The array of movies 
     movies: 
     type: array 
     items: 
      type: object 
      properties: 
      id: 
       type: string 
      title: 
       type: string 
      year: 
       type: number 
      month: 
       type: string 
    GeneralResponse: 
    type: object 
    properties: 
     success: 
     type: number 
     description: returns 1 if successful 
     description: 
     type: string 
     description: a short comment 
    required: 
     - success 
     - description 
    ErrorResponse: 
    required: 
     - message 
    properties: 
     message: 
     type: string 
+0

http://editor.swagger.ioにコードを貼り付け、ヒントに従ってください。コードの整列に役立つインデントインジケーターがあります。 – Helen

+0

これは、ローカルにホストされた魅力的なUIでも見ることができます。エラーが発生した行を特定できましたが、解決方法がわかりませんでした。それは既にeditor.swagger.ioなしで解決されています。ありがとう! – mashkurm

答えて

0

あなたのライン

 description: get the movies list 

秒houldいずれかと整列させることが:その上

 default: 

、又はラインその上

 responses: 

有します。しかし、それはそれらの2つの間にちょうどインデントされています。

関連する問題