Skip to content

Commit d378065

Browse files
authored
[python] Fix output folder of models when output folder is different with namespace in configuration (#5739)
Supplementation for #5711. The issue is not covered by test case since test case doesn't contain `models`. Here is updated test case to cover this issue: https://github.com/Azure/autorest.python/pull/3030/files#diff-5fa7ea68bc2d31e09e995e5f522a9e4f58572767f393937a1cf6baf35fa16664
1 parent 030cba0 commit d378065

5 files changed

Lines changed: 17 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@typespec/http-client-python"
5+
---
6+
7+
Fix output folder of models when output folder is different with namespace in configuration

packages/http-client-python/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log - @typespec/http-client-python
22

3+
## 0.6.9
4+
5+
### Bug Fixes
6+
7+
- Fix output folder of models when output folder is different with namespace in configuration
8+
39
## 0.6.8
410

511
### Bug Fixes

packages/http-client-python/generator/pygen/codegen/serializers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def _serialize_and_write_models_folder(
238238
self, env: Environment, namespace: str, models: List[ModelType], enums: List[EnumType]
239239
) -> None:
240240
# Write the models folder
241-
models_path = self.exec_path(namespace + ".models")
241+
models_path = self.exec_path(namespace) / "models"
242242
serializer = DpgModelSerializer if self.code_model.options["models_mode"] == "dpg" else MsrestModelSerializer
243243
if self.code_model.has_non_json_models(models):
244244
self.write_file(

packages/http-client-python/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/http-client-python/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typespec/http-client-python",
3-
"version": "0.6.8",
3+
"version": "0.6.9",
44
"author": "Microsoft Corporation",
55
"description": "TypeSpec emitter for Python SDKs",
66
"homepage": "https://typespec.io",

0 commit comments

Comments
 (0)