✔️ JSON Schemahard
13. Constrain every value of a free-form map
You have a "weights" map with arbitrary keys, but EVERY value must be a number that is 0 or greater. Write a schema (for the map object itself) where any property is allowed by name, but each value must be a number ≥ 0. Reject a negative number and a string value.
How to approach this
When the KEYS are open-ended (a metrics/weights/labels map) you can't list them under "properties". Instead give "additionalProperties" a SCHEMA (not false): every property whose name isn't otherwise declared must match it. Here "additionalProperties": { "type": "number", "minimum": 0 } forces all values to be non-negative numbers. An empty object is fine (nothing to check).
schema.json