{"id":19179502,"url":"https://github.com/hypermedia-app/hydra-validator","last_synced_at":"2025-07-23T04:05:09.352Z","repository":{"id":48284017,"uuid":"184803642","full_name":"hypermedia-app/hydra-validator","owner":"hypermedia-app","description":"A tool (also website) guarding a Hydra API against possible mistakes","archived":false,"fork":false,"pushed_at":"2023-05-01T01:25:50.000Z","size":3549,"stargazers_count":10,"open_issues_count":20,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-08T18:12:06.731Z","etag":null,"topics":["hydra-api","verifier"],"latest_commit_sha":null,"homepage":"https://analyse.hypermedia.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hypermedia-app.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":"2019-05-03T18:37:33.000Z","updated_at":"2025-01-10T10:13:51.000Z","dependencies_parsed_at":"2024-06-20T00:09:36.899Z","dependency_job_id":"e12e8225-f2eb-4286-b529-68a6b24c9c7a","html_url":"https://github.com/hypermedia-app/hydra-validator","commit_stats":null,"previous_names":[],"tags_count":102,"template":false,"template_full_name":null,"purl":"pkg:github/hypermedia-app/hydra-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypermedia-app%2Fhydra-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypermedia-app%2Fhydra-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypermedia-app%2Fhydra-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypermedia-app%2Fhydra-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hypermedia-app","download_url":"https://codeload.github.com/hypermedia-app/hydra-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hypermedia-app%2Fhydra-validator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266614344,"owners_count":23956353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["hydra-api","verifier"],"created_at":"2024-11-09T10:43:22.541Z","updated_at":"2025-07-23T04:05:09.324Z","avatar_url":"https://github.com/hypermedia-app.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e # hydra-validator\n\u003e A tool (also website) validating a Hydra API against possible mistakes\n\n## Usage\n\nThis is a monorepo. Check the packages for more information:\n\n### Online tool\n\nVisit [https://analyse.hypermedia.app](https://analyse.hypermedia.app)\n\nMore info in [validator-ui](validator-ui) package.\n\n### Command Line tool\n\nIt is also possible to run verification of a Hydra API from the command line. This may be useful to run sanity checks\nlocally during development or as part of a CI pipeline.\n\nMore info in [validator-cli](validator-cli) package.\n\n### Core package\n\nCode shared between other packages. \n\nMore info in [validator-core](validator-core) package.\n\n### Static API Documentation analysis\n\nStatic analyser of a Hydra API. Checks the triples and hypermedia controls for potential errors. \n\nMore info in [validator-analyse](validator-analyse) package.\n\n### E2E plugin (WIP)\n\nEnd-to-end rules executed against a Hydra API.\n\nMore info in [validator-e2e](validator-e2e) package.\n\n## Contributing\n\n### Creating individual checks\n\nEach verification check is a parameterless function, which returns the result and optionally an array of child checks.\nIt can also be async.\n\n```ts\nexport interface CheckResult {\n    result?: IResult;\n    results?: IResult[];\n    nextChecks?: checkChain[];\n    sameLevel?: boolean;\n}\n\nexport type checkChain = (this: Context) =\u003e Promise\u003cCheckResult\u003e | CheckResult\n```\n\nTo implement a check, you'd usually wrap the check function in a closure to pass in dependencies. This way checks are chained\nto run when the previous check succeeds.\n\nHere's an example which could verify that the input is a number and then pass on to a check for parity.\n\n```ts\n// isnum.ts\nimport {checkChain, Result} from '../check';\nimport iseven from './iseven';\n\nexport default function (maybeNum: any): checkChain {\n    return () =\u003e {\n        if (Number.isInteger(maybeNum)) {\n            return {\n                result: Result.Success('Value is number'),\n                nextChecks: [ iseven(maybeNum) ]\n            }\n        }\n\n        return {\n            result: Result.Failure('Value is not a number')\n        }\n    }\n}\n\n// iseven.ts\nimport {checkChain, Result} from '../check';\n\nexport default function (num: number): checkChain {\n    return () =\u003e {\n        const result = num % 2 === 0\n            ? Result.Success(`Number ${num} is even`)\n            : Result.Failure(`Number ${num} is odd`)\n\n        return { result }\n    }\n}\n```\n\nAny new check must be added to existing chains in a similar matter to how `iseven` follows `isnum`.\n\nResults can be reported with four factory methods: `Result.Succes`, `Result.Failure`, `Result.Warning`\nand `Result.Informational`.\n\nNote that there is no restriction for chaining. Additional checks can follow a successful check as well as failed ones.\n\n### Creating a CLI plugin\n\nTo create a plugin, create a project called `hydra-validator-uber-check`, where `uber-check` will become\nthe CLI command.\n\nIn the package main module, export a default `checkChain` function which will be called first from\nthe CLI.\n\nOptionally, add `export const options`, which exports an array of command line parameters. Here's an example\nof one such option:\n\n```\n  {\n    flags: '-l, --log-level \u003clogLevel\u003e',\n    description: 'Minimum log level',\n    defaultValue: 'INFO'\n  }\n```\n\nAn object with the values passed from the command line will be provided as the second argument to the\nmain `checkChain` function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypermedia-app%2Fhydra-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhypermedia-app%2Fhydra-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhypermedia-app%2Fhydra-validator/lists"}