Create a version: The `dependencies` property is not marked as required
MMK21Hub opened this issue · 4 comments
The bug
In the API documentation for the "Create a version" route (POST /version
), the dependencies
field in the request body is not listed as required. However, the API treats it as a required field. (See the relevant labrinth source code, where you can compare the dependencies
field to the actually-optional version_body
field.)
In addition, the documentation mentions that the dependencies
field can be set to null, but this is also contrary to how the API behaves.
API error message
Error while parsing JSON: missing field `dependencies` at line 1 column 240
To Reproduce
Verify that the documentation doesn't mark the dependencies
property as required.
Sending a HTTP POST request to https://staging-api.modrinth.com/v2/version with an otherwise-valid payload that doesn't include the dependencies
field. Verify that the API responds with an error.
Expected behavior
The documentation would mark the dependencies
property as required, and it would not mention the possibility of it being null
.
The documentation should also note that to create a version without dependencies, an empty array should be provided. Note that this is what the official frontend does when creating a version.
Notes
Geometrically has confirmed that the current API behaviour is indeed correct in a comment.
Transferring this to docs as this field should be marked as required
I don't see why we can't just do default Vec::new on it
This is still an issue. It doesn't matter whether it's optional or whether you have to specify an empty list, but the docs should be fixed to reflect the current state.
I've updated the issue's description to reflect it being moved to the docs
project.