pyramid_swagger icon indicating copy to clipboard operation
pyramid_swagger copied to clipboard

Option to validate only api and ignore the rest

Open maor121 opened this issue 8 years ago • 4 comments

Tried:

pyramid_swagger.enable_path_validation = false pyramid.includes = pyramid_swagger

but enable_path_validation doesn't seem to work, the pyramid_swagger still validates the paths not in swagger.json

also tried:

pyramid_swagger.exclude_paths = ['^(?!/api/).*$'] pyramid.includes = pyramid_swagger

but exclude_paths seem to either exclude all the paths, or none at all.

Help will be appriciated. Maor

maor121 avatar May 28 '16 10:05 maor121

Hi Maor,

Can you help me out with a bit more diagnostic information? It would be useful to know:

  • What version of pyramid_swagger you're using
  • The complete configuration you're using
  • A minimal swagger spec that reproduces the issue
  • A specific curl that isn't behaving like you expect

striglia avatar May 31 '16 18:05 striglia

I had the same problem. I think registry.settings.get(..) always returns string, and causes the regex compiler to generate the wrong pattern.
you should try with something like this: pyramid_swagger.exclude_paths = ^(?!/api/)

deubs avatar Jul 08 '16 16:07 deubs

Ah thanks @deubs. Sounds like it's just the INI format being picky about strings then?

striglia avatar Jul 08 '16 17:07 striglia

I guess so, i think you shouldn't test instance types here .As always are strings. Maybe to define multiple patterns would be convenient to use multi line values, or comma separated values (without quotes) and then split...

deubs avatar Jul 09 '16 12:07 deubs