-
Notifications
You must be signed in to change notification settings - Fork 199
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
required parameters w/in request body not being recognized as required #337
Comments
Investigating this a bit further with a forked version of the converter, I think this is bug in how required params are handled when included in request bodies. I only know the schema I'm working with so I'm hesitant to submit a PR, but the fix for us were the following changes convertToPmBody: before looping through the keys within the body pull the required hash from the schema, i.e. limit checking for the required property within the properties path on the key. I had to do for our preferences - we want to restrict setting disabled:false to only properties that are required on their own and not set it for properties that are required conditionally (i.e. n the presence of other properties that aren't required). To support this I needed to limit looking for 'required' w/in a key's path to just the key's properties path. So
becomes
Now when calculating the required property for a given key, look both for the required property within the key's path as as well for the key within the schema_requirements hash, i.e.:
Lastly I had to add the Also needed to remove the logic for prepending "(Required") to descriptions, as it's duplicated later on, causing the descriptions to start with "(Required) (Required)". |
@dawn-stripe Thanks for reporting the issue and investigation.! I have verified that the issue exists and we will fix this soon. The specification mentioned by you seems to be wrong, as defined by OAS As for the fix, we will include a correct description and similar functionality of |
wonderful thank you @VShingala . And I can believe I misread the OAS as I'm still getting up to speed in it. |
Heyy, @VShingala can I contribute? |
@dev1702ed This is fixed already so no need. |
I'm having trouble generating a collection that only enables required parameters as by default (I also don't see the extra description) it looks like required parameters get). If I don't set the
disableOptionalParameters
config option than all parameters are enabled by default, but if I add it, then all my parameters including required parameters are enabled by default. My schema has a content type and I've tried specifying the required both as a property on the parameter itself as well as including it in the schema.required hash. When I look at the logic in SchemaUtils.js it seems like therequired
property on the parameter itself should have been picked up? I couldn't see any logic that is looking at the schema.required property but I'm still familiarizing myself with the code. Advice?Here's an snippet from my schema (which I have confirmed validates against the OpenAPI spec) :
The text was updated successfully, but these errors were encountered: