THE DEV BENCH
✔️ JSON Schemahard

5. Restrict to a set of values (enum)

Write a schema for an object with a required "level" that must be exactly one of: "debug", "info", "warn", "error".

How to approach this

An "enum" restricts a value to a fixed list of allowed options — exactly how you validate a log level, an environment name, or a mode. Put "enum": ["debug", "info", "warn", "error"] on the property. Any value outside the list, or a missing field, must be rejected.

schema.json