-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add a schema for policy files
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "LavaMoat Policy Schema", | ||
"type": "object", | ||
"$id": "lavamoat-policy.v0-0-1", | ||
"properties": { | ||
"resources": { | ||
"type": "object", | ||
"$comment": "This one or more valid npm package names delimited by a \">\" character, or the special case \"<root>\"", | ||
"properties": { | ||
"<root>": { | ||
"$ref": "#/$defs/resourcePolicy" | ||
} | ||
}, | ||
"patternProperties": { | ||
"^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*(>(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*)*$": { | ||
"$ref": "#/$defs/resourcePolicy" | ||
} | ||
}, | ||
"allowAdditionalProperties": false | ||
} | ||
}, | ||
"required": ["resources"], | ||
"$defs": { | ||
"resourcePolicy": { | ||
"type": "object", | ||
"minProperties": 1, | ||
"properties": { | ||
"globals": { | ||
"type": "object", | ||
"$comment": "A global property key can be any string (accessible via bracket notation)", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
}, | ||
"packages": { | ||
"type": "object", | ||
"$comment": "This one or more valid npm package names delimited by a \">\" character", | ||
"patternProperties": { | ||
"^(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*(>(@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*)*$": { | ||
"type": "boolean" | ||
} | ||
}, | ||
"allowAdditionalProperties": false | ||
} | ||
}, | ||
"allowAdditionalProperties": false | ||
} | ||
} | ||
} |