def add_openapi_yaml(self): """ Adds spec yaml to {base_path}/swagger.yaml or {base_path}/openapi.yaml (for oas3) """ if not self.options.openapi_spec_path.endswith("json"): return openapi_spec_path_yaml = self.options.openapi_spec_path[:-len( "json")] + "yaml" logger.debug('Adding spec yaml: %s/%s', self.base_path, openapi_spec_path_yaml) endpoint_name = "{name}_openapi_yaml".format(name=self.blueprint.name) self.blueprint.add_url_rule( openapi_spec_path_yaml, endpoint_name, lambda: FlaskApi. _build_flask_response(status_code=200, content_type="text/yaml", data=yamldumper(self.specification.raw)))
def add_openapi_yaml(self): """ Adds spec yaml to {base_path}/swagger.yaml or {base_path}/openapi.yaml (for oas3) """ if not self.options.openapi_spec_path.endswith("json"): return openapi_spec_path_yaml = self.options.openapi_spec_path[:-len("json")] + "yaml" logger.debug('Adding spec yaml: %s/%s', self.base_path, openapi_spec_path_yaml) endpoint_name = "{name}_openapi_yaml".format(name=self.blueprint.name) self.blueprint.add_url_rule( openapi_spec_path_yaml, endpoint_name, lambda: FlaskApi._build_flask_response( status_code=200, content_type="text/yaml", data=yamldumper(self.specification.raw) ) )
def get_yaml_spec(self): return yamldumper(self._spec_for_prefix()), 200, {"Content-Type": "text/yaml"}
def _get_openapi_yaml(self, req): return web.Response( status=200, content_type='text/yaml', body=yamldumper(self.specification.raw) )
def _get_openapi_yaml(self, request): return web.Response(status=200, content_type='text/yaml', body=yamldumper(self._spec_for_prefix(request)))