mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Make ModInfo.jsonSchema strict about the major.minor factorio_version
The stored ModInfo always normalises factorio_version to a major.minor (see fromJSON), so the serialised schema can use the strict MajorMinorVersionSchema while infoJsonSchema keeps the lenient GameVersionSchema for raw info.json. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
7c2793752d
commit
5b1f7d796d
1 file changed
+4
-1
@@ -11,7 +11,7 @@ import {
|
|||||||
FullVersion, integerFullVersion,
|
FullVersion, integerFullVersion,
|
||||||
integerPartialVersion,
|
integerPartialVersion,
|
||||||
GameVersionSchema, normaliseGameVersion, normaliseMajorMinorVersion,
|
GameVersionSchema, normaliseGameVersion, normaliseMajorMinorVersion,
|
||||||
MajorMinorVersion,
|
MajorMinorVersion, MajorMinorVersionSchema,
|
||||||
ModVersionEquality,
|
ModVersionEquality,
|
||||||
} from "./version";
|
} from "./version";
|
||||||
|
|
||||||
@@ -266,6 +266,9 @@ export default class ModInfo {
|
|||||||
|
|
||||||
static jsonSchema = Type.Object({
|
static jsonSchema = Type.Object({
|
||||||
...this.infoJsonSchema.properties,
|
...this.infoJsonSchema.properties,
|
||||||
|
// The stored value is always normalised to a strict major.minor (see fromJSON),
|
||||||
|
// unlike the lenient info.json schema above.
|
||||||
|
"factorio_version": Type.Optional(MajorMinorVersionSchema),
|
||||||
"size": Type.Optional(Type.Integer()),
|
"size": Type.Optional(Type.Integer()),
|
||||||
"mtime_ms": Type.Optional(Type.Number()),
|
"mtime_ms": Type.Optional(Type.Number()),
|
||||||
"sha1": Type.Optional(Type.String()),
|
"sha1": Type.Optional(Type.String()),
|
||||||
|
|||||||
Reference in new issue
Block a user