-
Notifications
You must be signed in to change notification settings - Fork 50
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
Make it optional to add basurl to path in _getParameters - Express #125
Comments
What do you have baseUrl for in this case? Swagger spec explicitly says: |
@hpl002 Wait, it should be the other way around. You can add Would be easier to understand situation if you shared (potentially with scrambled names) relevant fragments of your spec. |
Thanks for getting back to me. Here is a derivative of your pets.yaml spec
if have to set basepath for use with my other middleware. This creates a conflict when calling Edit: |
And when you change server to
that doesn't help? |
No,still same result. Did however bypass this by just forecefully setting the baseurl to nothing before sending it in. Works, but not ideal..
|
Feel free to close the issue is you're not planning to address it further. Forcefully setting the baseUrl works.. |
no-no, I still need to look into it |
would it be possible to make the concat optional based on prop form options obj?
using this with routing and would have to append basePath to all paths in schema for paths to match, could avoid this if it was possible to avoid baseurl.
my routes go via /api, but paths in schema do not have this prefixed, thus causing a mismatch that results in the request not being validated.
Req points to /api/somewhere
While path goes directly to /somewhere
ref:
function _getParameters(req) {
const requestOptions = {};
const path = req.baseUrl.concat(req.route.path);
requestOptions.path = path.endsWith('/') ? path.substring(0, path.length - 1) : path;
requestOptions.headers = req.headers;
requestOptions.params = req.params;
requestOptions.query = req.query;
requestOptions.files = req.files;
requestOptions.method = req.method;
requestOptions.body = req.body;
}
I could create a PR on this if this is interesting? Would certainly help me out
The text was updated successfully, but these errors were encountered: