Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
changeKind: internal
packages:
- "@typespec/http-client-java"
- "@typespec/http-client-python"
---

Upgrade to eslint 10
13 changes: 13 additions & 0 deletions packages/http-client-python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log - @typespec/http-client-python

## 0.28.0

### Features

- [#9898](https://github.com/microsoft/typespec/pull/9898) Remove enum value padding because we generate our enum value names with upper case so there is no need

### Bug Fixes

- [#9778](https://github.com/microsoft/typespec/pull/9778) Return empty list instead of None for non-optional unwrapped XML list fields during deserialization
- [#9952](https://github.com/microsoft/typespec/pull/9952) Fix extensible enum member names incorrectly getting an `Enum` suffix when the member name matched a Python reserved word (e.g. `ANDEnum` → `AND`, `CLASSEnum` → `CLASS`).
- [#9964](https://github.com/microsoft/typespec/pull/9964) Remove includeRootSlash client option logic, which should be handled at the TypeSpec core level


## 0.27.2

### Bump dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# license information.
# --------------------------------------------------------------------------
"""The preprocessing autorest plugin."""

import copy
from typing import Callable, Any, Optional

Expand Down Expand Up @@ -266,8 +267,9 @@ def update_types(self, yaml_data: list[dict[str, Any]]) -> None:
add_redefined_builtin_info(property["clientName"], property)
if type.get("name"):
pad_type = PadType.MODEL if type["type"] == "model" else PadType.ENUM_CLASS
name = self.pad_reserved_words(type["name"], pad_type, type)
type["name"] = name[0].upper() + name[1:]
if type["type"] != "enumvalue":
name = self.pad_reserved_words(type["name"], pad_type, type)
type["name"] = name[0].upper() + name[1:]
type["description"] = update_description(type.get("description", ""), type["name"])
type["snakeCaseName"] = to_snake_case(type["name"])
if type.get("values"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ async def test_model_properties_dict_methods(client: SpecialWordsClient):
@pytest.mark.asyncio
async def test_model_properties_with_list(client: SpecialWordsClient):
await client.model_properties.with_list(models.ModelWithList(list="ok"))


@pytest.mark.asyncio
async def test_extensible_strings(client: SpecialWordsClient):
for enum_value in models.ExtensibleString:
assert enum_value == await client.extensible_strings.put_extensible_string_value(body=enum_value)
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ def test_model_properties_dict_methods(client: SpecialWordsClient):

def test_model_properties_with_list(client: SpecialWordsClient):
client.model_properties.with_list(models.ModelWithList(list="ok"))


def test_extensible_strings(client: SpecialWordsClient):
for enum_value in models.ExtensibleString:
assert enum_value == client.extensible_strings.put_extensible_string_value(body=enum_value)
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from specialwords.aio import SpecialWordsClient
from specialwords.models import models
from specialwords.modelproperties import models as model_properties_models
from specialwords.extensiblestrings import models as extensible_strings_models


@pytest.fixture
Expand Down Expand Up @@ -64,3 +65,9 @@ async def test_model_properties_dict_methods(client: SpecialWordsClient):
@pytest.mark.asyncio
async def test_model_properties_with_list(client: SpecialWordsClient):
await client.model_properties.with_list(model_properties_models.ModelWithList(list="ok"))


@pytest.mark.asyncio
async def test_extensible_strings(client: SpecialWordsClient):
for enum_value in extensible_strings_models.ExtensibleString:
assert enum_value == await client.extensible_strings.put_extensible_string_value(body=enum_value)
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from specialwords import SpecialWordsClient
from specialwords.models import models
from specialwords.modelproperties import models as model_properties_models
from specialwords.extensiblestrings import models as extensible_strings_models


@pytest.fixture
Expand Down Expand Up @@ -58,3 +59,8 @@ def test_model_properties_dict_methods(client: SpecialWordsClient):

def test_model_properties_with_list(client: SpecialWordsClient):
client.model_properties.with_list(model_properties_models.ModelWithList(list="ok"))


def test_extensible_strings(client: SpecialWordsClient):
for enum_value in extensible_strings_models.ExtensibleString:
assert enum_value == client.extensible_strings.put_extensible_string_value(body=enum_value)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# license information.
# --------------------------------------------------------------------------
from enum import Enum, EnumMeta
from specialwords.extensiblestrings import models as extensible_strings_models


class _CaseInsensitiveEnumMeta(EnumMeta):
Expand Down Expand Up @@ -50,3 +51,39 @@ def test_find():
def test_join():
assert EnumsWithCallableNames.JOIN == "join"
assert callable(EnumsWithCallableNames.join)


def test_extensible_strings_enum_with_special_words():
assert extensible_strings_models.ExtensibleString.AND == "and"
assert extensible_strings_models.ExtensibleString.AS == "as"
assert extensible_strings_models.ExtensibleString.ASSERT == "assert"
assert extensible_strings_models.ExtensibleString.ASYNC == "async"
assert extensible_strings_models.ExtensibleString.AWAIT == "await"
assert extensible_strings_models.ExtensibleString.BREAK == "break"
assert extensible_strings_models.ExtensibleString.CLASS == "class"
assert extensible_strings_models.ExtensibleString.CONSTRUCTOR == "constructor"
assert extensible_strings_models.ExtensibleString.CONTINUE == "continue"
assert extensible_strings_models.ExtensibleString.DEF == "def"
assert extensible_strings_models.ExtensibleString.DEL == "del"
assert extensible_strings_models.ExtensibleString.ELIF == "elif"
assert extensible_strings_models.ExtensibleString.ELSE == "else"
assert extensible_strings_models.ExtensibleString.EXCEPT == "except"
assert extensible_strings_models.ExtensibleString.EXEC == "exec"
assert extensible_strings_models.ExtensibleString.FINALLY == "finally"
assert extensible_strings_models.ExtensibleString.FOR == "for"
assert extensible_strings_models.ExtensibleString.FROM == "from"
assert extensible_strings_models.ExtensibleString.GLOBAL == "global"
assert extensible_strings_models.ExtensibleString.IF == "if"
assert extensible_strings_models.ExtensibleString.IMPORT == "import"
assert extensible_strings_models.ExtensibleString.IN == "in"
assert extensible_strings_models.ExtensibleString.IS == "is"
assert extensible_strings_models.ExtensibleString.LAMBDA == "lambda"
assert extensible_strings_models.ExtensibleString.NOT == "not"
assert extensible_strings_models.ExtensibleString.OR == "or"
assert extensible_strings_models.ExtensibleString.PASS == "pass"
assert extensible_strings_models.ExtensibleString.RAISE == "raise"
assert extensible_strings_models.ExtensibleString.RETURN == "return"
assert extensible_strings_models.ExtensibleString.TRY == "try"
assert extensible_strings_models.ExtensibleString.WHILE == "while"
assert extensible_strings_models.ExtensibleString.WITH == "with"
assert extensible_strings_models.ExtensibleString.YIELD == "yield"
Loading
Loading