Skip to content

Provide JSON Schema for config file #103

@mikaello

Description

@mikaello

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:

yajsv -s artifactory-cleanup-schema.yaml artifactory-cleanup.yaml

Users of VSCode with the YAML extension (or IntelliJ users natively) could have added this at the top of their config to get auto-complete and documentation:

# yaml-language-server: $schema=https://raw.githubusercontent.com/devopshq/artifactory-cleanup/master/artifactory-cleanup-schema.yaml

(see blog-post about this extension for more info)

Here is a start for such a JSON Schema:
---
"$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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions