feat: use tag @validatable to mark schema types

This commit is contained in:
Karl-Philipp Wulfert
2019-01-08 14:46:13 +01:00
parent 75ceeb4500
commit 7f248eea13
42 changed files with 92 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ import { SCLicensePlate } from '../types/namespaces';
/** /**
* A configuration file that configures app and backend * A configuration file that configures app and backend
* @validatable
*/ */
export interface SCConfigFile { export interface SCConfigFile {

View File

@@ -16,6 +16,8 @@ import {ValidationError} from 'jsonschema';
/** /**
* A generic error that can be returned by the backend if somethings fails during the processing of a request * A generic error that can be returned by the backend if somethings fails during the processing of a request
*
* @validatable
*/ */
export interface SCErrorResponse extends Error { export interface SCErrorResponse extends Error {
/** /**
@@ -126,11 +128,11 @@ export class SCNotFoundErrorResponse extends SCError {
} }
/** /**
* An error that is returned, when an internal server error occured * An error that is returned, when an internal server error occurred
*/ */
export class SCInternalServerErrorResponse extends SCError { export class SCInternalServerErrorResponse extends SCError {
/** /**
* Internal error that occured. If the stack is disabled this error is not set for security reasons * Internal error that occurred. If the stack is disabled this error is not set for security reasons
*/ */
additionalData?: Error; additionalData?: Error;

View File

@@ -16,6 +16,8 @@ import {SCAbstractRoute} from '../../../Route';
/** /**
* Index request * Index request
*
* @validatable
*/ */
export interface SCIndexRequest { export interface SCIndexRequest {
} }

View File

@@ -17,6 +17,8 @@ import {SCBackendConfiguration} from '../../../types/config/Backend';
/** /**
* A response to an index request * A response to an index request
*
* @validatable
*/ */
export interface SCIndexResponse { export interface SCIndexResponse {
app: SCAppConfiguration; app: SCAppConfiguration;

View File

@@ -17,6 +17,8 @@ import {SCAbstractRoute} from '../../../../Route';
/** /**
* Request to update an existing thing * Request to update an existing thing
*
* @validatable
*/ */
export type SCThingUpdateRequest = SCThings; export type SCThingUpdateRequest = SCThings;

View File

@@ -14,6 +14,8 @@
*/ */
/** /**
* Response for an entity update request * Response for an entity update request
*
* @validatable
*/ */
export interface SCThingUpdateResponse { export interface SCThingUpdateResponse {
} }

View File

@@ -17,6 +17,7 @@ import {SCUuid} from '../../../types/UUID';
/** /**
* Request to check the availability of books * Request to check the availability of books
* @validatable
*/ */
export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid; export type SCBookAvailabilityRequest = SCBookAvailabilityRequestByIsbn | SCBookAvailabilityRequestByUuid;

View File

@@ -16,5 +16,6 @@ import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../../base/
/** /**
* List of availabilities of a book * List of availabilities of a book
* @validatable
*/ */
export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>; export type SCBookAvailabilityResponse = Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;

View File

@@ -20,6 +20,8 @@ import {SCISO8601Date} from '../../../types/Time';
* A bulk request * A bulk request
* *
* Parameters to be sent to request a new bulk. * Parameters to be sent to request a new bulk.
*
* @validatable
*/ */
export interface SCBulkRequest extends SCBulkParameters { export interface SCBulkRequest extends SCBulkParameters {
} }

View File

@@ -17,6 +17,8 @@ import {SCBulkParameters} from './BulkRequest';
/** /**
* Requested Bulk from backend * Requested Bulk from backend
*
* @validatable
*/ */
export interface SCBulkResponse extends SCBulkParameters { export interface SCBulkResponse extends SCBulkParameters {
/** /**

View File

@@ -17,6 +17,7 @@ import {SCAbstractRoute} from '../../../../Route';
/** /**
* Request to add a thing to a bulk * Request to add a thing to a bulk
* @validatable
*/ */
export type SCBulkAddRequest = SCThings; export type SCBulkAddRequest = SCThings;

View File

@@ -14,6 +14,7 @@
*/ */
/** /**
* Response to a request to add a thing to a bulk * Response to a request to add a thing to a bulk
* @validatable
*/ */
export interface SCBulkAddResponse { export interface SCBulkAddResponse {
} }

View File

@@ -16,6 +16,7 @@ import {SCAbstractRoute} from '../../../../Route';
/** /**
* Request to change the bulk state to done (close the bulk process) * Request to change the bulk state to done (close the bulk process)
* @validatable
*/ */
export interface SCBulkDoneRequest { export interface SCBulkDoneRequest {
} }

View File

@@ -14,6 +14,7 @@
*/ */
/** /**
* Response to a request to change the state of a bulk to done * Response to a request to change the state of a bulk to done
* @validatable
*/ */
export interface SCBulkDoneResponse { export interface SCBulkDoneResponse {
} }

View File

@@ -17,6 +17,8 @@ import {SCMessage} from '../../../things/Message';
/** /**
* User feedback * User feedback
*
* @validatable
*/ */
export interface SCFeedbackRequest extends SCMessage { export interface SCFeedbackRequest extends SCMessage {
/** /**

View File

@@ -14,6 +14,8 @@
*/ */
/** /**
* A response to a feedback request * A response to a feedback request
*
* @validatable
*/ */
export interface SCFeedbackResponse { export interface SCFeedbackResponse {
} }

View File

@@ -21,6 +21,8 @@ import {SCSearchQuery} from './SearchRequest';
* This is a map of [[SCSearchRequest]]s indexed by name. * This is a map of [[SCSearchRequest]]s indexed by name.
* *
* **CAUTION: This is limited to an amount of queries. Currently this limit is 5.** * **CAUTION: This is limited to an amount of queries. Currently this limit is 5.**
*
* @validatable
*/ */
export interface SCMultiSearchRequest { export interface SCMultiSearchRequest {
[k: string]: SCSearchQuery; [k: string]: SCSearchQuery;

View File

@@ -18,6 +18,8 @@ import {SCSearchResult} from './SearchResponse';
* A multi search response * A multi search response
* *
* This is a map of [[SCSearchResponse]]s indexed by name * This is a map of [[SCSearchResponse]]s indexed by name
*
* @validatable
*/ */
export interface SCMultiSearchResponse { export interface SCMultiSearchResponse {
[k: string]: SCSearchResult; [k: string]: SCSearchResult;

View File

@@ -18,6 +18,8 @@ import {SCSearchSort} from '../../../types/sorts/Abstract';
/** /**
* A search request * A search request
*
* @validatable
*/ */
export interface SCSearchRequest extends SCSearchQuery { export interface SCSearchRequest extends SCSearchQuery {
} }

View File

@@ -16,6 +16,8 @@ import {SCThings, SCThingsField} from '../../../Classes';
/** /**
* A search response * A search response
*
* @validatable
*/ */
export interface SCSearchResponse extends SCSearchResult { export interface SCSearchResponse extends SCSearchResult {
} }

View File

@@ -49,6 +49,11 @@ export interface SCAcademicEventWithoutReferences
type: SCThingType.AcademicEvent; type: SCThingType.AcademicEvent;
} }
/**
* An academic event
*
* @validatable
*/
export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferences { export interface SCAcademicEvent extends SCEvent, SCAcademicEventWithoutReferences {
/** /**
* Translated fields of an academic event * Translated fields of an academic event

View File

@@ -50,6 +50,8 @@ export interface SCArticleWithoutReferences
/** /**
* An article * An article
*
* @validatable
*/ */
export interface SCArticle extends SCCreativeWork, SCArticleWithoutReferences { export interface SCArticle extends SCCreativeWork, SCArticleWithoutReferences {
/** /**

View File

@@ -54,6 +54,8 @@ export interface SCBookWithoutReferences extends SCCreativeWorkWithoutReferences
/** /**
* A book * A book
*
* @validatable
*/ */
export interface SCBook extends SCCreativeWork, SCBookWithoutReferences { export interface SCBook extends SCCreativeWork, SCBookWithoutReferences {
/** /**

View File

@@ -56,6 +56,11 @@ export interface SCBuildingWithoutReferences
type: SCThingType.Building; type: SCThingType.Building;
} }
/**
* A building
*
* @validatable
*/
export interface SCBuilding extends SCBuildingWithoutReferences { export interface SCBuilding extends SCBuildingWithoutReferences {
/** /**
* Type of the building * Type of the building

View File

@@ -37,6 +37,8 @@ export interface SCCatalogWithoutReferences
/** /**
* A catalog * A catalog
*
* @validatable
*/ */
export interface SCCatalog extends SCCatalogWithoutReferences { export interface SCCatalog extends SCCatalogWithoutReferences {
/** /**

View File

@@ -61,6 +61,8 @@ export interface SCCourseOfStudiesWithoutReferences extends
/** /**
* A course of studies * A course of studies
*
* @validatable
*/ */
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences { export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
/** /**

View File

@@ -73,6 +73,8 @@ export interface SCDateSeriesWithoutReferences
/** /**
* A date series * A date series
*
* @validatable
*/ */
export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace { export interface SCDateSeries extends SCDateSeriesWithoutReferences, SCThingInPlace {
/** /**

View File

@@ -12,6 +12,7 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import * as jsonpatch from 'json-patch';
import {SCThingsWithoutDiff} from '../Classes'; import {SCThingsWithoutDiff} from '../Classes';
import {SCThing, SCThingMeta, SCThingType} from '../Thing'; import {SCThing, SCThingMeta, SCThingType} from '../Thing';
import {SCISO8601Date} from '../types/Time'; import {SCISO8601Date} from '../types/Time';
@@ -43,6 +44,8 @@ export interface SCDiffWithoutReferences extends SCThing {
/** /**
* A diff * A diff
*
* @validatable
*/ */
export interface SCDiff extends SCDiffWithoutReferences { export interface SCDiff extends SCDiffWithoutReferences {
/** /**

View File

@@ -66,6 +66,8 @@ export interface SCDishWithoutReferences
/** /**
* A dish * A dish
*
* @validatable
*/ */
export interface SCDish extends SCDishWithoutReferences, SCThingInPlace { export interface SCDish extends SCDishWithoutReferences, SCThingInPlace {
/** /**

View File

@@ -50,6 +50,8 @@ export interface SCFavoriteWithoutReferences extends SCThing {
/** /**
* A favorite * A favorite
*
* @validatable
*/ */
export interface SCFavorite extends SCFavoriteWithoutReferences { export interface SCFavorite extends SCFavoriteWithoutReferences {
/** /**

View File

@@ -46,6 +46,8 @@ export interface SCFloorWithoutReferences extends SCThing {
/** /**
* A floor * A floor
*
* @validatable
*/ */
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace { export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
/** /**

View File

@@ -54,6 +54,8 @@ export interface SCMessageWithoutReferences extends SCCreativeWorkWithoutReferen
/** /**
* A message * A message
*
* @validatable
*/ */
export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences { export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
/** /**

View File

@@ -27,6 +27,8 @@ export interface SCOrganizationWithoutReferences extends SCThing {
/** /**
* An organization * An organization
*
* @validatable
*/ */
export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace { export interface SCOrganization extends SCOrganizationWithoutReferences, SCThingInPlace {
/** /**

View File

@@ -99,6 +99,8 @@ export interface SCPersonWithoutReferences extends SCThing {
/** /**
* A person * A person
*
* @validatable
*/ */
export interface SCPerson extends SCPersonWithoutReferences { export interface SCPerson extends SCPersonWithoutReferences {
/** /**

View File

@@ -42,6 +42,8 @@ export interface SCPointOfInterestWithoutReferences
/** /**
* A point of interest * A point of interest
*
* @validatable
*/ */
export interface SCPointOfInterest extends SCPointOfInterestWithoutReferences, SCThingInPlace { export interface SCPointOfInterest extends SCPointOfInterestWithoutReferences, SCThingInPlace {
/** /**

View File

@@ -70,6 +70,8 @@ export interface SCRoomWithoutReferences
/** /**
* A room * A room
*
* @validatable
*/ */
export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace { export interface SCRoom extends SCRoomWithoutReferences, SCThingInPlace {
/** /**

View File

@@ -34,6 +34,8 @@ export interface SCSemesterWithoutReferences extends SCAcademicTermWithoutRefere
/** /**
* A semester * A semester
*
* @validatable
*/ */
export interface SCSemester extends SCSemesterWithoutReferences { export interface SCSemester extends SCSemesterWithoutReferences {
/** /**

View File

@@ -13,7 +13,8 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { import {
SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferences,
} from '../base/ThingWithCategories'; } from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing'; import {SCThingMeta, SCThingType} from '../Thing';
@@ -56,6 +57,8 @@ export type SCSettingInputType = SCSettingSingleChoice
/** /**
* A setting with references * A setting with references
*
* @validatable
*/ */
export interface SCSetting extends SCSettingWithoutReferences { export interface SCSetting extends SCSettingWithoutReferences {
/** /**

View File

@@ -27,6 +27,8 @@ export interface SCSportCourseWithoutReferences extends SCEventWithoutReferences
/** /**
* A sport course * A sport course
*
* @validatable
*/ */
export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences { export interface SCSportCourse extends SCEvent, SCSportCourseWithoutReferences {
/** /**

View File

@@ -43,6 +43,8 @@ export interface SCTicketWithoutReferences extends SCThing {
/** /**
* A ticket * A ticket
*
* @validatable
*/ */
export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace { export interface SCTicket extends SCTicketWithoutReferences, SCThingInPlace {
/** /**

View File

@@ -36,6 +36,8 @@ export interface SCTourWithoutReferences extends SCThing {
/** /**
* A tour * A tour
*
* @validatable
*/ */
export interface SCTour extends SCTourWithoutReferences { export interface SCTour extends SCTourWithoutReferences {
/** /**

View File

@@ -99,6 +99,8 @@ export interface SCVideoTrack {
/** /**
* A video * A video
*
* @validatable
*/ */
export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences { export interface SCVideo extends SCCreativeWork, SCVideoWithoutReferences {
/** /**