Example #1
0
def validate(path):
    try:
        abspath = os.path.abspath(path)
        validate_spec_url(pathlib.Path(abspath).as_uri())
    except ValidationError as e:
        pprint(e)
        sys.exit(1)
    except Exception as e:
        pprint(e)
        sys.exit(2)
    else:
        log.info('validating bundled spec: OK')
Example #2
0
#!/bin/env python3

# pip3 install --user openapi-spec-validator

from openapi_spec_validator import validate_spec_url
validate_spec_url('file:///home/kefah/Development/edraj/api-spec/edraj.json')
Example #3
0
 def test_failed(self, spec_url):
     with pytest.raises(ValidationError):
         validate_spec_url(spec_url)
Example #4
0
 def test_valid(self, spec_url):
     validate_spec_url(spec_url)
Example #5
0
def test_swagger_specification(host):
    endpoint = os.path.join(host, 'api', 'swagger.json')
    validate_spec_url(endpoint)
Example #6
0
 def test_api_definition_validity(self):
     validate_spec_url('file://' +
                       os.path.abspath('./mygpo/api/openapi.yaml'))
Example #7
0
 def test_api_definition_validity(self):
     validate_spec_url("file://" +
                       os.path.abspath("./mygpo/api/openapi.yaml"))