Skip to content

Commit

Permalink
don't copy spec to cache when it's a local file
Browse files Browse the repository at this point in the history
  • Loading branch information
minuhin committed Aug 24, 2020
1 parent 2eb955e commit 1c97895
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.3

- Fix: build failed when spec referenced to other files with $ref.

# 1.2.2

- Fix spec path issue.
Expand Down
13 changes: 7 additions & 6 deletions foliant/preprocessors/swaggerdoc/swaggerdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ def _gather_specs(self,
except (HTTPError, URLError) as e:
self._warning(f'\nCannot retrieve swagger spec file from url {url}. Skipping.',
error=e)

if path_:
dest = self._swagger_tmp / f'swagger_spec'
if not Path(path_).exists():
local_path = Path(path_)
if local_path:
# dest = self._swagger_tmp / f'swagger_spec'
if not local_path.exists():
self._warning(f"Can't find file {path_}. Skipping.")
else: # file exists
copyfile(str(path_), str(dest))
return dest
return local_path.resolve()
# copyfile(str(path_), str(dest))
# return dest

def _process_jinja(self,
spec: PosixPath,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
description=SHORT_DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
version='1.2.2',
version='1.2.3',
author='Daniil Minukhin',
author_email='[email protected]',
packages=['foliant.preprocessors.swaggerdoc'],
Expand Down

0 comments on commit 1c97895

Please sign in to comment.