All Projects → anttiviljami → mock-json-schema

anttiviljami / mock-json-schema

Licence: MIT license
Simple utility to mock example objects based on JSON schema definitions

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mock-json-schema

openapi4j
OpenAPI 3 parser, JSON schema and request validator.
Stars: ✭ 92 (+300%)
Mutual labels:  json-schema, openapi
open-api-mocker
A mock server based in OpenAPI Specification
Stars: ✭ 58 (+152.17%)
Mutual labels:  mock, openapi
Kubernetes Json Schema
A set of JSON schemas for various Kubernetes versions, extracted from the OpenAPI definitions
Stars: ✭ 234 (+917.39%)
Mutual labels:  json-schema, openapi
Uvicorn Gunicorn Fastapi Docker
Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI web applications in Python 3.6 and above with performance auto-tuning. Optionally with Alpine Linux.
Stars: ✭ 1,014 (+4308.7%)
Mutual labels:  json-schema, openapi
Openapi Mock
OpenAPI mock server with random data generation
Stars: ✭ 202 (+778.26%)
Mutual labels:  mock, openapi
Json Schema To Openapi Schema
A little NodeJS package to convert JSON Schema to OpenAPI Schema Objects
Stars: ✭ 168 (+630.43%)
Mutual labels:  json-schema, openapi
main
Mocks Server monorepo
Stars: ✭ 109 (+373.91%)
Mutual labels:  mock, openapi
Swagger Parser
Swagger 2.0 and OpenAPI 3.0 parser/validator
Stars: ✭ 710 (+2986.96%)
Mutual labels:  json-schema, openapi
Raml Server
run a mocked server JUST based on a RAML API's definition .. zero coding
Stars: ✭ 158 (+586.96%)
Mutual labels:  mock, json-schema
Openapi Sampler
🔠 Tool for generation samples based on OpenAPI(fka Swagger) payload/response schema
Stars: ✭ 83 (+260.87%)
Mutual labels:  mock, openapi
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+172021.74%)
Mutual labels:  json-schema, openapi
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+14891.3%)
Mutual labels:  mock, openapi
Spectral
A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v2 & v3.
Stars: ✭ 876 (+3708.7%)
Mutual labels:  json-schema, openapi
Spot
Spot is a concise, developer-friendly way to describe your API contract.
Stars: ✭ 230 (+900%)
Mutual labels:  json-schema, openapi
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+3513.04%)
Mutual labels:  json-schema, openapi
Full Stack Fastapi Couchbase
Full stack, modern web application generator. Using FastAPI, Couchbase as database, Docker, automatic HTTPS and more.
Stars: ✭ 243 (+956.52%)
Mutual labels:  json-schema, openapi
Datamodel Code Generator
Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.
Stars: ✭ 393 (+1608.7%)
Mutual labels:  json-schema, openapi
Full Stack Fastapi Postgresql
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.
Stars: ✭ 7,635 (+33095.65%)
Mutual labels:  json-schema, openapi
Openapi Mock Generator
Progressive Web App for generating mocked data from an OpenAPI specification
Stars: ✭ 72 (+213.04%)
Mutual labels:  mock, openapi
Openapi Backend
Build, Validate, Route, Authenticate and Mock using OpenAPI
Stars: ✭ 216 (+839.13%)
Mutual labels:  mock, openapi

mock-json-schema

CI Dependencies npm version npm downloads Total alerts Language grade: JavaScript License Sponsored Buy me a coffee

Simple utility to mock example objects based on JSON schema definitions

Features

  • Minimal & deterministic. Predictable single example with no randomisation involved
  • Thoroughly tested feature set
  • Supports example, default
  • Supports anyOf, allOf, oneOf
  • Built-in examples for following string formats:
    • email
    • hostname
    • ipv4
    • ipv6
    • uri
    • uri-reference
    • uri-template
    • json-pointer
    • date-time
    • uuid
  • TypeScript types included
  • Supports $ref pointers

Usage

const { mock } = require('mock-json-schema');
const assert = require('assert');

const schema = {
  type: 'array',
  items: {
    type: 'object',
    properties: {
      id: {
        type: 'integer',
        minimum: 1,
      },
      name: {
        type: 'string',
        example: 'John Doe',
      },
      email: {
        type: 'string',
        format: 'email',
      },
    },
  },
};

assert.deepEqual(mock(schema), [{ id: 1, name: 'John Doe', email: '[email protected]' }]);

View more examples

Contributing

mock-json-schema is Free and Open Source Software. Issues and pull requests are more than welcome!

The Chilicorn

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].