0.0.13 • Published 3 years ago

apibuilder-mock-generator v0.0.13

Weekly downloads
141
License
MIT
Repository
github
Last release
3 years ago

Build Status

apibuilder-mock-generator

A mock data generator based on API Builder specifications for JavaScript

Install

npm install apibuilder-mock-generator

Usage

The following example assumes the service.json file refers to the apibuilder specs, which can be downloaded using the apibuilder CLI with the following command:

apibuilder download apicollective apibuilder-spec latest service > service.json
import { createMockGenerator } from 'apibuilder-mock-generator';
import serviceJson from './service.json';

const generator = createMockGenerator(serviceJson);

generator.model('model');
// =>
// {
//   "name": "dolorum",
//   "plural": "nam",
//   "description": "eveniet",
//   "deprecation": {
//     "description": "id"
//   },
//   "fields": [
//     {
//       "name": "eaque",
//       "type": "ad",
//       "description": "consequuntur",
//       "deprecation": {
//         "description": "vel"
//       },
//       "default": "laboriosam",
//       "required": false,
//       "minimum": 38729,
//       "maximum": 49706,
//       "example": "numquam",
//       "attributes": [
//         {
//           "name": "totam",
//           "value": {},
//           "description": "dolores",
//           "deprecation": {
//             "description": "in"
//           }
//         }
//       ],
//       "annotations": [
//         "ducimus"
//       ]
//     }
//   ],
//   "attributes": [
//     {
//       "name": "voluptatum",
//       "value": {},
//       "description": "est",
//       "deprecation": {
//         "description": "non"
//       }
//     }
//   ]
// }

Check the API reference for more details on mock generators.

License

MIT

0.0.12

3 years ago

0.0.13

3 years ago

0.0.11

4 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago