-2
Ich habe folgende YAML-Datei, in der ich folgende Fehler in ZeileErste Syntaxfehler in Prahlerei Code
YAML Syntax Error Bad Einzug eines Mapping-Eintrag bin immer 44, Spalte 8: Beschreibung: Holen Sie die Filmliste^
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
Fügen Sie Ihren Code in http://editor.swagger.io ein und folgen Sie den Hinweisen. Es hat Indentationsindikatoren, die Ihnen helfen können, den Code auszurichten. – Helen
Dies kann auch in unserer lokal gehosteten Swagger-Benutzeroberfläche gesehen werden. Ich konnte die Zeile identifizieren, in der der Fehler aufgetreten ist, aber ich wusste nicht, wie ich sie beheben sollte. Es ist bereits ohne editor.swagger.io gelöst. Vielen Dank! – mashkurm