diff --git a/cmd/gen-jsonschema/main.go b/cmd/gen-jsonschema/main.go index bedc2b9fc..522e6532a 100644 --- a/cmd/gen-jsonschema/main.go +++ b/cmd/gen-jsonschema/main.go @@ -9,6 +9,7 @@ import ( "github.com/aquaproj/aqua/v2/pkg/config/aqua" "github.com/aquaproj/aqua/v2/pkg/config/registry" + "github.com/aquaproj/aqua/v2/pkg/policy" "github.com/invopop/jsonschema" ) @@ -25,6 +26,9 @@ func core() error { if err := gen(®istry.Config{}, "json-schema/registry.json"); err != nil { return err } + if err := gen(&policy.ConfigYAML{}, "json-schema/policy.json"); err != nil { + return err + } return nil } diff --git a/json-schema/policy.json b/json-schema/policy.json new file mode 100644 index 000000000..d3f990236 --- /dev/null +++ b/json-schema/policy.json @@ -0,0 +1,75 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/aquaproj/aqua/v2/pkg/policy/config-yaml", + "$ref": "#/$defs/ConfigYAML", + "$defs": { + "ConfigYAML": { + "properties": { + "registries": { + "items": { + "$ref": "#/$defs/Registry" + }, + "type": "array" + }, + "packages": { + "items": { + "$ref": "#/$defs/Package" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "registries" + ] + }, + "Package": { + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "registry": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "Registry": { + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "standard", + "local", + "github_content" + ] + }, + "repo_owner": { + "type": "string" + }, + "repo_name": { + "type": "string" + }, + "ref": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + } + } +}