@inlang/project-settings
Advanced tools
Comparing version 2.2.3 to 2.3.0
@@ -79,3 +79,3 @@ import { Type } from "@sinclair/typebox"; | ||
// and `ExternalSettings` which are objects possible | ||
JSON, { additionalProperties: false, description: "Settings defined by apps, plugins, etc." }); | ||
JSON, { description: "Settings defined by apps, plugins, etc." }); | ||
export const ProjectSettings = Type.Intersect([InternalProjectSettings, ExternalProjectSettings]); |
@@ -110,2 +110,3 @@ import { TypeCompiler } from "@sinclair/typebox/compiler"; | ||
}); | ||
// #2325 - types have been loosened to allow for new/unknown properties | ||
it("should enforce namespaces", () => { | ||
@@ -119,5 +120,6 @@ const settings = { | ||
}; | ||
expect(Value.Check(ProjectSettings, settings)).toBe(false); | ||
expect(Value.Check(ProjectSettings, settings)).toBe(true); | ||
}); | ||
it("should fail on unknown types", () => { | ||
// #2325 - types have been loosened to allow for new/unknown properties | ||
it("should not fail on unknown types", () => { | ||
const settings = { | ||
@@ -130,5 +132,6 @@ sourceLanguageTag: "en", | ||
}; | ||
expect(Value.Check(ProjectSettings, settings)).toBe(false); | ||
expect(Value.Check(ProjectSettings, settings)).toBe(true); | ||
}); | ||
it("should enforce camelCase", () => { | ||
// #2325 - types have been loosened to allow for new/unknown properties | ||
it("should not enforce camelCase", () => { | ||
const settings = { | ||
@@ -148,3 +151,3 @@ sourceLanguageTag: "en", | ||
const config = { ...settings, settings: { [failCase]: {} } }; | ||
expect(Value.Check(ProjectSettings, config)).toBe(false); | ||
expect(Value.Check(ProjectSettings, config)).toBe(true); | ||
} | ||
@@ -183,3 +186,4 @@ }); | ||
}); | ||
// (reserving project namespace for internal use only) | ||
// #2325 - no longer blocking new/unknown keys since that breaks installed apps | ||
// when new features in project settings are rolled out | ||
it("should not be possible to define unknown project settings", () => { | ||
@@ -193,3 +197,3 @@ const settings = { | ||
}; | ||
expect(Value.Check(ProjectSettings, settings)).toBe(false); | ||
expect(Value.Check(ProjectSettings, settings)).toBe(true); | ||
}); | ||
@@ -196,0 +200,0 @@ it("should be possible to define known project settings", () => { |
{ | ||
"name": "@inlang/project-settings", | ||
"type": "module", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"license": "Apache-2.0", | ||
@@ -18,4 +18,4 @@ "publishConfig": { | ||
"dependencies": { | ||
"@inlang/language-tag": "1.5.1", | ||
"@inlang/json-types": "1.1.0" | ||
"@inlang/json-types": "1.1.0", | ||
"@inlang/language-tag": "1.5.1" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
@@ -123,2 +123,3 @@ import { TypeCompiler } from "@sinclair/typebox/compiler" | ||
// #2325 - types have been loosened to allow for new/unknown properties | ||
it("should enforce namespaces", () => { | ||
@@ -132,6 +133,7 @@ const settings: ProjectSettings = { | ||
} | ||
expect(Value.Check(ProjectSettings, settings)).toBe(false) | ||
expect(Value.Check(ProjectSettings, settings)).toBe(true) | ||
}) | ||
it("should fail on unknown types", () => { | ||
// #2325 - types have been loosened to allow for new/unknown properties | ||
it("should not fail on unknown types", () => { | ||
const settings: ProjectSettings = { | ||
@@ -144,6 +146,7 @@ sourceLanguageTag: "en", | ||
} | ||
expect(Value.Check(ProjectSettings, settings)).toBe(false) | ||
expect(Value.Check(ProjectSettings, settings)).toBe(true) | ||
}) | ||
it("should enforce camelCase", () => { | ||
// #2325 - types have been loosened to allow for new/unknown properties | ||
it("should not enforce camelCase", () => { | ||
const settings: ProjectSettings = { | ||
@@ -165,3 +168,3 @@ sourceLanguageTag: "en", | ||
const config = { ...settings, settings: { [failCase]: {} } } | ||
expect(Value.Check(ProjectSettings, config)).toBe(false) | ||
expect(Value.Check(ProjectSettings, config)).toBe(true) | ||
} | ||
@@ -203,3 +206,4 @@ }) | ||
// (reserving project namespace for internal use only) | ||
// #2325 - no longer blocking new/unknown keys since that breaks installed apps | ||
// when new features in project settings are rolled out | ||
it("should not be possible to define unknown project settings", () => { | ||
@@ -213,3 +217,3 @@ const settings: ProjectSettings = { | ||
} | ||
expect(Value.Check(ProjectSettings, settings)).toBe(false) | ||
expect(Value.Check(ProjectSettings, settings)).toBe(true) | ||
}) | ||
@@ -216,0 +220,0 @@ |
@@ -103,3 +103,3 @@ import { type Static, type TLiteral, type TTemplateLiteral, Type } from "@sinclair/typebox" | ||
JSON as unknown as typeof JSONObject, | ||
{ additionalProperties: false, description: "Settings defined by apps, plugins, etc." } | ||
{ description: "Settings defined by apps, plugins, etc." } | ||
) | ||
@@ -106,0 +106,0 @@ |
157090
1371