{"id":44762697,"url":"https://github.com/wspringer/njoi","last_synced_at":"2026-02-16T03:18:17.444Z","repository":{"id":43946892,"uuid":"229637433","full_name":"wspringer/njoi","owner":"wspringer","description":"An attempt to get some sensible documentation from Joi.","archived":false,"fork":false,"pushed_at":"2023-03-28T14:33:32.000Z","size":936,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T16:47:06.609Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wspringer.png","metadata":{"files":{"readme":"README.js.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-22T22:08:37.000Z","updated_at":"2020-05-14T11:10:27.000Z","dependencies_parsed_at":"2023-02-14T18:15:51.205Z","dependency_job_id":null,"html_url":"https://github.com/wspringer/njoi","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/wspringer/njoi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wspringer%2Fnjoi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wspringer%2Fnjoi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wspringer%2Fnjoi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wspringer%2Fnjoi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wspringer","download_url":"https://codeload.github.com/wspringer/njoi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wspringer%2Fnjoi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29499612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T02:07:14.481Z","status":"online","status_checked_at":"2026-02-16T02:03:22.852Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","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-02-16T03:18:16.830Z","updated_at":"2026-02-16T03:18:17.438Z","avatar_url":"https://github.com/wspringer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"```javascript --hide\nrunmd.onRequire = function(path) {\n  if (path === 'njoi') {\n    return './lib/njoi.js';\n  } else {\n    return path;\n  }\n}\n```\n\n# README\n\nAn experiment to render a sensible JSON-alike structure from the Joi definition\nto be copied in to (Github) fenced markdown sections.\n\nIf this is the Joi schema you're defining:\n\n```javascript --run simple\nconst Joi = require('@hapi/joi');\nconst schema = Joi.object().keys({\n  name: Joi.string().description('The given name').required(),\n  age: Joi.number().description('The age').default(5),\n  tags: Joi.array().items(Joi.string()).description('A set of tags to be a associated'),\n  address: Joi.object().keys({\n    street: Joi.string().description('The street'),\n    houseNumber: Joi.string().description('The housenumber.'),\n    type: Joi.string().valid('condo', 'appartment', 'mansion'),\n    city: Joi.string().description('The city')\n  }).label('Address'),\n  education: Joi.array().items(Joi.object().keys({\n    school: Joi.string().description('The school attended'),\n    degree: Joi.boolean().description('Got the degree or not')\n  }).label('Education'))\n}).label('Person');\n```\n\n… then you will be able to generate something a little easier on the eyes using:\n\n```javascript --run simple\nconst njoi = require('njoi');\nconsole.log(njoi.jsonish()(schema));\n```\n\nOr one including comments:\n\n```javascript --run simple\nconsole.log(njoi.jsonish({comments: true})(schema));\n```\n\nOr a markdown breakdown using:\n\n```javascript --run simple\nconsole.log(njoi.markdown()(schema));\n```\n\nOr a JSDoc breakdown using:\n\n```javascript --run simple\nconsole.log(njoi.jsdoc()(schema));\n```\n\n\nIf you want, then can pass in a callback to have the ability to render some\nadditional lines:\n\n```javascript --run simple\nconst envVariable = (node, context) =\u003e {\n  if (context \u0026\u0026 context.indexOf('[]') \u003c 0) {\n    const name = context.split('.').map(str =\u003e str.toUpperCase()).join('_');\n    return `Use the \\`${name}\\` environment variable to override this setting.`\n  } else {\n    return void 0;\n  }\n}\n\nconsole.log(njoi.markdown({extra: envVariable})(schema));\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwspringer%2Fnjoi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwspringer%2Fnjoi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwspringer%2Fnjoi/lists"}