{"id":22273094,"url":"https://github.com/mac-/ratify","last_synced_at":"2025-10-24T04:50:45.035Z","repository":{"id":10350268,"uuid":"12487227","full_name":"mac-/ratify","owner":"mac-","description":"A Hapi plugin for validating the schema of path, query, request body, and response body params using JSON-schema","archived":false,"fork":false,"pushed_at":"2023-08-24T16:03:49.000Z","size":122,"stargazers_count":71,"open_issues_count":11,"forks_count":27,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-18T02:11:29.986Z","etag":null,"topics":["hapi","hapi-plugin","javascript","json-schema"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"moqui/moqui-runtime","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mac-.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}},"created_at":"2013-08-30T13:38:55.000Z","updated_at":"2024-08-22T15:07:50.000Z","dependencies_parsed_at":"2022-08-31T13:10:20.928Z","dependency_job_id":"e44b8104-c0e8-49fe-a971-5b25370ca3f2","html_url":"https://github.com/mac-/ratify","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/mac-/ratify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fratify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fratify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fratify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fratify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mac-","download_url":"https://codeload.github.com/mac-/ratify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mac-%2Fratify/sbom","scorecard":{"id":609112,"data":{"date":"2025-08-11","repo":{"name":"github.com/mac-/ratify","commit":"3fbdce7a81a2f822cbcbfcecb32008e8e532f30b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":3,"reason":"Found 8/25 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T02:14:00.852Z","repository_id":10350268,"created_at":"2025-08-21T02:14:00.852Z","updated_at":"2025-08-21T02:14:00.852Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280734533,"owners_count":26381849,"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-10-24T02:00:06.418Z","response_time":73,"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":["hapi","hapi-plugin","javascript","json-schema"],"created_at":"2024-12-03T13:09:43.860Z","updated_at":"2025-10-24T04:50:45.000Z","avatar_url":"https://github.com/mac-.png","language":"JavaScript","readme":"ratify\n======\n\nA Hapi plugin for validating the schema of path, query, request body, and response body params using [JSON-schema](http://json-schema.org/), while providing documenation for your end points via [Swagger](https://helloreverb.com/developers/swagger)\n\n[![Build Status](https://secure.travis-ci.org/mac-/ratify.png)](http://travis-ci.org/mac-/ratify)\n[![Coverage Status](https://coveralls.io/repos/mac-/ratify/badge.png)](https://coveralls.io/r/mac-/ratify)\n[![Code Climate](https://codeclimate.com/github/mac-/ratify.png)](https://codeclimate.com/github/mac-/ratify)\n[![NPM version](https://badge.fury.io/js/ratify.png)](http://badge.fury.io/js/ratify)\n[![Dependency Status](https://david-dm.org/mac-/ratify.png)](https://david-dm.org/mac-/ratify)\n\n[![NPM](https://nodei.co/npm/ratify.png?downloads=true\u0026stars=true)](https://nodei.co/npm/ratify/)\n\n## Contributing\n\nThis module makes use of a `Makefile` for building/testing purposes. After obtaining a copy of the repo, run the following commands to make sure everything is in working condition before you start your work:\n\n\tmake install\n\tmake test\n\nBefore committing a change to your fork/branch, run the following commands to make sure nothing is broken:\n\n\tmake test\n\tmake test-cov\n\nDon't forget to bump the version in the `package.json` using the [semver](http://semver.org/spec/v2.0.0.html) spec as a guide for which part to bump. Submit a pull request when your work is complete.\n\n***Notes:***\n* Please do your best to ensure the code coverage does not drop. If new unit tests are required to maintain the same level of coverage, please include those in your pull request.\n* Please follow the same coding/formatting practices that have been established in the module.\n\n## Installation\n\n\tnpm install ratify\n\n## Usage\n\nTo install this plugin on your Hapi server, do something similar to this:\n\n\tvar Hapi = require('hapi');\n\tvar server = new Hapi.Server();\n\n\tvar ratifyOptions = {};\n\n\tserver.register({ register: require('ratify'), options: ratifyOptions }, function(err) {\n\t\tif (err) {\n\t\t\tconsole.log('error', 'Failed loading plugin: ratify');\n\t\t}\n\t});\n\n## Plugin Options\n\n### `auth`\n\nUsed to add authentication to the swagger routes that get created by the plugin. Valid values are described [here](https://github.com/spumko/hapi/blob/master/docs/Reference.md#route-options) under the `auth` property.\n\nDefaults to `false`\n\n### `baseUrl`\n\nThe protocol, hostname, and port where the application is running.\n\nDefaults to `'http://localhost'`\n\n### `startingPath`\n\nThe path at which all of the swagger routes begin at. This is the endpoint you would pass to an instance of the swagger UI.\n\nDefaults to `'/api-docs'`\n\n### `apiVersion`\n\nThe version of your API.\n\nDefaults to `''`\n\n### `responseContentTypes`\n\nA collection of valid response types returned by your services.\n\nDefaults to `['application/json']`\n\n### `swaggerHooks`\n\nAn object in which the property names represent swagger generated elements and the values must be functions to be invoked to customize how those elements are processed.\n\nPossible values:\n* `params`: `function(params, route, type)`\n* `operation`: `function(operation, route, resourceType, path)`\n* `routeNameGroup`: `function(route)`\n\n### `errorReporters`\n\nAn object in which the property keys represent elements that can be validated (`\"headers\"`, `\"query\"`, `\"path\"`, `\"payload\"`, `\"response\"`) and the values are initialized [ZSchemaErrors instances](https://github.com/dschenkelman/z-schema-errors) to be used to report those errors.\n\n### Parameter Validation\n\nOnce your server is set to use ratify, you can specify route-specific validations in each route config like so:\n\n\tvar route = {\n\t\tmethod: 'GET',\n\t\tpath: '/foo/{bar}',\n\t\tconfig: {\n\t\t\thandler: function(request, reply) {\n\n\t\t\t},\n\t\t\tplugins: {\n\t\t\t\tratify: {\n\t\t\t\t\tpath: {\n\t\t\t\t\t\t// path parameters schema\n\t\t\t\t\t},\n\t\t\t\t\tquery: {\n\t\t\t\t\t\t// query parameters schema\n\t\t\t\t\t},\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t// header parameters schema\n\t\t\t\t\t},\n\t\t\t\t\tpayload: {\n\t\t\t\t\t\t// request payload schema\n\t\t\t\t\t},\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t// response payload schema\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsample: 100, // percentage of responses to test against the schema\n\t\t\t\t\t\tfailAction: 'log' // action to take when schena validation fails. Valid options are; 'log' and 'error'\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\tserver.route(route);\n\nAll schemas should follow the [JSON schema specification](http://json-schema.org/).\n\n***Notes:***\nIn addition to the JSON schema defined types, ratify allows you to specify \"file\" as a payload type. If this is specified, no validation against JSON schema is performed, but swagger documentation will still be provided.\n\n#### Type Conversion\n\nIn the process of validating the properties based on the schema, ratify will attempt to convert path, header, and query params to the type defined in the schema. For example, if you have a query paramter called `limit` and it's type is `number`, since all query parameters are parsed as strings by Hapi, ratify will convert the string to a number.\n\nRatify can also specifically convert query parameters that are intended to be arrays. For example, both of the following query strings will result in a property called `types` having an array value:\n\n* `?types=first\u0026types=second\u0026types=third`\n* `?types[0]=first\u0026types[2]=third\u0026types[1]=second`\n\nResult:\n\n```\n{\n\ttypes: ['first', 'second', 'third']\n}\n```\n\n### Swagger Documentation\n\nRatify automatically generates routes that produce JSON in the format of the [Swagger API Specification](https://github.com/wordnik/swagger-core). In order to ge tthe most of the documentation, it's best to ensure there are descriptions to all your parameters as allowed by the JSON schema spec.\n\n## Version Compatibility\n\n### Currently compatible with: Hapi 10.x.x (Node v4)\n\n* 0.2.x - Hapi 1.x.x\n* 0.3.x - Don't use!\n* 0.4.x - Hapi 4.x.x\n* 0.6.x - Hapi 6.x.x\n* 0.7.x - Hapi 7.x.x\n* 0.8.x - Hapi 8.x.x\n* 0.10.x - Hapi 9.x.x\n* 1.x.x - Hapi 10.x.x (Node v4)\n* 2.x.x - Hapi 11.x.x\n* 3.x.x - Hapi 16.x.x\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmac-%2Fratify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmac-%2Fratify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmac-%2Fratify/lists"}