---
# System prepended metadata

title: Json schema for mining ops

---

# Json schema for mining ops

## Example object
```
{
  2021: {
    operations: [{label: 'tx1', address: '', energyConsumed: '', enrolled: true, dispatched: false}],
    certifications: [{instrument: '', unitQuantity: 2, location: ''}]
  },
  2022: {
    operations: [],
    certifications: []
  }
}
```

## JSON Schema

https://stackoverflow.com/questions/32044761/json-schema-with-unknown-property-names

```
{
  "type": "object",
  "properties": {
    "2021": { "type": "object" },
    "2022": { "type": "object" },
  }
}
```

https://stackoverflow.com/questions/19715303/regex-that-accepts-only-numbers-0-9-and-no-characters

```
{
  "type": "object",
  "patternProperties": {
    "^[0-9]*$": {
      "type": "object",
      "properties": {
        "operations": {
          "type": "array",
          "items": [
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "address": {
                  "type": "string"
                },
                "energyConsumed": {
                  "type": "string"
                },
                "enrolled": {
                  "type": "boolean"
                },
                "dispatched": {
                  "type": "boolean"
                }
              },
              "required": [
                "label",
                "address",
                "energyConsumed",
                "enrolled",
                "dispatched"
              ]
            }
          ]
        },
        "certifications": {
          "type": "array",
          "items": [
            {
              "type": "object",
              "properties": {
                "instrument": {
                  "type": "string"
                },
                "unitQuantity": {
                  "type": "integer"
                },
                "location": {
                  "type": "string"
                }
              },
              "required": [
                "instrument",
                "unitQuantity",
                "location"
              ]
            }
          ]
        }
      },
      "required": [
        "operations",
        "certifications"
      ]
    },
  },
  "additionalProperties": false
}
```