Skip to content

Commit

Permalink
add visibility support to discriminator rest field (#2645)
Browse files Browse the repository at this point in the history
  • Loading branch information
tadelesh authored Jun 19, 2024
1 parent 084f01e commit 8654126
Show file tree
Hide file tree
Showing 130 changed files with 266 additions and 129 deletions.
8 changes: 8 additions & 0 deletions .chronus/changes/main-2024-5-19-14-16-18.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

add visibility support to discriminator rest field
Original file line number Diff line number Diff line change
Expand Up @@ -894,5 +894,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Original file line number Diff line number Diff line change
Expand Up @@ -883,5 +883,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Loading

0 comments on commit 8654126

Please sign in to comment.