Skip to content

Commit

Permalink
feat(metaschema): Factor out file rule types
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Apr 26, 2024
1 parent 3322a40 commit 46d6ffa
Showing 1 changed file with 46 additions and 38 deletions.
84 changes: 46 additions & 38 deletions src/metaschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,10 @@
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"level": {"type": "string"},
"path": {"type": "string"},
"extensions": {"type": "array"},
"stem": {"type": "string"}
},
"required": ["level"],
"additionalProperties": false
"anyOf": [
{ "$ref": "#/definitions/pathRule" },
{ "$ref": "#/definitions/stemRule" }
]
}
},
"additionalProperties": false
Expand All @@ -426,17 +421,10 @@
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"level": {"type": "string"},
"path": {"type": "string"},
"extensions": {"type": "array"},
"stem": {"type": "string"},
"entities": {"$ref": "#/definitions/entities"},
"suffixes": {"type": "array"}
},
"required": ["level", "extensions"],
"additionalProperties": false
"anyOf": [
{ "$ref": "#/definitions/stemRule" },
{ "$ref": "#/definitions/suffixRule" }
]
}
},
"additionalProperties": false
Expand Down Expand Up @@ -471,24 +459,7 @@
"^[a-z]+$": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"type": "object",
"properties": {
"suffixes": {
"type": "array",
"items": {"type": "string"}
},
"extensions": {
"type": "array",
"items": {"pattern": "^[./][a-z.]+|"}
},
"datatypes": {
"type": "array",
"items": {"pattern": "^[a-z]+$"}
},
"entities": {"$ref": "#/definitions/entities"}
}
}
"^[a-zA-Z0-9_]+$": { "$ref": "#/definitions/suffixRule" }
},
"additionalProperties": false
}
Expand Down Expand Up @@ -722,6 +693,43 @@
"additionalProperties": false
}
}
},
"pathRule": {
"type": "object",
"properties": {
"level": { "enum": ["optional", "required"] },
"path": { "type": "string" }
},
"required": ["level", "path"],
"additionalProperties": false
},
"stemRule": {
"type": "object",
"properties": {
"level": { "enum": ["optional", "recommended", "required"] },
"stem": { "type": "string" },
"extensions": { "type": "array", "items": { "type": "string" } }
},
"required": ["level", "stem", "extensions"],
"additionalProperties": false
},
"suffixRule": {
"type": "object",
"properties": {
"level": { "enum": ["optional", "recommended", "required"] },
"datatypes": {
"type": "array",
"items": { "pattern": "^[a-z]+$" }
},
"suffixes": {
"type": "array",
"items": { "pattern": "^[a-zA-Z0-9]+$" }
},
"extensions": { "type": "array", "items": { "type": "string" } },
"entities": { "$ref": "#/definitions/entities" }
},
"required": ["suffixes", "extensions", "entities"],
"additionalProperties": false
}
}
}

0 comments on commit 46d6ffa

Please sign in to comment.