refactor: swap out jsonschema package for json-schema

This commit is contained in:
Wieland Schöbl
2020-02-18 14:27:44 +01:00
committed by Rainer Killinger
parent d3b620a745
commit 827ba47892
6 changed files with 813 additions and 829 deletions

1613
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -42,18 +42,19 @@
"Roman Klopsch"
],
"dependencies": {
"@openstapps/core-tools": "0.16.0",
"@types/geojson": "1.0.6",
"@types/json-patch": "0.0.30",
"@types/json-schema": "7.0.6",
"@types/node": "10.17.14",
"fast-clone": "1.5.13",
"http-status-codes": "2.1.2",
"json-patch": "0.7.0",
"jsonschema": "1.2.5",
"json-schema": "0.2.5",
"ts-optchain": "0.1.8"
},
"devDependencies": {
"@openstapps/configuration": "0.24.0",
"@openstapps/core-tools": "0.14.0",
"@openstapps/logger": "0.5.0",
"@types/chai": "4.2.12",
"@types/rimraf": "3.0.0",
@@ -67,8 +68,8 @@
"source-map-support": "0.5.19",
"ts-node": "9.0.0",
"tslint": "6.1.3",
"typedoc": "0.14.2",
"typescript": "3.5.3"
"typedoc": "0.18.0",
"typescript": "3.8.3"
},
"nyc": {
"all": true,

View File

@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {ValidationError} from '@openstapps/core-tools/lib/common';
import {BAD_REQUEST} from 'http-status-codes';
import {ValidationError} from 'jsonschema';
import {SCError} from '../error';
/**

View File

@@ -13,7 +13,7 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {OK} from 'http-status-codes';
import {Schema} from 'jsonschema';
import {JSONSchema7} from 'json-schema';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
@@ -78,12 +78,12 @@ export interface SCPluginMetaData {
/**
* How the requests of the plugin looks like, a JSON schema for validation
*/
requestSchema: Schema;
requestSchema: JSONSchema7;
/**
* How the responses of the plugin looks like, a JSON schema for validation
*/
responseSchema: Schema;
responseSchema: JSONSchema7;
/**
* The desired route, for example /feedback.

View File

@@ -189,7 +189,7 @@ export class SCThingTranslator {
* // or
* const dishTranslatedAccess = translator.translate(dish);
* dishTranslatedAccess.offers[0].inPlace.categories[1]();
* // undoing the TSTSOCType<T>
* // undoing the TSOCType<T>
* const dishAsBefore: SCDish = dishTranslatedAccess()!;
* @param data Top level object that gets passed through the recursion
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
@@ -231,7 +231,7 @@ export class SCThingTranslator {
/**
* Given a SCThingType this function will translate it
*
*
* @param type The type that will be translated
* @param language The language the type will be translated to
* @returns Known translation of type parameter

View File

@@ -6,7 +6,7 @@
"address": "http://foo.com:1234",
"name": "Foo Plugin",
"requestSchema": {
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"SCFooPluginRequest": {
"type": "object",
@@ -33,10 +33,10 @@
],
"additionalProperties": false,
"description": "User query",
"id": "https://core.stapps.tu-berlin.de/v0.18.0/lib/schema/SCFooPluginRequest.json"
"$id": "https://core.stapps.tu-berlin.de/v0.18.0/lib/schema/SCFooPluginRequest.json"
},
"responseSchema": {
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"SCFooPluginResponse": {
"type": "object",
@@ -65,7 +65,7 @@
],
"additionalProperties": false,
"description": "A response to a query",
"id": "https://core.stapps.tu-berlin.de/v0.18.0/lib/schema/SCFooPluginResponse.json"
"$id": "https://core.stapps.tu-berlin.de/v0.18.0/lib/schema/SCFooPluginResponse.json"
},
"route": "/foo"
}