
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
work.kdlm626.mom/pb33f/libopenapi
Advanced tools
libopenapi has full support for Swagger (OpenAPI 2), OpenAPI 3, and OpenAPI 3.1. It can handle the largest and most complex specifications you can think of.
If your company is using libopenapi, please considering supporting this project,
like our very kind sponsors:
libopenapi is pretty new, so our list of notable projects that depend on libopenapi is small (let me know if you'd like to add your project)
Need help? Have a question? Want to share your work? Join our discord and come say hi!
libopenapi-validatorNeed to validate requests, responses, parameters or schemas? Use the new libopenapi-validator module.
See all the documentation at https://pb33f.io/libopenapi/
👀 Get rolling fast using libopenapi with the
Parsing OpenAPI files using go guide 👀
Or, follow these steps and see something in a few seconds.
curl https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml > petstorev3.json
go get github.com/pb33f/libopenapi
Copy and paste this code into a main.go file.
package main
import (
"fmt"
"os"
"github.com/pb33f/libopenapi"
)
func main() {
petstore, _ := os.ReadFile("petstorev3.json")
document, err := libopenapi.NewDocument(petstore)
if err != nil {
panic(fmt.Sprintf("cannot create new document: %e", err))
}
docModel, errors := document.BuildV3Model()
if len(errors) > 0 {
for i := range errors {
fmt.Printf("error: %e\n", errors[i])
}
panic(fmt.Sprintf("cannot create v3 model from document: %d errors reported", len(errors)))
}
// The following fails after the first iteration
for schemaPairs := docModel.Model.Components.Schemas.First(); schemaPairs != nil; schemaPairs = schemaPairs.Next() {
schemaName := schemaPairs.Key()
schema := schemaPairs.Value()
fmt.Printf("Schema '%s' has %d properties\n", schemaName, schema.Schema().Properties.Len())
}
}
Run it, which should print out:
Schema 'Pet' has 3 properties
Schema 'Error' has 2 properties
Read the full docs at https://pb33f.io/libopenapi/
Logo gopher is modified, originally from egonelbre
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.