Parser error, duplicated mapping key, Jump to line 52 Issues while adding common parameter id
CodePudding user response:
Line 44 is over-indented. Replace
/tasks/{id}:
get:
with
/tasks/{id}:
get:
CodePudding user response:
There was a lot to fix.
There there multiple parameters
defined in one operation.
The path /tasks/{id}
was defined multiple times.
=> You have to use once and put each http-method inside this path.
I tried my best to create the YAML and I hope I fixed it correctly. It's much easier to do such stuff, if the complete code is part of the question.
openapi: 3.0.1
info:
title: Sample API v2
description: Sample Data API v2
contact:
name: John Smith
email: [email protected]
version: v2
servers:
- url: https://task-manager-pvs.herokuapp.com/
paths:
/tasks:
get:
tags:
- Tasks
summary: Get All Tasks
operationId: GetAllTasks
parameters: []
responses:
'200':
description: ''
headers: {}
deprecated: false
security: []
post:
tags:
- Tasks
summary: Create Task
operationId: CreateTask
parameters: []
requestBody:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTaskRequest'
example:
name: test
required: true
responses:
'200':
description: ''
headers: {}
deprecated: false
security: []
/tasks/{id}:
get:
tags:
- Single Task
parameters:
- name: id
in: path
required: true
schema:
type: string
description: The Task ID
summary: Get Single Task
operationId: GetSingleTask
responses:
'200':
description: ''
headers: {}
deprecated: false
security: []
patch:
tags:
- Single Task
summary: Update Task
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The Task ID
operationId: UpdateTask
requestBody:
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateTaskRequest'
example:
name: st
required: true
responses:
'200':
description: ''
headers: {}
deprecated: false
security: []
delete:
parameters:
- in: path
name: id
schema:
type: string
required: true
description: The Task ID
tags:
- Single Task
summary: Delete Task
operationId: DeleteTask
responses:
'200':
description: ''
headers: {}
deprecated: false
security: []
components:
schemas:
CreateTaskRequest:
title: CreateTaskRequest
required:
- name
type: object
properties:
name:
type: string
example:
name: test
UpdateTaskRequest:
title: UpdateTaskRequest
required:
- name
type: object
properties:
name:
type: string
example:
name: st
tags:
- name: Tasks
description: ''
- name: Single Task
description: ''