Skip to content

Commit

Permalink
Fix join_url bug when httpx 2.4.0 or later (#1699)
Browse files Browse the repository at this point in the history
  • Loading branch information
koxudaxi authored Nov 16, 2023
1 parent 65edaef commit 0ffcfd1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 52 deletions.
6 changes: 5 additions & 1 deletion datamodel_code_generator/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,11 @@ def resolve_ref(self, path: Union[Sequence[str], str]) -> str:
if self.base_url:
from .http import join_url

return join_url(self.base_url, ref)
joined_url = join_url(self.base_url, ref)
if '#' in joined_url:
return joined_url
return f'{joined_url}#'

if is_url(ref):
file_part, path_part = ref.split('#', 1)
if file_part == self.root_id:
Expand Down
71 changes: 21 additions & 50 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ types-PyYAML = "*"
types-toml = "*"
types-setuptools = ">=67.6.0.5,<69.0.0.0"
pydantic = "*"
httpx = "*"
httpx = ">=0.24.1"
PySnooper = "*"
ruff = ">=0.0.290,<0.1.6"
ruff-lsp = ">=0.0.39,<0.0.41"
Expand Down

0 comments on commit 0ffcfd1

Please sign in to comment.