New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/LarsKoelpin/golang-json-assert

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/LarsKoelpin/golang-json-assert

  • v0.0.0-20200731201028-96e3cfdbcc37
  • Source
  • Go
  • Socket score

Version published
Created
Source

Golang Json Assert

golang-json-assert

A Go library for testing JSON strings.

Mission

I could not find any library implementing the "Conform behavior", which checks, if JSON objects are downwards-compatible, therefore testing if there is a semantic versioning major bump change.

Usage

For full specification of the library see pkg/jsonassert_test.go.

In a Nutshell, given to strings, the library can check for strict equality:

actual := `
{
  "name": "Lars",
  "age": 12
}
`

Expect(actual).ToEqual(actual) // returns true

But, It can also check, if a JSON conforms with another. This means, that in theory actual and expected value are schematically compatible. This can be used to ensure that diffrent JSON objects provide some compability.

actual := `
{
  "name": "Lars",
  "age": 12
}
`

expect := `
{
  "age": 12
}
`

Expect(actual).ToConform(expect) // returns true

Contribution

If you feel like there are missing some assertions / specifications, feel free to open an issue / Submit a PR.

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ go test

License

The MIT License (MIT). Please see License File for more information.

FAQs

Package last updated on 31 Jul 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc