devopshq / devopshq/artifactory-cleanup
Provide JSON Schema for config file
- Dominant language
- Python
- Stars
- 160
- Forks
- 87
- PR merge metrics
- No merged PRs in 30d
Description
To enhance the developer experience and facilitate validation of config in CI/CD pipelines, it would have been nice if it were a JSON Schema to validate the config against. Given a schema, the config file could be validated with e.g. [yajsv](https://github.com/neilpa/yajsv):
```shell
yajsv -s artifactory-cleanup-schema.yaml artifactory-cleanup.yaml
```
Users of VSCode with the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) (or IntelliJ users natively) could have added this at the top of their config to get auto-complete and documentation:
```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/devopshq/artifactory-cleanup/master/artifactory-cleanup-schema.yaml
```
(see [blog-post](https://developers.redhat.com/blog/2020/11/25/how-to-configure-yaml-schema-to-make-editing-files-easier#schema_association_without_a_file_name_pattern) about this extension for more info)
Here is a start for such a JSON Schema:
```yaml
---
"$schema": http://json-schema.org/draft-07/schema#
type: object
properties:
artifactory-cleanup:
type: object
properties:
server:
type: string
format: uri
user:
type: string
password:
type: string
policies:
type: array
items:
type: object
properties:
name:
type: string
rules:
type: array
description:
See all rules in
https://github.com/devopshq/artifactory-cleanup#rules
items:
type: object
properties:
rule:
type: string
name:
type: string
days:
type: integer
count:
type: integer
property_key:
type:
- integer
- string
property_value:
type:
- integer
- string
custom_regexp:
type: string
masks:
type: array
items:
type: string
required:
- rule
additionalProperties: true
required:
- name
- rules
required:
- server
- user
- password
- policies
required:
- artifactory-cleanup
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.