Skip to content

Commit

Permalink
docs: add JSON Schema for policy (#3353)
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke authored Dec 14, 2024
1 parent ae17b30 commit de8b7e4
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/gen-jsonschema/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -25,6 +26,9 @@ func core() error {
if err := gen(&registry.Config{}, "json-schema/registry.json"); err != nil {
return err
}
if err := gen(&policy.ConfigYAML{}, "json-schema/policy.json"); err != nil {
return err
}
return nil
}

Expand Down
75 changes: 75 additions & 0 deletions json-schema/policy.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}

0 comments on commit de8b7e4

Please sign in to comment.