Fix InstanceConfigSetPropRequest schema

Fix the value incorrectly being set as required in the schema and thus
preventing props on config field objects of the instance from being
removed.
This commit is contained in:
Hornwitser committed 2024-01-24 03:43:21 +01:00
1 parent e3cfc090d3
commit 499e973db9
4 files changed
+12 -2

No files matched your search

+1
View File
@@ -18,6 +18,7 @@
- Fixed host hanging if stopped while an instance is in the process of creating a save during startup.
- Fixed `instance.auto_start` option.
- Fixed host log spammed with errors when plugins broadcast messages to instances with the plugin disabled.
- Fixed properties of object config fields not being possible to remove.
## Version 2.0.0-alpha.14
+1 -1
View File
@@ -459,7 +459,7 @@ export class Config<
setProp<Field extends keyof Fields & string>(
name: Field,
prop: string,
value: unknown,
value?: unknown,
location = this.location,
) {
let def = this.constructor.fieldDefinitions[name];
+1 -1
View File
@@ -208,7 +208,7 @@ export class InstanceConfigSetPropRequest {
"instanceId": Type.Integer(),
"field": Type.String(),
"prop": Type.String(),
"value": Type.Unknown(),
"value": Type.Optional(Type.Unknown()),
});
static fromJSON(json: Static<typeof this.jsonSchema>) {
+9
View File
@@ -557,6 +557,15 @@ describe("Integration of Clusterio", function() {
slowTest(this);
await checkInstanceStatus(44, "running");
});
it("should allow creating and removing props", async function() {
slowTest(this);
await execCtl("instance config set-prop test factorio.settings new_property new-string-value");
let config = await getControl().send(new lib.InstanceConfigGetRequest(44));
assert.equal(config["factorio.settings"]["new_property"], "new-string-value");
await execCtl("instance config set-prop test factorio.settings new_property");
config = await getControl().send(new lib.InstanceConfigGetRequest(44));
assert.equal(config["factorio.settings"]["new_property"], undefined);
});
});
describe("user set-admin/whitelisted/banned", function() {