def spawn_api(self, app, decorator=None): """Auto-generate server endpoints implementing the API into this Flask app""" if decorator: assert type(decorator).__name__ == 'function' self.is_server = True return spawn_server_api(self.name, app, self.api_spec, self.error_callback, decorator)
def generate_server_app(self, yaml_str, callback=default_error_callback): swagger_dict = yaml.load(yaml_str) spec = ApiSpec(swagger_dict) app = Flask('test') spawn_server_api('somename', app, spec, callback, None) return app, spec