{"id":13809024,"url":"https://github.com/terminalstatic/go-xsd-validate","last_synced_at":"2026-01-27T00:22:19.540Z","repository":{"id":26455636,"uuid":"105042416","full_name":"terminalstatic/go-xsd-validate","owner":"terminalstatic","description":"Xsd validation for go based on libxml2","archived":false,"fork":false,"pushed_at":"2024-10-27T07:53:05.000Z","size":107,"stargazers_count":80,"open_issues_count":7,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-13T18:52:46.357Z","etag":null,"topics":["go","golang","libxml2","validation","xml","xsd"],"latest_commit_sha":null,"homepage":"","language":"Go","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/terminalstatic.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,"zenodo":null}},"created_at":"2017-09-27T16:31:20.000Z","updated_at":"2025-07-18T14:11:57.000Z","dependencies_parsed_at":"2025-05-14T05:33:15.355Z","dependency_job_id":"d1fbd1b1-5863-4387-b4cb-d86a6978fd95","html_url":"https://github.com/terminalstatic/go-xsd-validate","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/terminalstatic/go-xsd-validate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalstatic%2Fgo-xsd-validate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalstatic%2Fgo-xsd-validate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalstatic%2Fgo-xsd-validate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalstatic%2Fgo-xsd-validate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terminalstatic","download_url":"https://codeload.github.com/terminalstatic/go-xsd-validate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalstatic%2Fgo-xsd-validate/sbom","scorecard":{"id":874455,"data":{"date":"2025-08-11","repo":{"name":"github.com/terminalstatic/go-xsd-validate","commit":"de64dc16657686ed97f61025d2ec774a05fd9631"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"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":"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":"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":"Code-Review","score":2,"reason":"Found 4/18 approved changesets -- score normalized to 2","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":"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":"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":"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 17 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"}},{"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"}}]},"last_synced_at":"2025-08-24T05:26:38.396Z","repository_id":26455636,"created_at":"2025-08-24T05:26:38.396Z","updated_at":"2025-08-24T05:26:38.396Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28792870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: 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":false,"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":["go","golang","libxml2","validation","xml","xsd"],"created_at":"2024-08-04T01:01:58.357Z","updated_at":"2026-01-27T00:22:19.481Z","avatar_url":"https://github.com/terminalstatic.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# xsdvalidate\n[![GoDoc](https://godoc.org/github.com/terminalstatic/go-xsd-validate?status.svg)](https://godoc.org/github.com/terminalstatic/go-xsd-validate)\n\nThe goal of this package is to preload xsd files into memory and to validate xml (fast) using libxml2, like post bodys of xml service endpoints or api routers. At the time of writing, similar packages I found on github either didn't provide error details or got stuck under load. In addition to providing error strings it also exposes some fields of libxml2 return structs. \n\n# Api Reference\n[https://godoc.org/github.com/terminalstatic/go-xsd-validate](https://godoc.org/github.com/terminalstatic/go-xsd-validate)\n\n# Install\nInstall libxml2 dev via distribution package manager or from source, below an example how to install the latest libxml2 from source on linux(Debian/Ubuntu): \n\n\tcurl -L ftp://xmlsoft.org/libxml2/LATEST_LIBXML2 -o ./LIBXML2_LATEST.tar.gz\n\ttar -xf ./LIBXML2_LATEST.tar.gz\n\tcd ./libxml2*\n\t./configure --prefix=/usr  --enable-static --with-threads --with-history\n\tmake\n\tsudo make install\n\t\nGo get the package:\n\n\tgo get github.com/terminalstatic/go-xsd-validate\n\t\n# Examples\nCheck [this](./examples/_server/simple/simple.go) for a simple http server example and [that](./examples/_server/simpler/simpler.go) for an even simpler one. Look at [this](./examples/_server/simpler_mem/simpler_mem.go) for an example using Go's `embed` package to bake an XML schema into a simple http server.\nTo see how this could be plugged into middleware see the [go-chi](https://github.com/go-chi/chi) [example](./examples/_server/chi/chi.go) I came up with. \n\n```go\n\txsdvalidate.Init()\n\tdefer xsdvalidate.Cleanup()\n\txsdhandler, err := xsdvalidate.NewXsdHandlerUrl(\"examples/test1_split.xsd\", xsdvalidate.ParsErrDefault)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer xsdhandler.Free()\n\n\txmlFile, err := os.Open(\"examples/test1_fail2.xml\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer xmlFile.Close()\n\tinXml, err := ioutil.ReadAll(xmlFile)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Option 1:\n\txmlhandler, err := xsdvalidate.NewXmlHandlerMem(inXml, xsdvalidate.ParsErrDefault)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer xmlhandler.Free()\n\n\terr = xsdhandler.Validate(xmlhandler, xsdvalidate.ValidErrDefault)\n\tif err != nil {\n\t\tswitch err.(type) {\n\t\tcase xsdvalidate.ValidationError:\n\t\t\tfmt.Println(err)\n\t\t\tfmt.Printf(\"Error in line: %d\\n\", err.(xsdvalidate.ValidationError).Errors[0].Line)\n\t\t\tfmt.Println(err.(xsdvalidate.ValidationError).Errors[0].Message)\n\t\tdefault:\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n\n\t// Option 2:\n\terr = xsdhandler.ValidateMem(inXml, xsdvalidate.ValidErrDefault)\n\tifT err != nil {\n\t\tswitch err.(type) {\n\t\tcase xsdvalidate.ValidationError:\n\t\t\tfmt.Println(err)\n\t\t\tfmt.Printf(\"Error in line: %d\\n\", err.(xsdvalidate.ValidationError).Errors[0].Line)\n\t\t\tfmt.Println(err.(xsdvalidate.ValidationError).Errors[0].Message)\n\t\tdefault:\n\t\t\tfmt.Println(err)\n\t\t}\n\t}\n```\n\n# Licence\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterminalstatic%2Fgo-xsd-validate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterminalstatic%2Fgo-xsd-validate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterminalstatic%2Fgo-xsd-validate/lists"}