Skip to content

Same endpoint for POST and GET method without the duplicate key error? #2699

Closed Answered by hkosova
Nikola-Milovic asked this question in Q&A
Discussion options

You must be logged in to vote

A path item can contain only one $ref. You'll have to put the GET and POST definitions into the same file so they can be $ref'erenced together:

paths:
  /task-items/create:
    $ref: 'paths/task-items.create.yml'
  /task-lists:
    $ref: 'paths/task-lists.yml'   # <------
# task-lists.yml
get:
  summary: Get task lists
  ...

post:
  summary: Create a task list
  ...

Replies: 4 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@Nikola-Milovic
Comment options

@webron
Comment options

@Nikola-Milovic
Comment options

@webron
Comment options

@Nikola-Milovic
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@hkosova
Comment options

Answer selected by handrews
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #2698 on September 03, 2021 18:19.