All Projects → Redocly → Openapi Sampler

Redocly / Openapi Sampler

Licence: mit
🔠 Tool for generation samples based on OpenAPI(fka Swagger) payload/response schema

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Openapi Sampler

Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+4043.37%)
Mutual labels:  schema, fake, mock
open-api-mocker
A mock server based in OpenAPI Specification
Stars: ✭ 58 (-30.12%)
Mutual labels:  mock, schema, openapi
stub-server
Stub server for REST APIs
Stars: ✭ 14 (-83.13%)
Mutual labels:  mock, fake
thema
A CUE-based framework for portable, evolvable schema
Stars: ✭ 41 (-50.6%)
Mutual labels:  schema, openapi
Php Openapi
Read and write OpenAPI yaml/json files and make the content accessible in PHP objects.
Stars: ✭ 268 (+222.89%)
Mutual labels:  openapi, schema
Openapi Mock Generator
Progressive Web App for generating mocked data from an OpenAPI specification
Stars: ✭ 72 (-13.25%)
Mutual labels:  openapi, mock
Stubmatic
Mock HTTP calls without coding. Designed specially for testing and testers.
Stars: ✭ 118 (+42.17%)
Mutual labels:  mock, fake
falso
All the Fake Data for All Your Real Needs 🙂
Stars: ✭ 877 (+956.63%)
Mutual labels:  mock, fake
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+156.63%)
Mutual labels:  mock, fake
Jsonschema
An implementation of the JSON Schema specification for Python
Stars: ✭ 3,474 (+4085.54%)
Mutual labels:  schema, openapi
Mocker Data Generator
A simplified way to generate masive mock data based on a schema, using the awesome fake/random data generators like (FakerJs, ChanceJs, CasualJs and RandExpJs), all in one tool to generate your fake data for testing.
Stars: ✭ 333 (+301.2%)
Mutual labels:  schema, fake
xrm-mock
📚 A fake implementation of the Xrm object model. Written in TypeScript against @types/xrm definitions.
Stars: ✭ 64 (-22.89%)
Mutual labels:  mock, fake
better-mock
Forked from Mockjs, Generate random data & Intercept ajax request. Support miniprogram.
Stars: ✭ 140 (+68.67%)
Mutual labels:  mock, fake
openapi-schema-validator
OpenAPI schema validator for Python
Stars: ✭ 35 (-57.83%)
Mutual labels:  schema, openapi
fakey-json
This is a utility for mocking json data that pretends the api response data with JSON format.
Stars: ✭ 27 (-67.47%)
Mutual labels:  mock, fake
bluepine
A DSL for defining API schemas/endpoints, validating, serializing and generating Open API v3
Stars: ✭ 21 (-74.7%)
Mutual labels:  schema, openapi
Compojure Api
Sweet web apis with Compojure & Swagger
Stars: ✭ 1,056 (+1172.29%)
Mutual labels:  openapi, schema
openapi
GitHub's official OpenAPI spec with Octokit extensions
Stars: ✭ 24 (-71.08%)
Mutual labels:  schema, openapi
Martian
The HTTP abstraction library for Clojure/script, supporting Swagger, Schema, re-frame and more
Stars: ✭ 294 (+254.22%)
Mutual labels:  openapi, schema
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-40.96%)
Mutual labels:  fake, mock

openapi-sampler

Travis build status Coverage Status Dependency Status devDependency Status

Tool for generation samples based on OpenAPI payload/response schema

Features

  • deterministic (given a particular input, will always produce the same output)
  • Supports allOf
  • Supports additionalProperties
  • Uses default, const, enum and examples where possible
  • Full array support: supports minItems, and tuples (items as an array)
  • Supports minLength, maxLength, min, max, exclusiveMinimum, exclusiveMaximum
  • Supports the next string formats:
    • email
    • password
    • date-time
    • date
    • ipv4
    • ipv6
    • hostname
    • uri
    • uuid
  • Infers schema type automatically following same rules as json-schema-faker
  • Support for $ref resolving

Installation

Install using npm

npm install openapi-sampler --save

or using yarn

yarn add openapi-sampler

Then require it in your code:

var OpenAPISampler = require('openapi-sampler');

Usage

OpenAPISampler.sample(schema, [options], [spec])

  • schema (required) - object A OpenAPI Schema Object
  • options (optional) - object Available options:
    • skipNonRequired - boolean Don't include non-required object properties not specified in required property of the schema object
    • skipReadOnly - boolean Don't include readOnly object properties
    • skipWriteOnly - boolean Don't include writeOnly object properties
    • quiet - boolean Don't log console warning messages
  • spec - whole specification where the schema is taken from. Required only when schema may contain $ref. spec must not contain any external references

Example

const OpenAPISampler = require('.');
OpenAPISampler.sample({
  type: 'object',
  properties: {
    a: {type: 'integer', minimum: 10},
    b: {type: 'string', format: 'password', minLength: 10},
    c: {type: 'boolean', readOnly: true}
  }
}, {skipReadOnly: true});
// { a: 10, b: 'pa$$word_q' }
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].