Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/discriminator support python #1500

Merged
merged 50 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e1a4c8e
Add parsable factory type
samwelkanda Apr 7, 2022
bccd985
Update parse node object methods to take factory as parameter
samwelkanda Apr 7, 2022
ec672d9
Add method to get additional data to parsable interface
samwelkanda Apr 7, 2022
7c049bb
Update module imports
samwelkanda Apr 7, 2022
7bc9164
Update error mapping type to use parsablefactory
samwelkanda Apr 7, 2022
71655f9
Update json parse node to take factory as parameter
samwelkanda Apr 7, 2022
8b944c0
Add factory to request adapter implementation
samwelkanda Apr 14, 2022
722c865
Bump abstractions, http, and serialization package versions
samwelkanda Apr 14, 2022
efe695a
Fix linting and format issues
samwelkanda Apr 14, 2022
8fd37d4
Add an entty to changelog
samwelkanda Apr 14, 2022
0816afb
Remove unnecessary get additional data method from parsable inteface
samwelkanda May 24, 2022
02ff3e1
Add support for no content responses
samwelkanda May 24, 2022
05e6e8b
Add support for vendor specific content types
samwelkanda May 25, 2022
42750cf
Simplify field deserializers
samwelkanda May 25, 2022
a5a4d01
Update test fixtures
samwelkanda May 25, 2022
9da3dce
Add support for encoding and decoding special characters in query par…
samwelkanda Jun 21, 2022
ba65992
Request configuration revamp
samwelkanda Jun 21, 2022
601af5a
Add parsable factory type
samwelkanda Apr 7, 2022
760dbc7
Update parse node object methods to take factory as parameter
samwelkanda Apr 7, 2022
6679636
Add method to get additional data to parsable interface
samwelkanda Apr 7, 2022
e6ed7c0
Update module imports
samwelkanda Apr 7, 2022
06bec69
Update error mapping type to use parsablefactory
samwelkanda Apr 7, 2022
38d9864
Update json parse node to take factory as parameter
samwelkanda Apr 7, 2022
074e754
Add factory to request adapter implementation
samwelkanda Apr 14, 2022
e18dd3c
Bump abstractions, http, and serialization package versions
samwelkanda Apr 14, 2022
a7b90c8
Fix linting and format issues
samwelkanda Apr 14, 2022
231e663
Add an entty to changelog
samwelkanda Apr 14, 2022
22ec230
Remove unnecessary get additional data method from parsable inteface
samwelkanda May 24, 2022
70e0eb7
Update parse node object methods to take factory as parameter
samwelkanda Jul 14, 2022
f442b64
Add method to get additional data to parsable interface
samwelkanda Apr 7, 2022
ca96fe5
Update module imports
samwelkanda Apr 7, 2022
04524eb
Add factory to request adapter implementation
samwelkanda Jul 14, 2022
1cb7bb8
Fix linting and format issues
samwelkanda Apr 14, 2022
bf4b73c
Remove unnecessary get additional data method from parsable inteface
samwelkanda May 24, 2022
73cbcf2
Add required dev dependency to fix failing checks
samwelkanda Jul 14, 2022
e1cc2b5
Fix lint and formatting issues
samwelkanda Jul 14, 2022
0fc57a8
Fix failing abstractions checks
samwelkanda Jul 14, 2022
ff5c67f
Merge branch 'feature/discriminator-support-python' into feature/no-c…
samwelkanda Jul 15, 2022
0a624d8
Remove unnecessary print statement
samwelkanda Jul 15, 2022
597c137
Add an entry into changelog
samwelkanda Jul 15, 2022
7002f45
Merge branch 'feature/no-content-response-python' into feature/vendor…
samwelkanda Jul 15, 2022
f30e874
Add an entry into changelog
samwelkanda Jul 15, 2022
2597f2e
Merge branch 'feature/vendor-specific-content-types-python' into feat…
samwelkanda Jul 15, 2022
ded67d9
Add changelog entry
samwelkanda Jul 15, 2022
6fa978f
Merge branch 'feature/field-deserializers-simplification-python' into…
samwelkanda Jul 15, 2022
a490962
Fix failing checks
samwelkanda Jul 15, 2022
ed8bf47
Merge pull request #1741 from microsoft/feature/request-config-revamp
samwelkanda Jul 15, 2022
0388c1b
Merge pull request #1632 from microsoft/feature/field-deserializers-s…
samwelkanda Jul 15, 2022
7677cc6
Merge pull request #1631 from microsoft/feature/vendor-specific-conte…
samwelkanda Jul 15, 2022
53db4f7
Merge pull request #1630 from microsoft/feature/no-content-response-p…
samwelkanda Jul 15, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed a bug with special characters in query parameters names. [#1445](https://github.com/microsoft/kiota/issues/1445)
- Fixed a bug where complex types path parameters would fail to generate.
- Fixed a bug where Go serialization/deserialization method would generate invalid accessor names.
- Added discriminator support in the python abstractions serialization and http packages. [#1500](https://github.com/microsoft/kiota/issues/1256)

## [0.0.22] - 2022-04-08

Expand Down
77 changes: 1 addition & 76 deletions abstractions/python/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,9 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
disable=long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
Expand All @@ -78,74 +72,12 @@ disable=print-statement,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
too-few-public-methods,
no-self-use,
missing-module-docstring,
missing-class-docstring,
missing-function-docstring,
C0103,
C0330,
R0801,
R0904,

Expand Down Expand Up @@ -324,13 +256,6 @@ max-line-length=100
# Maximum number of lines in a module.
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down
1 change: 1 addition & 0 deletions abstractions/python/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ pylint = "==2.14.4"
mypy = "==0.961"
yapf = "==0.32.0"
isort = "==5.10.1"
toml = "==0.10.2"

70 changes: 39 additions & 31 deletions abstractions/python/Pipfile.lock

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

2 changes: 1 addition & 1 deletion abstractions/python/kiota/abstractions/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION: str = '0.3.0'
VERSION: str = '0.4.0'
1 change: 1 addition & 0 deletions abstractions/python/kiota/abstractions/api_error.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class APIError(Exception):

def __init__(self, message: str) -> None:
super().__init__(message)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class AccessTokenProvider(ABC):
"""Defines a contract for obtaining access tokens for a given url.
"""

@abstractmethod
async def get_authorization_token(self, uri: str) -> str:
"""This method is called by the BaseBearerTokenAuthenticationProvider class to get the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class AllowedHostsValidator:
"""Maintains a list of valid hosts and allows authentication providers to check whether
a host is valid before authenticating a request
"""

def __init__(self, allowed_hosts: List[str]) -> None:
"""Creates a new AllowedHostsValidator object with provided values.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class AnonymousAuthenticationProvider(AuthenticationProvider):
Args:
AuthenticationProvider (ABC): The abstract base class that this class implements
"""

async def authenticate_request(self, request: RequestInformation) -> None:
"""Authenticates the provided request information

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class AuthenticationProvider(ABC):
"""
Base class for providing authentication information for a request.
"""

@abstractmethod
async def authenticate_request(self, request: RequestInformation) -> None:
"""Authenticates the application request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, Callable, Dict, Optional, TypeVar, cast

from .response_handler import ResponseHandler
from .serialization import Parsable
from .serialization import Parsable, ParsableFactory

NativeResponseType = TypeVar("NativeResponseType")
ModelType = TypeVar("ModelType")
Expand All @@ -16,10 +16,10 @@ class NativeResponseHandler(ResponseHandler):
# The error mappings for the response to use when deserializing failed responses bodies.
# Where an error code like 401 applies specifically to that status code, a class code like
# 4XX applies to all status codes within the range if a specific error code is not present.
error_map: Dict[str, Optional[Callable[[], Parsable]]]
error_map: Dict[str, Optional[ParsableFactory]]

async def handle_response_async(
self, response: NativeResponseType, error_map: Dict[str, Optional[Callable[[], Parsable]]]
self, response: NativeResponseType, error_map: Dict[str, Optional[ParsableFactory]]
) -> ModelType:
self.value = response
self.error_map = error_map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class NativeResponseWrapper:
"""This class can be used to wrap a request using the fluent API and get the native response
object in return.
"""

async def call_and_get_native(
self, original_call: OriginalCallType, q: Optional[QueryParametersType],
h: Optional[HeadersType], o: Optional[RequestOption]
Expand Down
Loading