Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
".esm-wrapper.mjs"
],
"scripts": {
"test": "nyc mocha --timeout 5000 --colors -r ts-node/register test/*.ts",
"test": "nyc mocha --timeout 5000 --colors -r ts-node/register test/*.ts src/**/*.test.ts",
"test-example-parse-from-file": "ts-node examples/parse-from-file.ts",
"test-example-parse-schema": "ts-node examples/parse-schema.ts",
"test-time": "ts-node ./test/time-testing.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
SimplifiedSchema
} from './schema-analyzer';
import * as schemaStats from './stats';
import { AnyIterable, StandardJSONSchema, MongoDBJSONSchema, ExtendedJSONSchema } from './types';
import { AnyIterable, StandardJSONSchema, MongoDBJSONSchema, ExpandedJSONSchema } from './types';

/**
* Analyze documents - schema can be retrieved in different formats.
Expand Down Expand Up @@ -77,7 +77,7 @@ export type {
SimplifiedSchema,
StandardJSONSchema,
MongoDBJSONSchema,
ExtendedJSONSchema
ExpandedJSONSchema
};

export {
Expand Down
12 changes: 6 additions & 6 deletions src/schema-accessor.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Schema as InternalSchema } from './schema-analyzer';
import convertors from './schema-convertors';
import { ExtendedJSONSchema, MongoDBJSONSchema, StandardJSONSchema } from './types';
import { ExpandedJSONSchema, MongoDBJSONSchema, StandardJSONSchema } from './types';

export interface SchemaAccessor {
getStandardJsonSchema: () => Promise<StandardJSONSchema>;
getMongoDBJsonSchema: () => Promise<MongoDBJSONSchema>;
getExtendedJsonSchema: () => Promise<ExtendedJSONSchema>;
getExpandedJSONSchema: () => Promise<ExpandedJSONSchema>;
getInternalSchema: () => Promise<InternalSchema>;
}

Expand All @@ -23,13 +23,13 @@ export class InternalSchemaBasedAccessor implements SchemaAccessor {
private internalSchema: InternalSchema;
private standardJSONSchema?: StandardJSONSchema;
private mongodbJSONSchema?: MongoDBJSONSchema;
private extendedJSONSchema?: ExtendedJSONSchema;
private ExpandedJSONSchema?: ExpandedJSONSchema;

constructor(internalSchema: InternalSchema) {
this.internalSchema = internalSchema;
}

async getInternalSchema(options?: Options): Promise<InternalSchema> {
async getInternalSchema(): Promise<InternalSchema> {
return this.internalSchema;
}

Expand All @@ -41,7 +41,7 @@ export class InternalSchemaBasedAccessor implements SchemaAccessor {
return this.mongodbJSONSchema ??= await convertors.internalSchemaToMongoDB(this.internalSchema, options);
}

async getExtendedJsonSchema(options: Options = {}): Promise<ExtendedJSONSchema> {
return this.extendedJSONSchema ??= await convertors.internalSchemaToExtended(this.internalSchema, options);
async getExpandedJSONSchema(options: Options = {}): Promise<ExpandedJSONSchema> {
return this.ExpandedJSONSchema ??= await convertors.internalSchemaToExpanded(this.internalSchema, options);
}
}
35 changes: 0 additions & 35 deletions src/schema-convertors.ts

This file was deleted.

9 changes: 9 additions & 0 deletions src/schema-convertors/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import internalSchemaToExpanded from './internalToExpanded';
import internalSchemaToMongoDB from './internalToMongoDB';
import internalSchemaToStandard from './internalToStandard';

export default {
internalSchemaToStandard,
internalSchemaToMongoDB,
internalSchemaToExpanded
};
12 changes: 12 additions & 0 deletions src/schema-convertors/internalToExpanded.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { InternalSchema } from '..';
import { ExpandedJSONSchema } from '../types';

export default function internalSchemaToExpanded(
/* eslint @typescript-eslint/no-unused-vars: 0 */
internalSchema: InternalSchema,
options: {
signal?: AbortSignal
}): ExpandedJSONSchema {
// TODO: COMPASS-8702
return {} as ExpandedJSONSchema;
}
Loading
Loading