20241206 ○

JSON Schema

json-schema-org/json-schema-spec

Although I don’t see many examples in real life, there is an attempt to let users define a schema for JSON documents.

The current version is 2020-12! The previous version was 2019-09.

They don’t update the specification for 4 years :thinking_face: I cannot tell if the specification is mature or the community is just not active.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "username": {
      "type": "string",
      "minLength": 2,
      "maxLength": 100
    },
    "age": {
      "type": "integer",
      "minimum": 0,
      "maximum": 120
    },
    "role": {
      "type": "string",
      "enum": ["user", "admin", "superadmin"]
    }
  },
  "required": ["name", "age"]
}

By defining this kind of schema, valdiations can be run with tools available.

Hmm… :thinking_face: as I browsed the available validators, the community seems to be inactive.


163.0 lb

Scramble eggs 40 g Yogurt 20 g Gummies 0 g Protein chips 20 g Sausages 60 g Salad 10 g Protein shake 40 g Milk 20 g

total protein -> 210 g (>= 140)


index 20241205 20241207