Forum Discussion
OK, try this, treat servers as an array:
path: $.servers.1.url
regex: https://{host}/mypath
- path must exit: false
Problem is, this assumes the "desired path" is always the second URL under the Servers tag.
Maybe have another rule that $.servers.0.url must exist and NOT be the special path ?
Or make sure the "special path" is always the first [zero] URL. The auto-mock doesn't need to be first <grin>.
Thanks, but your solution seems to be too static for my use case.
My given example was really just an example to simulate the problem, but in reality the APIs can look quite different.
My only goal is to make sure that the one server url is present an nothing more.
It just does not feel right, to enforce a certain order of server urls inside all of these APIs just to make one standardization rule work.
Is there no other solution? Or is there maybe a chance that the 'path exists' feature will support expressions in the future?
- mhiggins4 years agoStaff
I have created a Feature Request in the SwaggerHub Product Aha board.
SWAG-I-333 Custom Rules linter to support path-exists expressions.
Related Content
- 5 years ago
Recent Discussions
- 10 days ago
- 2 months ago