mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 14:02:48 +00:00
test: adjust schema test for broader use cases
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is a simple interface declaration for
|
||||
* testing the schema generation and validation.
|
||||
*
|
||||
* @validatable
|
||||
*/
|
||||
export interface Foo {
|
||||
@@ -21,4 +24,15 @@ export interface Foo {
|
||||
* Dummy parameter
|
||||
*/
|
||||
lorem: 'ipsum';
|
||||
|
||||
/**
|
||||
* String literal type property
|
||||
*/
|
||||
type: FooType;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a simple type declaration for
|
||||
* usage in the Foo interace.
|
||||
*/
|
||||
export type FooType = 'Foo';
|
||||
|
||||
@@ -30,13 +30,20 @@ export class SchemaSpec {
|
||||
const converter = new Converter(join(__dirname, '..', 'src', 'resources'));
|
||||
|
||||
const schema = converter.getSchema('Foo', '0.0.1');
|
||||
|
||||
expect(schema).to.be.deep.equal({
|
||||
$schema: 'http://json-schema.org/draft-06/schema#',
|
||||
additionalProperties: false,
|
||||
definitions: {
|
||||
FooType: {
|
||||
description: 'This is a simple type declaration for\nusage in the Foo interace.',
|
||||
enum: [
|
||||
'Foo',
|
||||
],
|
||||
type: 'string',
|
||||
},
|
||||
SCFoo: {
|
||||
additionalProperties: false,
|
||||
description: 'This is a simple interface declaration for\ntesting the schema generation and validation.',
|
||||
properties: {
|
||||
lorem: {
|
||||
description: 'Dummy parameter',
|
||||
@@ -45,13 +52,19 @@ export class SchemaSpec {
|
||||
],
|
||||
type: 'string',
|
||||
},
|
||||
type: {
|
||||
$ref: '#/definitions/FooType',
|
||||
description: 'String literal type property',
|
||||
},
|
||||
},
|
||||
required: [
|
||||
'lorem',
|
||||
'type',
|
||||
],
|
||||
type: 'object',
|
||||
},
|
||||
},
|
||||
description: 'This is a simple interface declaration for\ntesting the schema generation and validation.',
|
||||
id: 'https://core.stapps.tu-berlin.de/v0.0.1/lib/schema/Foo.json',
|
||||
properties: {
|
||||
lorem: {
|
||||
@@ -61,9 +74,14 @@ export class SchemaSpec {
|
||||
],
|
||||
type: 'string',
|
||||
},
|
||||
type: {
|
||||
$ref: '#/definitions/FooType',
|
||||
description: 'String literal type property',
|
||||
},
|
||||
},
|
||||
required: [
|
||||
'lorem',
|
||||
'type',
|
||||
],
|
||||
type: 'object',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user