This commit is contained in:
iscai-msft 2024-05-01 13:49:19 -04:00
Родитель 01635e1889 081bdb2fe8
Коммит 7c6b00cf30
957 изменённых файлов: 32083 добавлений и 1797 удалений

Просмотреть файл

@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-python"
---
Fix union deserialization for optional property of DPG model

Просмотреть файл

@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---
Fix typing annotation for internal model #2517

Просмотреть файл

@ -0,0 +1,8 @@
---
changeKind: feature
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---
add `--generate-test` to generate test for DPG

Просмотреть файл

@ -33,3 +33,5 @@ jobs:
- name: Create release branch
run: node ./eng/publish.mjs
env:
GITHUB_TOKEN: ${{secrets.CUSTOM_GITHUB_TOKEN}}

Просмотреть файл

@ -37,7 +37,7 @@ pnpm clean
Branch `publish/auto-release` should be automatically updated with the latest changelog. Give it 5min after merging a PR or check the status of the [Release action](https://github.com/Azure/autorest.python/actions/workflows/prepare-auto-release-branch.yml)
Then go to https://github.com/Azure/autorest.python/pull/new/publish/auto-release and create this PR. After PR created, please update `Minor Changes`/`Patch Changes` of changelog with existing items `New Features`/`Bug Fixes`/`Other Changes`.
Then go to https://github.com/Azure/autorest.python/pull/new/publish/auto-release and create this PR.
## Contributing

Просмотреть файл

@ -2,7 +2,7 @@ azure-pylint-guidelines-checker==0.0.8
invoke==2.2.0
colorama==0.4.6
debugpy==1.8.1
pytest==8.1.1
tox==4.14.2
pytest==8.2.0
tox==4.15.0
coverage==7.4.4
black==24.4.0
black==24.4.2

Просмотреть файл

@ -0,0 +1,47 @@
const stdout = execSync(`git status --porcelain`).toString();
if (stdout.trim() !== "") {
console.log("Commiting the following changes:\n", stdout);
execSync(`git add -A`);
execSync(`git -c user.email=chronus@github.com -c user.name="Auto Chronus Bot" commit -am "Bump versions"`);
execSync(`git push origin HEAD:${branchName} --force`);
console.log();
console.log("-".repeat(160));
console.log("| Link to create the PR");
console.log(`| https://github.com/timotheeguerin/chronus/pull/new/${branchName} `);
console.log("-".repeat(160));
const github = getOctokit(process.env.GITHUB_TOKEN ?? "");
const prs = await github.rest.pulls.list({
...context.repo,
head: `${context.repo.owner}:${branchName}`,
base: "main",
state: "open",
});
console.log(
"Found those prs",
prs.url,
prs.data.map((x) => x.head.ref),
);
const existing = prs.data[0];
if (existing) {
console.log("Existing, updating pr", existing.number);
await github.rest.pulls.update({
...context.repo,
pull_number: existing.number,
body: changeStatus,
});
} else {
await github.rest.pulls.create({
...context.repo,
title: "Release changes",
head: branchName,
base: "main",
body: changeStatus,
});
}
} else {
console.log("No changes to publish");
}

Просмотреть файл

@ -1,23 +0,0 @@
import { execSync } from "child_process";
const branchName = "publish/auto-release";
execSync(`pnpm changeset version`);
const stdout = execSync(`git status --porcelain`).toString();
if (stdout.trim() !== "") {
console.log("Commiting the following changes:\n", stdout);
execSync(
`git -c user.email=autochangesetbot@microsoft.com -c user.name="Microsoft Auto Changeset Bot" commit -am "Bump versions"`,
);
execSync(`git push origin HEAD:${branchName} --force`);
console.log();
console.log("-".repeat(160));
console.log("| Link to create the PR");
console.log(`| https://github.com/Azure/cadl-ranch/pull/new/${branchName} `);
console.log("-".repeat(160));
} else {
console.log("No changes to publish");
}

Просмотреть файл

@ -1,5 +1,5 @@
# This is for CI requirements or dev only
pyright==1.1.359
pyright==1.1.360
pylint==3.1.0
tox==4.14.2
tox==4.15.0
mypy==1.9.0

Просмотреть файл

@ -1,5 +1,53 @@
# Release
## 2024-04-30 - 6.13.16
| Library | Min Version |
| ----------------------------------------------------------------------- | ----------- |
| `@autorest/core` | `3.9.2` |
| `@autorest/modelerfour` | `4.24.3` |
| `azure-core` dep of generated code | `1.30.0` |
| `isodate` dep of generated code | `0.6.1` |
| `msrest` dep of generated code (If generating legacy code) | `0.7.1` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` |
| `typing-extensions` dep of generated code (If generating with constants)| `4.0.1` |
**Bug Fixes**
- Escape backslashes in docstrings. Thanks @onlined for this contribution, you rock! #2560
## 2024-04-29 - 6.13.15
| Library | Min Version |
| ----------------------------------------------------------------------- | ----------- |
| `@autorest/core` | `3.9.2` |
| `@autorest/modelerfour` | `4.24.3` |
| `azure-core` dep of generated code | `1.30.0` |
| `isodate` dep of generated code | `0.6.1` |
| `msrest` dep of generated code (If generating legacy code) | `0.7.1` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` |
| `typing-extensions` dep of generated code (If generating with constants)| `4.0.1` |
**Bug Fixes**
- Fix internal model typing #2517
## 2024-04-23 - 6.13.14
| Library | Min Version |
| ----------------------------------------------------------------------- | ----------- |
| `@autorest/core` | `3.9.2` |
| `@autorest/modelerfour` | `4.24.3` |
| `azure-core` dep of generated code | `1.30.0` |
| `isodate` dep of generated code | `0.6.1` |
| `msrest` dep of generated code (If generating legacy code) | `0.7.1` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` |
| `typing-extensions` dep of generated code (If generating with constants)| `4.0.1` |
**Bug Fixes**
- Json serialize input bodies whose default content type is a JSON type with a charset encoding section #2542
## 2024-04-22 - 6.13.13
| Library | Min Version |

Просмотреть файл

@ -37,6 +37,7 @@ class OptionsRetriever:
"multiapi": False,
"polymorphic-examples": 5,
"generate-sample": False,
"generate-test": False,
"from-typespec": False,
"emit-cross-language-definition-file": False,
}
@ -332,6 +333,7 @@ class CodeGenerator(Plugin):
"packaging_files_config",
"default_optional_constants_to_none",
"generate_sample",
"generate_test",
"default_api_version",
"from_typespec",
"flavor",
@ -436,6 +438,7 @@ class CodeGeneratorAutorest(CodeGenerator, PluginAutorest):
"default-optional-constants-to-none"
),
"generate-sample": self._autorestapi.get_boolean_value("generate-sample"),
"generate-test": self._autorestapi.get_boolean_value("generate-test"),
"default-api-version": self._autorestapi.get_value("default-api-version"),
}
return {k: v for k, v in options.items() if v is not None}

Просмотреть файл

@ -76,6 +76,7 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
t for t in self.types_map.values() if isinstance(t, CombinedType) and t.name
]
self.cross_language_package_id = self.yaml_data.get("crossLanguagePackageId")
self.for_test: bool = False
@property
def has_form_data(self) -> bool:

Просмотреть файл

@ -175,7 +175,9 @@ class EnumType(BaseType):
:rtype: str
"""
if self.code_model.options["models_mode"]:
model_name = f"_models.{self.name}"
module_name = "_models." if kwargs.get("need_module_name", True) else ""
file_name = f"{self.code_model.enums_filename}." if self.internal else ""
model_name = module_name + file_name + self.name
# we don't need quoted annotation in operation files, and need it in model folder files.
if not kwargs.get("is_operation_file", False):
model_name = f'"{model_name}"'

Просмотреть файл

@ -6,7 +6,10 @@
from collections import OrderedDict
from typing import Any, Dict, List, Optional, TYPE_CHECKING, cast
import sys
from autorest.codegen.models.utils import add_to_pylint_disable, NAME_LENGTH_LIMIT
from autorest.codegen.models.utils import (
add_to_pylint_disable,
NAME_LENGTH_LIMIT,
)
from .base import BaseType
from .constant_type import ConstantType
from .property import Property
@ -148,7 +151,11 @@ class ModelType( # pylint: disable=abstract-method
if self.discriminated_subtypes:
# we will instead print the discriminated subtypes
self._created_json_template_representation = False
return self.snake_case_name
return (
f'"{self.snake_case_name}"'
if self.code_model.for_test
else self.snake_case_name
)
# don't add additional properties, because there's not really a concept of
# additional properties in the template
@ -308,13 +315,14 @@ class JSONModelType(ModelType):
class GeneratedModelType(ModelType): # pylint: disable=abstract-method
def type_annotation(self, **kwargs: Any) -> str:
is_operation_file = kwargs.pop("is_operation_file", False)
retval = f"_models.{self.name}"
if self.internal:
retval = f"{self.code_model.models_filename}.{retval}"
return retval if is_operation_file else f'"{retval}"'
skip_quote = kwargs.get("skip_quote", False)
module_name = "_models." if kwargs.get("need_module_name", True) else ""
file_name = f"{self.code_model.models_filename}." if self.internal else ""
retval = module_name + file_name + self.name
return retval if is_operation_file or skip_quote else f'"{retval}"'
def docstring_type(self, **kwargs: Any) -> str:
return f"~{self.code_model.namespace}.models.{self.name}"
return f"~{self.code_model.namespace}.models.{self.type_annotation(need_module_name=False, skip_quote=True)}"
def docstring_text(self, **kwargs: Any) -> str:
return self.name
@ -358,8 +366,7 @@ class MsrestModelType(GeneratedModelType):
@property
def serialization_type(self) -> str:
private_model_path = f"_models.{self.code_model.models_filename}."
return f"{private_model_path if self.internal else ''}{self.name}"
return self.type_annotation(skip_quote=True) if self.internal else self.name
@property
def instance_check_template(self) -> str:
@ -378,7 +385,11 @@ class DPGModelType(GeneratedModelType):
@property
def serialization_type(self) -> str:
return f"{'_models.' if self.internal else ''}_models.{self.name}"
return (
self.type_annotation(skip_quote=True)
if self.internal
else self.type_annotation(need_module_name=False, skip_quote=True)
)
@property
def instance_check_template(self) -> str:

Просмотреть файл

@ -217,7 +217,7 @@ class OperationBase( # pylint: disable=too-many-public-methods,too-many-instanc
return None
excep_schema = default_exceptions[0].type
if isinstance(excep_schema, ModelType):
return f"_models.{excep_schema.name}"
return excep_schema.type_annotation(skip_quote=True)
# in this case, it's just an AnyType
return "'object'"

Просмотреть файл

@ -62,7 +62,9 @@ class PrimitiveType(BaseType): # pylint: disable=abstract-method
comment = add_to_description(comment, description)
if comment:
comment = f"# {comment}"
return f"{client_default_value_declaration}{comment}"
return client_default_value_declaration + (
"" if self.code_model.for_test else comment
)
@property
def default_template_representation_declaration(self) -> str:

Просмотреть файл

@ -134,7 +134,8 @@ class Property(BaseModel): # pylint: disable=too-many-instance-attributes
description: Optional[str] = None,
) -> Any:
if self.is_multipart_file_input:
return "[filetype]" if self.type.type == "list" else "filetype"
file_type_str = '"filetype"' if self.code_model.for_test else "filetype"
return f"[{file_type_str}]" if self.type.type == "list" else file_type_str
if self.client_default_value:
client_default_value_declaration = self.get_declaration(
self.client_default_value

Просмотреть файл

@ -27,6 +27,7 @@ from .metadata_serializer import MetadataSerializer
from .request_builders_serializer import RequestBuildersSerializer
from .patch_serializer import PatchSerializer
from .sample_serializer import SampleSerializer
from .test_serializer import TestSerializer, TestGeneralSerializer
from .types_serializer import TypesSerializer
from ..._utils import to_snake_case
from .._utils import VALID_PACKAGE_MODE
@ -146,6 +147,14 @@ class JinjaSerializer(ReaderAndWriter): # pylint: disable=abstract-method
):
self._serialize_and_write_sample(env, namespace_path)
if (
self.code_model.options["show_operations"]
and self.code_model.has_operations
and self.code_model.options["generate_test"]
and not self.code_model.options["azure_arm"]
):
self._serialize_and_write_test(env, namespace_path)
def serialize(self) -> None:
env = Environment(
loader=PackageLoader("autorest.codegen", "templates"),
@ -631,6 +640,40 @@ class JinjaSerializer(ReaderAndWriter): # pylint: disable=abstract-method
log_error = f"error happens in sample {file}: {e}"
_LOGGER.error(log_error)
def _serialize_and_write_test(self, env: Environment, namespace_path: Path):
self.code_model.for_test = True
out_path = self._package_root_folder(namespace_path) / Path("generated_tests")
general_serializer = TestGeneralSerializer(code_model=self.code_model, env=env)
self.write_file(
out_path / "conftest.py", general_serializer.serialize_conftest()
)
for is_async in (True, False):
async_suffix = "_async" if is_async else ""
general_serializer.is_async = is_async
self.write_file(
out_path / f"testpreparer{async_suffix}.py",
general_serializer.serialize_testpreparer(),
)
for client in self.code_model.clients:
for og in client.operation_groups:
test_serializer = TestSerializer(
self.code_model, env, client=client, operation_group=og
)
for is_async in (True, False):
try:
test_serializer.is_async = is_async
self.write_file(
out_path
/ f"{to_snake_case(test_serializer.test_class_name)}.py",
test_serializer.serialize_test(),
)
except Exception as e: # pylint: disable=broad-except
# test generation shall not block code generation, so just log error
log_error = f"error happens in test generation for operation group {og.class_name}: {e}"
_LOGGER.error(log_error)
self.code_model.for_test = False
class JinjaSerializerAutorest(JinjaSerializer, ReaderAndWriterAutorest):
def __init__(

Просмотреть файл

@ -4,10 +4,9 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import json
from abc import abstractmethod
from collections import defaultdict
from typing import Any, Generic, List, Type, TypeVar, Dict, Union, Optional, cast
from typing import Generic, List, Type, TypeVar, Dict, Union, Optional, cast
from ..models import (
Operation,
@ -59,6 +58,10 @@ OperationType = TypeVar(
)
def _json_serializable(content_type: str) -> bool:
return bool(JSON_REGEXP.match(content_type.split(";")[0].strip().lower()))
def _need_type_ignore(builder: OperationType) -> bool:
for excep in builder.non_default_errors:
for status_code in excep.status_codes:
@ -80,34 +83,13 @@ def _escape_str(input_str: str) -> str:
return f'"{replace}"'
def _improve_json_string(template_representation: str) -> Any:
origin = template_representation.split("\n")
final = []
for line in origin:
idx0 = line.find("#")
idx1 = line.rfind('"')
modified_line = ""
if idx0 > -1 and idx1 > -1:
modified_line = line[:idx0] + line[idx1:] + " " + line[idx0:idx1] + "\n"
else:
modified_line = line + "\n"
modified_line = modified_line.replace('"', "").replace("\\", '"')
final.append(modified_line)
return "".join(final)
def _json_dumps_template(template_representation: Any) -> Any:
# only for template use, since it wraps everything in strings
return _improve_json_string(json.dumps(template_representation, indent=4))
def _get_polymorphic_subtype_template(polymorphic_subtype: ModelType) -> List[str]:
retval: List[str] = []
retval.append("")
retval.append(
f'# JSON input template for discriminator value "{polymorphic_subtype.discriminator_value}":'
)
subtype_template = _json_dumps_template(
subtype_template = utils.json_dumps_template(
polymorphic_subtype.get_json_template_representation(),
)
@ -225,7 +207,7 @@ def _get_json_response_template_to_status_codes(
if not json_template:
continue
status_codes = [str(status_code) for status_code in response.status_codes]
response_json = _json_dumps_template(json_template)
response_json = utils.json_dumps_template(json_template)
retval[response_json].extend(status_codes)
return retval
@ -436,7 +418,7 @@ class _BuilderBaseSerializer(Generic[BuilderType]): # pylint: disable=abstract-
template.append(
"# JSON input template you can fill out and use as your body input."
)
json_template = _json_dumps_template(
json_template = utils.json_dumps_template(
json_type.get_json_template_representation(),
)
template.extend(
@ -813,7 +795,7 @@ class _OperationSerializer(
f"'{body_param.type.serialization_type}'{is_xml_cmd}{serialization_ctxt_cmd})"
)
elif self.code_model.options["models_mode"] == "dpg":
if JSON_REGEXP.match(body_param.default_content_type):
if _json_serializable(body_param.default_content_type):
if hasattr(body_param.type, "encode") and body_param.type.encode: # type: ignore
create_body_call = (
f"_{body_kwarg_name} = json.dumps({body_param.client_name}, "
@ -1157,7 +1139,7 @@ class _OperationSerializer(
)
response_attr = (
"json"
if JSON_REGEXP.match(str(response.default_content_type))
if _json_serializable(str(response.default_content_type))
else "text"
)
deserialize_code.append("deserialized = _deserialize(")

Просмотреть файл

@ -77,6 +77,7 @@ class ClientSerializer:
":keyword int polling_interval: Default waiting time between two polls for LRO operations "
"if no Retry-After header is present."
)
retval = [s.replace("\\", "\\\\") for s in retval]
retval.append('"""')
return retval

Просмотреть файл

@ -17,11 +17,8 @@ def _documentation_string(
) -> List[str]:
retval: List[str] = []
sphinx_prefix = f":{description_keyword} {prop.client_name}:"
retval.append(
f"{sphinx_prefix} {prop.description(is_operation_file=False)}"
if prop.description(is_operation_file=False)
else sphinx_prefix
)
description = prop.description(is_operation_file=False).replace("\\", "\\\\")
retval.append(f"{sphinx_prefix} {description}" if description else sphinx_prefix)
retval.append(
f":{docstring_type_keyword} {prop.client_name}: {prop.type.docstring_type()}"
)

Просмотреть файл

@ -0,0 +1,283 @@
# pylint: disable=too-many-lines
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typing import Dict, Any, List, Optional
from jinja2 import Environment
from .import_serializer import FileImportSerializer
from .base_serializer import BaseSerializer
from ..models import (
CodeModel,
ImportType,
OperationGroup,
Client,
OperationType,
ModelType,
BaseType,
CombinedType,
)
from .utils import get_namespace_from_package_name, json_dumps_template
class TestName:
def __init__(self, client_name: str, *, is_async: bool = False) -> None:
self.client_name = client_name
self.is_async = is_async
@property
def async_suffix_capt(self) -> str:
return "Async" if self.is_async else ""
@property
def create_client_name(self) -> str:
return "create_async_client" if self.is_async else "create_client"
@property
def prefix(self) -> str:
return self.client_name.replace("Client", "")
@property
def preparer_name(self) -> str:
return self.prefix + "Preparer"
@property
def base_test_class_name(self) -> str:
return f"{self.client_name}TestBase{self.async_suffix_capt}"
class TestCase:
def __init__(
self,
operation_groups: List[OperationGroup],
params: Dict[str, Any],
operation: OperationType,
*,
is_async: bool = False,
) -> None:
self.operation_groups = operation_groups
self.params = params
self.operation = operation
self.is_async = is_async
@property
def operation_group_prefix(self) -> str:
if self.operation_groups[-1].is_mixin:
return ""
return "." + ".".join([og.property_name for og in self.operation_groups])
@property
def response(self) -> str:
if self.is_async:
if self.operation.operation_type == "lropaging":
return "response = await (await "
return "response = await "
return "response = "
@property
def lro_comment(self) -> str:
return " # poll until service return final result"
@property
def operation_suffix(self) -> str:
if self.operation.operation_type == "lropaging":
extra = ")" if self.is_async else ""
return f"{extra}.result(){self.lro_comment}"
return ""
@property
def extra_operation(self) -> str:
if self.is_async:
if self.operation.operation_type == "lro":
return f"result = await response.result(){self.lro_comment}"
if self.operation.operation_type == ("lropaging", "paging"):
return "result = [r async for r in response]"
else:
if self.operation.operation_type == "lro":
return f"result = response.result(){self.lro_comment}"
if self.operation.operation_type in ("lropaging", "paging"):
return "result = [r for r in response]"
return ""
class Test(TestName):
def __init__(
self,
client_name: str,
operation_group: OperationGroup,
testcases: List[TestCase],
test_class_name: str,
*,
is_async: bool = False,
) -> None:
super().__init__(client_name, is_async=is_async)
self.operation_group = operation_group
self.testcases = testcases
self.test_class_name = test_class_name
class TestGeneralSerializer(BaseSerializer):
def __init__(
self, code_model: CodeModel, env: Environment, *, is_async: bool = False
) -> None:
super().__init__(code_model, env)
self.is_async = is_async
@property
def aio_str(self) -> str:
return ".aio" if self.is_async else ""
@property
def test_names(self) -> List[TestName]:
return [
TestName(c.name, is_async=self.is_async) for c in self.code_model.clients
]
@property
def import_clients(self) -> FileImportSerializer:
imports = self.init_file_import()
namespace = get_namespace_from_package_name(
self.code_model.options["package_name"]
)
imports.add_submodule_import(
"devtools_testutils", "AzureRecordedTestCase", ImportType.STDLIB
)
if not self.is_async:
imports.add_import("functools", ImportType.STDLIB)
imports.add_submodule_import(
"devtools_testutils", "PowerShellPreparer", ImportType.STDLIB
)
for client in self.code_model.clients:
imports.add_submodule_import(
namespace + self.aio_str, client.name, ImportType.STDLIB
)
return FileImportSerializer(imports, self.is_async)
def serialize_conftest(self) -> str:
return self.env.get_template("conftest.py.jinja2").render(
test_names=self.test_names,
code_model=self.code_model,
)
def serialize_testpreparer(self) -> str:
return self.env.get_template("testpreparer.py.jinja2").render(
test_names=self.test_names,
imports=self.import_clients,
code_model=self.code_model,
)
class TestSerializer(TestGeneralSerializer):
def __init__(
self,
code_model: CodeModel,
env: Environment,
*,
client: Client,
operation_group: OperationGroup,
is_async: bool = False,
) -> None:
super().__init__(code_model, env, is_async=is_async)
self.client = client
self.operation_group = operation_group
@property
def import_test(self) -> FileImportSerializer:
imports = self.init_file_import()
test_name = TestName(self.client.name, is_async=self.is_async)
async_suffix = "_async" if self.is_async else ""
imports.add_submodule_import(
"testpreparer" + async_suffix,
test_name.base_test_class_name,
ImportType.LOCAL,
)
imports.add_submodule_import(
"testpreparer", test_name.preparer_name, ImportType.LOCAL
)
imports.add_submodule_import(
"devtools_testutils" + self.aio_str,
"recorded_by_proxy" + async_suffix,
ImportType.LOCAL,
)
return FileImportSerializer(imports, self.is_async)
@property
def breadth_search_operation_group(self) -> List[List[OperationGroup]]:
result = []
queue = [[self.operation_group]]
while queue:
current = queue.pop(0)
if current[-1].operations:
result.append(current)
if current[-1].operation_groups:
queue.extend([current + [og] for og in current[-1].operation_groups])
return result
def get_sub_type(self, param_type: ModelType) -> ModelType:
if param_type.discriminated_subtypes:
for item in param_type.discriminated_subtypes.values():
return self.get_sub_type(item)
return param_type
def get_model_type(self, param_type: BaseType) -> Optional[ModelType]:
if isinstance(param_type, ModelType):
return param_type
if isinstance(param_type, CombinedType):
return param_type.target_model_subtype((ModelType,))
return None
def get_operation_params(self, operation: OperationType) -> Dict[str, Any]:
operation_params = {}
required_params = [p for p in operation.parameters.method if not p.optional]
for param in required_params:
model_type = self.get_model_type(param.type)
param_type = self.get_sub_type(model_type) if model_type else param.type
operation_params[param.client_name] = json_dumps_template(
param_type.get_json_template_representation()
)
return operation_params
def get_test(self) -> Test:
testcases = []
for operation_groups in self.breadth_search_operation_group:
for operation in operation_groups[-1].operations:
if operation.internal or operation.is_lro_initial_operation:
continue
operation_params = self.get_operation_params(operation)
testcase = TestCase(
operation_groups=operation_groups,
params=operation_params,
operation=operation,
is_async=self.is_async,
)
testcases.append(testcase)
if not testcases:
raise Exception( # pylint: disable=broad-exception-raised
"no public operation to test"
)
return Test(
client_name=self.client.name,
operation_group=self.operation_group,
testcases=testcases,
test_class_name=self.test_class_name,
is_async=self.is_async,
)
@property
def test_class_name(self) -> str:
test_name = TestName(self.client.name, is_async=self.is_async)
class_name = (
"" if self.operation_group.is_mixin else self.operation_group.class_name
)
return f"Test{test_name.prefix}{class_name}{test_name.async_suffix_capt}"
def serialize_test(self) -> str:
return self.env.get_template("test.py.jinja2").render(
imports=self.import_test,
code_model=self.code_model,
test=self.get_test(),
)

Просмотреть файл

@ -3,7 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typing import Optional, List
import json
from typing import Optional, List, Any
from pathlib import Path
from ..models import Client, OperationGroup
@ -44,3 +45,24 @@ def get_all_operation_groups_recursively(clients: List[Client]) -> List[Operatio
if operation_groups[-1].operation_groups:
queue.extend(operation_groups[-1].operation_groups)
return operation_groups
def _improve_json_string(template_representation: str) -> Any:
origin = template_representation.split("\n")
final = []
for line in origin:
idx0 = line.find("#")
idx1 = line.rfind('"')
modified_line = ""
if idx0 > -1 and idx1 > -1:
modified_line = line[:idx0] + line[idx1:] + " " + line[idx0:idx1] + "\n"
else:
modified_line = line + "\n"
modified_line = modified_line.replace('"', "").replace("\\", '"')
final.append(modified_line)
return "".join(final)
def json_dumps_template(template_representation: Any) -> Any:
# only for template use, since it wraps everything in strings
return _improve_json_string(json.dumps(template_representation, indent=4))

Просмотреть файл

@ -0,0 +1,28 @@
# coding=utf-8
{{ code_model.options['license_header'] }}
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import test_proxy, add_general_regex_sanitizer, add_body_key_sanitizer, add_header_regex_sanitizer
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
{% for test_name in test_names %}
{% set prefix_upper = test_name.prefix|upper %}
{% set prefix_lower = test_name.prefix|lower %}
{{ prefix_lower }}_subscription_id = os.environ.get("{{ prefix_upper }}_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
{{ prefix_lower }}_tenant_id = os.environ.get("{{ prefix_upper }}_TENANT_ID", "00000000-0000-0000-0000-000000000000")
{{ prefix_lower }}_client_id = os.environ.get("{{ prefix_upper }}_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
{{ prefix_lower }}_client_secret = os.environ.get("{{ prefix_upper }}_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex={{ prefix_lower }}_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex={{ prefix_lower }}_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex={{ prefix_lower }}_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex={{ prefix_lower }}_client_secret, value="00000000-0000-0000-0000-000000000000")
{% endfor %}
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

Просмотреть файл

@ -1,13 +1,13 @@
class {{ enum.name }}({{ enum.value_type.type_annotation(is_operation_file=False) }}, Enum, metaclass=CaseInsensitiveEnumMeta):
{% if enum.yaml_data.get("description") %}
"""{{ enum.yaml_data["description"] | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
"""{{ op_tools.wrap_string(enum.yaml_data["description"], "\n ") }}
"""
{% endif %}
{% for value in enum.values %}
{{ value.name }} = {{ enum.value_type.get_declaration(value.value) }}
{% if value.description(is_operation_file=False) %}
"""{{ value.description(is_operation_file=False) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}"""
"""{{ op_tools.wrap_string(value.description(is_operation_file=False), "\n ") }}"""
{% endif %}
{% endfor %}

Просмотреть файл

@ -1,3 +1,4 @@
{% import 'operation_tools.jinja2' as op_tools %}
# coding=utf-8
{{ code_model.options['license_header'] }}

Просмотреть файл

@ -6,6 +6,7 @@
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except
import copy
import calendar
import decimal
import functools
@ -613,6 +614,12 @@ class Model(_MyMutableMapping):
return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v
def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]:
return sorted(
types,
key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"),
)
def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912
annotation: typing.Any,
module: typing.Optional[str],
@ -651,13 +658,28 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915,
except AttributeError:
pass
# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
# is it union?
if getattr(annotation, "__origin__", None) is typing.Union:
# initial ordering is we make `string` the last deserialization option, because it is often them most generic
deserializers: typing.List[typing.Callable] = [
_get_deserialize_callable_from_annotation(arg, module, rf)
for arg in sorted(
annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore
)
for arg in _sorted_annotations(annotation.__args__) # pyright: ignore
]
return functools.partial(SdkDecoder.deserialize_union, deserializers)

Просмотреть файл

@ -1,3 +1,4 @@
{% import 'operation_tools.jinja2' as op_tools %}
# coding=utf-8
# pylint: disable=too-many-lines
{{ code_model.options['license_header'] }}

Просмотреть файл

@ -3,7 +3,7 @@
{{ serializer.declare_model(model) }}
"""{{ model.description(is_operation_file=False) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
"""{{ op_tools.wrap_string(model.description(is_operation_file=False), "\n ") }}
{% if model.discriminated_subtypes %}
{{ serializer.discriminator_docstring(model) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}

Просмотреть файл

@ -4,7 +4,7 @@
{% set exist_constant = (model.properties | selectattr('constant') | first) is defined %}
{{ serializer.declare_model(model) }}
"""{{ model.description(is_operation_file=False) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
"""{{ op_tools.wrap_string(model.description(is_operation_file=False), "\n ") }}
{% if model.discriminated_subtypes %}
{{ serializer.discriminator_docstring(model) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}

Просмотреть файл

@ -1,4 +1,4 @@
{% macro wrap_string(string, wrapstring, width=95) %}{{ string | wordwrap(width=width, break_long_words=False, break_on_hyphens=False, wrapstring=wrapstring)}}{% endmacro %}
{% macro wrap_string(string, wrapstring, width=95) %}{{ string | replace("\\", "\\\\") | wordwrap(width=width, break_long_words=False, break_on_hyphens=False, wrapstring=wrapstring)}}{% endmacro %}
{% macro description(builder, serializer) %}
{% set example_template = serializer.example_template(builder) %}

Просмотреть файл

@ -0,0 +1,26 @@
{% set prefix_lower = test.prefix|lower %}
{% set async = "async " if test.is_async else "" %}
{% set async_suffix = "_async" if test.is_async else "" %}
# coding=utf-8
{{ code_model.options['license_header'] }}
import pytest
{{ imports }}
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class {{ test.test_class_name }}({{ test.base_test_class_name }}):
{% for testcase in test.testcases %}
@{{ test.preparer_name }}()
@recorded_by_proxy{{ async_suffix }}
{{ async }}def test_{{ testcase.operation.name }}(self, {{ prefix_lower }}_endpoint):
client = self.{{ test.create_client_name }}(endpoint={{ prefix_lower }}_endpoint)
{{testcase.response }}client{{ testcase.operation_group_prefix }}.{{ testcase.operation.name }}(
{% for key, value in testcase.params.items() %}
{{ key }}={{ value|indent(12) }},
{% endfor %}
){{ testcase.operation_suffix }}
{{ testcase.extra_operation }}
# please add some check logic here by yourself
# ...
{% endfor %}

Просмотреть файл

@ -0,0 +1,26 @@
# coding=utf-8
{{ code_model.options['license_header'] }}
{{ imports }}
{% for test_name in test_names %}
{% set extra_async = ", is_async=True" if test_name.is_async else ""%}
{% set prefix_lower = test_name.prefix|lower %}
class {{ test_name.base_test_class_name }}(AzureRecordedTestCase):
def {{ test_name.create_client_name }}(self, endpoint):
credential = self.get_credential({{ test_name.client_name }}{{ extra_async }})
return self.create_client_from_credential(
{{ test_name.client_name }},
credential=credential,
endpoint=endpoint,
)
{% if not test_name.is_async %}
{{ test_name.preparer_name }} = functools.partial(
PowerShellPreparer,
"{{ prefix_lower }}",
{{ prefix_lower }}_endpoint="https://fake_{{ prefix_lower }}_endpoint.com"
)
{% endif %}
{% endfor %}

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "@autorest/python",
"version": "6.13.13",
"version": "6.13.16",
"description": "The Python extension for generators in AutoRest.",
"scripts": {
"prepare": "node run-python3.js prepare.py",

Просмотреть файл

@ -1,5 +1,109 @@
# Release
## 2023-04-30 - 0.23.9
| Library | Min Version |
| ----------------------------------------------------------------------- | ------------- |
| `@typespec/compiler` | `0.55.0` |
| `@typespec/http` | `0.55.0` |
| `@typespec/rest` | `0.55.0` |
| `@typespec/versioning` | `0.55.0` |
| `@azure-tools/typespec-azure-core` | `0.41.8` |
| `@azure-tools/typespec-client-generator-core` | `0.41.2` |
| `azure-core` dep of generated code | `1.30.0` |
| `corehttp` dep of generated code | `1.0.0b3` |
| `isodate` dep of generated code | `0.6.1` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` |
| `typing-extensions` dep of generated code | `4.6.0` |
**Bug Fixes**
- Escape backslashes in docstrings. Thanks @onlined for this contribution, you rock! #2560
- **Other Changes**
- Bump `@azure-tools/typespec-client-generator-core` version to `0.41.8` #2562
## 2023-04-26 - 0.23.8
| Library | Min Version |
| ----------------------------------------------------------------------- | ------------- |
| `@typespec/compiler` | `0.55.0` |
| `@typespec/http` | `0.55.0` |
| `@typespec/rest` | `0.55.0` |
| `@typespec/versioning` | `0.55.0` |
| `@azure-tools/typespec-azure-core` | `0.41.7` |
| `@azure-tools/typespec-client-generator-core` | `0.41.2` |
| `azure-core` dep of generated code | `1.30.0` |
| `corehttp` dep of generated code | `1.0.0b3` |
| `isodate` dep of generated code | `0.6.1` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` |
| `typing-extensions` dep of generated code | `4.6.0` |
**Bug Fixes**
- Use fully qualified name for operation `crossLanguageDefinitionId`s in `api_view_mapping_python.json` #2548
## 2023-04-25 - 0.23.7
| Library | Min Version |
| ----------------------------------------------------------------------- | ------------- |
| `@typespec/compiler` | `0.55.0` |
| `@typespec/http` | `0.55.0` |
| `@typespec/rest` | `0.55.0` |
| `@typespec/versioning` | `0.55.0` |
| `@azure-tools/typespec-azure-core` | `0.41.6` |
| `@azure-tools/typespec-client-generator-core` | `0.41.2` |
| `azure-core` dep of generated code | `1.30.0` |
| `corehttp` dep of generated code | `1.0.0b3` |
| `isodate` dep of generated code | `0.6.1` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` |
| `typing-extensions` dep of generated code | `4.6.0` |
**Other Changes**
- Bump `@azure-tools/typespec-client-generator-core` version to `0.41.6` #2545
## 2023-04-25 - 0.23.6
| Library | Min Version |
| ----------------------------------------------------------------------- | ------------- |
| `@typespec/compiler` | `0.55.0` |
| `@typespec/http` | `0.55.0` |
| `@typespec/rest` | `0.55.0` |
| `@typespec/versioning` | `0.55.0` |
| `@azure-tools/typespec-azure-core` | `0.41.5` |
| `@azure-tools/typespec-client-generator-core` | `0.41.2` |
| `azure-core` dep of generated code | `1.30.0` |
| `corehttp` dep of generated code | `1.0.0b3` |
| `isodate` dep of generated code | `0.6.1` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` |
| `typing-extensions` dep of generated code | `4.6.0` |
**Other Changes**
- Bump `@azure-tools/typespec-client-generator-core` version to `0.41.5` #2544
## 2023-04-23 - 0.23.5
| Library | Min Version |
| ----------------------------------------------------------------------- | ------------- |
| `@typespec/compiler` | `0.55.0` |
| `@typespec/http` | `0.55.0` |
| `@typespec/rest` | `0.55.0` |
| `@typespec/versioning` | `0.55.0` |
| `@azure-tools/typespec-azure-core` | `0.41.4` |
| `@azure-tools/typespec-client-generator-core` | `0.41.2` |
| `azure-core` dep of generated code | `1.30.0` |
| `corehttp` dep of generated code | `1.0.0b3` |
| `isodate` dep of generated code | `0.6.1` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` |
| `typing-extensions` dep of generated code | `4.6.0` |
**Bug Fixes**
- Json serialize input bodies whose default content type is a JSON type with a charset encoding section #2542
## 2023-04-22 - 0.23.4
| Library | Min Version |

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "@azure-tools/typespec-python",
"version": "0.23.4",
"version": "0.23.9",
"author": "Microsoft Corporation",
"description": "TypeSpec emitter for Python SDKs",
"homepage": "https://github.com/Azure/autorest.python",
@ -45,7 +45,7 @@
"@azure-tools/typespec-azure-core": ">=0.41.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.41.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.41.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.41.4 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.41.8 <1.0.0",
"@typespec/compiler": ">=0.55.0 <1.0.0",
"@typespec/http": ">=0.55.0 <1.0.0",
"@typespec/rest": ">=0.55.0 <1.0.0",
@ -66,7 +66,7 @@
"@azure-tools/typespec-azure-resource-manager": "~0.41.0",
"@azure-tools/typespec-autorest": "~0.41.0",
"@azure-tools/cadl-ranch-expect": "~0.13.3",
"@azure-tools/cadl-ranch-specs": "~0.32.0",
"@azure-tools/cadl-ranch-specs": "~0.33.0",
"@types/js-yaml": "~4.0.5",
"@types/mocha": "~10.0.1",
"@types/node": "^18.16.3",
@ -78,7 +78,7 @@
"rimraf": "~5.0.0",
"typescript": "~5.1.3",
"@azure-tools/typespec-azure-core": "~0.41.0",
"@azure-tools/typespec-client-generator-core": "~0.41.4",
"@azure-tools/typespec-client-generator-core": "~0.41.8",
"@typespec/compiler": "~0.55.0",
"@typespec/http": "~0.55.0",
"@typespec/rest": "~0.55.0",

Просмотреть файл

@ -12,7 +12,6 @@ import {
SdkQueryParameter,
SdkServiceMethod,
SdkServiceResponseHeader,
getCrossLanguageDefinitionId,
} from "@azure-tools/typespec-client-generator-core";
import {
camelToSnakeCase,
@ -180,7 +179,7 @@ function emitHttpOperation(
apiVersions: [],
wantTracing: true,
exposeStreamKeyword: true,
crossLanguageDefinitionId: method ? getCrossLanguageDefinitionId(method) : undefined,
crossLanguageDefinitionId: method?.crossLanguageDefintionId,
};
if (
result.bodyParameter &&

Просмотреть файл

@ -13,6 +13,7 @@ export interface PythonEmitterOptions {
"models-mode"?: string;
"tracing"?: boolean;
"company-name"?: string;
"generate-test"?: boolean;
"debug"?: boolean;
"flavor"?: "azure";
}
@ -37,6 +38,7 @@ const EmitterOptionsSchema: JSONSchemaType<PythonEmitterOptions> = {
"models-mode": { type: "string", nullable: true },
"tracing": { type: "boolean", nullable: true },
"company-name": { type: "string", nullable: true },
"generate-test": { type: "boolean", nullable: true },
"debug": { type: "boolean", nullable: true },
"flavor": { type: "string", nullable: true },
},

Просмотреть файл

@ -59,6 +59,9 @@ EMITTER_OPTIONS = {
"type/model/empty": {
"package-name": "typetest-model-empty",
},
"type/model/flatten": {
"package-name": "typetest-model-flatten",
},
"type/model/inheritance/enum-discriminator": {
"package-name": "typetest-model-enumdiscriminator",
},
@ -241,7 +244,7 @@ def regenerate_azure(c, name=None, debug=False):
for s in _all_specification_folders("azure")
if not is_invalid_folder(s)
]
special_flags = {"flavor": "azure"}
special_flags = {"flavor": "azure", "generate-test": "true"}
_regenerate(
c,
specs,

Просмотреть файл

@ -0,0 +1,595 @@
{
"scenariosMetadata": {
"commit": "d09ec42624676370f0d4e46e5c94c46ee84ed32a",
"version": "0.33.0"
},
"results": {
"SpecialWords_Operations_and": "not-implemented",
"SpecialWords_Operations_as": "not-implemented",
"SpecialWords_Operations_assert": "not-implemented",
"SpecialWords_Operations_async": "not-implemented",
"SpecialWords_Operations_await": "not-implemented",
"SpecialWords_Operations_break": "not-implemented",
"SpecialWords_Operations_class": "not-implemented",
"SpecialWords_Operations_constructor": "not-implemented",
"SpecialWords_Operations_continue": "not-implemented",
"SpecialWords_Operations_def": "not-implemented",
"SpecialWords_Operations_del": "not-implemented",
"SpecialWords_Operations_elif": "not-implemented",
"SpecialWords_Operations_else": "not-implemented",
"SpecialWords_Operations_except": "not-implemented",
"SpecialWords_Operations_exec": "not-implemented",
"SpecialWords_Operations_finally": "not-implemented",
"SpecialWords_Operations_for": "not-implemented",
"SpecialWords_Operations_from": "not-implemented",
"SpecialWords_Operations_global": "not-implemented",
"SpecialWords_Operations_if": "not-implemented",
"SpecialWords_Operations_import": "not-implemented",
"SpecialWords_Operations_in": "not-implemented",
"SpecialWords_Operations_is": "not-implemented",
"SpecialWords_Operations_lambda": "not-implemented",
"SpecialWords_Operations_not": "not-implemented",
"SpecialWords_Operations_or": "not-implemented",
"SpecialWords_Operations_pass": "not-implemented",
"SpecialWords_Operations_raise": "not-implemented",
"SpecialWords_Operations_return": "not-implemented",
"SpecialWords_Operations_try": "not-implemented",
"SpecialWords_Operations_while": "not-implemented",
"SpecialWords_Operations_with": "not-implemented",
"SpecialWords_Operations_yield": "not-implemented",
"SpecialWords_Parameters_and": "not-implemented",
"SpecialWords_Parameters_as": "not-implemented",
"SpecialWords_Parameters_assert": "not-implemented",
"SpecialWords_Parameters_async": "not-implemented",
"SpecialWords_Parameters_await": "not-implemented",
"SpecialWords_Parameters_break": "not-implemented",
"SpecialWords_Parameters_class": "not-implemented",
"SpecialWords_Parameters_constructor": "not-implemented",
"SpecialWords_Parameters_continue": "not-implemented",
"SpecialWords_Parameters_def": "not-implemented",
"SpecialWords_Parameters_del": "not-implemented",
"SpecialWords_Parameters_elif": "not-implemented",
"SpecialWords_Parameters_else": "not-implemented",
"SpecialWords_Parameters_except": "not-implemented",
"SpecialWords_Parameters_exec": "not-implemented",
"SpecialWords_Parameters_finally": "not-implemented",
"SpecialWords_Parameters_for": "not-implemented",
"SpecialWords_Parameters_from": "not-implemented",
"SpecialWords_Parameters_global": "not-implemented",
"SpecialWords_Parameters_if": "not-implemented",
"SpecialWords_Parameters_import": "not-implemented",
"SpecialWords_Parameters_in": "not-implemented",
"SpecialWords_Parameters_is": "not-implemented",
"SpecialWords_Parameters_lambda": "not-implemented",
"SpecialWords_Parameters_not": "not-implemented",
"SpecialWords_Parameters_or": "not-implemented",
"SpecialWords_Parameters_pass": "not-implemented",
"SpecialWords_Parameters_raise": "not-implemented",
"SpecialWords_Parameters_return": "not-implemented",
"SpecialWords_Parameters_try": "not-implemented",
"SpecialWords_Parameters_while": "not-implemented",
"SpecialWords_Parameters_with": "not-implemented",
"SpecialWords_Parameters_yield": "not-implemented",
"SpecialWords_Parameters_cancellationToken": "not-implemented",
"SpecialWords_Models_and": "not-implemented",
"SpecialWords_Models_as": "not-implemented",
"SpecialWords_Models_assert": "not-implemented",
"SpecialWords_Models_async": "not-implemented",
"SpecialWords_Models_await": "not-implemented",
"SpecialWords_Models_break": "not-implemented",
"SpecialWords_Models_class": "not-implemented",
"SpecialWords_Models_constructor": "not-implemented",
"SpecialWords_Models_continue": "not-implemented",
"SpecialWords_Models_def": "not-implemented",
"SpecialWords_Models_del": "not-implemented",
"SpecialWords_Models_elif": "not-implemented",
"SpecialWords_Models_else": "not-implemented",
"SpecialWords_Models_except": "not-implemented",
"SpecialWords_Models_exec": "not-implemented",
"SpecialWords_Models_finally": "not-implemented",
"SpecialWords_Models_for": "not-implemented",
"SpecialWords_Models_from": "not-implemented",
"SpecialWords_Models_global": "not-implemented",
"SpecialWords_Models_if": "not-implemented",
"SpecialWords_Models_import": "not-implemented",
"SpecialWords_Models_in": "not-implemented",
"SpecialWords_Models_is": "not-implemented",
"SpecialWords_Models_lambda": "not-implemented",
"SpecialWords_Models_not": "not-implemented",
"SpecialWords_Models_or": "not-implemented",
"SpecialWords_Models_pass": "not-implemented",
"SpecialWords_Models_raise": "not-implemented",
"SpecialWords_Models_return": "not-implemented",
"SpecialWords_Models_try": "not-implemented",
"SpecialWords_Models_while": "not-implemented",
"SpecialWords_Models_with": "not-implemented",
"SpecialWords_Models_yield": "not-implemented",
"SpecialWords_ModelProperties_sameAsModel": "not-implemented",
"Type_Union_StringsOnly_get": "not-implemented",
"Type_Union_StringsOnly_send": "not-implemented",
"Type_Union_StringExtensible_get": "not-implemented",
"Type_Union_StringExtensible_send": "not-implemented",
"Type_Union_StringExtensibleNamed_get": "not-implemented",
"Type_Union_StringExtensibleNamed_send": "not-implemented",
"Type_Union_IntsOnly_get": "not-implemented",
"Type_Union_IntsOnly_send": "not-implemented",
"Type_Union_FloatsOnly_get": "not-implemented",
"Type_Union_FloatsOnly_send": "not-implemented",
"Type_Union_ModelsOnly_get": "not-implemented",
"Type_Union_ModelsOnly_send": "not-implemented",
"Type_Union_EnumsOnly_get": "not-implemented",
"Type_Union_EnumsOnly_send": "not-implemented",
"Type_Union_StringAndArray_get": "not-implemented",
"Type_Union_StringAndArray_send": "not-implemented",
"Type_Union_MixedLiterals_get": "not-implemented",
"Type_Union_MixedLiterals_send": "not-implemented",
"Type_Union_MixedTypes_get": "not-implemented",
"Type_Union_MixedTypes_send": "not-implemented",
"Type_Scalar_String_get": "not-implemented",
"Type_Scalar_String_put": "not-implemented",
"Type_Scalar_Boolean_get": "not-implemented",
"Type_Scalar_Boolean_put": "not-implemented",
"Type_Scalar_Unknown_get": "not-implemented",
"Type_Scalar_Unknown_put": "not-implemented",
"Type_Scalar_DecimalType_responseBody": "not-implemented",
"Type_Scalar_DecimalType_requestBody": "not-implemented",
"Type_Scalar_DecimalType_requestParameter": "not-implemented",
"Type_Scalar_Decimal128Type_responseBody": "not-implemented",
"Type_Scalar_Decimal128Type_requestBody": "not-implemented",
"Type_Scalar_Decimal128Type_requestParameter": "not-implemented",
"Type_Scalar_DecimalVerify_prepareVerify": "not-implemented",
"Type_Scalar_DecimalVerify_verify": "not-implemented",
"Type_Scalar_Decimal128Verify_prepareVerify": "not-implemented",
"Type_Scalar_Decimal128Verify_verify": "not-implemented",
"Type_Dictionary_Int32Value_get": "not-implemented",
"Type_Dictionary_Int32Value_put": "not-implemented",
"Type_Dictionary_Int64Value_get": "not-implemented",
"Type_Dictionary_Int64Value_put": "not-implemented",
"Type_Dictionary_BooleanValue_get": "not-implemented",
"Type_Dictionary_BooleanValue_put": "not-implemented",
"Type_Dictionary_StringValue_get": "not-implemented",
"Type_Dictionary_StringValue_put": "not-implemented",
"Type_Dictionary_Float32Value_get": "not-implemented",
"Type_Dictionary_Float32Value_put": "not-implemented",
"Type_Dictionary_DatetimeValue_get": "not-implemented",
"Type_Dictionary_DatetimeValue_put": "not-implemented",
"Type_Dictionary_DurationValue_get": "not-implemented",
"Type_Dictionary_DurationValue_put": "not-implemented",
"Type_Dictionary_UnknownValue_get": "not-implemented",
"Type_Dictionary_UnknownValue_put": "not-implemented",
"Type_Dictionary_ModelValue_get": "not-implemented",
"Type_Dictionary_ModelValue_put": "not-implemented",
"Type_Dictionary_RecursiveModelValue_get": "not-implemented",
"Type_Dictionary_RecursiveModelValue_put": "not-implemented",
"Type_Dictionary_NullableFloatValue_get": "not-implemented",
"Type_Dictionary_NullableFloatValue_put": "not-implemented",
"Type_Array_Int32Value_get": "not-implemented",
"Type_Array_Int32Value_put": "not-implemented",
"Type_Array_Int64Value_get": "not-implemented",
"Type_Array_Int64Value_put": "not-implemented",
"Type_Array_BooleanValue_get": "not-implemented",
"Type_Array_BooleanValue_put": "not-implemented",
"Type_Array_StringValue_get": "not-implemented",
"Type_Array_StringValue_put": "not-implemented",
"Type_Array_Float32Value_get": "not-implemented",
"Type_Array_Float32Value_put": "not-implemented",
"Type_Array_DatetimeValue_get": "not-implemented",
"Type_Array_DatetimeValue_put": "not-implemented",
"Type_Array_DurationValue_get": "not-implemented",
"Type_Array_DurationValue_put": "not-implemented",
"Type_Array_UnknownValue_get": "not-implemented",
"Type_Array_UnknownValue_put": "not-implemented",
"Type_Array_ModelValue_get": "not-implemented",
"Type_Array_ModelValue_put": "not-implemented",
"Type_Array_NullableFloatValue_get": "not-implemented",
"Type_Array_NullableFloatValue_put": "not-implemented",
"SpecialHeaders_Repeatability_immediateSuccess": "not-implemented",
"SpecialHeaders_ConditionalRequest_postIfMatch": "not-implemented",
"SpecialHeaders_ConditionalRequest_postIfNoneMatch": "not-implemented",
"Payload_MultiPart_FormData_basic": "not-implemented",
"Payload_MultiPart_FormData_complex": "not-implemented",
"Payload_MultiPart_FormData_jsonPart": "not-implemented",
"Payload_MultiPart_FormData_binaryArrayParts": "not-implemented",
"Payload_MultiPart_FormData_jsonArrayParts": "not-implemented",
"Payload_MultiPart_FormData_multiBinaryParts": "not-implemented",
"Payload_MultiPart_FormData_checkFileNameAndContentType": "not-implemented",
"Payload_MultiPart_FormData_anonymousModel": "not-implemented",
"Payload_Pageable_list": "not-implemented",
"Payload_MediaType_StringBody_sendAsText": "not-implemented",
"Payload_MediaType_StringBody_getAsText": "not-implemented",
"Payload_MediaType_StringBody_sendAsJson": "not-implemented",
"Payload_MediaType_StringBody_getAsJson": "not-implemented",
"Payload_JsonMergePatch_createResource": "not-implemented",
"Payload_JsonMergePatch_updateResource": "not-implemented",
"Payload_JsonMergePatch_updateOptionalResource": "not-implemented",
"Payload_ContentNegotiation_SameBody": "not-implemented",
"Payload_ContentNegotiation_DifferentBody": "not-implemented",
"Parameters_CollectionFormat_Query_multi": "not-implemented",
"Parameters_CollectionFormat_Query_csv": "not-implemented",
"Parameters_CollectionFormat_Query_ssv": "not-implemented",
"Parameters_CollectionFormat_Query_tsv": "not-implemented",
"Parameters_CollectionFormat_Query_pipes": "not-implemented",
"Parameters_CollectionFormat_Header_csv": "not-implemented",
"Parameters_Spread_Model_spreadAsRequestBody": "not-implemented",
"Parameters_Spread_Alias_spreadAsRequestBody": "not-implemented",
"Parameters_Spread_Alias_spreadAsRequestParameter": "not-implemented",
"Parameters_Spread_Alias_spreadWithMultipleParameters": "not-implemented",
"Parameters_BodyOptionality_requiredExplicit": "not-implemented",
"Parameters_BodyOptionality_OptionalExplicit": "not-implemented",
"Parameters_BodyOptionality_requiredImplicit": "not-implemented",
"Encode_Duration_Query_default": "not-implemented",
"Encode_Duration_Query_iso8601": "not-implemented",
"Encode_Duration_Query_int32Seconds": "not-implemented",
"Encode_Duration_Query_int32SecondsArray": "not-implemented",
"Encode_Duration_Query_floatSeconds": "not-implemented",
"Encode_Duration_Property_default": "not-implemented",
"Encode_Duration_Property_iso8601": "not-implemented",
"Encode_Duration_Property_int32Seconds": "not-implemented",
"Encode_Duration_Property_floatSeconds": "not-implemented",
"Encode_Duration_Property_floatSecondsArray": "not-implemented",
"Encode_Duration_Header_default": "not-implemented",
"Encode_Duration_Header_iso8601": "not-implemented",
"Encode_Duration_Header_iso8601Array": "not-implemented",
"Encode_Duration_Header_int32Seconds": "not-implemented",
"Encode_Duration_Header_floatSeconds": "not-implemented",
"Encode_Datetime_Query_default": "not-implemented",
"Encode_Datetime_Query_rfc3339": "not-implemented",
"Encode_Datetime_Query_rfc7231": "not-implemented",
"Encode_Datetime_Query_unixTimestamp": "not-implemented",
"Encode_Datetime_Query_unixTimestampArray": "not-implemented",
"Encode_Datetime_Property_default": "not-implemented",
"Encode_Datetime_Property_rfc3339": "not-implemented",
"Encode_Datetime_Property_rfc7231": "not-implemented",
"Encode_Datetime_Property_unixTimestamp": "not-implemented",
"Encode_Datetime_Property_unixTimestampArray": "not-implemented",
"Encode_Datetime_Header_default": "not-implemented",
"Encode_Datetime_Header_rfc3339": "not-implemented",
"Encode_Datetime_Header_rfc7231": "not-implemented",
"Encode_Datetime_Header_unixTimestamp": "not-implemented",
"Encode_Datetime_Header_unixTimestampArray": "not-implemented",
"Encode_Datetime_ResponseHeader_default": "not-implemented",
"Encode_Datetime_ResponseHeader_rfc3339": "not-implemented",
"Encode_Datetime_ResponseHeader_rfc7231": "not-implemented",
"Encode_Datetime_ResponseHeader_unixTimestamp": "not-implemented",
"Resiliency_ServiceDriven_AddOptionalParam_fromNone": "not-implemented",
"Resiliency_ServiceDriven_AddOptionalParam_fromOneRequired": "not-implemented",
"Resiliency_ServiceDriven_AddOptionalParam_fromOneOptional": "not-implemented",
"Resiliency_ServiceDriven_breakTheGlass": "not-implemented",
"Resiliency_ServiceDriven_addOperation": "not-implemented",
"Encode_Bytes_Query_default": "not-implemented",
"Encode_Bytes_Query_base64": "not-implemented",
"Encode_Bytes_Query_base64url": "not-implemented",
"Encode_Bytes_Query_base64urlArray": "not-implemented",
"Encode_Bytes_Property_default": "not-implemented",
"Encode_Bytes_Property_base64": "not-implemented",
"Encode_Bytes_Property_base64url": "not-implemented",
"Encode_Bytes_Property_base64urlArray": "not-implemented",
"Encode_Bytes_Header_default": "not-implemented",
"Encode_Bytes_Header_base64": "not-implemented",
"Encode_Bytes_Header_base64url": "not-implemented",
"Encode_Bytes_Header_base64urlArray": "not-implemented",
"Encode_Bytes_RequestBody_default": "not-implemented",
"Encode_Bytes_RequestBody_octetStream": "not-implemented",
"Encode_Bytes_RequestBody_customContentType": "not-implemented",
"Encode_Bytes_RequestBody_base64": "not-implemented",
"Encode_Bytes_RequestBody_base64url": "not-implemented",
"Encode_Bytes_ResponseBody_default": "not-implemented",
"Encode_Bytes_ResponseBody_octetStream": "not-implemented",
"Encode_Bytes_ResponseBody_customContentType": "not-implemented",
"Encode_Bytes_ResponseBody_base64": "not-implemented",
"Encode_Bytes_ResponseBody_base64url": "not-implemented",
"Authentication_OAuth2_valid": "not-implemented",
"Authentication_OAuth2_invalid": "not-implemented",
"Authentication_Union_validKey": "not-implemented",
"Authentication_Union_validToken": "not-implemented",
"Authentication_ApiKey_valid": "not-implemented",
"Authentication_ApiKey_invalid": "not-implemented",
"Client_Naming_Property_client": "not-implemented",
"Client_Naming_Property_language": "not-implemented",
"Client_Naming_Property_compatibleWithEncodedName": "not-implemented",
"Client_Naming_operation": "not-implemented",
"Client_Naming_parameter": "not-implemented",
"Client_Naming_Header_request": "not-implemented",
"Client_Naming_Header_response": "not-implemented",
"Client_Naming_Model_client": "not-implemented",
"Client_Naming_Model_language": "not-implemented",
"Client_Naming_UnionEnum_unionEnumName": "not-implemented",
"Client_Naming_UnionEnum_unionEnumMemberName": "not-implemented",
"Type_Property_Optional_String_getAll": "not-implemented",
"Type_Property_Optional_String_getDefault": "not-implemented",
"Type_Property_Optional_String_putAll": "not-implemented",
"Type_Property_Optional_String_putDefault": "not-implemented",
"Type_Property_Optional_Bytes_getAll": "not-implemented",
"Type_Property_Optional_Bytes_getDefault": "not-implemented",
"Type_Property_Optional_Bytes_putAll": "not-implemented",
"Type_Property_Optional_Bytes_putDefault": "not-implemented",
"Type_Property_Optional_Datetime_getAll": "not-implemented",
"Type_Property_Optional_Datetime_getDefault": "not-implemented",
"Type_Property_Optional_Datetime_putAll": "not-implemented",
"Type_Property_Optional_Datetime_putDefault": "not-implemented",
"Type_Property_Optional_Duration_getAll": "not-implemented",
"Type_Property_Optional_Duration_getDefault": "not-implemented",
"Type_Property_Optional_Duration_putAll": "not-implemented",
"Type_Property_Optional_Duration_putDefault": "not-implemented",
"Type_Property_Optional_CollectionsByte_getAll": "not-implemented",
"Type_Property_Optional_CollectionsByte_getDefault": "not-implemented",
"Type_Property_Optional_CollectionsByte_putAll": "not-implemented",
"Type_Property_Optional_CollectionsByte_putDefault": "not-implemented",
"Type_Property_Optional_CollectionsModel_getAll": "not-implemented",
"Type_Property_Optional_CollectionsModel_getDefault": "not-implemented",
"Type_Property_Optional_CollectionsModel_putAll": "not-implemented",
"Type_Property_Optional_CollectionsModel_putDefault": "not-implemented",
"Type_Property_Optional_StringLiteral_getAll": "not-implemented",
"Type_Property_Optional_StringLiteral_getDefault": "not-implemented",
"Type_Property_Optional_StringLiteral_putAll": "not-implemented",
"Type_Property_Optional_StringLiteral_putDefault": "not-implemented",
"Type_Property_Optional_IntLiteral_getAll": "not-implemented",
"Type_Property_Optional_IntLiteral_getDefault": "not-implemented",
"Type_Property_Optional_IntLiteral_putAll": "not-implemented",
"Type_Property_Optional_IntLiteral_putDefault": "not-implemented",
"Type_Property_Optional_FloatLiteral_getAll": "not-implemented",
"Type_Property_Optional_FloatLiteral_getDefault": "not-implemented",
"Type_Property_Optional_FloatLiteral_putAll": "not-implemented",
"Type_Property_Optional_FloatLiteral_putDefault": "not-implemented",
"Type_Property_Optional_BooleanLiteral_getAll": "not-implemented",
"Type_Property_Optional_BooleanLiteral_getDefault": "not-implemented",
"Type_Property_Optional_BooleanLiteral_putAll": "not-implemented",
"Type_Property_Optional_BooleanLiteral_putDefault": "not-implemented",
"Type_Property_Optional_UnionStringLiteral_getAll": "not-implemented",
"Type_Property_Optional_UnionStringLiteral_getDefault": "not-implemented",
"Type_Property_Optional_UnionStringLiteral_putAll": "not-implemented",
"Type_Property_Optional_UnionStringLiteral_putDefault": "not-implemented",
"Type_Property_Optional_UnionIntLiteral_getAll": "not-implemented",
"Type_Property_Optional_UnionIntLiteral_getDefault": "not-implemented",
"Type_Property_Optional_UnionIntLiteral_putAll": "not-implemented",
"Type_Property_Optional_UnionIntLiteral_putDefault": "not-implemented",
"Type_Property_Optional_UnionFloatLiteral_getAll": "not-implemented",
"Type_Property_Optional_UnionFloatLiteral_getDefault": "not-implemented",
"Type_Property_Optional_UnionFloatLiteral_putAll": "not-implemented",
"Type_Property_Optional_UnionFloatLiteral_putDefault": "not-implemented",
"Type_Property_Optional_RequiredAndOptional_getAll": "not-implemented",
"Type_Property_Optional_RequiredAndOptional_getRequiredOnly": "not-implemented",
"Type_Property_Optional_RequiredAndOptional_putAll": "not-implemented",
"Type_Property_Optional_RequiredAndOptional_putRequiredOnly": "not-implemented",
"Type_Property_ValueTypes_Boolean_get": "not-implemented",
"Type_Property_ValueTypes_Boolean_put": "not-implemented",
"Type_Property_ValueTypes_String_get": "not-implemented",
"Type_Property_ValueTypes_String_put": "not-implemented",
"Type_Property_ValueTypes_Bytes_get": "not-implemented",
"Type_Property_ValueTypes_Bytes_put": "not-implemented",
"Type_Property_ValueTypes_Int_get": "not-implemented",
"Type_Property_ValueTypes_Int_put": "not-implemented",
"Type_Property_ValueTypes_Float_get": "not-implemented",
"Type_Property_ValueTypes_Float_put": "not-implemented",
"Type_Property_ValueTypes_Decimal_get": "not-implemented",
"Type_Property_ValueTypes_Decimal_put": "not-implemented",
"Type_Property_ValueTypes_Decimal128_get": "not-implemented",
"Type_Property_ValueTypes_Decimal128_put": "not-implemented",
"Type_Property_ValueTypes_Datetime_get": "not-implemented",
"Type_Property_ValueTypes_Datetime_put": "not-implemented",
"Type_Property_ValueTypes_Duration_get": "not-implemented",
"Type_Property_ValueTypes_Duration_put": "not-implemented",
"Type_Property_ValueTypes_Enum_get": "not-implemented",
"Type_Property_ValueTypes_Enum_put": "not-implemented",
"Type_Property_ValueTypes_ExtensibleEnum_get": "not-implemented",
"Type_Property_ValueTypes_ExtensibleEnum_put": "not-implemented",
"Type_Property_ValueTypes_Model_get": "not-implemented",
"Type_Property_ValueTypes_Model_put": "not-implemented",
"Type_Property_ValueTypes_CollectionsString_get": "not-implemented",
"Type_Property_ValueTypes_CollectionsString_put": "not-implemented",
"Type_Property_ValueTypes_CollectionsInt_get": "not-implemented",
"Type_Property_ValueTypes_CollectionsInt_put": "not-implemented",
"Type_Property_ValueTypes_CollectionsModel_get": "not-implemented",
"Type_Property_ValueTypes_CollectionsModel_put": "not-implemented",
"Type_Property_ValueTypes_DictionaryString_get": "not-implemented",
"Type_Property_ValueTypes_DictionaryString_put": "not-implemented",
"Type_Property_ValueTypes_Never_get": "not-implemented",
"Type_Property_ValueTypes_Never_put": "not-implemented",
"Type_Property_ValueTypes_UnknownString_get": "not-implemented",
"Type_Property_ValueTypes_UnknownString_put": "not-implemented",
"Type_Property_ValueTypes_UnknownInt_get": "not-implemented",
"Type_Property_ValueTypes_UnknownInt_put": "not-implemented",
"Type_Property_ValueTypes_UnknownDict_get": "not-implemented",
"Type_Property_ValueTypes_UnknownDict_put": "not-implemented",
"Type_Property_ValueTypes_UnknownArray_get": "not-implemented",
"Type_Property_ValueTypes_UnknownArray_put": "not-implemented",
"Type_Property_ValueTypes_StringLiteral_get": "not-implemented",
"Type_Property_ValueTypes_StringLiteral_put": "not-implemented",
"Type_Property_ValueTypes_IntLiteral_get": "not-implemented",
"Type_Property_ValueTypes_IntLiteral_put": "not-implemented",
"Type_Property_ValueTypes_FloatLiteral_get": "not-implemented",
"Type_Property_ValueTypes_FloatLiteral_put": "not-implemented",
"Type_Property_ValueTypes_BooleanLiteral_get": "not-implemented",
"Type_Property_ValueTypes_BooleanLiteral_put": "not-implemented",
"Type_Property_ValueTypes_UnionStringLiteral_get": "not-implemented",
"Type_Property_ValueTypes_UnionStringLiteral_put": "not-implemented",
"Type_Property_ValueTypes_UnionIntLiteral_get": "not-implemented",
"Type_Property_ValueTypes_UnionIntLiteral_put": "not-implemented",
"Type_Property_ValueTypes_UnionFloatLiteral_get": "not-implemented",
"Type_Property_ValueTypes_UnionFloatLiteral_put": "not-implemented",
"Type_Property_ValueTypes_UnionEnumValue_get": "not-implemented",
"Type_Property_ValueTypes_UnionEnumValue_put": "not-implemented",
"Type_Property_Nullable_String_getNonNull": "not-implemented",
"Type_Property_Nullable_String_getNull": "not-implemented",
"Type_Property_Nullable_String_patchNonNull": "not-implemented",
"Type_Property_Nullable_String_patchNull": "not-implemented",
"Type_Property_Nullable_Bytes_getNonNull": "not-implemented",
"Type_Property_Nullable_Bytes_getNull": "not-implemented",
"Type_Property_Nullable_Bytes_patchNonNull": "not-implemented",
"Type_Property_Nullable_Bytes_patchNull": "not-implemented",
"Type_Property_Nullable_Datetime_getNonNull": "not-implemented",
"Type_Property_Nullable_Datetime_getNull": "not-implemented",
"Type_Property_Nullable_Datetime_patchNonNull": "not-implemented",
"Type_Property_Nullable_Datetime_patchNull": "not-implemented",
"Type_Property_Nullable_Duration_getNonNull": "not-implemented",
"Type_Property_Nullable_Duration_getNull": "not-implemented",
"Type_Property_Nullable_Duration_patchNonNull": "not-implemented",
"Type_Property_Nullable_Duration_patchNull": "not-implemented",
"Type_Property_Nullable_CollectionsByte_getNonNull": "not-implemented",
"Type_Property_Nullable_CollectionsByte_getNull": "not-implemented",
"Type_Property_Nullable_CollectionsByte_patchNonNull": "not-implemented",
"Type_Property_Nullable_CollectionsByte_patchNull": "not-implemented",
"Type_Property_Nullable_CollectionsModel_getNonNull": "not-implemented",
"Type_Property_Nullable_CollectionsModel_getNull": "not-implemented",
"Type_Property_Nullable_CollectionsModel_patchNonNull": "not-implemented",
"Type_Property_Nullable_CollectionsModel_patchNull": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsUnknown_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsUnknown_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsUnknownDerived_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsUnknownDerived_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsUnknownDiscriminated_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsUnknownDiscriminated_put": "not-implemented",
"Type_Property_AdditionalProperties_IsUnknown_get": "not-implemented",
"Type_Property_AdditionalProperties_IsUnknown_put": "not-implemented",
"Type_Property_AdditionalProperties_IsUnknownDerived_get": "not-implemented",
"Type_Property_AdditionalProperties_IsUnknownDerived_put": "not-implemented",
"Type_Property_AdditionalProperties_IsUnknownDiscriminated_get": "not-implemented",
"Type_Property_AdditionalProperties_IsUnknownDiscriminated_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsString_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsString_put": "not-implemented",
"Type_Property_AdditionalProperties_IsString_get": "not-implemented",
"Type_Property_AdditionalProperties_IsString_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadString_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadString_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsFloat_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsFloat_put": "not-implemented",
"Type_Property_AdditionalProperties_IsFloat_get": "not-implemented",
"Type_Property_AdditionalProperties_IsFloat_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadFloat_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadFloat_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsModel_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsModel_put": "not-implemented",
"Type_Property_AdditionalProperties_IsModel_get": "not-implemented",
"Type_Property_AdditionalProperties_IsModel_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadModel_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadModel_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsModelArray_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsModelArray_put": "not-implemented",
"Type_Property_AdditionalProperties_IsModelArray_get": "not-implemented",
"Type_Property_AdditionalProperties_IsModelArray_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadModelArray_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadModelArray_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadDifferentString_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadDifferentString_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadDifferentFloat_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadDifferentFloat_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadDifferentModel_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadDifferentModel_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadDifferentModelArray_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadDifferentModelArray_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsDifferentSpreadString_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsDifferentSpreadString_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsDifferentSpreadFloat_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsDifferentSpreadFloat_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsDifferentSpreadModel_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsDifferentSpreadModel_put": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsDifferentSpreadModelArray_get": "not-implemented",
"Type_Property_AdditionalProperties_ExtendsDifferentSpreadModelArray_put": "not-implemented",
"Type_Property_AdditionalProperties_MultipleSpread_get": "not-implemented",
"Type_Property_AdditionalProperties_MultipleSpread_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordUnion_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordUnion_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordDiscriminatedUnion_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordDiscriminatedUnion_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion2_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion2_put": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion3_get": "not-implemented",
"Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion3_put": "not-implemented",
"Type_Model_Visibility_headModel": "not-implemented",
"Type_Model_Visibility_getModel": "not-implemented",
"Type_Model_Visibility_putModel": "not-implemented",
"Type_Model_Visibility_patchModel": "not-implemented",
"Type_Model_Visibility_postModel": "not-implemented",
"Type_Model_Visibility_deleteModel": "not-implemented",
"Type_Model_Usage_input": "not-implemented",
"Type_Model_Usage_output": "not-implemented",
"Type_Model_Usage_inputAndOutput": "not-implemented",
"Type_Model_Flatten_putFlattenModel": "not-implemented",
"Type_Model_Flatten_putNestedFlattenModel": "not-implemented",
"Type_Model_Empty_putEmpty": "not-implemented",
"Type_Model_Empty_getEmpty": "not-implemented",
"Type_Model_Empty_postRoundTripEmpty": "not-implemented",
"Type_Enum_Fixed_String_getKnownValue": "not-implemented",
"Type_Enum_Fixed_String_putKnownValue": "not-implemented",
"Type_Enum_Fixed_String_putUnknownValue": "not-implemented",
"Type_Enum_Extensible_String_getKnownValue": "not-implemented",
"Type_Enum_Extensible_String_putKnownValue": "not-implemented",
"Type_Enum_Extensible_String_getUnknownValue": "not-implemented",
"Type_Enum_Extensible_String_putUnknownValue": "not-implemented",
"Server_Versions_Versioned_withoutApiVersion": "not-implemented",
"Server_Versions_Versioned_withQueryApiVersion": "not-implemented",
"Server_Versions_Versioned_withPathApiVersion": "not-implemented",
"Server_Versions_Versioned_withQueryOldApiVersion": "not-implemented",
"Server_Versions_NotVersioned_withoutApiVersion": "not-implemented",
"Server_Versions_NotVersioned_withQueryApiVersion": "not-implemented",
"Server_Versions_NotVersioned_withPathApiVersion": "not-implemented",
"Server_Path_Single_myOp": "not-implemented",
"Server_Path_Multiple_noOperationParams": "not-implemented",
"Server_Path_Multiple_withOperationPathParam": "not-implemented",
"Serialization_EncodedName_Json_Property_send": "not-implemented",
"Serialization_EncodedName_Json_Property_get": "not-implemented",
"Azure_SpecialHeaders_XmsClientRequestId": "not-implemented",
"Server_Endpoint_NotDefined_valid": "not-implemented",
"Azure_ClientGenerator_Core_Usage_ModelInOperation": "not-implemented",
"Azure_ClientGenerator_Core_Access_PublicOperation": "not-implemented",
"Azure_ClientGenerator_Core_Access_InternalOperation": "not-implemented",
"Azure_ClientGenerator_Core_Access_SharedModelInOperation": "not-implemented",
"Azure_ClientGenerator_Core_Access_RelativeModelInOperation": "not-implemented",
"Azure_Core_Traits_smokeTest": "not-implemented",
"Azure_Core_Traits_repeatableAction": "not-implemented",
"Azure_Core_Scalar_AzureLocationScalar_get": "not-implemented",
"Azure_Core_Scalar_AzureLocationScalar_put": "not-implemented",
"Azure_Core_Scalar_AzureLocationScalar_post": "not-implemented",
"Azure_Core_Scalar_AzureLocationScalar_header": "not-implemented",
"Azure_Core_Scalar_AzureLocationScalar_query": "not-implemented",
"Azure_Core_Basic_createOrUpdate": "not-implemented",
"Azure_Core_Basic_createOrReplace": "not-implemented",
"Azure_Core_Basic_get": "not-implemented",
"Azure_Core_Basic_list": "not-implemented",
"Azure_Core_Basic_listWithPage": "not-implemented",
"Azure_Core_Basic_listWithParameters": "not-implemented",
"Azure_Core_Basic_TwoModelsAsPageItem": "not-implemented",
"Azure_Core_Basic_listWithCustomPageModel": "not-implemented",
"Azure_Core_Basic_delete": "not-implemented",
"Azure_Core_Basic_export": "not-implemented",
"Client_Structure_TwoOperationGroup": "not-implemented",
"Authentication_Http_Custom_valid": "not-implemented",
"Authentication_Http_Custom_invalid": "not-implemented",
"Client_Structure_RenamedOperation": "not-implemented",
"Client_Structure_MultiClient": "not-implemented",
"Client_Structure_Service": "not-implemented",
"Type_Model_Inheritance_SingleDiscriminator_getModel": "not-implemented",
"Type_Model_Inheritance_SingleDiscriminator_putModel": "not-implemented",
"Type_Model_Inheritance_SingleDiscriminator_getRecursiveModel": "not-implemented",
"Type_Model_Inheritance_SingleDiscriminator_putRecursiveModel": "not-implemented",
"Type_Model_Inheritance_SingleDiscriminator_getMissingDiscriminator": "not-implemented",
"Type_Model_Inheritance_SingleDiscriminator_getWrongDiscriminator": "not-implemented",
"Type_Model_Inheritance_SingleDiscriminator_getLegacyModel": "not-implemented",
"Type_Model_Inheritance_Recursive_put": "not-implemented",
"Type_Model_Inheritance_Recursive_get": "not-implemented",
"Type_Model_Inheritance_NestedDiscriminator_getModel": "not-implemented",
"Type_Model_Inheritance_NestedDiscriminator_putModel": "not-implemented",
"Type_Model_Inheritance_NestedDiscriminator_getRecursiveModel": "not-implemented",
"Type_Model_Inheritance_NestedDiscriminator_putRecursiveModel": "not-implemented",
"Type_Model_Inheritance_NestedDiscriminator_getMissingDiscriminator": "not-implemented",
"Type_Model_Inheritance_NestedDiscriminator_getWrongDiscriminator": "not-implemented",
"Type_Model_Inheritance_NotDiscriminated_postValid": "not-implemented",
"Type_Model_Inheritance_NotDiscriminated_getValid": "not-implemented",
"Type_Model_Inheritance_NotDiscriminated_putValid": "not-implemented",
"Azure_Core_Lro_Standard_createOrReplace": "not-implemented",
"Azure_Core_Lro_Standard_delete": "not-implemented",
"Azure_Core_Lro_Standard_export": "not-implemented",
"Type_Model_Inheritance_EnumDiscriminator_getExtensibleModel": "not-implemented",
"Type_Model_Inheritance_EnumDiscriminator_putExtensibleModel": "not-implemented",
"Type_Model_Inheritance_EnumDiscriminator_getExtensibleModelMissingDiscriminator": "not-implemented",
"Type_Model_Inheritance_EnumDiscriminator_getExtensibleModelWrongDiscriminator": "not-implemented",
"Type_Model_Inheritance_EnumDiscriminator_getFixedModel": "not-implemented",
"Type_Model_Inheritance_EnumDiscriminator_putFixedModel": "not-implemented",
"Type_Model_Inheritance_EnumDiscriminator_getFixedModelMissingDiscriminator": "not-implemented",
"Type_Model_Inheritance_EnumDiscriminator_getFixedModelWrongDiscriminator": "not-implemented",
"Azure_Core_Lro_Rpc_longRunningRpc": "not-implemented"
},
"createdAt": "2024-04-30T19:35:42.784Z"
}

Просмотреть файл

@ -2,7 +2,7 @@
"CrossLanguagePackageId": "Authentication.ApiKey",
"CrossLanguageDefinitionId": {
"authentication.apikey.models.InvalidAuth": "Authentication.ApiKey.InvalidAuth",
"authentication.apikey.ApiKeyClient.valid": "valid",
"authentication.apikey.ApiKeyClient.invalid": "invalid"
"authentication.apikey.ApiKeyClient.valid": "Authentication.ApiKey.valid",
"authentication.apikey.ApiKeyClient.invalid": "Authentication.ApiKey.invalid"
}
}

Просмотреть файл

@ -6,6 +6,7 @@
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except
import copy
import calendar
import decimal
import functools
@ -639,6 +640,13 @@ def _deserialize_sequence(
return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]:
return sorted(
types,
key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"),
)
def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912
annotation: typing.Any,
module: typing.Optional[str],
@ -680,21 +688,25 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915,
# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
# is it union?
if getattr(annotation, "__origin__", None) is typing.Union:
# initial ordering is we make `string` the last deserialization option, because it is often them most generic
deserializers = [
_get_deserialize_callable_from_annotation(arg, module, rf)
for arg in sorted(
annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore
)
for arg in _sorted_annotations(annotation.__args__) # pyright: ignore
]
return functools.partial(_deserialize_with_union, deserializers)

Просмотреть файл

@ -1,4 +1,3 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
../../core/azure-core
aiohttp

Просмотреть файл

@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
apikey_subscription_id = os.environ.get("APIKEY_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
apikey_tenant_id = os.environ.get("APIKEY_TENANT_ID", "00000000-0000-0000-0000-000000000000")
apikey_client_id = os.environ.get("APIKEY_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
apikey_client_secret = os.environ.get("APIKEY_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=apikey_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=apikey_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=apikey_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=apikey_client_secret, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

Просмотреть файл

@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import ApiKeyClientTestBase, ApiKeyPreparer
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestApiKey(ApiKeyClientTestBase):
@ApiKeyPreparer()
@recorded_by_proxy
def test_valid(self, apikey_endpoint):
client = self.create_client(endpoint=apikey_endpoint)
response = client.valid()
# please add some check logic here by yourself
# ...
@ApiKeyPreparer()
@recorded_by_proxy
def test_invalid(self, apikey_endpoint):
client = self.create_client(endpoint=apikey_endpoint)
response = client.invalid()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import ApiKeyPreparer
from testpreparer_async import ApiKeyClientTestBaseAsync
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestApiKeyAsync(ApiKeyClientTestBaseAsync):
@ApiKeyPreparer()
@recorded_by_proxy_async
async def test_valid(self, apikey_endpoint):
client = self.create_async_client(endpoint=apikey_endpoint)
response = await client.valid()
# please add some check logic here by yourself
# ...
@ApiKeyPreparer()
@recorded_by_proxy_async
async def test_invalid(self, apikey_endpoint):
client = self.create_async_client(endpoint=apikey_endpoint)
response = await client.invalid()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,24 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from authentication.apikey import ApiKeyClient
from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer
import functools
class ApiKeyClientTestBase(AzureRecordedTestCase):
def create_client(self, endpoint):
credential = self.get_credential(ApiKeyClient)
return self.create_client_from_credential(
ApiKeyClient,
credential=credential,
endpoint=endpoint,
)
ApiKeyPreparer = functools.partial(PowerShellPreparer, "apikey", apikey_endpoint="https://fake_apikey_endpoint.com")

Просмотреть файл

@ -0,0 +1,20 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from authentication.apikey.aio import ApiKeyClient
from devtools_testutils import AzureRecordedTestCase
class ApiKeyClientTestBaseAsync(AzureRecordedTestCase):
def create_async_client(self, endpoint):
credential = self.get_credential(ApiKeyClient, is_async=True)
return self.create_client_from_credential(
ApiKeyClient,
credential=credential,
endpoint=endpoint,
)

Просмотреть файл

@ -2,7 +2,7 @@
"CrossLanguagePackageId": "Authentication.Http.Custom",
"CrossLanguageDefinitionId": {
"authentication.http.custom.models.InvalidAuth": "Authentication.Http.Custom.InvalidAuth",
"authentication.http.custom.CustomClient.valid": "valid",
"authentication.http.custom.CustomClient.invalid": "invalid"
"authentication.http.custom.CustomClient.valid": "Authentication.Http.Custom.valid",
"authentication.http.custom.CustomClient.invalid": "Authentication.Http.Custom.invalid"
}
}

Просмотреть файл

@ -6,6 +6,7 @@
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except
import copy
import calendar
import decimal
import functools
@ -639,6 +640,13 @@ def _deserialize_sequence(
return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]:
return sorted(
types,
key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"),
)
def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912
annotation: typing.Any,
module: typing.Optional[str],
@ -680,21 +688,25 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915,
# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
# is it union?
if getattr(annotation, "__origin__", None) is typing.Union:
# initial ordering is we make `string` the last deserialization option, because it is often them most generic
deserializers = [
_get_deserialize_callable_from_annotation(arg, module, rf)
for arg in sorted(
annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore
)
for arg in _sorted_annotations(annotation.__args__) # pyright: ignore
]
return functools.partial(_deserialize_with_union, deserializers)

Просмотреть файл

@ -1,4 +1,3 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
../../core/azure-core
aiohttp

Просмотреть файл

@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
custom_subscription_id = os.environ.get("CUSTOM_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
custom_tenant_id = os.environ.get("CUSTOM_TENANT_ID", "00000000-0000-0000-0000-000000000000")
custom_client_id = os.environ.get("CUSTOM_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
custom_client_secret = os.environ.get("CUSTOM_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=custom_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=custom_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=custom_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=custom_client_secret, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

Просмотреть файл

@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import CustomClientTestBase, CustomPreparer
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestCustom(CustomClientTestBase):
@CustomPreparer()
@recorded_by_proxy
def test_valid(self, custom_endpoint):
client = self.create_client(endpoint=custom_endpoint)
response = client.valid()
# please add some check logic here by yourself
# ...
@CustomPreparer()
@recorded_by_proxy
def test_invalid(self, custom_endpoint):
client = self.create_client(endpoint=custom_endpoint)
response = client.invalid()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import CustomPreparer
from testpreparer_async import CustomClientTestBaseAsync
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestCustomAsync(CustomClientTestBaseAsync):
@CustomPreparer()
@recorded_by_proxy_async
async def test_valid(self, custom_endpoint):
client = self.create_async_client(endpoint=custom_endpoint)
response = await client.valid()
# please add some check logic here by yourself
# ...
@CustomPreparer()
@recorded_by_proxy_async
async def test_invalid(self, custom_endpoint):
client = self.create_async_client(endpoint=custom_endpoint)
response = await client.invalid()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,24 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from authentication.http.custom import CustomClient
from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer
import functools
class CustomClientTestBase(AzureRecordedTestCase):
def create_client(self, endpoint):
credential = self.get_credential(CustomClient)
return self.create_client_from_credential(
CustomClient,
credential=credential,
endpoint=endpoint,
)
CustomPreparer = functools.partial(PowerShellPreparer, "custom", custom_endpoint="https://fake_custom_endpoint.com")

Просмотреть файл

@ -0,0 +1,20 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from authentication.http.custom.aio import CustomClient
from devtools_testutils import AzureRecordedTestCase
class CustomClientTestBaseAsync(AzureRecordedTestCase):
def create_async_client(self, endpoint):
credential = self.get_credential(CustomClient, is_async=True)
return self.create_client_from_credential(
CustomClient,
credential=credential,
endpoint=endpoint,
)

Просмотреть файл

@ -2,7 +2,7 @@
"CrossLanguagePackageId": "Authentication.OAuth2",
"CrossLanguageDefinitionId": {
"authentication.oauth2.models.InvalidAuth": "Authentication.OAuth2.InvalidAuth",
"authentication.oauth2.OAuth2Client.valid": "valid",
"authentication.oauth2.OAuth2Client.invalid": "invalid"
"authentication.oauth2.OAuth2Client.valid": "Authentication.OAuth2.valid",
"authentication.oauth2.OAuth2Client.invalid": "Authentication.OAuth2.invalid"
}
}

Просмотреть файл

@ -6,6 +6,7 @@
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except
import copy
import calendar
import decimal
import functools
@ -639,6 +640,13 @@ def _deserialize_sequence(
return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]:
return sorted(
types,
key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"),
)
def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912
annotation: typing.Any,
module: typing.Optional[str],
@ -680,21 +688,25 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915,
# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
# is it union?
if getattr(annotation, "__origin__", None) is typing.Union:
# initial ordering is we make `string` the last deserialization option, because it is often them most generic
deserializers = [
_get_deserialize_callable_from_annotation(arg, module, rf)
for arg in sorted(
annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore
)
for arg in _sorted_annotations(annotation.__args__) # pyright: ignore
]
return functools.partial(_deserialize_with_union, deserializers)

Просмотреть файл

@ -1,4 +1,3 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
../../core/azure-core
../../identity/azure-identity

Просмотреть файл

@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
oauth2_subscription_id = os.environ.get("OAUTH2_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
oauth2_tenant_id = os.environ.get("OAUTH2_TENANT_ID", "00000000-0000-0000-0000-000000000000")
oauth2_client_id = os.environ.get("OAUTH2_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
oauth2_client_secret = os.environ.get("OAUTH2_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=oauth2_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=oauth2_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=oauth2_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=oauth2_client_secret, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

Просмотреть файл

@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import OAuth2ClientTestBase, OAuth2Preparer
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestOAuth2(OAuth2ClientTestBase):
@OAuth2Preparer()
@recorded_by_proxy
def test_valid(self, oauth2_endpoint):
client = self.create_client(endpoint=oauth2_endpoint)
response = client.valid()
# please add some check logic here by yourself
# ...
@OAuth2Preparer()
@recorded_by_proxy
def test_invalid(self, oauth2_endpoint):
client = self.create_client(endpoint=oauth2_endpoint)
response = client.invalid()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import OAuth2Preparer
from testpreparer_async import OAuth2ClientTestBaseAsync
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestOAuth2Async(OAuth2ClientTestBaseAsync):
@OAuth2Preparer()
@recorded_by_proxy_async
async def test_valid(self, oauth2_endpoint):
client = self.create_async_client(endpoint=oauth2_endpoint)
response = await client.valid()
# please add some check logic here by yourself
# ...
@OAuth2Preparer()
@recorded_by_proxy_async
async def test_invalid(self, oauth2_endpoint):
client = self.create_async_client(endpoint=oauth2_endpoint)
response = await client.invalid()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,24 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from authentication.oauth2 import OAuth2Client
from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer
import functools
class OAuth2ClientTestBase(AzureRecordedTestCase):
def create_client(self, endpoint):
credential = self.get_credential(OAuth2Client)
return self.create_client_from_credential(
OAuth2Client,
credential=credential,
endpoint=endpoint,
)
OAuth2Preparer = functools.partial(PowerShellPreparer, "oauth2", oauth2_endpoint="https://fake_oauth2_endpoint.com")

Просмотреть файл

@ -0,0 +1,20 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from authentication.oauth2.aio import OAuth2Client
from devtools_testutils import AzureRecordedTestCase
class OAuth2ClientTestBaseAsync(AzureRecordedTestCase):
def create_async_client(self, endpoint):
credential = self.get_credential(OAuth2Client, is_async=True)
return self.create_client_from_credential(
OAuth2Client,
credential=credential,
endpoint=endpoint,
)

Просмотреть файл

@ -1,7 +1,7 @@
{
"CrossLanguagePackageId": "Authentication.Union",
"CrossLanguageDefinitionId": {
"authentication.union.UnionClient.valid_key": "validKey",
"authentication.union.UnionClient.valid_token": "validToken"
"authentication.union.UnionClient.valid_key": "Authentication.Union.validKey",
"authentication.union.UnionClient.valid_token": "Authentication.Union.validToken"
}
}

Просмотреть файл

@ -6,6 +6,7 @@
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except
import copy
import calendar
import decimal
import functools
@ -639,6 +640,13 @@ def _deserialize_sequence(
return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]:
return sorted(
types,
key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"),
)
def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912
annotation: typing.Any,
module: typing.Optional[str],
@ -680,21 +688,25 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915,
# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
# is it union?
if getattr(annotation, "__origin__", None) is typing.Union:
# initial ordering is we make `string` the last deserialization option, because it is often them most generic
deserializers = [
_get_deserialize_callable_from_annotation(arg, module, rf)
for arg in sorted(
annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore
)
for arg in _sorted_annotations(annotation.__args__) # pyright: ignore
]
return functools.partial(_deserialize_with_union, deserializers)

Просмотреть файл

@ -1,4 +1,3 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
../../core/azure-core
aiohttp

Просмотреть файл

@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
union_subscription_id = os.environ.get("UNION_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
union_tenant_id = os.environ.get("UNION_TENANT_ID", "00000000-0000-0000-0000-000000000000")
union_client_id = os.environ.get("UNION_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
union_client_secret = os.environ.get("UNION_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=union_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=union_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=union_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=union_client_secret, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

Просмотреть файл

@ -0,0 +1,31 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import UnionClientTestBase, UnionPreparer
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestUnion(UnionClientTestBase):
@UnionPreparer()
@recorded_by_proxy
def test_valid_key(self, union_endpoint):
client = self.create_client(endpoint=union_endpoint)
response = client.valid_key()
# please add some check logic here by yourself
# ...
@UnionPreparer()
@recorded_by_proxy
def test_valid_token(self, union_endpoint):
client = self.create_client(endpoint=union_endpoint)
response = client.valid_token()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,32 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import UnionPreparer
from testpreparer_async import UnionClientTestBaseAsync
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestUnionAsync(UnionClientTestBaseAsync):
@UnionPreparer()
@recorded_by_proxy_async
async def test_valid_key(self, union_endpoint):
client = self.create_async_client(endpoint=union_endpoint)
response = await client.valid_key()
# please add some check logic here by yourself
# ...
@UnionPreparer()
@recorded_by_proxy_async
async def test_valid_token(self, union_endpoint):
client = self.create_async_client(endpoint=union_endpoint)
response = await client.valid_token()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,24 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from authentication.union import UnionClient
from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer
import functools
class UnionClientTestBase(AzureRecordedTestCase):
def create_client(self, endpoint):
credential = self.get_credential(UnionClient)
return self.create_client_from_credential(
UnionClient,
credential=credential,
endpoint=endpoint,
)
UnionPreparer = functools.partial(PowerShellPreparer, "union", union_endpoint="https://fake_union_endpoint.com")

Просмотреть файл

@ -0,0 +1,20 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from authentication.union.aio import UnionClient
from devtools_testutils import AzureRecordedTestCase
class UnionClientTestBaseAsync(AzureRecordedTestCase):
def create_async_client(self, endpoint):
credential = self.get_credential(UnionClient, is_async=True)
return self.create_client_from_credential(
UnionClient,
credential=credential,
endpoint=endpoint,
)

Просмотреть файл

@ -12,8 +12,8 @@
"specs.azure.clientgenerator.core.access.models.PublicDecoratorModelInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.PublicDecoratorModelInPublic",
"specs.azure.clientgenerator.core.access.models.RealModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.RealModel",
"specs.azure.clientgenerator.core.access.models.SharedModel": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.SharedModel",
"specs.azure.clientgenerator.core.access.AccessClient.public_operation.no_decorator_in_public": "noDecoratorInPublic",
"specs.azure.clientgenerator.core.access.AccessClient.public_operation.public_decorator_in_public": "publicDecoratorInPublic",
"specs.azure.clientgenerator.core.access.AccessClient.shared_model_in_operation.public": "public"
"specs.azure.clientgenerator.core.access.AccessClient.public_operation.no_decorator_in_public": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic",
"specs.azure.clientgenerator.core.access.AccessClient.public_operation.public_decorator_in_public": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic",
"specs.azure.clientgenerator.core.access.AccessClient.shared_model_in_operation.public": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public"
}
}

Просмотреть файл

@ -1,4 +1,3 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
../../core/azure-core
aiohttp

Просмотреть файл

@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
access_subscription_id = os.environ.get("ACCESS_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
access_tenant_id = os.environ.get("ACCESS_TENANT_ID", "00000000-0000-0000-0000-000000000000")
access_client_id = os.environ.get("ACCESS_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
access_client_secret = os.environ.get("ACCESS_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=access_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=access_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=access_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=access_client_secret, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

Просмотреть файл

@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import AccessClientTestBase, AccessPreparer
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestAccessPublicOperationOperations(AccessClientTestBase):
@AccessPreparer()
@recorded_by_proxy
def test_no_decorator_in_public(self, access_endpoint):
client = self.create_client(endpoint=access_endpoint)
response = client.public_operation.no_decorator_in_public(
name="str",
)
# please add some check logic here by yourself
# ...
@AccessPreparer()
@recorded_by_proxy
def test_public_decorator_in_public(self, access_endpoint):
client = self.create_client(endpoint=access_endpoint)
response = client.public_operation.public_decorator_in_public(
name="str",
)
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,36 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import AccessPreparer
from testpreparer_async import AccessClientTestBaseAsync
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestAccessPublicOperationOperationsAsync(AccessClientTestBaseAsync):
@AccessPreparer()
@recorded_by_proxy_async
async def test_no_decorator_in_public(self, access_endpoint):
client = self.create_async_client(endpoint=access_endpoint)
response = await client.public_operation.no_decorator_in_public(
name="str",
)
# please add some check logic here by yourself
# ...
@AccessPreparer()
@recorded_by_proxy_async
async def test_public_decorator_in_public(self, access_endpoint):
client = self.create_async_client(endpoint=access_endpoint)
response = await client.public_operation.public_decorator_in_public(
name="str",
)
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,24 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import AccessClientTestBase, AccessPreparer
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestAccessSharedModelInOperationOperations(AccessClientTestBase):
@AccessPreparer()
@recorded_by_proxy
def test_public(self, access_endpoint):
client = self.create_client(endpoint=access_endpoint)
response = client.shared_model_in_operation.public(
name="str",
)
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,25 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import AccessPreparer
from testpreparer_async import AccessClientTestBaseAsync
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestAccessSharedModelInOperationOperationsAsync(AccessClientTestBaseAsync):
@AccessPreparer()
@recorded_by_proxy_async
async def test_public(self, access_endpoint):
client = self.create_async_client(endpoint=access_endpoint)
response = await client.shared_model_in_operation.public(
name="str",
)
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,24 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer
import functools
from specs.azure.clientgenerator.core.access import AccessClient
class AccessClientTestBase(AzureRecordedTestCase):
def create_client(self, endpoint):
credential = self.get_credential(AccessClient)
return self.create_client_from_credential(
AccessClient,
credential=credential,
endpoint=endpoint,
)
AccessPreparer = functools.partial(PowerShellPreparer, "access", access_endpoint="https://fake_access_endpoint.com")

Просмотреть файл

@ -0,0 +1,20 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from devtools_testutils import AzureRecordedTestCase
from specs.azure.clientgenerator.core.access.aio import AccessClient
class AccessClientTestBaseAsync(AzureRecordedTestCase):
def create_async_client(self, endpoint):
credential = self.get_credential(AccessClient, is_async=True)
return self.create_client_from_credential(
AccessClient,
credential=credential,
endpoint=endpoint,
)

Просмотреть файл

@ -6,6 +6,7 @@
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except
import copy
import calendar
import decimal
import functools
@ -639,6 +640,13 @@ def _deserialize_sequence(
return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]:
return sorted(
types,
key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"),
)
def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912
annotation: typing.Any,
module: typing.Optional[str],
@ -680,21 +688,25 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915,
# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
# is it union?
if getattr(annotation, "__origin__", None) is typing.Union:
# initial ordering is we make `string` the last deserialization option, because it is often them most generic
deserializers = [
_get_deserialize_callable_from_annotation(arg, module, rf)
for arg in sorted(
annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore
)
for arg in _sorted_annotations(annotation.__args__) # pyright: ignore
]
return functools.partial(_deserialize_with_union, deserializers)

Просмотреть файл

@ -212,7 +212,7 @@ class InternalOperationOperations:
:paramtype name: str
:return: NoDecoratorModelInInternal. The NoDecoratorModelInInternal is compatible with
MutableMapping
:rtype: ~specs.azure.clientgenerator.core.access.models.NoDecoratorModelInInternal
:rtype: ~specs.azure.clientgenerator.core.access.models._models.NoDecoratorModelInInternal
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@ -280,7 +280,8 @@ class InternalOperationOperations:
:paramtype name: str
:return: InternalDecoratorModelInInternal. The InternalDecoratorModelInInternal is compatible
with MutableMapping
:rtype: ~specs.azure.clientgenerator.core.access.models.InternalDecoratorModelInInternal
:rtype:
~specs.azure.clientgenerator.core.access.models._models.InternalDecoratorModelInInternal
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@ -580,7 +581,7 @@ class RelativeModelInOperationOperations:
:keyword name: Required.
:paramtype name: str
:return: OuterModel. The OuterModel is compatible with MutableMapping
:rtype: ~specs.azure.clientgenerator.core.access.models.OuterModel
:rtype: ~specs.azure.clientgenerator.core.access.models._models.OuterModel
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@ -654,7 +655,7 @@ class RelativeModelInOperationOperations:
:keyword kind: Required.
:paramtype kind: str
:return: AbstractModel. The AbstractModel is compatible with MutableMapping
:rtype: ~specs.azure.clientgenerator.core.access.models.AbstractModel
:rtype: ~specs.azure.clientgenerator.core.access.models._models.AbstractModel
:raises ~azure.core.exceptions.HttpResponseError:
Example:

Просмотреть файл

@ -128,7 +128,7 @@ class OuterModel(BaseModel):
:ivar name: Required.
:vartype name: str
:ivar inner: Required.
:vartype inner: ~specs.azure.clientgenerator.core.access.models.InnerModel
:vartype inner: ~specs.azure.clientgenerator.core.access.models._models.InnerModel
"""
inner: "_models._models.InnerModel" = rest_field()

Просмотреть файл

@ -386,7 +386,7 @@ class InternalOperationOperations:
:paramtype name: str
:return: NoDecoratorModelInInternal. The NoDecoratorModelInInternal is compatible with
MutableMapping
:rtype: ~specs.azure.clientgenerator.core.access.models.NoDecoratorModelInInternal
:rtype: ~specs.azure.clientgenerator.core.access.models._models.NoDecoratorModelInInternal
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@ -454,7 +454,8 @@ class InternalOperationOperations:
:paramtype name: str
:return: InternalDecoratorModelInInternal. The InternalDecoratorModelInInternal is compatible
with MutableMapping
:rtype: ~specs.azure.clientgenerator.core.access.models.InternalDecoratorModelInInternal
:rtype:
~specs.azure.clientgenerator.core.access.models._models.InternalDecoratorModelInInternal
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@ -750,7 +751,7 @@ class RelativeModelInOperationOperations:
:keyword name: Required.
:paramtype name: str
:return: OuterModel. The OuterModel is compatible with MutableMapping
:rtype: ~specs.azure.clientgenerator.core.access.models.OuterModel
:rtype: ~specs.azure.clientgenerator.core.access.models._models.OuterModel
:raises ~azure.core.exceptions.HttpResponseError:
Example:
@ -824,7 +825,7 @@ class RelativeModelInOperationOperations:
:keyword kind: Required.
:paramtype kind: str
:return: AbstractModel. The AbstractModel is compatible with MutableMapping
:rtype: ~specs.azure.clientgenerator.core.access.models.AbstractModel
:rtype: ~specs.azure.clientgenerator.core.access.models._models.AbstractModel
:raises ~azure.core.exceptions.HttpResponseError:
Example:

Просмотреть файл

@ -1,7 +0,0 @@
include *.md
include LICENSE
include type/model/flatten/py.typed
recursive-include tests *.py
recursive-include samples *.py *.md
include type/__init__.py
include type/model/__init__.py

Просмотреть файл

@ -1,11 +0,0 @@
{
"CrossLanguagePackageId": "Type.Model.Flatten",
"CrossLanguageDefinitionId": {
"type.model.flatten.models.ChildFlattenModel": "Type.Model.Flatten.ChildFlattenModel",
"type.model.flatten.models.ChildModel": "Type.Model.Flatten.ChildModel",
"type.model.flatten.models.FlattenModel": "Type.Model.Flatten.FlattenModel",
"type.model.flatten.models.NestedFlattenModel": "Type.Model.Flatten.NestedFlattenModel",
"type.model.flatten.FlattenClient.put_flatten_model": "putFlattenModel",
"type.model.flatten.FlattenClient.put_nested_flatten_model": "putNestedFlattenModel"
}
}

Просмотреть файл

@ -1,11 +0,0 @@
{
"CrossLanguagePackageId": "Type.Model.Flatten",
"CrossLanguageDefinitionId": {
"type.model.flatten.models.ChildFlattenModel": "Type.Model.Flatten.ChildFlattenModel",
"type.model.flatten.models.ChildModel": "Type.Model.Flatten.ChildModel",
"type.model.flatten.models.FlattenModel": "Type.Model.Flatten.FlattenModel",
"type.model.flatten.models.NestedFlattenModel": "Type.Model.Flatten.NestedFlattenModel",
"type.model.flatten.FlattenClient.put_flatten_model": "putFlattenModel",
"type.model.flatten.FlattenClient.put_nested_flatten_model": "putNestedFlattenModel"
}
}

Просмотреть файл

@ -4,7 +4,7 @@
"specs.azure.clientgenerator.core.usage.models.InputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.InputModel",
"specs.azure.clientgenerator.core.usage.models.OrphanModel": "_Specs_.Azure.ClientGenerator.Core.Usage.OrphanModel",
"specs.azure.clientgenerator.core.usage.models.OutputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.OutputModel",
"specs.azure.clientgenerator.core.usage.UsageClient.model_in_operation.input_to_input_output": "inputToInputOutput",
"specs.azure.clientgenerator.core.usage.UsageClient.model_in_operation.output_to_input_output": "outputToInputOutput"
"specs.azure.clientgenerator.core.usage.UsageClient.model_in_operation.input_to_input_output": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput",
"specs.azure.clientgenerator.core.usage.UsageClient.model_in_operation.output_to_input_output": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput"
}
}

Просмотреть файл

@ -1,4 +1,3 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
../../core/azure-core
aiohttp

Просмотреть файл

@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
usage_subscription_id = os.environ.get("USAGE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
usage_tenant_id = os.environ.get("USAGE_TENANT_ID", "00000000-0000-0000-0000-000000000000")
usage_client_id = os.environ.get("USAGE_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
usage_client_secret = os.environ.get("USAGE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=usage_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=usage_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=usage_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=usage_client_secret, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

Просмотреть файл

@ -0,0 +1,33 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import UsageClientTestBase, UsagePreparer
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestUsageModelInOperationOperations(UsageClientTestBase):
@UsagePreparer()
@recorded_by_proxy
def test_input_to_input_output(self, usage_endpoint):
client = self.create_client(endpoint=usage_endpoint)
response = client.model_in_operation.input_to_input_output(
body={"name": "str"},
)
# please add some check logic here by yourself
# ...
@UsagePreparer()
@recorded_by_proxy
def test_output_to_input_output(self, usage_endpoint):
client = self.create_client(endpoint=usage_endpoint)
response = client.model_in_operation.output_to_input_output()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,34 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import UsagePreparer
from testpreparer_async import UsageClientTestBaseAsync
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestUsageModelInOperationOperationsAsync(UsageClientTestBaseAsync):
@UsagePreparer()
@recorded_by_proxy_async
async def test_input_to_input_output(self, usage_endpoint):
client = self.create_async_client(endpoint=usage_endpoint)
response = await client.model_in_operation.input_to_input_output(
body={"name": "str"},
)
# please add some check logic here by yourself
# ...
@UsagePreparer()
@recorded_by_proxy_async
async def test_output_to_input_output(self, usage_endpoint):
client = self.create_async_client(endpoint=usage_endpoint)
response = await client.model_in_operation.output_to_input_output()
# please add some check logic here by yourself
# ...

Просмотреть файл

@ -0,0 +1,24 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer
import functools
from specs.azure.clientgenerator.core.usage import UsageClient
class UsageClientTestBase(AzureRecordedTestCase):
def create_client(self, endpoint):
credential = self.get_credential(UsageClient)
return self.create_client_from_credential(
UsageClient,
credential=credential,
endpoint=endpoint,
)
UsagePreparer = functools.partial(PowerShellPreparer, "usage", usage_endpoint="https://fake_usage_endpoint.com")

Просмотреть файл

@ -0,0 +1,20 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from devtools_testutils import AzureRecordedTestCase
from specs.azure.clientgenerator.core.usage.aio import UsageClient
class UsageClientTestBaseAsync(AzureRecordedTestCase):
def create_async_client(self, endpoint):
credential = self.get_credential(UsageClient, is_async=True)
return self.create_client_from_credential(
UsageClient,
credential=credential,
endpoint=endpoint,
)

Просмотреть файл

@ -6,6 +6,7 @@
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except
import copy
import calendar
import decimal
import functools
@ -639,6 +640,13 @@ def _deserialize_sequence(
return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]:
return sorted(
types,
key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"),
)
def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912
annotation: typing.Any,
module: typing.Optional[str],
@ -680,21 +688,25 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915,
# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
# is it union?
if getattr(annotation, "__origin__", None) is typing.Union:
# initial ordering is we make `string` the last deserialization option, because it is often them most generic
deserializers = [
_get_deserialize_callable_from_annotation(arg, module, rf)
for arg in sorted(
annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore
)
for arg in _sorted_annotations(annotation.__args__) # pyright: ignore
]
return functools.partial(_deserialize_with_union, deserializers)

Просмотреть файл

@ -8,16 +8,16 @@
"specs.azure.core.basic.models.UserListResults": "_Specs_.Azure.Core.Basic.CustomPageModel",
"specs.azure.core.basic.models.UserOrder": "_Specs_.Azure.Core.Basic.UserOrder",
"specs.azure.core.basic.models.ListItemInputExtensibleEnum": "_Specs_.Azure.Core.Basic.ListItemInputExtensibleEnum",
"specs.azure.core.basic.BasicClient.two_models_as_page_item.list_first_item": "listFirstItem",
"specs.azure.core.basic.BasicClient.two_models_as_page_item.list_second_item": "listSecondItem",
"specs.azure.core.basic.BasicClient.create_or_update": "createOrUpdate",
"specs.azure.core.basic.BasicClient.create_or_replace": "createOrReplace",
"specs.azure.core.basic.BasicClient.get": "get",
"specs.azure.core.basic.BasicClient.list": "list",
"specs.azure.core.basic.BasicClient.list_with_page": "listWithPage",
"specs.azure.core.basic.BasicClient.list_with_parameters": "listWithParameters",
"specs.azure.core.basic.BasicClient.list_with_custom_page_model": "listWithCustomPageModel",
"specs.azure.core.basic.BasicClient.delete": "delete",
"specs.azure.core.basic.BasicClient.export": "export"
"specs.azure.core.basic.BasicClient.two_models_as_page_item.list_first_item": "_Specs_.Azure.Core.Basic.TwoModelsAsPageItem.listFirstItem",
"specs.azure.core.basic.BasicClient.two_models_as_page_item.list_second_item": "_Specs_.Azure.Core.Basic.TwoModelsAsPageItem.listSecondItem",
"specs.azure.core.basic.BasicClient.create_or_update": "_Specs_.Azure.Core.Basic.createOrUpdate",
"specs.azure.core.basic.BasicClient.create_or_replace": "_Specs_.Azure.Core.Basic.createOrReplace",
"specs.azure.core.basic.BasicClient.get": "_Specs_.Azure.Core.Basic.get",
"specs.azure.core.basic.BasicClient.list": "_Specs_.Azure.Core.Basic.list",
"specs.azure.core.basic.BasicClient.list_with_page": "_Specs_.Azure.Core.Basic.listWithPage",
"specs.azure.core.basic.BasicClient.list_with_parameters": "_Specs_.Azure.Core.Basic.listWithParameters",
"specs.azure.core.basic.BasicClient.list_with_custom_page_model": "_Specs_.Azure.Core.Basic.listWithCustomPageModel",
"specs.azure.core.basic.BasicClient.delete": "_Specs_.Azure.Core.Basic.delete",
"specs.azure.core.basic.BasicClient.export": "_Specs_.Azure.Core.Basic.export"
}
}

Просмотреть файл

@ -1,4 +1,3 @@
-e ../../../tools/azure-devtools
-e ../../../tools/azure-sdk-tools
../../core/azure-core
aiohttp

Просмотреть файл

@ -0,0 +1,35 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import os
import pytest
from dotenv import load_dotenv
from devtools_testutils import (
test_proxy,
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_header_regex_sanitizer,
)
load_dotenv()
# aovid record sensitive identity information in recordings
@pytest.fixture(scope="session", autouse=True)
def add_sanitizers(test_proxy):
basic_subscription_id = os.environ.get("BASIC_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000")
basic_tenant_id = os.environ.get("BASIC_TENANT_ID", "00000000-0000-0000-0000-000000000000")
basic_client_id = os.environ.get("BASIC_CLIENT_ID", "00000000-0000-0000-0000-000000000000")
basic_client_secret = os.environ.get("BASIC_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=basic_subscription_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=basic_tenant_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=basic_client_id, value="00000000-0000-0000-0000-000000000000")
add_general_regex_sanitizer(regex=basic_client_secret, value="00000000-0000-0000-0000-000000000000")
add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]")
add_header_regex_sanitizer(key="Cookie", value="cookie;")
add_body_key_sanitizer(json_path="$..access_token", value="access_token")

Просмотреть файл

@ -0,0 +1,109 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import BasicClientTestBase, BasicPreparer
@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestBasic(BasicClientTestBase):
@BasicPreparer()
@recorded_by_proxy
def test_create_or_update(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.create_or_update(
id=0,
resource={"etag": "str", "id": 0, "name": "str", "orders": [{"detail": "str", "id": 0, "userId": 0}]},
)
# please add some check logic here by yourself
# ...
@BasicPreparer()
@recorded_by_proxy
def test_create_or_replace(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.create_or_replace(
id=0,
resource={"etag": "str", "id": 0, "name": "str", "orders": [{"detail": "str", "id": 0, "userId": 0}]},
)
# please add some check logic here by yourself
# ...
@BasicPreparer()
@recorded_by_proxy
def test_get(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.get(
id=0,
)
# please add some check logic here by yourself
# ...
@BasicPreparer()
@recorded_by_proxy
def test_list(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.list()
result = [r for r in response]
# please add some check logic here by yourself
# ...
@BasicPreparer()
@recorded_by_proxy
def test_list_with_page(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.list_with_page()
result = [r for r in response]
# please add some check logic here by yourself
# ...
@BasicPreparer()
@recorded_by_proxy
def test_list_with_parameters(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.list_with_parameters(
body_input={"inputName": "str"},
)
result = [r for r in response]
# please add some check logic here by yourself
# ...
@BasicPreparer()
@recorded_by_proxy
def test_list_with_custom_page_model(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.list_with_custom_page_model()
result = [r for r in response]
# please add some check logic here by yourself
# ...
@BasicPreparer()
@recorded_by_proxy
def test_delete(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.delete(
id=0,
)
# please add some check logic here by yourself
# ...
@BasicPreparer()
@recorded_by_proxy
def test_export(self, basic_endpoint):
client = self.create_client(endpoint=basic_endpoint)
response = client.export(
id=0,
format="str",
)
# please add some check logic here by yourself
# ...

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше