{"id":16954110,"url":"https://github.com/pjungermann/config-validator","last_synced_at":"2026-04-16T07:33:49.819Z","repository":{"id":151675533,"uuid":"44661225","full_name":"pjungermann/config-validator","owner":"pjungermann","description":"Polyglot configuration validation library","archived":false,"fork":false,"pushed_at":"2017-05-01T19:42:08.000Z","size":345,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T11:51:05.544Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pjungermann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-21T07:58:23.000Z","updated_at":"2016-07-09T16:41:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"b4503385-33ec-4c0f-9afc-794590ddd59f","html_url":"https://github.com/pjungermann/config-validator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pjungermann/config-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjungermann%2Fconfig-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjungermann%2Fconfig-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjungermann%2Fconfig-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjungermann%2Fconfig-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pjungermann","download_url":"https://codeload.github.com/pjungermann/config-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pjungermann%2Fconfig-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31876531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T22:08:50.067Z","updated_at":"2026-04-16T07:33:49.802Z","avatar_url":"https://github.com/pjungermann.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/pjungermann/config-validator.svg?branch=master)](https://travis-ci.org/pjungermann/config-validator)\n[![Coverage Status](https://codecov.io/github/pjungermann/config-validator/coverage.svg?branch=master)](https://codecov.io/github/pjungermann/config-validator?branch=master)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.pjungermann.config/config-validator/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.pjungermann.config/config-validator)\n[![Dependency Status](https://www.versioneye.com/user/projects/56583c14ff016c003a001ad3/badge.svg)](https://www.versioneye.com/user/projects/56583c14ff016c003a001ad3)\n\n# Config Validator\nConfiguration is an elementary part of most applications. \nIt allows to apply to different use cases and environments. \nTherefore, applications have certain expectations onto the \nvalues handed in. Some of them might be optional, some have\nto be within a certain set of values, etc. The possible \nconstraints to apply to are endless and can be based on very \nspecific application internal conditions and rules.\n\nThe goal of this library is to provide an extensible and polyglot framework\nfor config validation with support for any kind of config format.\n\nThis gets supported by the following modules:\n\n* Config\n* Config Loader\n* Config Specification\n* Config Validator\n* Config Validator Application\n\n## Config\nBasic key-value data structure.\nTheoretically it allows hierarchical structures, \nbut the validation itself is based on a flat structure.\n\n### Data Types and Data Structures\nIn general, configs can contain the following data types:\n\n* key-value type\n* collection type\n* value type\n * primitive values (boolean, numbers, strings, null, undefined / undef, ...)\n * complex types (key-value, collection, any other complex object)\n\nThe root type, the config itself is a value as well as a key-value data structure \neven though there are certain config types which can start with a different structure, \ne.g. Array at JSON. For those, the (virtual) key ``\"__config__\"`` will be used to create a \nkey-value structure as wrapper.\n\n### Flat Config\nIn order to flatten the hierarchical config structure, the key-value and collection typed\ndata needs to be flattened. The root config which is a key-value structure itself, is excluded\nfrom that rule.\n\n#### Key-Value Data\nAny key-value typed data can be resolved by using the higher level key as key path / prefix\nfor any key of it using a key separator between the different hierarchical levels in order\nto be able reconstruct the hierarchy on a later stage.\n\nExample:\n\n    key1:\n        key11: value11\n        key12: value12\n\nwill get resolved to\n\n    key1.key11: value11\n    key1.key12: value12\n\n#### Collection Data\nFor collections, capabilities are needed in order to\n\n* provide specification for the collection itself like e.g. size\n* provide specification for each item\n\nIn certain special cases, there might be the need to specify expectations\nfor a single item only, maybe additionally to the one applied to all items.\n\nTo achieve those goals, a way is needed to reference the collection, all of its\nitems as well a concrete item of it.\n\nFor creating those references, keys like the following can be used:\n\n* ``collection_key`` as reference for the collection itself\n* ``collection_key.[*]`` as reference for all items\n* ``collection_key.[index]`` as reference for a single item\n* ``collection_key.[from..to]`` as reference for a range of items\n\nTo flatten a collection, either the collection could get resolved so that the \nflat config contains only flat keys like the example above or the collection \ncould get flattened recursively by flattening all its items.\n\nThe first approach provides a truly flat structure, but looses the information \nabout the collection's properties. Also applying a specification for each item \nmight be harder to achieve, esp. if the size of the collection is unknown. This \ncould get circumvented by providing collection metadata, e.g. for the collection \nkey itself or any other way.\n\nThe second approach leave the collection fully functional and only provides\na mechanism to define a specification for its content.\n\nThe second approach is the one used here.\n\n## Config Loader\nis an abstraction layer to load any kind of config format.\n\nIt also provides implementations for the following formats:\n\n* Groovy config files (``ConfigObject``)\n* INI files\n* JSON files\n* Properties files\n* Yaml files\n\nFurther implementations can be added and / or plugged in.\n\nPlanned for future iterations:\n\n* XML files\n* [Typesafe Config (``*.conf``)](https://github.com/typesafehub/config)\n\n## Config Specification\nTo be able to validate a config, you need a way to specify your expectations to it.\nThe config specification module provides a DSL backed by Groovy to express those.\n\nFor the sake of a higher flexibility an abstraction allows to plug in another DSL easily.\n\n## Config Validator\nThe config validator uses the config loader and config specification modules\nand validates the loaded config against the loaded specification for it.\n\n## Config Validator Application\nThe application provides a command line interface to run your validation easily,\ni.e. as part of your build chain of your project, at configuration management \ntools like Puppet or Chef as a test for all your instances' configuration.\n\n# TODOs\n* Support for\n * XML\n * Typesafe Config ``*.conf`` files\n* Make all modules separately accessible via Gradle multi-project setup\n* Where to deploy the fatJar to (aka. shadowJar)\n* Google Guice vs Spring Core for DI? Support for both?\n\n# License\nThis project is licensed under the terms of the \n[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjungermann%2Fconfig-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpjungermann%2Fconfig-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpjungermann%2Fconfig-validator/lists"}