From 5f0b3e4aeaad649333741edb8886ceddcb4c485a Mon Sep 17 00:00:00 2001 From: remo-lab Date: Fri, 13 Feb 2026 15:55:21 +0530 Subject: [PATCH] fix: sync ModelCapabilities schema with Go struct and docs Signed-off-by: remo-lab --- schema/config-schema.json | 13 ++++- schema/config_test.go | 103 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/schema/config-schema.json b/schema/config-schema.json index 94e88f3..ce13fcc 100644 --- a/schema/config-schema.json +++ b/schema/config-schema.json @@ -146,8 +146,19 @@ }, "toolUsage": { "type": "boolean" + }, + "reward": { + "type": "boolean" + }, + "languages": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-z]{2}$" + } } - } + }, + "additionalProperties": false }, "Modality": { "type": "string", diff --git a/schema/config_test.go b/schema/config_test.go index fd6b644..391727a 100644 --- a/schema/config_test.go +++ b/schema/config_test.go @@ -474,6 +474,109 @@ func TestConfig(t *testing.T) { ] } } +`, + fail: true, + }, + // expected failure: reward is not boolean + { + config: ` +{ + "descriptor": { + "name": "xyz-3-8B-Instruct", + "version": "3.1" + }, + "config": { + "paramSize": "8b", + "capabilities": { + "inputTypes": ["text"], + "outputTypes": ["text"], + "reward": "true" + } + }, + "modelfs": { + "type": "layers", + "diffIds": [ + "sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ] + } +} +`, + fail: true, + }, + // expected failure: languages is not an array + { + config: ` +{ + "descriptor": { + "name": "xyz-3-8B-Instruct", + "version": "3.1" + }, + "config": { + "paramSize": "8b", + "capabilities": { + "inputTypes": ["text"], + "outputTypes": ["text"], + "languages": "en" + } + }, + "modelfs": { + "type": "layers", + "diffIds": [ + "sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ] + } +} +`, + fail: true, + }, + // expected failure: language code is not a two-letter ISO 639 code + { + config: ` +{ + "descriptor": { + "name": "xyz-3-8B-Instruct", + "version": "3.1" + }, + "config": { + "paramSize": "8b", + "capabilities": { + "inputTypes": ["text"], + "outputTypes": ["text"], + "languages": ["fra"] + } + }, + "modelfs": { + "type": "layers", + "diffIds": [ + "sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ] + } +} +`, + fail: true, + }, + // expected failure: unknown field in capabilities + { + config: ` +{ + "descriptor": { + "name": "xyz-3-8B-Instruct", + "version": "3.1" + }, + "config": { + "paramSize": "8b", + "capabilities": { + "inputTypes": ["text"], + "unknownField": true + } + }, + "modelfs": { + "type": "layers", + "diffIds": [ + "sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + ] + } +} `, fail: true, },