Yelp / swagger_spec_validator

Other
104 stars 71 forks source link

why isn't it possible to validate a string? #19

Closed ysangkok closed 2 years ago

ysangkok commented 9 years ago

or any local file for that matter? thanks in advance.

dnephin commented 9 years ago

You can validate a local file, it's just not well document, Use file:// urls, or pass the spec to https://github.com/Yelp/swagger_spec_validator/blob/v1.0.8/swagger_spec_validator/validator20.py#L27

ysangkok commented 9 years ago

it would still be very useful if i could pass a string instead of having to write it to disk first...

palfrey commented 4 years ago

You can do this.

from swagger_spec_validator.util import get_validator

spec_json = get_swagger()
validator = get_validator(spec_json)
validator.validate_spec(spec_json)

where get_swagger is a method for acquiring the string and JSON-parsing it

ysangkok commented 2 years ago

Closing since I stopped using this project.