Using resource added through POST, but resource is created async
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior. How do you call the dredd command? Which command line options?
Expected behavior A clear and concise description of what you expected to happen. We're using dredd to use the dredd.yml spec to perform an order of requests:
- Adding a show
- Getting resources for a show
- Other actions we want to do on a show
- Delete show
Only issue is that the application will add the show threaded. Meaning it will provide a queue item id back as response. And then start adding the show.
The followup requests will asume the show has been added to the db. But it hasn't. Is there are way to build in a delay, to make sure the show has been added at that point.
Nicer solution would be the ability to loop a different requests for a max of time, to check if the show has been added. In our frontend we utilize the queue item id for that.
What is in your dredd.yml?
Order of requests for:
- Adding a show
- Getting resources for a show
- Other actions we want to do on a show
- Delete show
/series:
post:
summary: Add series
description: |
Given an indexer and its id, adds the series to Medusa.
parameters:
- name: series
in: body
required: true
description: Only id (with indexer information) should be specified
schema:
example:
id:
tvdb: 301824
responses:
201:
description: Series added
headers:
Location:
type: string
description: The location of the newly added series
schema:
$ref: '#/definitions/SeriesQueueItem'
400:
$ref: '#/responses/error'
description: Invalid request
x-request:
body: {}
404:
$ref: '#/responses/error'
description: Series not found in the indexer
x-request:
body:
id:
tvdb: 99999999
409:
$ref: '#/responses/error'
description: Series already added
get:
summary: Return series that the user has access to
description: |
The Series endpoint returns information about the Series added to Medusa.
parameters:
- name: paused
in: query
required: false
description: Filter series based on paused status
type: boolean
- $ref: '#/parameters/detailed'
- $ref: '#/parameters/episodes'
- $ref: '#/parameters/page'
- $ref: '#/parameters/limit'
- $ref: '#/parameters/sort'
responses:
200:
$ref: '#/responses/pagination'
description: A paged array of series
schema:
type: array
items:
$ref: '#/definitions/Series'
400:
$ref: '#/responses/error'
description: Invalid pagination parameters
x-request:
query-params:
sort: abc
/series/{id}:
get:
summary: Return information about a specific series
description: Retrieves information about a specific series
parameters:
- $ref: '#/parameters/series-id'
name: id
- $ref: '#/parameters/detailed'
- $ref: '#/parameters/episodes'
responses:
200:
description: The series information
schema:
$ref: '#/definitions/Series'
400:
$ref: '#/responses/error'
description: Invalid id
x-request:
path-params:
id: 123456
404:
$ref: '#/responses/error'
description: Series not found
x-request:
path-params:
id: tvdb999999999
patch:
summary: Partial update series
description: Partial update series
parameters:
- $ref: '#/parameters/series-id'
name: id
- name: series
in: body
required: false
description: Currently, only pause field is supported
schema:
$ref: '#/definitions/Series'
responses:
200:
description: Response with only the updated fields
schema:
$ref: '#/definitions/Series'
x-request:
body:
{"tvdb": 301824, "paused": true}
400:
$ref: '#/responses/error'
description: Conflicting series identifier
x-request:
body:
id:
tvdb: 80379
path-params:
id: tvdb301824
404:
$ref: '#/responses/error'
description: Series not found
x-request:
body:
id:
tvdb: 999999999
path-params:
id: tvdb999999999
delete:
summary: Delete a series
description: Delete a series
parameters:
- $ref: '#/parameters/series-id'
name: id
- name: remove-files
in: query
required: false
description: Whether files from the series should be removed
type: boolean
responses:
204:
description: Series is deleted successfully
400:
$ref: '#/responses/error'
description: Invalid id
x-request:
path-params:
id: 123456
404:
$ref: '#/responses/error'
description: Series not found
x-request:
path-params:
id: tvdb999999999
409:
$ref: '#/responses/error'
description: Unable to delete series
What's your dredd --version output?
dredd v13.1.2 (Windows_NT 10.0.18363; x64)
Does dredd --loglevel=debug uncover something?
If you run Dredd with debugging output, do you see any interesting information relevant to the bug?
We changed from adding shows sync to async.
After the change, we noticed subsequent requests where failing.
Can you send us failing test in a Pull Request? We'll gladly help you to contribute; answering yes raises the chances the issue gets fixed.
Anyone 🙏?