mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
apiDoc: meta (#8167)
* apiDoc: meta * Update modelsPaths.js * Update error * fix test * Update GET-model_paths.test.js * Fixed test
This commit is contained in:
@@ -10,7 +10,7 @@ describe('GET /models/:model/paths', () => {
|
|||||||
user = await generateUser();
|
user = await generateUser();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns an error when model is not accessible or doesn\'t exists', async () => {
|
it('returns an error when model is not accessible or doesn\'t exist', async () => {
|
||||||
await expect(user.get('/models/1234/paths')).to.eventually.be.rejected.and.eql({
|
await expect(user.get('/models/1234/paths')).to.eventually.be.rejected.and.eql({
|
||||||
code: 400,
|
code: 400,
|
||||||
error: 'BadRequest',
|
error: 'BadRequest',
|
||||||
|
|||||||
@@ -266,5 +266,6 @@
|
|||||||
"invalidReqParams": "Invalid request parameters.",
|
"invalidReqParams": "Invalid request parameters.",
|
||||||
"memberIdRequired": "\"member\" must be a valid UUID.",
|
"memberIdRequired": "\"member\" must be a valid UUID.",
|
||||||
"heroIdRequired": "\"heroId\" must be a valid UUID.",
|
"heroIdRequired": "\"heroId\" must be a valid UUID.",
|
||||||
"cannotFulfillReq":"Your request cannot be fulfilled. Email admin@habitica.com if this error persists."
|
"cannotFulfillReq":"Your request cannot be fulfilled. Email admin@habitica.com if this error persists.",
|
||||||
|
"modelNotFound":"This model does not exist."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,24 @@ let allModels = ['user', 'tag', 'challenge', 'group'].concat(tasksModels);
|
|||||||
* @apiName GetUserModelPaths
|
* @apiName GetUserModelPaths
|
||||||
* @apiGroup Meta
|
* @apiGroup Meta
|
||||||
*
|
*
|
||||||
* @apiParam {String="user","group","challenge","tag","habit","daily","todo","reward"} model The name of the model
|
* @apiParam (Path) {String="user","group","challenge","tag","habit","daily","todo","reward"} model The name of the model
|
||||||
|
*
|
||||||
|
* @apiExample {curl} Tag
|
||||||
|
* curl https://habitica.com/api/v3/models/tag/paths
|
||||||
*
|
*
|
||||||
* @apiSuccess {Object} data A key-value object made of fieldPath: fieldType (like {'field.nested': Boolean})
|
* @apiSuccess {Object} data A key-value object made of fieldPath: fieldType (like {'field.nested': Boolean})
|
||||||
|
*
|
||||||
|
* @apiSuccessExample {json} Tag
|
||||||
|
* {
|
||||||
|
* "success":true,
|
||||||
|
* "data": {
|
||||||
|
* "id":"String",
|
||||||
|
* "name":"String",
|
||||||
|
* "challenge":"String"
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @apiError (400) {badRequest} modelNotFound The model specified was not found
|
||||||
*/
|
*/
|
||||||
api.getModelPaths = {
|
api.getModelPaths = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|||||||
Reference in New Issue
Block a user