{"id":13716422,"url":"https://github.com/brandon93s/micro-superstruct","last_synced_at":"2025-09-15T14:19:12.974Z","repository":{"id":57143529,"uuid":"120106318","full_name":"brandon93s/micro-superstruct","owner":"brandon93s","description":"A Superstruct wrapper for Micro to validate your request body and query parameters","archived":false,"fork":false,"pushed_at":"2020-09-07T16:47:31.000Z","size":85,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-24T00:25:32.668Z","etag":null,"topics":["micro","superstruct","validation"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/brandon93s.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}},"created_at":"2018-02-03T16:05:16.000Z","updated_at":"2023-12-07T16:26:24.000Z","dependencies_parsed_at":"2022-09-05T12:01:14.833Z","dependency_job_id":null,"html_url":"https://github.com/brandon93s/micro-superstruct","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/brandon93s/micro-superstruct","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fmicro-superstruct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fmicro-superstruct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fmicro-superstruct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fmicro-superstruct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brandon93s","download_url":"https://codeload.github.com/brandon93s/micro-superstruct/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandon93s%2Fmicro-superstruct/sbom","scorecard":{"id":251081,"data":{"date":"2025-08-11","repo":{"name":"github.com/brandon93s/micro-superstruct","commit":"865835857851d154b599683a0fbeeb12f4547967"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/18 approved changesets -- score normalized to 0","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":"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":"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":"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":"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":"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"}}]},"last_synced_at":"2025-08-17T08:28:35.547Z","repository_id":57143529,"created_at":"2025-08-17T08:28:35.548Z","updated_at":"2025-08-17T08:28:35.548Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275267988,"owners_count":25434742,"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-09-15T02:00:09.272Z","response_time":75,"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":["micro","superstruct","validation"],"created_at":"2024-08-03T00:01:10.332Z","updated_at":"2025-09-15T14:19:12.909Z","avatar_url":"https://github.com/brandon93s.png","language":"JavaScript","readme":"# micro-superstruct [![Build Status](https://travis-ci.org/brandon93s/micro-superstruct.svg?branch=master)](https://travis-ci.org/brandon93s/micro-superstruct)\n\n\u003e A [Superstruct](https://github.com/ianstormtaylor/superstruct) wrapper for [Micro](https://github.com/zeit/micro) to validate request body and query parameters.\n\n## Install\n\n```shell\nnpm install micro-superstruct\n```\n\n## Usage\n\nmicro-superstruct exports a validate function that allows you to create API validators from any `Struct`:\n\n```js\nconst {object, string, number} = require('superstruct')\nconst {json, send} = require('micro')\nconst validate = require('micro-superstruct')\n\n// define a Superstruct `Struct`\nconst Unicorn = object({\n  name: string(),\n  age: number(),\n  color: string()\n})\n\n// create a validator\nconst validator = validate(Unicorn)\n\n// write your Micro API\nconst handler = async (req, res) =\u003e {\n  const body = await json(req)\n  send(res, 200, body)\n}\n\n// export validated service\nmodule.exports = validator(handler)\n```\n\nRequests that fail validation will return a 400 error along with a Superstruct validation message:\n\n![Error](demo.png)\n\n## API\n\n### validate(config)\n\nReturns a validator function that can be used to validate a Micro handler.\n\n#### config\nType: `Struct | object`\n\nPassing a `Struct` directly will configure request body validation using the provided validator.\n\nPassing an `object` allows for validation of both the request body and query string. Both are optional.\n\n```js\n// body validation\nvalidate(object({}))\n\n// body and/or query validation\nvalidate({\n  body: object({}),\n  query: object({})\n})\n```\n\n## Request Properties\n\nmicro-superstruct attaches validated `body` and/or `query` objects to the request object for use by the API handler:\n\n```js\nconst validator = validate(Unicorn)\n\nconst handler = async (req, res) =\u003e {\n  const {body, query} = req\n  send(res, 200, body)\n}\n```\n\n## License\n\nMIT © [Brandon Smith](https://github.com/brandon93s)\n","funding_links":[],"categories":["Modules"],"sub_categories":["Wrappers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandon93s%2Fmicro-superstruct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrandon93s%2Fmicro-superstruct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandon93s%2Fmicro-superstruct/lists"}