{"id":50517645,"url":"https://github.com/iamteppei/json-rule","last_synced_at":"2026-06-03T01:03:23.548Z","repository":{"id":361730409,"uuid":"1255575614","full_name":"iamteppei/json-rule","owner":"iamteppei","description":"A dynamic json validation rule utility","archived":false,"fork":false,"pushed_at":"2026-06-01T03:02:13.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-01T03:22:28.495Z","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/iamteppei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-01T01:28:46.000Z","updated_at":"2026-06-01T03:01:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/iamteppei/json-rule","commit_stats":null,"previous_names":["iamteppei/json-rule"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/iamteppei/json-rule","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamteppei%2Fjson-rule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamteppei%2Fjson-rule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamteppei%2Fjson-rule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamteppei%2Fjson-rule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamteppei","download_url":"https://codeload.github.com/iamteppei/json-rule/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamteppei%2Fjson-rule/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33843611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"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":"2026-06-03T01:03:21.552Z","updated_at":"2026-06-03T01:03:23.536Z","avatar_url":"https://github.com/iamteppei.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-rule\n\n[![CI/CD Pipeline](https://github.com/iamteppei/json-rule/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/iamteppei/json-rule/actions/workflows/ci.yml)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.iamteppei/json-rule)](https://search.maven.org/artifact/io.github.iamteppei/json-rule)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n[![Java](https://img.shields.io/badge/java-21-blue.svg)](https://openjdk.org/projects/jdk/21/)\n[![Coverage Gate](https://img.shields.io/badge/coverage%20gate-line%2060%25%20%7C%20branch%2040%25-brightgreen.svg)](#development)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=iamteppei_json-rule\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=iamteppei_json-rule)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iamteppei_json-rule\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=iamteppei_json-rule)\n\nJSON-based rule engine for decision processing.\n\nThis library lets you define rules in JSON and evaluate them against JSON-like input maps. It is designed for policy checks, event filtering, and lightweight decision flows where rules should be data, not code.\n\n## Features\n\n- JSON rule parser with nested object support\n- Logical composition with $all and $any\n- Rich predicate set for numbers, strings, lists, existence, null checks, and regex\n- Expression helper support for ${path.to.value}-style extraction\n- JUnit 5 test suite with JaCoCo coverage checks\n- GitHub Actions pipeline with build, test, Sonar scan, and Maven Central publish job\n\n## Requirements\n\n- Java 21\n- Maven 3.9+\n\n## Installation\n\nIf you consume from Maven Central, add this dependency:\n\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003eio.github.iamteppei\u003c/groupId\u003e\n\t\u003cartifactId\u003ejson-rule\u003c/artifactId\u003e\n\t\u003cversion\u003eLATEST_RELEASE\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor local development:\n\n```bash\nmvn -B -ntp clean install\n```\n\n## Quick Start\n\n```java\nimport io.abc.feature.decision_engine.core.rule.api.Rule;\nimport io.abc.feature.decision_engine.core.rule.api.RuleParser;\nimport io.abc.feature.decision_engine.core.rule.impl.MapParser;\n\nimport java.util.Map;\n\npublic class QuickStart {\n\t\tpublic static void main(String[] args) {\n\t\t\t\tString ruleJson = \"\"\"\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"detail\": {\n\t\t\t\t\t\t\t\t\"state\": [\"in\", [\"running\", \"initializing\"]]\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"source\": [\"eq_ignore_case\", \"aws.ec2\"]\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\"\"\";\n\n\t\t\t\tString inputJson = \"\"\"\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\"source\": \"AWS.EC2\",\n\t\t\t\t\t\t\t\"detail\": {\n\t\t\t\t\t\t\t\t\"state\": \"running\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\"\"\";\n\n\t\t\t\tRuleParser ruleParser = new RuleParser();\n\t\t\t\tMapParser mapParser = new MapParser();\n\n\t\t\t\tRule rule = ruleParser.parse(ruleJson);\n\t\t\t\tMap\u003cString, Object\u003e input = mapParser.parse(inputJson);\n\n\t\t\t\tboolean matched = rule.test(input);\n\t\t\t\tSystem.out.println(\"Matched: \" + matched);\n\t\t}\n}\n```\n\n## Rule Syntax\n\n### Simple condition\n\n```json\n{\n  \"detail\": {\n    \"state\": [\"eq\", \"running\"]\n  }\n}\n```\n\n### Any/All composition\n\n```json\n{\n  \"$all\": [\n    {\n      \"source\": [\"eq\", \"aws.ec2\"]\n    },\n    {\n      \"$any\": [\n        { \"detail\": { \"state\": [\"eq\", \"running\"] } },\n        { \"detail\": { \"state\": [\"eq\", \"initializing\"] } }\n      ]\n    }\n  ]\n}\n```\n\n### Supported operators\n\n| Operator            | Meaning                                   |\n| ------------------- | ----------------------------------------- |\n| eq                  | Equals                                    |\n| ne                  | Not equals                                |\n| gt                  | Greater than (BigDecimal)                 |\n| ge                  | Greater than or equal (BigDecimal)        |\n| lt                  | Less than (BigDecimal)                    |\n| le                  | Less than or equal (BigDecimal)           |\n| in                  | Source is in expected list                |\n| not_in              | Source is not in expected list            |\n| contains            | Collection/String contains expected value |\n| not_contains        | Negated contains                          |\n| start_with          | String starts with expected prefix        |\n| end_with            | String ends with expected suffix          |\n| anything_start_with | String starts with any expected prefix    |\n| anything_end_with   | String ends with any expected suffix      |\n| eq_ignore_case      | Case-insensitive equals                   |\n| matches             | Regex full match                          |\n| email               | Valid email and expected boolean true     |\n| exists              | Property exists and expected boolean true |\n| non_null            | Source is not null and not unknown        |\n| is_null             | Source is null                            |\n\n## Development\n\nRun compile:\n\n```bash\nmvn -B -ntp clean compile\n```\n\nRun tests:\n\n```bash\nmvn -B -ntp test\n```\n\nRun tests with coverage gate:\n\n```bash\nmvn -B -ntp verify\n```\n\nJaCoCo rules currently enforce:\n\n- Line coverage \u003e= 60%\n- Branch coverage \u003e= 40%\n\n## Community and Governance\n\n- Code of Conduct: see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)\n- Security Policy: see [SECURITY.md](SECURITY.md)\n- License: see [LICENSE](LICENSE)\n\n## Contributing\n\nContributions are welcome.\n\n1. Fork the repository.\n2. Create a feature branch.\n3. Add or update tests for your change.\n4. Run verify locally with Java 21.\n5. Open a pull request with a clear description.\n\n## License\n\nThis project is licensed under Apache License 2.0. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamteppei%2Fjson-rule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamteppei%2Fjson-rule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamteppei%2Fjson-rule/lists"}