1.0.13 • Published 4 months ago

openapi-ts-mock-generator v1.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

openapi-ts-mock-generator

This project inpired from msw-auto-mock

  • Generate mock data from openapi.json: schema and paths with responses.
  • Custom mock data: use special fakers.

Usage

  • openapi.json with url
npx openapi-ts-mock-generator http://127.0.0.1/openapi.json
  • openapi.json with file
npx openapi-ts-mock-generator openapi.json

Options

  • -b, --base-dir: base directory for input and output files.
  • -c, --include-codes: include status codes in response.
  • -m, --array-min-length: minimum length of array.
  • -M, --array-max-length: maximum length of array.
  • --special-path: special path for custom mock data.
  • -l, --locales: locales for faker data. look at faker.js Localization use Locale value. ex) ko
  • -s, --static: generate static mock data.
  • --handler-url: handler url for msw.

Special Keys

Special Keys are used for custom mock data. Applied based on title and description. Key is target title or description, value can be value type or faker type.

value type

use value as mock data.

{
  "year": {
    "value": "2024"
  }
}

faker type

generate faker data.

{
  "age": {
    "module": "number",
    "type": "int",
    "options": {
      "min": 0,
      "max": 150
    }
  }
}
1.0.13

4 months ago

1.0.12

8 months ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.2

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.3

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago