{"action":"created","issue":{"url":"https://api.github.com/repos/sloria/webargs/issues/125","repository_url":"https://api.github.com/repos/sloria/webargs","labels_url":"https://api.github.com/repos/sloria/webargs/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/sloria/webargs/issues/125/comments","events_url":"https://api.github.com/repos/sloria/webargs/issues/125/events","html_url":"https://github.com/sloria/webargs/issues/125","id":179545205,"number":125,"title":"Validating Variable URL Parameters","user":{"login":"cmuell89","id":6877040,"avatar_url":"https://avatars.githubusercontent.com/u/6877040?v=3","gravatar_id":"","url":"https://api.github.com/users/cmuell89","html_url":"https://github.com/cmuell89","followers_url":"https://api.github.com/users/cmuell89/followers","following_url":"https://api.github.com/users/cmuell89/following{/other_user}","gists_url":"https://api.github.com/users/cmuell89/gists{/gist_id}","starred_url":"https://api.github.com/users/cmuell89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmuell89/subscriptions","organizations_url":"https://api.github.com/users/cmuell89/orgs","repos_url":"https://api.github.com/users/cmuell89/repos","events_url":"https://api.github.com/users/cmuell89/events{/privacy}","received_events_url":"https://api.github.com/users/cmuell89/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-27T16:32:39Z","updated_at":"2016-09-28T02:48:26Z","closed_at":null,"body":"Hey @sloria ,\r\n\r\nReally like webargs. Good stuff. \r\n\r\nI am building a backend JSON API using Flask-Restful. Flask's ability to parse out variable URL's is very convenient with GET requests. I would like to validate the input passed in as the 'classifier' variable paramter to my get(self, args, classifier) method (see below for an example). I've attempted to add a custom location onto the flask parser via the @parser.location_handler decorator. However, the variable part of the URL is not explicitly supplied to the Flasks Request object. I could use a regex parse what was passed into the URI from such fields as Request.base_url, Request.endpoint etc,. although it feels like a hack. I believe Flask passes this parameter to the Resource object so I am not sure if this is available to incorporate into webargs at the moment.\r\n\r\nURI example:\r\n```\r\nhttps://localhost:3000/train_classifier/<string:classifier>\r\n\r\nhttps://localhost:3000/train_classifier/classifier1\r\n```\r\nCode example:\r\n\r\n```\r\nclass Train(Resource):\r\n    \r\n    decorators = [auth.login_required]\r\n    validate_application_json = partial(valid_application_type, 'application/json')\r\n    \r\n    train_args = {\r\n            'content_type': fields.Str(required=True, load_from='Content-Type', location='headers', validate=validate_application_json),\r\n           # Something along these lines:\r\n            'classifier': fields.Str(required=True, location='variableURL', validate=validate.OneOf(classifier1, classifier2)\r\n        }\r\n    \r\n    @use_args(train_args)\r\n    def get(self, args, classifier):\r\n       ....\r\n```\r\n\r\nSome doc resources:\r\n\r\n- http://flask.pocoo.org/docs/0.11/quickstart/#variable-rules\r\n- http://flask.pocoo.org/docs/0.11/api/#incoming-request-data\r\n\r\nIf I am missing something obvious, feel free to slap me on the back of the head. Otherwise I think this would be a nice feature."},"comment":{"url":"https://api.github.com/repos/sloria/webargs/issues/comments/250058082","html_url":"https://github.com/sloria/webargs/issues/125#issuecomment-250058082","issue_url":"https://api.github.com/repos/sloria/webargs/issues/125","id":250058082,"user":{"login":"sloria","id":2379650,"avatar_url":"https://avatars.githubusercontent.com/u/2379650?v=3","gravatar_id":"","url":"https://api.github.com/users/sloria","html_url":"https://github.com/sloria","followers_url":"https://api.github.com/users/sloria/followers","following_url":"https://api.github.com/users/sloria/following{/other_user}","gists_url":"https://api.github.com/users/sloria/gists{/gist_id}","starred_url":"https://api.github.com/users/sloria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloria/subscriptions","organizations_url":"https://api.github.com/users/sloria/orgs","repos_url":"https://api.github.com/users/sloria/repos","events_url":"https://api.github.com/users/sloria/events{/privacy}","received_events_url":"https://api.github.com/users/sloria/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T02:48:26Z","updated_at":"2016-09-28T02:48:26Z","body":"I think the `'view_args'` location should meet your use case."}}
{"actor":{"display_login":"sloria"}}