Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unable to validate schema with type: array #196

Merged
merged 3 commits into from
Apr 13, 2020

Conversation

VShingala
Copy link
Member

@VShingala VShingala commented Apr 7, 2020

Issue : postmanlabs/postman-app-support#8098

Bug was happening due to always overriding minItems and maxItems properties to 2 for type: array in deref.resolveRefs().

Added support for Resolving refs for CONVERSION/VALIDATION in deref.resolveRefs() function.

@VShingala VShingala requested a review from abhijitkane April 7, 2020 10:50
lib/deref.js Outdated
@@ -20,6 +20,11 @@ const _ = require('lodash'),
PARAMETER_SOURCE = {
REQUEST: 'REQUEST',
RESPONSE: 'RESPONSE'
},
// Specifies type of Resolving of Refs that can be performed
RESOLVE_REFS_FOR = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems incorrectly named
the validation/conversion should be in a different enum - PROCESSING_TYPE, for example

@@ -64,6 +64,11 @@ const async = require('async'),
RESPONSE_HEADER: 'response header',
RESPONSE_BODY: 'response body'
},
// Specifies types of Resolving of Refs that can be performed
RESOLVE_REFS_FOR = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this enum should only be defined in one place

lib/deref.js Outdated
// This nonsense is needed because the schemaFaker doesn't respect options.maxItems/minItems
schema.maxItems = 2;
schema.minItems = 2;
// Set minItems and maxItems property as 2 for CONVERSION
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also explain why
I can tell that you're setting max/min to 2 for conversion. The comment should explain why you're not doing that for validation

…TYPE and added decriptive comment for setting minItems and maxItems properties to 2
@abhijitkane abhijitkane merged commit eb5cc8e into develop Apr 13, 2020
@umeshp7 umeshp7 deleted the feature/support-resolveref-for-validation branch November 24, 2021 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants