Closed EloB closed 2 years ago
Another suggestion is to but it will become a breaking change. To strip description from schema when it's an empty string.
function extractDescription (description) {
const value = (description || '').replace(/ ?(\[required\]|\[default=(.*?)(?<!\\)\]) ?/gi, '').trim()
if (!value) return {}
return { description: value }
}
Hi @EloB,
Thanks for your contribution, please consider to add tests so the PR could be evaluated, if this is just an example code I will just close and take into consideration for the feature implementation thanks.
Best Regards.
@joolfe Sorry for late reply. I ended up using a different solution but if you like the proposal you can finalize this. :)
Thanks for your time <3
This PR doesn't contain any tests for default value but I've tried it and seems to work.
https://github.com/joolfe/postman-to-openapi/issues/195
Here is a playground for the regexp
[default=value]
https://regex101.com/r/oGS42o/1