Screenshot of Swagger Editor & code Hi, I am new to API testing and Swagger and am getting this parser error message in the Swagger Editor and I am having problems locating the problem.
Bellow is a copy paste of the code.
The error message is "bad indentation of a mapping entry" and is displayed where --> in: "path"
.
I followed this YouTube Tutorial --> https://www.youtube.com/watch?v=CoUl9_NWdqQ
swagger: '2.0'
info:
version: 'v1.0'
title: 'Random'
# Added by API Auto Mocking Plugin
host: virtserver.swaggerhub.com
basePath: /GroovySalmon/DOITNOW/v1.0
schemes:
- https
paths:
/vehicles/{id}/data_request/drive_state:
get:
operationId: "drive_state"
description: "Returns the driving and position state of the vehicle"
parameters:
**-name: "id"**
in: "path"
description: "The ID number of the car"
required: true
type: "String"
responses:
200:
description: "Success"
schema:
properties:
shift_state:
type: "String"
example: "sport"
speed:
type: "number"
format: "double"
example: 94.5
latitude:
description: "degrees north of the equator"
type: "number"
format: "double"
example: 37.345
longitude:
description: "degrees west of the prime meridian"
type: "number"
format: "double"
example: 122.1243
heading:
description: "integer compass heading"
type: "integer"
format: "int32"
minimum: 0
maximum: 359
example: 4
gps_as_of:
description: "unix timestamp of gps fix"
example: "1234934991232"
Change
type: "String"
to
type: "string"
Note the lowercase "s" in "string".
All OpenAPI type
values are lowercase and case-sensitive.
Also, make sure there are spaces after -
in parameter definitions (and in YAML lists in general), and that the indentation is correct:
- name: "id"
in: "path"
...