Socket
Socket
Sign inDemoInstall

jj-spec-validator

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jj-spec-validator

jj mocks validator for openapi specs


Maintainers
1

Usage

  1. Decorate your mocked function with @validate_spec(), providing a link to a YAML or JSON OpenAPI spec.
import jj
from jj.mock import mocked
from jj_spec_validator import validate_spec

@validate_spec(spec_link="http://example.com/api/users/spec.yml")
async def your_mocked_function():
    matcher = jj.match("GET", "/users")
    response = jj.Response(status=200, json=[])
    
    mock = await mocked(matcher, response)
  1. Control discrepancy handling with validate_level key:
    • "error" (default, raises error)
    • "warning" (prints warning, continues execution)
    • "skip" (skips validation)
@validate_spec(spec_link="http://example.com/spec.yml", validate_level="warning")
  1. is_strict key (in development) will allow choosing between strict and non-strict comparison. Currently, non-strict comparison is used.

FAQs


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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc