Skip to content

Commit df1bf2b

Browse files
committed
chore: rename to @stoplight/json-schema-sampler
1 parent d60cadd commit df1bf2b

13 files changed

+92
-61
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ bower_components
3232
# Users Environment Variables
3333
.lock-wscript
3434
package-lock.json
35+
36+
# JetBrains IDEs
37+
.idea/

Diff for: LICENSE

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
The MIT License (MIT)
22

3+
Copyright (c) 2021 Stoplight <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
24+
The MIT License (MIT)
25+
326
Copyright (c) 2017 Roman Hotsiy <[email protected]>
427

528
Permission is hereby granted, free of charge, to any person obtaining a copy

Diff for: README.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# openapi-sampler
1+
# @stoplight/json-schema-sampler
22

3-
[![Travis build status](http://img.shields.io/travis/Redocly/openapi-sampler.svg?style=flat)](https://travis-ci.org/Redocly/openapi-sampler) [![Coverage Status](https://coveralls.io/repos/Redocly/openapi-sampler/badge.svg?branch=master&service=github)](https://coveralls.io/github/Redocly/openapi-sampler?branch=master) [![Dependency Status](https://david-dm.org/Redocly/openapi-sampler.svg)](https://david-dm.org/Redocly/openapi-sampler) [![devDependency Status](https://david-dm.org/Redocly/openapi-sampler/dev-status.svg)](https://david-dm.org/Redocly/openapi-sampler#info=devDependencies)
3+
It's a fork of [openapi-sampler](https://github.com/Redocly/openapi-sampler) by Redocly, with focus on supporting JSON Schema Draft 6.
44

5-
Tool for generation samples based on OpenAPI payload/response schema
5+
Tool for generation samples based on JSON Schema Draft 6.
66

77
## Features
8+
89
- deterministic (given a particular input, will always produce the same output)
910
- Supports `allOf`
1011
- Supports `additionalProperties`
@@ -28,22 +29,22 @@ Tool for generation samples based on OpenAPI payload/response schema
2829

2930
Install using [npm](https://docs.npmjs.com/getting-started/what-is-npm)
3031

31-
npm install openapi-sampler --save
32+
npm install @stoplight/json-schema-sampler --save
3233

3334
or using [yarn](https://yarnpkg.com)
3435

35-
yarn add openapi-sampler
36+
yarn add @stoplight/json-schema-sampler
3637

3738
Then require it in your code:
3839

3940
```js
40-
var OpenAPISampler = require('openapi-sampler');
41+
const JSONSchemaSampler = require('@stoplight/json-schema-sampler');
4142
```
4243

4344
## Usage
44-
#### `OpenAPISampler.sample(schema, [options], [spec])`
45+
#### `JSONSchemaSampler.sample(schema, [options], [spec])`
4546
- **schema** (_required_) - `object`
46-
A [OpenAPI Schema Object](http://swagger.io/specification/#schemaObject)
47+
A JSON Schema Draft 6 document.
4748
- **options** (_optional_) - `object`
4849
Available options:
4950
- **skipNonRequired** - `boolean`
@@ -58,8 +59,8 @@ Available options:
5859

5960
## Example
6061
```js
61-
const OpenAPISampler = require('.');
62-
OpenAPISampler.sample({
62+
const JSONSchemaSampler = require('@stoplight/json-schema-sampler');
63+
JSONSchemaSampler.sample({
6364
type: 'object',
6465
properties: {
6566
a: {type: 'integer', minimum: 10},

Diff for: gulp-tasks/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function build() {
1111
const $ = global.$;
1212

1313
return browserify({
14-
standalone: 'OpenAPISampler',
14+
standalone: 'JSONSchemaSampler',
1515
entries: [path.join('src', config.entryFileName + '.js')]
1616
})
1717
.transform('babelify', {presets: ['@babel/preset-env']})

Diff for: gulp-tasks/config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import manifest from '../package.json';
22
import path from 'path';
33

44
module.exports = {
5-
entryFileName: 'openapi-sampler',
6-
mainVarName: 'OpenAPISampler',
5+
entryFileName: 'json-schema-sampler',
6+
mainVarName: 'JSONSchemaSampler',
77
mainFile: manifest.main,
88
destinationFolder: path.dirname(manifest.main),
99
exportFileName: path.basename(manifest.main, path.extname(manifest.main))

Diff for: index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<script src="dist/openapi-sampler.js"> </script>
1+
<script src="dist/json-schema-sampler.js"> </script>

Diff for: package.json

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "openapi-sampler",
3-
"version": "1.0.0-beta.18",
4-
"description": "Tool for generation samples based on OpenAPI payload/response schema",
5-
"main": "dist/openapi-sampler.js",
6-
"module": "src/openapi-sampler.js",
2+
"name": "@stoplight/json-schema-sampler",
3+
"version": "1.0.0",
4+
"description": "Tool for generation samples based on JSON Schema Draft 6",
5+
"main": "dist/json-schema-sampler.js",
6+
"module": "src/json-schema-sampler.js",
77
"scripts": {
88
"test": "gulp",
99
"lint": "gulp lint",
@@ -16,21 +16,25 @@
1616
},
1717
"repository": {
1818
"type": "git",
19-
"url": "https://github.com/APIs-guru/openapi-sampler.git"
19+
"url": "https://github.com/stoplightio/json-schema-sampler.git"
2020
},
2121
"keywords": [
2222
"OpenAPI",
23+
"JSON Schema",
2324
"Swagger",
2425
"instantiator",
2526
"sampler",
2627
"faker"
2728
],
28-
"author": "Roman Hotsiy <[email protected]>",
29+
"author": "Stoplight <[email protected]>",
30+
"contributors": [
31+
"Roman Hotsiy <[email protected]>"
32+
],
2933
"license": "MIT",
3034
"bugs": {
31-
"url": "https://github.com/APIs-guru/openapi-sampler/issues"
35+
"url": "https://github.com/stoplightio/json-schema-sampler/issues"
3236
},
33-
"homepage": "https://github.com/APIs-guru/openapi-sampler/",
37+
"homepage": "https://github.com/stoplightio/json-schema-sampler/",
3438
"browserslist": "> 0.25%, not dead",
3539
"devDependencies": {
3640
"@babel/core": "^7.7.2",

Diff for: src/allOf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function allOfSample(into, children, options, spec, context) {
2323
} else {
2424
if (res.type === 'array') {
2525
// TODO: implement arrays
26-
if (!options.quiet) console.warn('OpenAPI Sampler: found allOf with "array" type. Result may be incorrect');
26+
if (!options.quiet) console.warn('JSON Schema Sampler: found allOf with "array" type. Result may be incorrect');
2727
}
2828
const lastSample = subSamples[subSamples.length - 1];
2929
res.value = lastSample != null ? lastSample : res.value;
File renamed without changes.

Diff for: src/traverse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { _samplers } from './openapi-sampler';
1+
import { _samplers } from './json-schema-sampler';
22
import { allOfSample } from './allOf';
33
import { inferType } from './infer';
44
import { getResultForCircular, popSchemaStack } from './utils';

0 commit comments

Comments
 (0)