Skip to content

Commit

Permalink
Merge pull request #5 from Exabyte-io/fix/hotfix-cache
Browse files Browse the repository at this point in the history
hotfix: disable cache
  • Loading branch information
timurbazhirov authored Oct 19, 2022
2 parents b9cef4a + 1221ea4 commit e4dfbde
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/JsonToSimpleSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export default class JsonToSimpleSchema {
const schemaId = this.jsonSchema?.schemaId;
const properties = getJsonSchemaProperties(this.jsonSchema);

if (schemaId && schemaCache.has(schemaId)) {
return schemaCache.get(schemaId);
}
// if (schemaId && schemaCache.has(schemaId)) {
// return schemaCache.get(schemaId);
// }

const simpleSchemaEntries = Object.entries(properties).reduce(
(accumulatedEntries, [propertyName, jsonProperty]) => {
Expand Down
50 changes: 25 additions & 25 deletions tests/JsonToSimpleSchema.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,29 +299,29 @@ describe("JsonToSimpleSchema", () => {
});
});

it("Cache schemas", () => {
new JsonToSimpleSchema({
schemaId: "cache-test",
...baseJsonSchema,
}).toSimpleSchema();

const simpleSchema = new JsonToSimpleSchema({
schemaId: "cache-test",
type: "object",
properties: {
_id: {
description: "The unique identifier for a product",
type: "integer",
},
},
}).toSimpleSchema();

const rawSchema = simpleSchema._schema;

// eslint-disable-next-line no-unused-expressions
expect(rawSchema._id).to.be.undefined;

expect(rawSchema.id.type.definitions[0].type).to.equal(SimpleSchema.Integer);
expect(rawSchema.id.optional).to.equal(false);
});
// it("Cache schemas", () => {
// new JsonToSimpleSchema({
// schemaId: "cache-test",
// ...baseJsonSchema,
// }).toSimpleSchema();

// const simpleSchema = new JsonToSimpleSchema({
// schemaId: "cache-test",
// type: "object",
// properties: {
// _id: {
// description: "The unique identifier for a product",
// type: "integer",
// },
// },
// }).toSimpleSchema();

// const rawSchema = simpleSchema._schema;

// // eslint-disable-next-line no-unused-expressions
// expect(rawSchema._id).to.be.undefined;

// expect(rawSchema.id.type.definitions[0].type).to.equal(SimpleSchema.Integer);
// expect(rawSchema.id.optional).to.equal(false);
// });
});

0 comments on commit e4dfbde

Please sign in to comment.