Skip to content

declareType function missing checks #1341

@m5x5

Description

@m5x5

declareType (alias: string, uriOrSchema: string|tv4.JsonSchema, schema?: tv4.JsonSchema): void {
let uri: string;
if (schema && typeof uriOrSchema === 'string') {
uri = uriOrSchema;
} else if (!schema && typeof uriOrSchema !== 'string') {
schema = uriOrSchema;
uri = this._defaultTypeURI(alias);
} else if (!schema && typeof uriOrSchema === 'string') {
throw new Error('declareType() requires a JSON Schema object to be passed, in order to validate object types/formats');
}
BaseClient.Types.declare(this.moduleName, alias, uri, schema);
}

I'm currently working on bringing remotestorage to Java (to learn the language) and noticed that there might be an error when schema is given but uriOrSchema is null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions