Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Commit dc66210

Browse files
committed
Update schema errors, fix model script
1 parent b0286c3 commit dc66210

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

scripts/generateTables.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const https = require('https');
22
const fs = require('fs');
33

44
function downloadDocs () {
5-
return new Promise((resolve) => {
6-
const docsUrl = "https://api.bleeding.maps4news.com/docs";
5+
return new Promise((resolve, reject) => {
6+
const docsUrl = 'https://api.beta.maps4news.com/docs';
77

88
https.get(docsUrl, function (res) {
99
let body = '';
@@ -65,7 +65,7 @@ function generateTables (models) {
6565
return string.trimRight();
6666
}
6767

68-
function writeFile(content) {
68+
function writeFile (content) {
6969
fs.writeFileSync(`${__dirname}/../source/includes/_models.md`, content);
7070
}
7171

source/v1/index.html.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,46 @@ To Log in and try it out hit the "Try out" button.
144144
"type": "ValidationException",
145145
"message": "Input data failed to pass validation",
146146
"validation_errors": {
147-
"attribute": "validation error for the attribute"
147+
"attribute": [
148+
"validation error for the attribute"
149+
]
148150
}
149151
}
150152
}
151153
```
152154

155+
> For Error Responses With JSON Schema Errors (Current only used when creating a Job Revision)
156+
157+
```json
158+
{
159+
"success": false,
160+
"error": {
161+
"type": "ValidationException",
162+
"message": "Input data failed to pass validation",
163+
"validation_errors": {
164+
"attribute": [
165+
"validation error for the attribute"
166+
]
167+
},
168+
"schema_errors": [
169+
{
170+
"property": "data.meta",
171+
"pointer": "/data/meta",
172+
"message": "The propery meta is required",
173+
"constraint": "required",
174+
"context": 1
175+
}
176+
]
177+
}
178+
}
179+
```
180+
153181
All JSON responses from the API is wrapped in a base object.
154182

155183
Be sure to include an `Accept: application/json` header, otherwise errors like `401`, `403` & `404` will either return HTML or redirect you to the login page.
156184

157185
<aside class="warning">
158-
The current version (1.4.2) returns `validation_errors` as an array of strings, this behavior will change the one described on the right in the next version 1.4.3. (no release ETA)
186+
The current version (1.4.2) returns `validation_errors` as an array of strings, this behavior will change the one described on the right in the next version 1.4.3. (there is currently no release ETA). The new behavior is available on beta.
159187
</aside>
160188

161189

0 commit comments

Comments
 (0)