Sign inDemoInstall

Package Overview
File Explorer

Install Socket

Protect your apps from supply chain attacks


Package validate provides methods to validate a swagger specification, as well as tools to validate data against their schema. This package follows Swagger 2.0. specification (aka OpenAPI 2.0). Reference can be found here: Validates a spec document (from JSON or YAML) against the JSON schema for swagger, then checks a number of extra rules that can't be expressed in JSON schema. Entry points: Reported as errors: Reported as warnings: The schema validation toolkit validates data against JSON-schema-draft 04 schema. It is tested against the full json-schema-testing-suite (, except for the optional part (bignum, ECMA regexp, ...). It supports the complete JSON-schema vocabulary, including keywords not supported by Swagger (e.g. additionalItems, ...) Entry points: With the current version of this package, the following aspects of swagger are not yet supported:


Version published


# Validation helpers [![Build Status](]("go+test") [![codecov](](

[![Slack Status](](
[![Go Reference](](
[![Go Report Card](](

This package provides helpers to validate Swagger 2.0. specification (aka OpenAPI 2.0). 

Reference can be found here:

## What's inside?

* A validator for Swagger specifications
* A validator for JSON schemas draft4
* Helper functions to validate individual values (used by code generated by [go-swagger](
  * Required, RequiredNumber, RequiredString
  * ReadOnly
  * UniqueItems, MaxItems, MinItems
  * Enum, EnumCase
  * Pattern, MinLength, MaxLength
  * Minimum, Maximum, MultipleOf
  * FormatOf


## FAQ

* Does this library support OpenAPI 3?

> No.
> This package currently only supports OpenAPI 2.0 (aka Swagger 2.0).
> There is no plan to make it evolve toward supporting OpenAPI 3.x.
> This [discussion thread]( relates the full story.
> An early attempt to support Swagger 3 may be found at:


Last updated on 27 Dec 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.


Related posts

SocketSocket SOC 2 Logo


  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc