-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(versioning): revert all commits from 3.2.0 onwards to create new …
…minor release for 3.x
- Loading branch information
Showing
69 changed files
with
18,352 additions
and
8,181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
|
||
[*.{ts,js,yaml,scenario,md}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{ts,js}] | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,3 @@ | ||
*.swp | ||
build.sh | ||
.coveralls.yml | ||
.node-version | ||
.nyc_output | ||
yarn.lock | ||
resolved.yaml | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage | ||
# (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
dist | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
declare namespace OpenapiSchemaToJsonSchema { | ||
interface Options { | ||
dateToDateTime?: boolean; | ||
cloneSchema?: boolean; | ||
supportPatternProperties?: boolean; | ||
keepNotSupported?: NotSupported[]; | ||
strictMode?: boolean; | ||
} | ||
type NotSupported = | ||
| "nullable" | ||
| "discriminator" | ||
| "readOnly" | ||
| "writeOnly" | ||
| "xml" | ||
| "externalDocs" | ||
| "example" | ||
| "deprecated"; | ||
|
||
function fromSchema<T = Record<string | number, any>>( | ||
schema: Record<string | number, any>, | ||
options?: Options | ||
): T; | ||
function fromParameter<T = Record<string | number, any>>( | ||
parameter: Record<string | number, any>, | ||
options?: Options | ||
): T; | ||
} | ||
declare function OpenapiSchemaToJsonSchema<T = Record<string | number, any>>( | ||
schema: Record<string | number, any>, | ||
options?: OpenapiSchemaToJsonSchema.Options | ||
): T; | ||
export = OpenapiSchemaToJsonSchema; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
var deepEqual = require('fast-deep-equal'); | ||
var convert = require('./lib/convert'); | ||
|
||
module.exports = openapiSchemaToJsonSchema; | ||
module.exports.fromSchema = openapiSchemaToJsonSchema; | ||
module.exports.fromParameter = openapiParameterToJsonSchema; | ||
|
||
function openapiSchemaToJsonSchema(schema, options) { | ||
options = resolveOptions(options); | ||
|
||
var jsonSchema = convert.fromSchema(schema, options); | ||
return jsonSchema; | ||
} | ||
|
||
function openapiParameterToJsonSchema(parameter, options) { | ||
options = resolveOptions(options); | ||
|
||
var jsonSchema = convert.fromParameter(parameter, options); | ||
return jsonSchema; | ||
} | ||
|
||
function resolveOptions(options) { | ||
var notSupported = [ | ||
'nullable', 'discriminator', 'readOnly', | ||
'writeOnly', 'xml', 'externalDocs', | ||
'example', 'deprecated' | ||
]; | ||
|
||
options = options || {}; | ||
options.dateToDateTime = options.dateToDateTime || false; | ||
options.cloneSchema = options.cloneSchema == false ? false : true; | ||
options.supportPatternProperties = options.supportPatternProperties || false; | ||
options.keepNotSupported = options.keepNotSupported || []; | ||
options.strictMode = options.strictMode == false ? false : true; | ||
|
||
if (typeof options.patternPropertiesHandler !== 'function') { | ||
options.patternPropertiesHandler = patternPropertiesHandler; | ||
} | ||
|
||
options._removeProps = []; | ||
|
||
if (options.removeReadOnly === true) { | ||
options._removeProps.push('readOnly'); | ||
} | ||
|
||
if (options.removeWriteOnly === true) { | ||
options._removeProps.push('writeOnly'); | ||
} | ||
|
||
options._structs = ['allOf', 'anyOf', 'oneOf', 'not', 'items', 'additionalProperties']; | ||
options._notSupported = resolveNotSupported(notSupported, options.keepNotSupported); | ||
|
||
return options; | ||
} | ||
|
||
function patternPropertiesHandler(schema) { | ||
var pattern; | ||
var patternsObj = schema.patternProperties; | ||
var additProps = schema.additionalProperties; | ||
|
||
if (typeof additProps !== 'object') { | ||
return schema; | ||
} | ||
|
||
for (pattern in patternsObj) { | ||
if (deepEqual(patternsObj[pattern], additProps)) { | ||
schema.additionalProperties = false; | ||
break; | ||
} | ||
} | ||
|
||
return schema; | ||
} | ||
|
||
function resolveNotSupported(notSupported, toRetain) { | ||
var i = 0; | ||
var index; | ||
|
||
for (i; i < toRetain.length; i++) { | ||
index = notSupported.indexOf(toRetain[i]); | ||
|
||
if (index >= 0) { | ||
notSupported.splice(index, 1); | ||
} | ||
} | ||
|
||
return notSupported; | ||
} |
Oops, something went wrong.