You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to issues like #104 I cannot define a yaml that fully matches the deployment environment so I'd prefer to just not serve the yaml if I can help it. I'd just like it to be used to validate paths, as the yaml defines everything relative to the app's subpath so works across deployments so long as pyramid_openapi3 is using request.application_url as the base path.
The text was updated successfully, but these errors were encountered:
@zupo (cc: @mmerickel) ... ran into similar issue, using rutter WSGI compositor. Found solution of using request.script_name for PyramidOpenAPIRequest.path_pattern did the trick for relative absolute server urls without any additional variables. Below is the fix I propose. Tests should be easy enough to modify as well.
Let me know if you are ok with the fix, I'll do a PR.
@property
def path_pattern(self) -> str:
"""The matched url with path pattern.""" # noqa D401
# since application might be mounted on virtual location we need
# to prepend it to the route pattern, or request's response validation
# will fail. one example of this is using WSGI compositors like
# rutter (https://rutter.rtfd.io)
# see: https://wsgi.readthedocs.io/en/latest/definitions.html#envvar-SCRIPT_NAME
relative_matched_route_pattern = "%s%s" % \
(self.request.script_name, self.request.matched_route.pattern)
path_pattern = (
relative_matched_route_pattern
if self.request.matched_route
else self.request.path
)
return path_pattern
Due to issues like #104 I cannot define a yaml that fully matches the deployment environment so I'd prefer to just not serve the yaml if I can help it. I'd just like it to be used to validate paths, as the yaml defines everything relative to the app's subpath so works across deployments so long as pyramid_openapi3 is using
request.application_url
as the base path.The text was updated successfully, but these errors were encountered: