Skip to content

Commit

Permalink
Merge branch 'release/1.2.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishal Shingala committed Sep 9, 2020
2 parents 353e4ab + 901ce48 commit 0b0994e
Show file tree
Hide file tree
Showing 23 changed files with 2,450 additions and 512 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ test/data/.temp
*.orig

# Prevent unit test coverage reports from being added
.coverage
.coverage
.nyc_output
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ test/data/.temp
*.orig

# Prevent unit test coverage reports from being added
.coverage
.coverage
.nyc_output
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# OpenAPI-Postman Changelog
#### v1.2.5 (July 21, 2020)
#### v1.2.7 (September 9, 2020)
* Fixed issue where schema type object with no properties reolved to string.
* Fix for [#8474](https://github.com/postmanlabs/postman-app-support/issues/8474) - Unable to validate primitive data types in req/res body.
* Added support for handling correct media types which were throwing mismatches for validation.
* Added support for internal $ref resolution in validation flows.
* Fixed issue where parameter resolution was "schema" when "example" was specified.
* Add supported formats for schema resolution (deref).
* Fix for [#7643](https://github.com/postmanlabs/postman-app-support/issues/7643), [#7914](https://github.com/postmanlabs/postman-app-support/issues/7914), [#9004](https://github.com/postmanlabs/postman-app-support/issues/9004) - Added support for Auth params in response/example.
* Bumped up multiple dependecies and dev-dependencies versions to keep them up-to-date.
* Updated code coverage tool from deprecated istanbul to nyc.

#### v1.2.6 (August 10, 2020)
* Fixed TypeError happening when null parameter value provided.
* Fixed an issue where suggested value for mismatch did not fix corresponding mismatch upon applying.
* Fixed issue where root path was not matched during validation.
Expand Down
19 changes: 14 additions & 5 deletions lib/deref.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ const _ = require('lodash'),
PARAMETER_SOURCE = {
REQUEST: 'REQUEST',
RESPONSE: 'RESPONSE'
};
},
// All formats supported by both ajv and json-schema-faker
SUPPORTED_FORMATS = [
'date', 'time', 'date-time',
'uri', 'uri-reference', 'uri-template',
'email',
'hostname',
'ipv4', 'ipv6',
'regex',
'uuid',
'json-pointer'
];

module.exports = {
/**
Expand Down Expand Up @@ -234,8 +245,6 @@ module.exports = {
return tempSchema;
}

schema.type = 'string';

// Override deefault value to appropriate type representation for parameter resolution to schema
if (resolveFor === 'CONVERSION' && resolveTo === 'schema') {
schema.default = '<object>';
Expand Down Expand Up @@ -308,8 +317,8 @@ module.exports = {
schema.type = 'string';
}

// For VALIDATION - Keep format as is to perform ajv validation on format
if (resolveFor !== 'VALIDATION') {
// Discard format if not supported by both json-schema-faker and ajv
if (!_.includes(SUPPORTED_FORMATS, schema.format)) {
delete schema.format;
}
}
Expand Down
9 changes: 9 additions & 0 deletions lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ module.exports = {
external: false,
usage: ['CONVERSION']
},
{
name: 'Include auth info in example requests',
id: 'includeAuthInfoInExample',
type: 'boolean',
default: true,
description: 'Select whether to include authentication parameters in the example request',
external: true,
usage: ['CONVERSION']
},
{
name: 'Short error messages during request <> schema validation',
id: 'shortValidationErrors',
Expand Down
Loading

0 comments on commit 0b0994e

Please sign in to comment.