Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rust): several schema validation fixes (#1845)
## Problem An exported profile is not valid. ```shell # agama config show > profile.json # agama profile validate profile.json ✗ The profile is not valid. Please, check the following errors: * Additional properties are not allowed ('autoconnect', 'ignoreAutoDns', 'status' were unexpected). ValidationError { instance: Object {"autoconnect": Bool(true), "id": String("Wired connection 1"), "ignoreAutoDns": Bool(false), "interface": String("enp1s0"), "method4": String("auto"), "method6": String("auto"), "status": String("up")}, kind: AdditionalProperties { unexpected: ["autoconnect", "ignoreAutoDns", "status"] }, instance_path: JSONPointer([Property("network"), Property("connections"), Index(0)]), schema_path: JSONPointer([Keyword("properties"), Property("network"), Keyword("properties"), Property("connections"), Keyword("items"), Keyword("additionalProperties")]) } * null is not of type "string". ValidationError { instance: Null, kind: Type { kind: Single(String) }, instance_path: JSONPointer([Property("product"), Property("registrationCode")]), schema_path: JSONPointer([Keyword("properties"), Property("product"), Keyword("properties"), Property("registrationCode"), Keyword("type")]) } * null is not of type "string". ValidationError { instance: Null, kind: Type { kind: Single(String) }, instance_path: JSONPointer([Property("product"), Property("registrationEmail")]), schema_path: JSONPointer([Keyword("properties"), Property("product"), Keyword("properties"), Property("registrationEmail"), Keyword("type")]) } * null is not of type "string". ValidationError { instance: Null, kind: Type { kind: Single(String) }, instance_path: JSONPointer([Property("root"), Property("sshPublicKey")]), schema_path: JSONPointer([Keyword("properties"), Property("root"), Keyword("properties"), Property("sshPublicKey"), Keyword("type")]) } * Additional properties are not allowed ('autologin' was unexpected). ValidationError { instance: Object {"autologin": Bool(false), "fullName": String(""), "hashedPassword": Bool(false), "password": String(""), "userName": String("")}, kind: AdditionalProperties { unexpected: ["autologin"] }, instance_path: JSONPointer([Property("user")]), schema_path: JSONPointer([Keyword("properties"), Property("user"), Keyword("additionalProperties")]) } ``` ## Solution Fix both the exported values and the JSON schema. ```shell # agama config show > profile.json # agama profile validate profile.json ✓ The profile is valid. ```
- Loading branch information