From 3ab2a26535ae4f4e5eacc08d53738903fcd6e7af Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Fri, 23 Aug 2024 06:27:51 +0800 Subject: [PATCH] Fix ci (#2785) --- .../changes/fix-ci-2024-2024-7-20-16-32-44.md | 7 + .../changes/fix-ci-2024-2024-7-22-11-47-37.md | 7 + .gitignore | 1 + eng/dev_requirements.txt | 1 + eng/pipelines/ci-template.yml | 28 +- eng/pipelines/ci.yml | 3 +- eng/scripts/run_mypy.py | 12 +- eng/scripts/run_pylint.py | 12 +- eng/scripts/run_pyright.py | 13 +- packages/autorest.python/package.json | 11 +- .../autorest.python/scripts/copy-generator.js | 19 -- .../autorest.python/scripts/copy-generator.ts | 24 ++ .../autorest.python/{ => scripts}/mypy.ini | 3 + .../autorest.python/scripts/run-python3.ts | 25 ++ .../scripts/system-requirements.ts | 253 ++++++++++++++++++ .../typespec-python/generator/pygen/black.py | 5 +- .../pygen/codegen/models/combined_type.py | 2 +- .../pygen/codegen/models/credential_types.py | 21 +- .../pygen/codegen/models/enum_type.py | 2 +- .../pygen/codegen/models/lro_operation.py | 1 - .../codegen/models/lro_paging_operation.py | 2 +- .../pygen/codegen/models/model_type.py | 12 +- .../pygen/codegen/models/paging_operation.py | 1 - .../pygen/codegen/models/parameter_list.py | 7 +- .../pygen/codegen/models/primitive_types.py | 6 +- .../pygen/codegen/serializers/__init__.py | 2 +- .../codegen/serializers/builder_serializer.py | 21 +- .../codegen/serializers/sample_serializer.py | 2 - .../typespec-python/generator/pygen/m2r.py | 2 +- .../generator/pygen/postprocess/__init__.py | 4 +- .../generator/pygen/postprocess/venvtools.py | 4 +- .../generator/pygen/preprocess/__init__.py | 2 +- .../typespec-python/generator/pygen/utils.py | 4 +- packages/typespec-python/generator/setup.py | 2 +- packages/typespec-python/package.json | 10 +- .../typespec-python/scripts/eng/format.ts | 5 + packages/typespec-python/scripts/eng/lint.ts | 50 ++++ packages/typespec-python/scripts/eng/mypy.ini | 38 +++ .../scripts/eng}/pylintrc | 0 .../scripts/eng}/pyrightconfig.json | 0 .../scripts/{ => eng}/regenerate.ts | 27 +- .../scripts/eng}/run-tests.ts | 21 +- packages/typespec-python/scripts/eng/utils.ts | 30 +++ packages/typespec-python/scripts/run-tests.ts | 57 ---- .../apikey/apiview_mapping_python.json | 8 - .../http/custom/apiview_mapping_python.json | 8 - .../oauth2/apiview_mapping_python.json | 8 - .../core/access/apiview_mapping_python.json | 19 -- .../client/naming/apiview_mapping_python.json | 23 -- .../apiview_mapping_python.json | 12 - .../apiview_mapping_python.json | 12 - .../datetime/apiview_mapping_python.json | 29 -- .../duration/apiview_mapping_python.json | 25 -- .../apiview_mapping_python.json | 12 - .../apiview_mapping_python.json | 12 - .../apiview_mapping_python.json | 10 - .../apiview_mapping_python.json | 11 - .../spread/apiview_mapping_python.json | 13 - .../apiview_mapping_python.json | 10 - .../apiview_mapping_python.json | 11 - .../mediatype/apiview_mapping_python.json | 9 - .../srv/driven1/apiview_mapping_python.json | 8 - .../srv/driven2/apiview_mapping_python.json | 9 - .../json/apiview_mapping_python.json | 8 - .../notdefined/apiview_mapping_python.json | 6 - .../path/multiple/apiview_mapping_python.json | 8 - .../path/single/apiview_mapping_python.json | 6 - .../notversioned/apiview_mapping_python.json | 8 - .../apiview_mapping_python.json | 7 - .../repeatability/apiview_mapping_python.json | 6 - .../array/apiview_mapping_python.json | 26 -- .../dictionary/apiview_mapping_python.json | 28 -- .../extensible/apiview_mapping_python.json | 10 - .../model/empty/apiview_mapping_python.json | 11 - .../apiview_mapping_python.json | 16 -- .../apiview_mapping_python.json | 11 - .../recursive/apiview_mapping_python.json | 9 - .../apiview_mapping_python.json | 19 -- .../model/usage/apiview_mapping_python.json | 11 - .../visibility/apiview_mapping_python.json | 12 - .../nullable/apiview_mapping_python.json | 36 --- .../optional/apiview_mapping_python.json | 75 ------ .../scalar/apiview_mapping_python.json | 21 -- .../union/apiview_mapping_python.json | 52 ---- pnpm-lock.yaml | 12 + 85 files changed, 575 insertions(+), 831 deletions(-) create mode 100644 .chronus/changes/fix-ci-2024-2024-7-20-16-32-44.md create mode 100644 .chronus/changes/fix-ci-2024-2024-7-22-11-47-37.md delete mode 100644 packages/autorest.python/scripts/copy-generator.js create mode 100644 packages/autorest.python/scripts/copy-generator.ts rename packages/autorest.python/{ => scripts}/mypy.ini (93%) create mode 100644 packages/autorest.python/scripts/run-python3.ts create mode 100644 packages/autorest.python/scripts/system-requirements.ts create mode 100644 packages/typespec-python/scripts/eng/format.ts create mode 100644 packages/typespec-python/scripts/eng/lint.ts create mode 100644 packages/typespec-python/scripts/eng/mypy.ini rename packages/{autorest.python => typespec-python/scripts/eng}/pylintrc (100%) rename packages/{autorest.python => typespec-python/scripts/eng}/pyrightconfig.json (100%) rename packages/typespec-python/scripts/{ => eng}/regenerate.ts (94%) rename packages/{autorest.python/scripts => typespec-python/scripts/eng}/run-tests.ts (85%) create mode 100644 packages/typespec-python/scripts/eng/utils.ts delete mode 100644 packages/typespec-python/scripts/run-tests.ts delete mode 100644 packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/client-naming/client/naming/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/encode-duration/encode/duration/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/server-path-single/server/path/single/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-array/typetest/array/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/apiview_mapping_python.json delete mode 100644 packages/typespec-python/test/azure/generated/typetest-union/typetest/union/apiview_mapping_python.json diff --git a/.chronus/changes/fix-ci-2024-2024-7-20-16-32-44.md b/.chronus/changes/fix-ci-2024-2024-7-20-16-32-44.md new file mode 100644 index 0000000000..cd66ead76e --- /dev/null +++ b/.chronus/changes/fix-ci-2024-2024-7-20-16-32-44.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-python" +--- + +Enable lint check in CI \ No newline at end of file diff --git a/.chronus/changes/fix-ci-2024-2024-7-22-11-47-37.md b/.chronus/changes/fix-ci-2024-2024-7-22-11-47-37.md new file mode 100644 index 0000000000..8428d53c3f --- /dev/null +++ b/.chronus/changes/fix-ci-2024-2024-7-22-11-47-37.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@autorest/python" +--- + +update ci to use npm \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2bbf0a3b85..f1141470bb 100644 --- a/.gitignore +++ b/.gitignore @@ -126,3 +126,4 @@ node_modules/ # Generated test folders test/services/*/_generated **/autorest.python/generator +**/autorest.python/scripts/eng diff --git a/eng/dev_requirements.txt b/eng/dev_requirements.txt index 1af2a78431..a5295e285a 100644 --- a/eng/dev_requirements.txt +++ b/eng/dev_requirements.txt @@ -5,3 +5,4 @@ pytest==8.3.2 tox==4.18.0 coverage==7.6.1 black==24.8.0 +setuptools==69.2.0 diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index e930664284..a209c74709 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -3,11 +3,10 @@ parameters: installTypeSpec: false installCadlRanch: false folderName: "" - pythonCodeChecks: false - pythonFolderName: "" regenerate: false checkChange: true updateToLatestTypespec: false + unitTest: false steps: - checkout: self @@ -55,12 +54,6 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), eq(${{ parameters.updateToLatestTypespec }}, false)) - # - script: pnpm change verify - # displayName: Check changelog - # workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - # condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) - # continueOnError: true - - script: pnpm list displayName: Pnpm list workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python @@ -81,46 +74,39 @@ steps: displayName: List installed packages workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - - script: pylint ${{parameters.pythonFolderName}} + - script: pnpm run lint --command pylint displayName: Pylint workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - condition: and(succeeded(), ${{ parameters.pythonCodeChecks }}) - - script: mypy ${{parameters.pythonFolderName}} + - script: pnpm run lint --command mypy displayName: Mypy workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - condition: and(succeeded(), ${{ parameters.pythonCodeChecks }}) - - script: pyright ${{parameters.pythonFolderName}} + - script: pnpm run lint --command pyright displayName: Pyright workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - condition: and(succeeded(), ${{ parameters.pythonCodeChecks }}) - - script: black $(Build.SourcesDirectory)/autorest.python + - script: pnpm run format displayName: Black workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} - condition: and(succeeded(), ${{ parameters.pythonCodeChecks }}) - script: node ./eng/scripts/check-for-changed-files.js displayName: Fail on black autorest diff workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - condition: and(succeeded(), ${{ parameters.pythonCodeChecks }}) - script: | cd test/unittests tox run -e ci displayName: Unit tests workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ - condition: and(succeeded(), ${{ parameters.pythonCodeChecks }}) + condition: and(succeeded(), ${{ parameters.unitTest }}) - script: inv regenerate displayName: "Regenerate Code" workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ condition: and(succeeded(), ${{ parameters.regenerate }}, eq('${{parameters.folderName}}', 'autorest.python')) - - script: | - find test/azure/generated -type f ! -name '*apiview_mapping_python.json*' -delete - npm run regenerate + - script: npm run regenerate displayName: "Regenerate Code" workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}}/ condition: and(succeeded(), ${{ parameters.regenerate }}, eq('${{parameters.folderName}}', 'typespec-python')) diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 0db6c0abbc..cbf0c9948c 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -78,8 +78,7 @@ jobs: parameters: installAutorest: true folderName: "autorest.python" - pythonCodeChecks: true - pythonFolderName: autorest + unitTest: true regenerate: true - script: | diff --git a/eng/scripts/run_mypy.py b/eng/scripts/run_mypy.py index 0ee1840184..ff9978af8d 100644 --- a/eng/scripts/run_mypy.py +++ b/eng/scripts/run_mypy.py @@ -12,11 +12,17 @@ import os import logging import sys -from util import run_check, AUTOREST_PACKAGE_DIR +from util import run_check logging.getLogger().setLevel(logging.INFO) -config_file_location = os.path.join(AUTOREST_PACKAGE_DIR, "mypy.ini") + +def get_config_file_location(): + mypy_ini_path = os.path.join(os.getcwd(), "../../scripts/eng/mypy.ini") + if os.path.exists(mypy_ini_path): + return mypy_ini_path + else: + return os.path.join(os.getcwd(), "../../../scripts/eng/mypy.ini") def _single_dir_mypy(mod): @@ -28,7 +34,7 @@ def _single_dir_mypy(mod): "-m", "mypy", "--config-file", - config_file_location, + get_config_file_location(), "--ignore-missing", str(inner_class.absolute()), ] diff --git a/eng/scripts/run_pylint.py b/eng/scripts/run_pylint.py index 9c72240b9b..897b474ec9 100644 --- a/eng/scripts/run_pylint.py +++ b/eng/scripts/run_pylint.py @@ -12,11 +12,17 @@ import os import logging import sys -from util import run_check, AUTOREST_PACKAGE_DIR +from util import run_check logging.getLogger().setLevel(logging.INFO) -rfc_file_location = os.path.join(AUTOREST_PACKAGE_DIR, "pylintrc") + +def get_rfc_file_location(): + rfc_file_location = os.path.join(os.getcwd(), "../../scripts/eng/pylintrc") + if os.path.exists(rfc_file_location): + return rfc_file_location + else: + return os.path.join(os.getcwd(), "../../../scripts/eng/pylintrc") def _single_dir_pylint(mod): @@ -27,7 +33,7 @@ def _single_dir_pylint(mod): sys.executable, "-m", "pylint", - "--rcfile={}".format(rfc_file_location), + "--rcfile={}".format(get_rfc_file_location()), "--load-plugins=pylint_guidelines_checker", "--output-format=parseable", str(inner_class.absolute()), diff --git a/eng/scripts/run_pyright.py b/eng/scripts/run_pyright.py index decfb9c80e..c6df4eefad 100644 --- a/eng/scripts/run_pyright.py +++ b/eng/scripts/run_pyright.py @@ -8,15 +8,24 @@ # This script is used to execute pyright within a tox environment. Depending on which package is being executed against, # a failure may be suppressed. +import os from subprocess import check_output, CalledProcessError import logging import sys import time -from util import run_check, AUTOREST_PACKAGE_DIR +from util import run_check logging.getLogger().setLevel(logging.INFO) +def get_pyright_config_file_location(): + pyright_config = os.path.join(os.getcwd(), "../../scripts/eng/pyrightconfig.json") + if os.path.exists(pyright_config): + return pyright_config + else: + return os.path.join(os.getcwd(), "../../../scripts/eng/pyrightconfig.json") + + def _single_dir_pyright(mod): inner_class = next(d for d in mod.iterdir() if d.is_dir() and not str(d).endswith("egg-info")) retries = 3 @@ -28,7 +37,7 @@ def _single_dir_pyright(mod): "-m", "pyright", "-p", - str(AUTOREST_PACKAGE_DIR), + get_pyright_config_file_location(), str(inner_class.absolute()), ], text=True, diff --git a/packages/autorest.python/package.json b/packages/autorest.python/package.json index 2e90e2c796..e2e1bffded 100644 --- a/packages/autorest.python/package.json +++ b/packages/autorest.python/package.json @@ -5,10 +5,12 @@ "scripts": { "start": "node ./scripts/run-python3.js ./scripts/start.py", "prepare": "node ./scripts/run-python3.js ./scripts/prepare.py", - "build": "node ./scripts/copy-generator.js --force", - "install": "node ./scripts/copy-generator.js && node ./scripts/run-python3.js ./scripts/install.py", + "build": "tsx ./scripts/copy-generator.ts --force", + "install": "tsx ./scripts/copy-generator.ts && node ./scripts/run-python3.js ./scripts/install.py", "debug": "node ./scripts/run-python3.js ./scripts/start.py --debug", - "test": "tsx ./scripts/run-tests.ts" + "test": "tsx ./scripts/eng/run-tests.ts --validFolders azure/legacy azure/version-tolerant vanilla/legacy vanilla/version-tolerant dpg/version-tolerant", + "lint": "tsx ./scripts/eng/lint.ts --folderName autorest", + "format": "tsx ./scripts/eng/format.ts --folderName autorest" }, "main": "index.js", "repository": { @@ -34,7 +36,8 @@ "devDependencies": { "@microsoft.azure/autorest.testserver": "^3.3.46", "typescript": "~5.1.3", - "@azure-tools/typespec-python": "workspace:^" + "@azure-tools/typespec-python": "workspace:^", + "chalk": "5.3.0" }, "files": [ "autorest/**/*.py", diff --git a/packages/autorest.python/scripts/copy-generator.js b/packages/autorest.python/scripts/copy-generator.js deleted file mode 100644 index c85af504e1..0000000000 --- a/packages/autorest.python/scripts/copy-generator.js +++ /dev/null @@ -1,19 +0,0 @@ -const fs = require("fs-extra"); -const path = require("path"); - -const force = process.argv[2] === "--force" ? true : false; - -const typespecModulePath = path.join(__dirname, "..", "node_modules", "@azure-tools", "typespec-python"); - -// Define the source and destination directories -const sourceDir = path.join(typespecModulePath, "generator"); -const destDir = path.join(__dirname, "..", "generator"); - -// Delete the destination directory if it exists -if (fs.existsSync(destDir)) { - if (force) fs.removeSync(destDir); - else process.exit(0); -} - -// Copy the source directory to the destination directory -fs.copySync(sourceDir, destDir); diff --git a/packages/autorest.python/scripts/copy-generator.ts b/packages/autorest.python/scripts/copy-generator.ts new file mode 100644 index 0000000000..7a2858e0ae --- /dev/null +++ b/packages/autorest.python/scripts/copy-generator.ts @@ -0,0 +1,24 @@ +import { copyFileSync, readdirSync } from "fs"; +import { existsSync, removeSync, copySync } from "fs-extra"; +import { join } from "path"; + +const force: boolean = process.argv[2] === "--force"; + +function copyAndCreateDir(sourceDir: string, destDir: string) { + // Delete the destination directory if it exists + if (existsSync(destDir)) { + if (force) removeSync(destDir); + else process.exit(0); + } + + // Copy the source directory to the destination directory + copySync(sourceDir, destDir); +} + +const typespecModulePath: string = join(__dirname, "..", "node_modules", "@azure-tools", "typespec-python"); + +// Copy the generator directory +copyAndCreateDir(join(typespecModulePath, "generator"), join(__dirname, "..", "generator")); + +// Copy the scripts directory +copyAndCreateDir(join(typespecModulePath, "scripts", "eng"), join(__dirname, "..", "scripts", "eng")); diff --git a/packages/autorest.python/mypy.ini b/packages/autorest.python/scripts/mypy.ini similarity index 93% rename from packages/autorest.python/mypy.ini rename to packages/autorest.python/scripts/mypy.ini index 7fbbd82b84..9deae01db2 100644 --- a/packages/autorest.python/mypy.ini +++ b/packages/autorest.python/scripts/mypy.ini @@ -33,3 +33,6 @@ ignore_missing_imports = True [mypy-pygen.*] ignore_missing_imports = True + +[mypy-yaml.*] +ignore_missing_imports = True diff --git a/packages/autorest.python/scripts/run-python3.ts b/packages/autorest.python/scripts/run-python3.ts new file mode 100644 index 0000000000..11497fbe53 --- /dev/null +++ b/packages/autorest.python/scripts/run-python3.ts @@ -0,0 +1,25 @@ +// This script wraps logic in @azure-tools/extension to resolve +// the path to Python 3 so that a Python script file can be run +// from an npm script in package.json. It uses the same Python 3 +// path resolution algorithm as AutoRest so that the behavior +// is fully consistent (and also supports AUTOREST_PYTHON_EXE). +// +// Invoke it like so: "tsx run-python3.ts script.py" + +import cp from "child_process"; +import { patchPythonPath } from "./system-requirements.js"; + +async function runPython3(...args: string[]) { + const command = await patchPythonPath(["python", ...args], { + version: ">=3.8", + environmentVariable: "AUTOREST_PYTHON_EXE", + }); + cp.execSync(command.join(" "), { + stdio: [0, 1, 2], + }); +} + +runPython3(...process.argv.slice(2)).catch((err) => { + console.error(err.toString()); // eslint-disable-line no-console + process.exit(1); +}); diff --git a/packages/autorest.python/scripts/system-requirements.ts b/packages/autorest.python/scripts/system-requirements.ts new file mode 100644 index 0000000000..adbc7ea0f0 --- /dev/null +++ b/packages/autorest.python/scripts/system-requirements.ts @@ -0,0 +1,253 @@ +import { SpawnOptions, ChildProcess, spawn } from "child_process"; +import { coerce, satisfies } from "semver"; + +/* + * Copied from @autorest/system-requirements + */ + +const execute = (command: string, cmdlineargs: Array, options: MoreOptions = {}): Promise => { + return new Promise((resolve, reject) => { + const cp = spawn(command, cmdlineargs, { ...options, stdio: "pipe", shell: true }); + if (options.onCreate) { + options.onCreate(cp); + } + + options.onStdOutData ? cp.stdout.on("data", options.onStdOutData) : cp; + options.onStdErrData ? cp.stderr.on("data", options.onStdErrData) : cp; + + let err = ""; + let out = ""; + let all = ""; + cp.stderr.on("data", (chunk) => { + err += chunk; + all += chunk; + }); + cp.stdout.on("data", (chunk) => { + out += chunk; + all += chunk; + }); + + cp.on("error", (err) => { + reject(err); + }); + cp.on("close", (code, signal) => + resolve({ + stdout: out, + stderr: err, + log: all, + error: code ? new Error("Process Failed.") : null, + code, + }), + ); + }); +}; + +const versionIsSatisfied = (version: string, requirement: string): boolean => { + const cleanedVersion = coerce(version); + if (!cleanedVersion) { + throw new Error(`Invalid version ${version}.`); + } + return satisfies(cleanedVersion, requirement, true); +}; + +/** + * Validate the provided system requirement resolution is satisfying the version requirement if applicable. + * @param resolution Command resolution. + * @param actualVersion Version for that resolution. + * @param requirement Requirement. + * @returns the resolution if it is valid or an @see SystemRequirementError if not. + */ +const validateVersionRequirement = ( + resolution: SystemRequirementResolution, + actualVersion: string, + requirement: SystemRequirement, +): SystemRequirementResolution | SystemRequirementError => { + if (!requirement.version) { + return resolution; // No version requirement. + } + + try { + if (versionIsSatisfied(actualVersion, requirement.version)) { + return resolution; + } + return { + ...resolution, + error: true, + message: `'${resolution.command}' version is '${actualVersion}' but doesn't satisfy requirement '${requirement.version}'. Please update.`, + actualVersion: actualVersion, + neededVersion: requirement.version, + }; + } catch { + return { + ...resolution, + error: true, + message: `Couldn't parse the version ${actualVersion}. This is not a valid semver version.`, + actualVersion: actualVersion, + neededVersion: requirement.version, + }; + } +}; + +const tryPython = async ( + requirement: SystemRequirement, + command: string, + additionalArgs: string[] = [], +): Promise => { + const resolution: SystemRequirementResolution = { + name: PythonRequirement, + command, + additionalArgs: additionalArgs.length > 0 ? additionalArgs : undefined, + }; + + try { + const result = await execute(command, [...additionalArgs, "-c", `"${PRINT_PYTHON_VERSION_SCRIPT}"`]); + return validateVersionRequirement(resolution, result.stdout.trim(), requirement); + } catch (e) { + return { + error: true, + ...resolution, + message: `'${command}' command line is not found in the path. Make sure to have it installed.`, + }; + } +}; + +/** + * Returns the path to the executable as asked in the requirement. + * @param requirement System requirement definition. + * @returns If the requirement provide an environment variable for the path returns the value of that environment variable. undefined otherwise. + */ +const getExecutablePath = (requirement: SystemRequirement): string | undefined => + requirement.environmentVariable && process.env[requirement.environmentVariable]; + +const createPythonErrorMessage = ( + requirement: SystemRequirement, + errors: SystemRequirementError[], +): SystemRequirementError => { + const versionReq = requirement.version ?? "*"; + const lines = [ + `Couldn't find a valid python interpreter satisfying the requirement (version: ${versionReq}). Tried:`, + ...errors.map((x) => ` - ${x.command} (${x.message})`), + ]; + + return { + error: true, + name: "python", + command: "python", + message: lines.join("\n"), + }; +}; + +const resolvePythonRequirement = async ( + requirement: SystemRequirement, +): Promise => { + // Hardcoding AUTOREST_PYTHON_EXE is for backward compatibility + const path = getExecutablePath(requirement) ?? process.env["AUTOREST_PYTHON_EXE"]; + if (path) { + return await tryPython(requirement, path); + } + + const errors: SystemRequirementError[] = []; + // On windows try `py` executable with `-3` flag. + if (process.platform === "win32") { + const pyResult = await tryPython(requirement, "py", ["-3"]); + if ("error" in pyResult) { + errors.push(pyResult); + } else { + return pyResult; + } + } + + const python3Result = await tryPython(requirement, "python3"); + if ("error" in python3Result) { + errors.push(python3Result); + } else { + return python3Result; + } + + const pythonResult = await tryPython(requirement, "python"); + if ("error" in pythonResult) { + errors.push(pythonResult); + } else { + return pythonResult; + } + + return createPythonErrorMessage(requirement, errors); +}; + +/** + * @param command list of the command and arguments. First item in array must be a python exe @see KnownPythonExe. (e.g. ["python", "mypythonfile.py"] + * @param requirement + */ +export const patchPythonPath = async ( + command: PythonCommandLine, + requirement: SystemRequirement, +): Promise => { + const [_, ...args] = command; + const resolution = await resolvePythonRequirement(requirement); + if ("error" in resolution) { + throw new Error(`Failed to find compatible python version. ${resolution.message}`); + } + return [resolution.command, ...(resolution.additionalArgs ?? []), ...args]; +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// TYPES +const PythonRequirement = "python"; +const PRINT_PYTHON_VERSION_SCRIPT = "import sys; print('.'.join(map(str, sys.version_info[:3])))"; + +type KnownPythonExe = "python.exe" | "python3.exe" | "python" | "python3"; +type PythonCommandLine = [KnownPythonExe, ...string[]]; + +interface MoreOptions extends SpawnOptions { + onCreate?(cp: ChildProcess): void; + onStdOutData?(chunk: any): void; + onStdErrData?(chunk: any): void; +} + +interface SystemRequirement { + version?: string; + /** + * Name of an environment variable where the user could provide the path to the exe. + * @example "AUTOREST_PYTHON_PATH" + */ + environmentVariable?: string; +} + +interface SystemRequirementResolution { + /** + * Name of the requirement. + * @example python, java, etc. + */ + name: string; + + /** + * Name of the command + * @example python3, /home/myuser/python39/python, java, etc. + */ + command: string; + + /** + * List of additional arguments to pass to this command. + * @example '-3' for 'py' to specify to use python 3 + */ + additionalArgs?: string[]; +} + +interface ExecResult { + stdout: string; + stderr: string; + + /** + * Union of stdout and stderr. + */ + log: string; + error: Error | null; + code: number | null; +} + +interface SystemRequirementError extends SystemRequirementResolution { + error: true; + message: string; + neededVersion?: string; + actualVersion?: string; +} diff --git a/packages/typespec-python/generator/pygen/black.py b/packages/typespec-python/generator/pygen/black.py index 78c55dfc83..f444e5fd5e 100644 --- a/packages/typespec-python/generator/pygen/black.py +++ b/packages/typespec-python/generator/pygen/black.py @@ -6,7 +6,6 @@ import logging from pathlib import Path import os -from typing import Any, Dict import black from black.report import NothingChanged @@ -19,7 +18,7 @@ _BLACK_MODE.line_length = 120 -class BlackScriptPlugin(Plugin): # pylint: disable=abstract-method +class BlackScriptPlugin(Plugin): def __init__(self, **kwargs): super().__init__(**kwargs) output_folder = self.options.get("output_folder", str(self.output_folder)) @@ -57,7 +56,7 @@ def format_file(self, file: Path) -> None: file_content = black.format_file_contents(file_content, fast=True, mode=_BLACK_MODE) except NothingChanged: pass - except: # pylint: disable=bare-except + except: _LOGGER.error("Error: failed to format %s", file) raise else: diff --git a/packages/typespec-python/generator/pygen/codegen/models/combined_type.py b/packages/typespec-python/generator/pygen/codegen/models/combined_type.py index 5eeea95c62..6afbe08ac9 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/combined_type.py +++ b/packages/typespec-python/generator/pygen/codegen/models/combined_type.py @@ -51,7 +51,7 @@ def serialization_type(self) -> str: def client_default_value(self) -> Any: return self.yaml_data.get("clientDefaultValue") - def description(self, *, is_operation_file: bool) -> str: # pylint: disable=unused-argument + def description(self, *, is_operation_file: bool) -> str: if len(self.types) == 2: return f"Is either a {self.types[0].type_description} type or a {self.types[1].type_description} type." return f"Is one of the following types: {', '.join([t.type_description for t in self.types])}" diff --git a/packages/typespec-python/generator/pygen/codegen/models/credential_types.py b/packages/typespec-python/generator/pygen/codegen/models/credential_types.py index f2f8b75796..82dd74302a 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/credential_types.py +++ b/packages/typespec-python/generator/pygen/codegen/models/credential_types.py @@ -106,7 +106,7 @@ def from_yaml(cls, yaml_data: Dict[str, Any], code_model: "CodeModel") -> "KeyCr ) -class CredentialType(Generic[CredentialPolicyType], BaseType): # pylint:disable=abstract-method +class CredentialType(Generic[CredentialPolicyType], BaseType): """Store info about the type of the credential. Can be either an KeyCredential or a TokenCredential""" def __init__( @@ -118,7 +118,7 @@ def __init__( super().__init__(yaml_data, code_model) self.policy = policy - def description(self, *, is_operation_file: bool) -> str: # pylint: disable=unused-argument + def description(self, *, is_operation_file: bool) -> str: return "" def get_json_template_representation( @@ -146,11 +146,7 @@ def from_yaml(cls, yaml_data: Dict[str, Any], code_model: "CodeModel") -> "Crede ) -class TokenCredentialType( - CredentialType[ # pylint: disable=unsubscriptable-object - Union[BearerTokenCredentialPolicyType, ARMChallengeAuthenticationPolicyType] - ] -): +class TokenCredentialType(CredentialType[Union[BearerTokenCredentialPolicyType, ARMChallengeAuthenticationPolicyType]]): """Type of a token credential. Used by BearerAuth and ARMChallenge policies""" def type_annotation(self, **kwargs: Any) -> str: @@ -194,23 +190,20 @@ def instance_check_template(self) -> str: return "hasattr({}, 'get_token')" -class KeyCredentialType( - # pylint: disable=unsubscriptable-object - CredentialType[KeyCredentialPolicyType] -): +class KeyCredentialType(CredentialType[KeyCredentialPolicyType]): """Type for an KeyCredential""" - def docstring_type(self, **kwargs: Any) -> str: # pylint: disable=unused-argument + def docstring_type(self, **kwargs: Any) -> str: return f"~{self.code_model.core_library}.credentials.{self.policy.credential_name}" - def type_annotation(self, **kwargs: Any) -> str: # pylint: disable=unused-argument + def type_annotation(self, **kwargs: Any) -> str: return self.policy.credential_name @property def instance_check_template(self) -> str: return "isinstance({}, " + f"{self.policy.credential_name})" - def imports(self, **kwargs: Any) -> FileImport: # pylint: disable=unused-argument + def imports(self, **kwargs: Any) -> FileImport: file_import = super().imports(**kwargs) file_import.add_submodule_import( "credentials", diff --git a/packages/typespec-python/generator/pygen/codegen/models/enum_type.py b/packages/typespec-python/generator/pygen/codegen/models/enum_type.py index 6a26c37c4a..56e712654f 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/enum_type.py +++ b/packages/typespec-python/generator/pygen/codegen/models/enum_type.py @@ -137,7 +137,7 @@ def serialization_type(self) -> str: """ return self.value_type.serialization_type - def description(self, *, is_operation_file: bool) -> str: # pylint: disable=unused-argument + def description(self, *, is_operation_file: bool) -> str: possible_values = [self.get_declaration(v.value) for v in self.values] if not possible_values: return "" diff --git a/packages/typespec-python/generator/pygen/codegen/models/lro_operation.py b/packages/typespec-python/generator/pygen/codegen/models/lro_operation.py index 2e127df9d3..b2ea32728c 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/lro_operation.py +++ b/packages/typespec-python/generator/pygen/codegen/models/lro_operation.py @@ -1,4 +1,3 @@ -# pylint: disable=multiple-statements # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for diff --git a/packages/typespec-python/generator/pygen/codegen/models/lro_paging_operation.py b/packages/typespec-python/generator/pygen/codegen/models/lro_paging_operation.py index 42c885f308..326ed2aac9 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/lro_paging_operation.py +++ b/packages/typespec-python/generator/pygen/codegen/models/lro_paging_operation.py @@ -21,7 +21,7 @@ def operation_type(self) -> str: return "lropaging" def cls_type_annotation(self, *, async_mode: bool) -> str: - return f"ClsType[{Response.type_annotation(self.responses[0], async_mode=async_mode)}]" # pylint: disable=no-member + return f"ClsType[{Response.type_annotation(self.responses[0], async_mode=async_mode)}]" def imports(self, async_mode: bool, **kwargs: Any) -> FileImport: lro_imports = LROOperationBase.imports(self, async_mode, **kwargs) diff --git a/packages/typespec-python/generator/pygen/codegen/models/model_type.py b/packages/typespec-python/generator/pygen/codegen/models/model_type.py index 19a2c4ee90..e844dc03a5 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/model_type.py +++ b/packages/typespec-python/generator/pygen/codegen/models/model_type.py @@ -17,9 +17,9 @@ from .imports import FileImport, ImportType, TypingSection if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports + from typing import Literal else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + from typing_extensions import Literal # type: ignore if TYPE_CHECKING: from .code_model import CodeModel @@ -50,9 +50,7 @@ def _get_properties(type: "ModelType", properties: List[Property]) -> List[Prope return properties -class ModelType( # pylint: disable=abstract-method - BaseType -): # pylint: disable=too-many-instance-attributes, too-many-public-methods +class ModelType(BaseType): # pylint: disable=too-many-instance-attributes, too-many-public-methods """Represents a class ready to be serialized in Python. :param str name: The name of the class. @@ -89,7 +87,7 @@ def __init__( @property def is_usage_output(self) -> bool: - return self.usage & UsageFlags.Output.value + return bool(self.usage & UsageFlags.Output.value) @property def flattened_property(self) -> Optional[Property]: @@ -284,7 +282,7 @@ def imports(self, **kwargs: Any) -> FileImport: return file_import -class GeneratedModelType(ModelType): # pylint: disable=abstract-method +class GeneratedModelType(ModelType): def type_annotation(self, **kwargs: Any) -> str: is_operation_file = kwargs.pop("is_operation_file", False) skip_quote = kwargs.get("skip_quote", False) diff --git a/packages/typespec-python/generator/pygen/codegen/models/paging_operation.py b/packages/typespec-python/generator/pygen/codegen/models/paging_operation.py index 554b72d443..dd5ee82640 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/paging_operation.py +++ b/packages/typespec-python/generator/pygen/codegen/models/paging_operation.py @@ -1,4 +1,3 @@ -# pylint: disable=multiple-statements # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for diff --git a/packages/typespec-python/generator/pygen/codegen/models/parameter_list.py b/packages/typespec-python/generator/pygen/codegen/models/parameter_list.py index 73278584a3..fe0210c301 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/parameter_list.py +++ b/packages/typespec-python/generator/pygen/codegen/models/parameter_list.py @@ -261,8 +261,7 @@ def from_yaml(cls, yaml_data: Dict[str, Any], code_model: "CodeModel"): ) -class _ParameterList(_ParameterListBase[Parameter, BodyParameter]): # pylint: disable=unsubscriptable-object - """Base Parameter class for the two operation ParameterLists""" +class _ParameterList(_ParameterListBase[Parameter, BodyParameter]): @staticmethod def parameter_creator() -> Callable[[Dict[str, Any], "CodeModel"], Parameter]: @@ -285,9 +284,7 @@ class ParameterList(_ParameterList): """ParameterList is the parameter list for Operation classes""" -class _RequestBuilderParameterList( - _ParameterListBase[RequestBuilderParameter, RequestBuilderBodyParameter] # pylint: disable=unsubscriptable-object -): +class _RequestBuilderParameterList(_ParameterListBase[RequestBuilderParameter, RequestBuilderBodyParameter]): """_RequestBuilderParameterList is base parameter list for RequestBuilder classes""" @staticmethod diff --git a/packages/typespec-python/generator/pygen/codegen/models/primitive_types.py b/packages/typespec-python/generator/pygen/codegen/models/primitive_types.py index b24dff342c..78a5ae4dd6 100644 --- a/packages/typespec-python/generator/pygen/codegen/models/primitive_types.py +++ b/packages/typespec-python/generator/pygen/codegen/models/primitive_types.py @@ -22,8 +22,8 @@ def __repr__(self) -> str: return "r'{}'".format(self.string.replace("'", "\\'")) -class PrimitiveType(BaseType): # pylint: disable=abstract-method - def description(self, *, is_operation_file: bool) -> str: # pylint: disable=unused-argument +class PrimitiveType(BaseType): + def description(self, *, is_operation_file: bool) -> str: return "" def type_annotation(self, **kwargs: Any) -> str: @@ -188,7 +188,7 @@ def type_description(self) -> str: return "JSON" -class NumberType(PrimitiveType): # pylint: disable=abstract-method +class NumberType(PrimitiveType): def __init__(self, yaml_data: Dict[str, Any], code_model: "CodeModel") -> None: super().__init__(yaml_data=yaml_data, code_model=code_model) self.precision: Optional[int] = yaml_data.get("precision") diff --git a/packages/typespec-python/generator/pygen/codegen/serializers/__init__.py b/packages/typespec-python/generator/pygen/codegen/serializers/__init__.py index aefb7fabdc..c6ad4cee49 100644 --- a/packages/typespec-python/generator/pygen/codegen/serializers/__init__.py +++ b/packages/typespec-python/generator/pygen/codegen/serializers/__init__.py @@ -66,7 +66,7 @@ def _sample_output_path(source_file_path: str) -> Path: return Path("") -class JinjaSerializer(ReaderAndWriter): # pylint: disable=abstract-method +class JinjaSerializer(ReaderAndWriter): def __init__( self, code_model: CodeModel, diff --git a/packages/typespec-python/generator/pygen/codegen/serializers/builder_serializer.py b/packages/typespec-python/generator/pygen/codegen/serializers/builder_serializer.py index c38d2b66db..1f517c31b7 100644 --- a/packages/typespec-python/generator/pygen/codegen/serializers/builder_serializer.py +++ b/packages/typespec-python/generator/pygen/codegen/serializers/builder_serializer.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,multiple-statements +# 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 @@ -23,7 +23,6 @@ BinaryType, BodyParameter, ParameterMethodLocation, - RequestBuilderBodyParameter, OverloadedRequestBuilder, Property, RequestBuilderType, @@ -218,7 +217,7 @@ def is_json_model_type(parameters: ParameterListType) -> bool: ) -class _BuilderBaseSerializer(Generic[BuilderType]): # pylint: disable=abstract-method +class _BuilderBaseSerializer(Generic[BuilderType]): def __init__(self, code_model: CodeModel, async_mode: bool) -> None: self.code_model = code_model self.async_mode = async_mode @@ -391,7 +390,7 @@ def pipeline_name(self) -> str: ############################## REQUEST BUILDERS ############################## -class RequestBuilderSerializer(_BuilderBaseSerializer[RequestBuilderType]): # pylint: disable=abstract-method +class RequestBuilderSerializer(_BuilderBaseSerializer[RequestBuilderType]): def description_and_summary(self, builder: RequestBuilderType) -> List[str]: retval = super().description_and_summary(builder) retval += [ @@ -517,7 +516,7 @@ def construct_url(self, builder: RequestBuilderType) -> str: ############################## NORMAL OPERATIONS ############################## -class _OperationSerializer(_BuilderBaseSerializer[OperationType]): # pylint: disable=abstract-method +class _OperationSerializer(_BuilderBaseSerializer[OperationType]): def description_and_summary(self, builder: OperationType) -> List[str]: retval = super().description_and_summary(builder) if builder.deprecated: @@ -842,14 +841,14 @@ def _create_request_builder_call( elif request_builder.overloads: seen_body_params = set() for overload in request_builder.overloads: - body_param = cast(RequestBuilderBodyParameter, overload.parameters.body_parameter) + body_param = overload.parameters.body_parameter if body_param.client_name in seen_body_params: continue seen_body_params.add(body_param.client_name) retval.append(f" {body_param.client_name}={body_param.name_in_high_level_operation},") elif request_builder.parameters.has_body: - body_param = cast(RequestBuilderBodyParameter, request_builder.parameters.body_parameter) + body_param = request_builder.parameters.body_parameter retval.append(f" {body_param.client_name}={body_param.name_in_high_level_operation},") retval.append(" headers=_headers,") retval.append(" params=_params,") @@ -871,7 +870,7 @@ def _postprocess_http_request(self, builder: OperationType, template_url: Option ) return retval - def _call_request_builder_helper( # pylint: disable=too-many-statements + def _call_request_builder_helper( self, builder: OperationType, request_builder: RequestBuilderType, @@ -1031,7 +1030,7 @@ def handle_response(self, builder: OperationType) -> List[str]: retval.append("deserialized = None") if builder.any_response_has_headers: retval.append("response_headers = {}") - if builder.has_response_body or builder.any_response_has_headers: + if builder.has_response_body or builder.any_response_has_headers: # pylint: disable=too-many-nested-blocks if len(builder.responses) > 1: status_codes, res_headers, res_deserialization = [], [], [] for status_code in builder.success_status_codes: @@ -1173,7 +1172,7 @@ class OperationSerializer(_OperationSerializer[Operation]): ... PagingOperationType = TypeVar("PagingOperationType", bound=Union[PagingOperation, LROPagingOperation]) -class _PagingOperationSerializer(_OperationSerializer[PagingOperationType]): # pylint: disable=abstract-method +class _PagingOperationSerializer(_OperationSerializer[PagingOperationType]): def __init__(self, code_model: CodeModel, async_mode: bool) -> None: # for pylint reasons need to redefine init # probably because inheritance is going too deep @@ -1458,7 +1457,7 @@ class LROOperationSerializer(_LROOperationSerializer[LROOperation]): ... class LROPagingOperationSerializer( _LROOperationSerializer[LROPagingOperation], _PagingOperationSerializer[LROPagingOperation], -): # pylint: disable=abstract-method +): @property def _call_method(self) -> str: return "await " if self.async_mode else "" diff --git a/packages/typespec-python/generator/pygen/codegen/serializers/sample_serializer.py b/packages/typespec-python/generator/pygen/codegen/serializers/sample_serializer.py index 37c4d27e46..e2a1d6b130 100644 --- a/packages/typespec-python/generator/pygen/codegen/serializers/sample_serializer.py +++ b/packages/typespec-python/generator/pygen/codegen/serializers/sample_serializer.py @@ -1,4 +1,3 @@ -# 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 @@ -22,7 +21,6 @@ FileImport, ) from .utils import get_namespace_config, get_namespace_from_package_name -from ...utils import to_snake_case _LOGGER = logging.getLogger(__name__) diff --git a/packages/typespec-python/generator/pygen/m2r.py b/packages/typespec-python/generator/pygen/m2r.py index d709863e7c..a61fd4cb0a 100644 --- a/packages/typespec-python/generator/pygen/m2r.py +++ b/packages/typespec-python/generator/pygen/m2r.py @@ -27,7 +27,7 @@ def inline_html(self, html: str) -> str: return f":code:`{html}`" -class M2R(YamlUpdatePlugin): # pylint: disable=abstract-method +class M2R(YamlUpdatePlugin): """A plugin to convert any description and summary from MD to RST.""" def update_yaml(self, yaml_data: Dict[str, Any]) -> None: diff --git a/packages/typespec-python/generator/pygen/postprocess/__init__.py b/packages/typespec-python/generator/pygen/postprocess/__init__.py index 771177261c..8e9439de64 100644 --- a/packages/typespec-python/generator/pygen/postprocess/__init__.py +++ b/packages/typespec-python/generator/pygen/postprocess/__init__.py @@ -3,7 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from typing import Tuple, Any, Dict +from typing import Tuple, Any from pathlib import Path import os import shutil @@ -28,7 +28,7 @@ def format_file(file: Path, file_content: str) -> str: return file_content -class PostProcessPlugin(Plugin): # pylint: disable=abstract-method +class PostProcessPlugin(Plugin): def __init__(self, **kwargs: Any): super().__init__(**kwargs) output_folder_uri = self.options["outputFolderUri"] diff --git a/packages/typespec-python/generator/pygen/postprocess/venvtools.py b/packages/typespec-python/generator/pygen/postprocess/venvtools.py index 482cb9ee0f..ef286bf085 100644 --- a/packages/typespec-python/generator/pygen/postprocess/venvtools.py +++ b/packages/typespec-python/generator/pygen/postprocess/venvtools.py @@ -52,9 +52,7 @@ def create( return builder.context -def python_run( # pylint: disable=inconsistent-return-statements - venv_context, module, command, directory=_ROOT_DIR -) -> Optional[str]: +def python_run(venv_context, module, command, directory=_ROOT_DIR) -> Optional[str]: try: cmd_line = [ venv_context.env_exe, diff --git a/packages/typespec-python/generator/pygen/preprocess/__init__.py b/packages/typespec-python/generator/pygen/preprocess/__init__.py index 883aa062b4..a07bc47779 100644 --- a/packages/typespec-python/generator/pygen/preprocess/__init__.py +++ b/packages/typespec-python/generator/pygen/preprocess/__init__.py @@ -163,7 +163,7 @@ def has_multi_part_content_type(yaml_data: Dict[str, Any]) -> bool: return any(ct for ct in yaml_data.get("contentTypes", []) if ct == "multipart/form-data") -class PreProcessPlugin(YamlUpdatePlugin): # pylint: disable=abstract-method +class PreProcessPlugin(YamlUpdatePlugin): """Add Python naming information.""" @property diff --git a/packages/typespec-python/generator/pygen/utils.py b/packages/typespec-python/generator/pygen/utils.py index 2fa5f35c4a..1bc94ee02a 100644 --- a/packages/typespec-python/generator/pygen/utils.py +++ b/packages/typespec-python/generator/pygen/utils.py @@ -82,9 +82,7 @@ def _get_value(value: Any) -> Any: return value unknown_args_ret = { - ua.strip("--").split("=", maxsplit=1)[0]: _get_value( # pylint: disable=bad-str-strip-call - ua.strip("--").split("=", maxsplit=1)[1] # pylint: disable=bad-str-strip-call - ) + ua.strip("--").split("=", maxsplit=1)[0]: _get_value(ua.strip("--").split("=", maxsplit=1)[1]) for ua in unknown_args } return args, unknown_args_ret diff --git a/packages/typespec-python/generator/setup.py b/packages/typespec-python/generator/setup.py index b19d4f2692..92c28c3a57 100644 --- a/packages/typespec-python/generator/setup.py +++ b/packages/typespec-python/generator/setup.py @@ -15,7 +15,7 @@ # Version extraction inspired from 'requests' with open(os.path.join("pygen", "_version.py"), "r") as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) # type: ignore if not version: raise RuntimeError("Cannot find version information") diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index d3fd48fdfd..922551b614 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -30,12 +30,13 @@ "clean": "rimraf ./dist ./temp ./venv ./node_modules", "build": "tsc -p .", "watch": "tsc -p . --watch", - "lint": "eslint . --ext .ts --max-warnings=0", + "lint": "eslint . --ext .ts --max-warnings=0 && tsx ./scripts/eng/lint.ts", "lint:fix": "eslint . --fix --ext .ts", + "format": "npx prettier **/*.ts --write && tsx ./scripts/eng/format.ts", "install": "tsx ./scripts/run-python3.ts ./scripts/install.py", "prepare": "tsx ./scripts/run-python3.ts ./scripts/prepare.py", - "regenerate": "tsx ./scripts/regenerate.ts", - "test": "tsx ./scripts/run-tests.ts" + "regenerate": "tsx ./scripts/eng/regenerate.ts", + "test": "tsx ./scripts/eng/run-tests.ts" }, "files": [ "dist/**", @@ -82,6 +83,7 @@ "@typespec/rest": "~0.59.0", "@typespec/versioning": "~0.59.0", "@azure-tools/typespec-azure-rulesets": "0.45.0", - "yargs": "~17.2.1" + "yargs": "~17.2.1", + "chalk": "5.3.0" } } diff --git a/packages/typespec-python/scripts/eng/format.ts b/packages/typespec-python/scripts/eng/format.ts new file mode 100644 index 0000000000..d979869845 --- /dev/null +++ b/packages/typespec-python/scripts/eng/format.ts @@ -0,0 +1,5 @@ +/* eslint-disable no-console */ + +import { runCommand } from "./utils.js"; + +runCommand("black .", "black"); diff --git a/packages/typespec-python/scripts/eng/lint.ts b/packages/typespec-python/scripts/eng/lint.ts new file mode 100644 index 0000000000..39f07938df --- /dev/null +++ b/packages/typespec-python/scripts/eng/lint.ts @@ -0,0 +1,50 @@ +/* eslint-disable no-console */ +import yargs from "yargs"; +import { hideBin } from "yargs/helpers"; +import { runCommand } from "./utils.js"; + +interface Arguments { + folderName: string; + command?: "pylint" | "mypy" | "pyright"; +} + +const validCommands = ["pylint", "mypy", "pyright"]; + +// PARSE INPUT ARGUMENTS +const argv = yargs(hideBin(process.argv)) + .option("folderName", { + type: "string", + choices: ["generator", "autorest"], + description: "Specify the flavor", + default: "generator", + }) + .option("command", { + alias: "c", + type: "string", + choices: validCommands, + description: "Specify the command to run", + }).argv as Arguments; + +export function pylint() { + runCommand(`pylint ${argv.folderName}/ --rcfile ./scripts/eng/pylintrc`, "pylint"); +} + +export function mypy() { + runCommand(`mypy ${argv.folderName}/ --config-file ./scripts/eng/mypy.ini`, "mypy"); +} + +export function pyright() { + runCommand(`pyright ${argv.folderName}/ -p ./scripts/eng/pyrightconfig.json`, "pyright"); +} + +if (argv.command === "pylint") { + pylint(); +} else if (argv.command === "mypy") { + mypy(); +} else if (argv.command === "pyright") { + pyright(); +} else { + pylint(); + mypy(); + pyright(); +} diff --git a/packages/typespec-python/scripts/eng/mypy.ini b/packages/typespec-python/scripts/eng/mypy.ini new file mode 100644 index 0000000000..9deae01db2 --- /dev/null +++ b/packages/typespec-python/scripts/eng/mypy.ini @@ -0,0 +1,38 @@ +# global configurations +[mypy] +python_version = 3.8 + + +# module level configuratiohns +[mypy-jsonrpc.*] +ignore_missing_imports = True + +[mypy-ptvsd.*] +ignore_missing_imports = True + +[mypy-debugpy.*] +ignore_missing_imports = True + +[mypy-m2r2.*] +ignore_missing_imports = True + +[mypy-autorest.common.utils.*] +ignore_missing_imports = True + +[mypy-autorest.common.python_mappings.*] +ignore_missing_imports = True + +[mypy-pygen.codegen.models.*] +ignore_missing_imports = True + +[mypy-setuptools] +ignore_missing_imports = True + +[mypy-*._patch] +ignore_missing_imports = True + +[mypy-pygen.*] +ignore_missing_imports = True + +[mypy-yaml.*] +ignore_missing_imports = True diff --git a/packages/autorest.python/pylintrc b/packages/typespec-python/scripts/eng/pylintrc similarity index 100% rename from packages/autorest.python/pylintrc rename to packages/typespec-python/scripts/eng/pylintrc diff --git a/packages/autorest.python/pyrightconfig.json b/packages/typespec-python/scripts/eng/pyrightconfig.json similarity index 100% rename from packages/autorest.python/pyrightconfig.json rename to packages/typespec-python/scripts/eng/pyrightconfig.json diff --git a/packages/typespec-python/scripts/regenerate.ts b/packages/typespec-python/scripts/eng/regenerate.ts similarity index 94% rename from packages/typespec-python/scripts/regenerate.ts rename to packages/typespec-python/scripts/eng/regenerate.ts index 5e7f395f8e..cf2a01b5e5 100644 --- a/packages/typespec-python/scripts/regenerate.ts +++ b/packages/typespec-python/scripts/eng/regenerate.ts @@ -4,14 +4,14 @@ import { promisify } from "util"; import yargs from "yargs"; import { hideBin } from "yargs/helpers"; import { dirname, join, relative, resolve } from "path"; -import { promises } from "fs"; +import { promises, rm } from "fs"; import { fileURLToPath } from "url"; // Promisify the exec function const exec = promisify(execCallback); // Get the directory of the current file -const PLUGIN_DIR = resolve(fileURLToPath(import.meta.url), "../../"); +const PLUGIN_DIR = resolve(fileURLToPath(import.meta.url), "../../../"); const CADL_RANCH_DIR = resolve(PLUGIN_DIR, "node_modules/@azure-tools/cadl-ranch-specs/http"); const EMITTER_OPTIONS: Record | Record[]> = { @@ -206,8 +206,13 @@ function defaultPackageName(spec: string): string { .toLowerCase(); } -function addOptions(spec: string, generatedFolder: string, flags: RegenerateFlags): string[] { - const emitterConfigs: string[] = []; +interface EmitterConfig { + optionsStr: string; + outputDir: string; +} + +function addOptions(spec: string, generatedFolder: string, flags: RegenerateFlags): EmitterConfig[] { + const emitterConfigs: EmitterConfig[] = []; for (const config of getEmitterOption(spec)) { const options: Record = { ...config }; options["flavor"] = flags.flavor; @@ -228,7 +233,10 @@ function addOptions(spec: string, generatedFolder: string, flags: RegenerateFlag const configs = Object.entries(options).flatMap(([k, v]) => { return `--option @azure-tools/typespec-python.${k}=${v}`; }); - emitterConfigs.push(configs.join(" ")); + emitterConfigs.push({ + optionsStr: configs.join(" "), + outputDir: options["emitter-output-dir"], + }); } return emitterConfigs; } @@ -237,9 +245,12 @@ async function _regenerateSingle(spec: string, flags: RegenerateFlags): Promise< // Perform some asynchronous operation here const options = addOptions(spec, PLUGIN_DIR, flags); const commandPromises = options.map((option) => { - const command = `tsp compile ${spec} --emit=${toPosix(PLUGIN_DIR)} ${option}`; - console.log(command); - return executeCommand(command); + // delete the folder, then regenerate into it + rm(option.outputDir, () => { + const command = `tsp compile ${spec} --emit=${toPosix(PLUGIN_DIR)} ${option.optionsStr}`; + console.log(command); + return executeCommand(command); + }); }); await Promise.all(commandPromises); } diff --git a/packages/autorest.python/scripts/run-tests.ts b/packages/typespec-python/scripts/eng/run-tests.ts similarity index 85% rename from packages/autorest.python/scripts/run-tests.ts rename to packages/typespec-python/scripts/eng/run-tests.ts index 5aae78c114..f2df1928a0 100644 --- a/packages/autorest.python/scripts/run-tests.ts +++ b/packages/typespec-python/scripts/eng/run-tests.ts @@ -4,28 +4,27 @@ import { readFileSync } from "fs"; import { join } from "path"; import yargs from "yargs"; import { hideBin } from "yargs/helpers"; +import { fileURLToPath } from "url"; interface Arguments { + validFolders: string[]; folder?: string; command?: string; } -const validFolders = [ - "azure/legacy", - "azure/version-tolerant", - "vanilla/legacy", - "vanilla/version-tolerant", - "dpg/version-tolerant", -]; - const validCommands = ["ci", "lint", "mypy", "pyright", "apiview"]; // Parse command-line arguments using yargs const argv = yargs(hideBin(process.argv)) + .option("validFolders", { + alias: "vf", + describe: "Specify the valid folders", + type: "array", + default: ["azure", "unbranded"], + }) .option("folder", { alias: "f", describe: "Specify the folder to use", - choices: validFolders, type: "string", }) .option("command", { @@ -35,7 +34,7 @@ const argv = yargs(hideBin(process.argv)) type: "string", }).argv as Arguments; -const foldersToProcess = argv.folder ? [argv.folder] : validFolders; +const foldersToProcess = argv.folder ? [argv.folder] : argv.validFolders; const commandToRun = argv.command || "all"; @@ -45,7 +44,7 @@ function getCommand(command: string, folder: string) { } function sectionExistsInToxIni(command: string, folder: string): boolean { - const toxIniPath = join(__dirname, `../test/${folder}/tox.ini`); + const toxIniPath = join(fileURLToPath(import.meta.url), `../../../test/${folder}/tox.ini`); const toxIniContent = readFileSync(toxIniPath, "utf-8"); const sectionHeader = `[testenv:${command}]`; return toxIniContent.includes(sectionHeader); diff --git a/packages/typespec-python/scripts/eng/utils.ts b/packages/typespec-python/scripts/eng/utils.ts new file mode 100644 index 0000000000..09a7bcae36 --- /dev/null +++ b/packages/typespec-python/scripts/eng/utils.ts @@ -0,0 +1,30 @@ +/* eslint-disable no-console */ +import { exec } from "child_process"; +import { existsSync } from "fs"; +import { dirname, join } from "path"; +import { fileURLToPath } from "url"; +import chalk from "chalk"; + +// Function to run a command and log the output +export function runCommand(command: string, prettyName: string) { + let pythonPath = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "venv/"); + if (existsSync(join(pythonPath, "bin"))) { + pythonPath = join(pythonPath, "bin", "python"); + } else if (existsSync(join(pythonPath, "Scripts"))) { + pythonPath = join(pythonPath, "Scripts", "python"); + } else { + throw new Error(pythonPath); + } + command = `${pythonPath} -m ${command}`; + exec(command, (error, stdout, stderr) => { + if (error) { + console.error(chalk.red(`Error executing ${command}: ${stderr || stdout}`)); + return; + } + if (stderr) { + // Process stderr output + console.log(chalk.yellow(`${command}:\n${stderr}`)); + } + console.log(chalk.green(`${prettyName} passed`)); + }); +} diff --git a/packages/typespec-python/scripts/run-tests.ts b/packages/typespec-python/scripts/run-tests.ts deleted file mode 100644 index 2904ca54b1..0000000000 --- a/packages/typespec-python/scripts/run-tests.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* eslint-disable no-console */ -import { execSync } from "child_process"; -import yargs from "yargs"; -import { hideBin } from "yargs/helpers"; - -interface Arguments { - folder?: string; - command?: string; -} - -const validFolders = ["azure", "unbranded"]; - -const validCommands = ["ci", "lint", "mypy", "pyright", "apiview"]; - -// Parse command-line arguments using yargs -const argv = yargs(hideBin(process.argv)) - .option("folder", { - alias: "f", - describe: "Specify the folder to use", - choices: validFolders, - type: "string", - }) - .option("command", { - alias: "c", - describe: "Specify the command to run", - choices: validCommands, - type: "string", - }).argv as Arguments; - -const foldersToProcess = argv.folder ? [argv.folder] : validFolders; - -const commandToRun = argv.command || "all"; - -function getCommand(command: string, folder: string) { - if (!validCommands.includes(command)) throw new Error(`Unknown command '${command}'.`); - return `FOLDER=${folder} tox -c ./test/${folder}/tox.ini -e ${command}`; -} - -foldersToProcess.forEach((folder) => { - try { - if (commandToRun === "all") { - for (const key of validCommands) { - console.log(`Running ${key} for folder ${folder}...`); - execSync(getCommand(key, folder), { stdio: "inherit" }); - } - } else if (getCommand(commandToRun, folder)) { - console.log(`Running ${commandToRun} for folder ${folder}...`); - execSync(getCommand(commandToRun, folder), { stdio: "inherit" }); - } else { - console.error(`Error: Unknown command '${commandToRun}'.`); - process.exit(1); - } - } catch (error) { - console.error(`Error executing command for folder ${folder}: ${(error as Error).message}`); - process.exit(1); - } -}); diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/apiview_mapping_python.json deleted file mode 100644 index 4298533787..0000000000 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CrossLanguagePackageId": "Authentication.ApiKey", - "CrossLanguageDefinitionId": { - "authentication.apikey.models.InvalidAuth": "Authentication.ApiKey.InvalidAuth", - "authentication.apikey.ApiKeyClient.valid": "valid", - "authentication.apikey.ApiKeyClient.invalid": "invalid" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/apiview_mapping_python.json deleted file mode 100644 index 1452879dcf..0000000000 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/apiview_mapping_python.json deleted file mode 100644 index 720c0906f9..0000000000 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CrossLanguagePackageId": "Authentication.OAuth2", - "CrossLanguageDefinitionId": { - "authentication.oauth2.models.InvalidAuth": "Authentication.OAuth2.InvalidAuth", - "authentication.oauth2.OAuth2Client.valid": "valid", - "authentication.oauth2.OAuth2Client.invalid": "invalid" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/apiview_mapping_python.json deleted file mode 100644 index cc283c5bd7..0000000000 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/apiview_mapping_python.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "CrossLanguagePackageId": "_Specs_.Azure.ClientGenerator.Core.Access", - "CrossLanguageDefinitionId": { - "specs.azure.clientgenerator.core.access.models.AbstractModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.AbstractModel", - "specs.azure.clientgenerator.core.access.models.BaseModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.BaseModel", - "specs.azure.clientgenerator.core.access.models.InnerModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.InnerModel", - "specs.azure.clientgenerator.core.access.models.InternalDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.InternalDecoratorModelInInternal", - "specs.azure.clientgenerator.core.access.models.NoDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.NoDecoratorModelInInternal", - "specs.azure.clientgenerator.core.access.models.NoDecoratorModelInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.NoDecoratorModelInPublic", - "specs.azure.clientgenerator.core.access.models.OuterModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.OuterModel", - "specs.azure.clientgenerator.core.access.models.PublicDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.PublicDecoratorModelInInternal", - "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" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/client-naming/client/naming/apiview_mapping_python.json deleted file mode 100644 index ebcd83d1a9..0000000000 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/apiview_mapping_python.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "CrossLanguagePackageId": "Client.Naming", - "CrossLanguageDefinitionId": { - "client.naming.models.ClientModel": "Client.Naming.Model.ModelWithClientClientName", - "client.naming.models.ClientNameAndJsonEncodedNameModel": "Client.Naming.Property.ClientNameAndJsonEncodedNameModel", - "client.naming.models.ClientNameModel": "Client.Naming.Property.ClientNameModel", - "client.naming.models.LanguageClientNameModel": "Client.Naming.Property.LanguageClientNameModel", - "client.naming.models.PythonModel": "Client.Naming.Model.ModelWithLanguageClientName", - "client.naming.models.ClientExtensibleEnum": "Client.Naming.UnionEnum.ServerExtensibleEnum", - "client.naming.models.ExtensibleEnum": "Client.Naming.UnionEnum.ExtensibleEnum", - "client.naming.NamingClient.model.client": "client", - "client.naming.NamingClient.model.language": "language", - "client.naming.NamingClient.union_enum.union_enum_name": "unionEnumName", - "client.naming.NamingClient.union_enum.union_enum_member_name": "unionEnumMemberName", - "client.naming.NamingClient.client_name": "clientName", - "client.naming.NamingClient.parameter": "parameter", - "client.naming.NamingClient.client": "client", - "client.naming.NamingClient.language": "language", - "client.naming.NamingClient.compatible_with_encoded_name": "compatibleWithEncodedName", - "client.naming.NamingClient.request": "request", - "client.naming.NamingClient.response": "response" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/apiview_mapping_python.json deleted file mode 100644 index b5850ab060..0000000000 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "Client.Structure.Service", - "CrossLanguageDefinitionId": { - "client.structure.renamedoperation.models.ClientType": "Client.Structure.Service.ClientType", - "client.structure.renamedoperation.RenamedOperationClient.group.renamed_two": "renamedTwo", - "client.structure.renamedoperation.RenamedOperationClient.group.renamed_four": "renamedFour", - "client.structure.renamedoperation.RenamedOperationClient.group.renamed_six": "renamedSix", - "client.structure.renamedoperation.RenamedOperationClient.renamed_one": "renamedOne", - "client.structure.renamedoperation.RenamedOperationClient.renamed_three": "renamedThree", - "client.structure.renamedoperation.RenamedOperationClient.renamed_five": "renamedFive" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/apiview_mapping_python.json deleted file mode 100644 index 6fbdb3570a..0000000000 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "Client.Structure.Service", - "CrossLanguageDefinitionId": { - "client.structure.twooperationgroup.models.ClientType": "Client.Structure.Service.ClientType", - "client.structure.twooperationgroup.TwoOperationGroupClient.group1.one": "one", - "client.structure.twooperationgroup.TwoOperationGroupClient.group1.three": "three", - "client.structure.twooperationgroup.TwoOperationGroupClient.group1.four": "four", - "client.structure.twooperationgroup.TwoOperationGroupClient.group2.two": "two", - "client.structure.twooperationgroup.TwoOperationGroupClient.group2.five": "five", - "client.structure.twooperationgroup.TwoOperationGroupClient.group2.six": "six" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/apiview_mapping_python.json deleted file mode 100644 index 887af502bf..0000000000 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/apiview_mapping_python.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "CrossLanguagePackageId": "Encode.Datetime", - "CrossLanguageDefinitionId": { - "encode.datetime.models.DefaultDatetimeProperty": "Encode.Datetime.DefaultDatetimeProperty", - "encode.datetime.models.Rfc3339DatetimeProperty": "Encode.Datetime.Rfc3339DatetimeProperty", - "encode.datetime.models.Rfc7231DatetimeProperty": "Encode.Datetime.Rfc7231DatetimeProperty", - "encode.datetime.models.UnixTimestampArrayDatetimeProperty": "Encode.Datetime.UnixTimestampArrayDatetimeProperty", - "encode.datetime.models.UnixTimestampDatetimeProperty": "Encode.Datetime.UnixTimestampDatetimeProperty", - "encode.datetime.DatetimeClient.query.default": "default", - "encode.datetime.DatetimeClient.query.rfc3339": "rfc3339", - "encode.datetime.DatetimeClient.query.rfc7231": "rfc7231", - "encode.datetime.DatetimeClient.query.unix_timestamp": "unixTimestamp", - "encode.datetime.DatetimeClient.query.unix_timestamp_array": "unixTimestampArray", - "encode.datetime.DatetimeClient.property.default": "default", - "encode.datetime.DatetimeClient.property.rfc3339": "rfc3339", - "encode.datetime.DatetimeClient.property.rfc7231": "rfc7231", - "encode.datetime.DatetimeClient.property.unix_timestamp": "unixTimestamp", - "encode.datetime.DatetimeClient.property.unix_timestamp_array": "unixTimestampArray", - "encode.datetime.DatetimeClient.header.default": "default", - "encode.datetime.DatetimeClient.header.rfc3339": "rfc3339", - "encode.datetime.DatetimeClient.header.rfc7231": "rfc7231", - "encode.datetime.DatetimeClient.header.unix_timestamp": "unixTimestamp", - "encode.datetime.DatetimeClient.header.unix_timestamp_array": "unixTimestampArray", - "encode.datetime.DatetimeClient.response_header.default": "default", - "encode.datetime.DatetimeClient.response_header.rfc3339": "rfc3339", - "encode.datetime.DatetimeClient.response_header.rfc7231": "rfc7231", - "encode.datetime.DatetimeClient.response_header.unix_timestamp": "unixTimestamp" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/apiview_mapping_python.json deleted file mode 100644 index 60305e6ba1..0000000000 --- a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/apiview_mapping_python.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "CrossLanguagePackageId": "Encode.Duration", - "CrossLanguageDefinitionId": { - "encode.duration.models.DefaultDurationProperty": "Encode.Duration.Property.DefaultDurationProperty", - "encode.duration.models.FloatSecondsDurationArrayProperty": "Encode.Duration.Property.FloatSecondsDurationArrayProperty", - "encode.duration.models.FloatSecondsDurationProperty": "Encode.Duration.Property.FloatSecondsDurationProperty", - "encode.duration.models.Int32SecondsDurationProperty": "Encode.Duration.Property.Int32SecondsDurationProperty", - "encode.duration.models.ISO8601DurationProperty": "Encode.Duration.Property.ISO8601DurationProperty", - "encode.duration.DurationClient.query.default": "default", - "encode.duration.DurationClient.query.iso8601": "iso8601", - "encode.duration.DurationClient.query.int32_seconds": "int32Seconds", - "encode.duration.DurationClient.query.float_seconds": "floatSeconds", - "encode.duration.DurationClient.query.int32_seconds_array": "int32SecondsArray", - "encode.duration.DurationClient.property.default": "default", - "encode.duration.DurationClient.property.iso8601": "iso8601", - "encode.duration.DurationClient.property.int32_seconds": "int32Seconds", - "encode.duration.DurationClient.property.float_seconds": "floatSeconds", - "encode.duration.DurationClient.property.float_seconds_array": "floatSecondsArray", - "encode.duration.DurationClient.header.default": "default", - "encode.duration.DurationClient.header.iso8601": "iso8601", - "encode.duration.DurationClient.header.iso8601_array": "iso8601Array", - "encode.duration.DurationClient.header.int32_seconds": "int32Seconds", - "encode.duration.DurationClient.header.float_seconds": "floatSeconds" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/apiview_mapping_python.json deleted file mode 100644 index 2370dcc5c6..0000000000 --- a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Visibility", - "CrossLanguageDefinitionId": { - "headasbooleanfalse.models.VisibilityModel": "Type.Model.Visibility.VisibilityModel", - "headasbooleanfalse.VisibilityClient.get_model": "getModel", - "headasbooleanfalse.VisibilityClient.head_model": "headModel", - "headasbooleanfalse.VisibilityClient.put_model": "putModel", - "headasbooleanfalse.VisibilityClient.patch_model": "patchModel", - "headasbooleanfalse.VisibilityClient.post_model": "postModel", - "headasbooleanfalse.VisibilityClient.delete_model": "deleteModel" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/apiview_mapping_python.json deleted file mode 100644 index 04da995fa2..0000000000 --- a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Visibility", - "CrossLanguageDefinitionId": { - "headasbooleantrue.models.VisibilityModel": "Type.Model.Visibility.VisibilityModel", - "headasbooleantrue.VisibilityClient.get_model": "getModel", - "headasbooleantrue.VisibilityClient.head_model": "headModel", - "headasbooleantrue.VisibilityClient.put_model": "putModel", - "headasbooleantrue.VisibilityClient.patch_model": "patchModel", - "headasbooleantrue.VisibilityClient.post_model": "postModel", - "headasbooleantrue.VisibilityClient.delete_model": "deleteModel" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/apiview_mapping_python.json deleted file mode 100644 index ca321a3023..0000000000 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/apiview_mapping_python.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "CrossLanguagePackageId": "Parameters.BodyOptionality", - "CrossLanguageDefinitionId": { - "parameters.bodyoptionality.models.BodyModel": "Parameters.BodyOptionality.BodyModel", - "parameters.bodyoptionality.BodyOptionalityClient.optional_explicit.set": "set", - "parameters.bodyoptionality.BodyOptionalityClient.optional_explicit.omit": "omit", - "parameters.bodyoptionality.BodyOptionalityClient.required_explicit": "requiredExplicit", - "parameters.bodyoptionality.BodyOptionalityClient.required_implicit": "requiredImplicit" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/apiview_mapping_python.json deleted file mode 100644 index 3d40c52b19..0000000000 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "Parameters.CollectionFormat", - "CrossLanguageDefinitionId": { - "parameters.collectionformat.CollectionFormatClient.query.multi": "multi", - "parameters.collectionformat.CollectionFormatClient.query.ssv": "ssv", - "parameters.collectionformat.CollectionFormatClient.query.tsv": "tsv", - "parameters.collectionformat.CollectionFormatClient.query.pipes": "pipes", - "parameters.collectionformat.CollectionFormatClient.query.csv": "csv", - "parameters.collectionformat.CollectionFormatClient.header.csv": "csv" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/apiview_mapping_python.json deleted file mode 100644 index 58c9aa64b5..0000000000 --- a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/apiview_mapping_python.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "CrossLanguagePackageId": "Parameters.Spread", - "CrossLanguageDefinitionId": { - "parameters.spread.models.BodyParameter": "Parameters.Spread.Model.BodyParameter", - "parameters.spread.models.SpreadAsRequestBodyRequest": "Parameters.Spread.Alias.", - "parameters.spread.models.SpreadAsRequestParameterRequest": "", - "parameters.spread.models.SpreadWithMultipleParametersRequest": "", - "parameters.spread.SpreadClient.model.spread_as_request_body": "spreadAsRequestBody", - "parameters.spread.SpreadClient.alias.spread_as_request_body": "spreadAsRequestBody", - "parameters.spread.SpreadClient.alias.spread_as_request_parameter": "spreadAsRequestParameter", - "parameters.spread.SpreadClient.alias.spread_with_multiple_parameters": "spreadWithMultipleParameters" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/apiview_mapping_python.json deleted file mode 100644 index b63d693499..0000000000 --- a/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/apiview_mapping_python.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "CrossLanguagePackageId": "Payload.ContentNegotiation", - "CrossLanguageDefinitionId": { - "payload.contentnegotiation.models.PngImageAsJson": "Payload.ContentNegotiation.DifferentBody.PngImageAsJson", - "payload.contentnegotiation.ContentNegotiationClient.same_body.get_avatar_as_png": "getAvatarAsPng", - "payload.contentnegotiation.ContentNegotiationClient.same_body.get_avatar_as_jpeg": "getAvatarAsJpeg", - "payload.contentnegotiation.ContentNegotiationClient.different_body.get_avatar_as_png": "getAvatarAsPng", - "payload.contentnegotiation.ContentNegotiationClient.different_body.get_avatar_as_json": "getAvatarAsJson" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/apiview_mapping_python.json deleted file mode 100644 index f9e0de0488..0000000000 --- a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "Payload.JsonMergePatch", - "CrossLanguageDefinitionId": { - "payload.jsonmergepatch.models.InnerModel": "Payload.JsonMergePatch.InnerModel", - "payload.jsonmergepatch.models.Resource": "Payload.JsonMergePatch.Resource", - "payload.jsonmergepatch.models.ResourcePatch": "Payload.JsonMergePatch.ResourcePatch", - "payload.jsonmergepatch.JsonMergePatchClient.create_resource": "createResource", - "payload.jsonmergepatch.JsonMergePatchClient.update_resource": "updateResource", - "payload.jsonmergepatch.JsonMergePatchClient.update_optional_resource": "updateOptionalResource" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/apiview_mapping_python.json deleted file mode 100644 index 40e0faf12d..0000000000 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/apiview_mapping_python.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "CrossLanguagePackageId": "Payload.MediaType", - "CrossLanguageDefinitionId": { - "payload.mediatype.MediaTypeClient.string_body.send_as_text": "sendAsText", - "payload.mediatype.MediaTypeClient.string_body.get_as_text": "getAsText", - "payload.mediatype.MediaTypeClient.string_body.send_as_json": "sendAsJson", - "payload.mediatype.MediaTypeClient.string_body.get_as_json": "getAsJson" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/apiview_mapping_python.json deleted file mode 100644 index 2aa0d231f5..0000000000 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CrossLanguagePackageId": "Resiliency.ServiceDriven", - "CrossLanguageDefinitionId": { - "resiliency.srv.driven1.ResiliencyServiceDrivenClient.from_none": "fromNone", - "resiliency.srv.driven1.ResiliencyServiceDrivenClient.from_one_required": "fromOneRequired", - "resiliency.srv.driven1.ResiliencyServiceDrivenClient.from_one_optional": "fromOneOptional" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/apiview_mapping_python.json deleted file mode 100644 index 39acd2e028..0000000000 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/apiview_mapping_python.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "CrossLanguagePackageId": "Resiliency.ServiceDriven", - "CrossLanguageDefinitionId": { - "resiliency.srv.driven2.ResiliencyServiceDrivenClient.add_operation": "addOperation", - "resiliency.srv.driven2.ResiliencyServiceDrivenClient.from_none": "fromNone", - "resiliency.srv.driven2.ResiliencyServiceDrivenClient.from_one_required": "fromOneRequired", - "resiliency.srv.driven2.ResiliencyServiceDrivenClient.from_one_optional": "fromOneOptional" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/apiview_mapping_python.json deleted file mode 100644 index 7612224f55..0000000000 --- a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CrossLanguagePackageId": "Serialization.EncodedName.Json", - "CrossLanguageDefinitionId": { - "serialization.encodedname.json.models.JsonEncodedNameModel": "Serialization.EncodedName.Json.Property.JsonEncodedNameModel", - "serialization.encodedname.json.JsonClient.property.send": "send", - "serialization.encodedname.json.JsonClient.property.get": "get" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/apiview_mapping_python.json deleted file mode 100644 index 84506f1998..0000000000 --- a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/apiview_mapping_python.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "CrossLanguagePackageId": "Server.Endpoint.NotDefined", - "CrossLanguageDefinitionId": { - "server.endpoint.notdefined.NotDefinedClient.valid": "valid" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/apiview_mapping_python.json deleted file mode 100644 index 0cd8966a8e..0000000000 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CrossLanguagePackageId": "Server.Path.Multiple", - "CrossLanguageDefinitionId": { - "server.path.multiple.models.Versions": "Server.Path.Multiple.Versions", - "server.path.multiple.MultipleClient.no_operation_params": "noOperationParams", - "server.path.multiple.MultipleClient.with_operation_path_param": "withOperationPathParam" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/apiview_mapping_python.json deleted file mode 100644 index 08afa9fe73..0000000000 --- a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/apiview_mapping_python.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "CrossLanguagePackageId": "Server.Path.Single", - "CrossLanguageDefinitionId": { - "server.path.single.SingleClient.my_op": "myOp" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/apiview_mapping_python.json deleted file mode 100644 index 64b3db24c6..0000000000 --- a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/apiview_mapping_python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "CrossLanguagePackageId": "Server.Versions.NotVersioned", - "CrossLanguageDefinitionId": { - "server.versions.notversioned.NotVersionedClient.without_api_version": "withoutApiVersion", - "server.versions.notversioned.NotVersionedClient.with_query_api_version": "withQueryApiVersion", - "server.versions.notversioned.NotVersionedClient.with_path_api_version": "withPathApiVersion" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/apiview_mapping_python.json deleted file mode 100644 index de17776816..0000000000 --- a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/apiview_mapping_python.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "CrossLanguagePackageId": "SpecialHeaders.ConditionalRequest", - "CrossLanguageDefinitionId": { - "specialheaders.conditionalrequest.ConditionalRequestClient.post_if_match": "postIfMatch", - "specialheaders.conditionalrequest.ConditionalRequestClient.post_if_none_match": "postIfNoneMatch" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/apiview_mapping_python.json deleted file mode 100644 index 1e88229bd7..0000000000 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/apiview_mapping_python.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "CrossLanguagePackageId": "SpecialHeaders.Repeatability", - "CrossLanguageDefinitionId": { - "specialheaders.repeatability.RepeatabilityClient.immediate_success": "immediateSuccess" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/apiview_mapping_python.json deleted file mode 100644 index a11e2d72e6..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/apiview_mapping_python.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Array", - "CrossLanguageDefinitionId": { - "typetest.array.models.InnerModel": "Type.Array.InnerModel", - "typetest.array.ArrayClient.int32_value.get": "get", - "typetest.array.ArrayClient.int32_value.put": "put", - "typetest.array.ArrayClient.int64_value.get": "get", - "typetest.array.ArrayClient.int64_value.put": "put", - "typetest.array.ArrayClient.boolean_value.get": "get", - "typetest.array.ArrayClient.boolean_value.put": "put", - "typetest.array.ArrayClient.string_value.get": "get", - "typetest.array.ArrayClient.string_value.put": "put", - "typetest.array.ArrayClient.float32_value.get": "get", - "typetest.array.ArrayClient.float32_value.put": "put", - "typetest.array.ArrayClient.datetime_value.get": "get", - "typetest.array.ArrayClient.datetime_value.put": "put", - "typetest.array.ArrayClient.duration_value.get": "get", - "typetest.array.ArrayClient.duration_value.put": "put", - "typetest.array.ArrayClient.unknown_value.get": "get", - "typetest.array.ArrayClient.unknown_value.put": "put", - "typetest.array.ArrayClient.model_value.get": "get", - "typetest.array.ArrayClient.model_value.put": "put", - "typetest.array.ArrayClient.nullable_float_value.get": "get", - "typetest.array.ArrayClient.nullable_float_value.put": "put" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/apiview_mapping_python.json deleted file mode 100644 index e1ef0c4f01..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/apiview_mapping_python.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Dictionary", - "CrossLanguageDefinitionId": { - "typetest.dictionary.models.InnerModel": "Type.Dictionary.InnerModel", - "typetest.dictionary.DictionaryClient.int32_value.get": "get", - "typetest.dictionary.DictionaryClient.int32_value.put": "put", - "typetest.dictionary.DictionaryClient.int64_value.get": "get", - "typetest.dictionary.DictionaryClient.int64_value.put": "put", - "typetest.dictionary.DictionaryClient.boolean_value.get": "get", - "typetest.dictionary.DictionaryClient.boolean_value.put": "put", - "typetest.dictionary.DictionaryClient.string_value.get": "get", - "typetest.dictionary.DictionaryClient.string_value.put": "put", - "typetest.dictionary.DictionaryClient.float32_value.get": "get", - "typetest.dictionary.DictionaryClient.float32_value.put": "put", - "typetest.dictionary.DictionaryClient.datetime_value.get": "get", - "typetest.dictionary.DictionaryClient.datetime_value.put": "put", - "typetest.dictionary.DictionaryClient.duration_value.get": "get", - "typetest.dictionary.DictionaryClient.duration_value.put": "put", - "typetest.dictionary.DictionaryClient.unknown_value.get": "get", - "typetest.dictionary.DictionaryClient.unknown_value.put": "put", - "typetest.dictionary.DictionaryClient.model_value.get": "get", - "typetest.dictionary.DictionaryClient.model_value.put": "put", - "typetest.dictionary.DictionaryClient.recursive_model_value.get": "get", - "typetest.dictionary.DictionaryClient.recursive_model_value.put": "put", - "typetest.dictionary.DictionaryClient.nullable_float_value.get": "get", - "typetest.dictionary.DictionaryClient.nullable_float_value.put": "put" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/apiview_mapping_python.json deleted file mode 100644 index d7af031d76..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/apiview_mapping_python.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Enum.Extensible", - "CrossLanguageDefinitionId": { - "typetest.enum.extensible.models.DaysOfWeekExtensibleEnum": "Type.Enum.Extensible.DaysOfWeekExtensibleEnum", - "typetest.enum.extensible.ExtensibleClient.string.get_known_value": "getKnownValue", - "typetest.enum.extensible.ExtensibleClient.string.get_unknown_value": "getUnknownValue", - "typetest.enum.extensible.ExtensibleClient.string.put_known_value": "putKnownValue", - "typetest.enum.extensible.ExtensibleClient.string.put_unknown_value": "putUnknownValue" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/apiview_mapping_python.json deleted file mode 100644 index f3058fc269..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Empty", - "CrossLanguageDefinitionId": { - "typetest.model.empty.models.EmptyInput": "Type.Model.Empty.EmptyInput", - "typetest.model.empty.models.EmptyInputOutput": "Type.Model.Empty.EmptyInputOutput", - "typetest.model.empty.models.EmptyOutput": "Type.Model.Empty.EmptyOutput", - "typetest.model.empty.EmptyClient.put_empty": "putEmpty", - "typetest.model.empty.EmptyClient.get_empty": "getEmpty", - "typetest.model.empty.EmptyClient.post_round_trip_empty": "postRoundTripEmpty" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/apiview_mapping_python.json deleted file mode 100644 index ca43c2b02d..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/apiview_mapping_python.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Inheritance.NestedDiscriminator", - "CrossLanguageDefinitionId": { - "typetest.model.nesteddiscriminator.models.Fish": "Type.Model.Inheritance.NestedDiscriminator.Fish", - "typetest.model.nesteddiscriminator.models.Shark": "Type.Model.Inheritance.NestedDiscriminator.Shark", - "typetest.model.nesteddiscriminator.models.GoblinShark": "Type.Model.Inheritance.NestedDiscriminator.GoblinShark", - "typetest.model.nesteddiscriminator.models.Salmon": "Type.Model.Inheritance.NestedDiscriminator.Salmon", - "typetest.model.nesteddiscriminator.models.SawShark": "Type.Model.Inheritance.NestedDiscriminator.SawShark", - "typetest.model.nesteddiscriminator.NestedDiscriminatorClient.get_model": "getModel", - "typetest.model.nesteddiscriminator.NestedDiscriminatorClient.put_model": "putModel", - "typetest.model.nesteddiscriminator.NestedDiscriminatorClient.get_recursive_model": "getRecursiveModel", - "typetest.model.nesteddiscriminator.NestedDiscriminatorClient.put_recursive_model": "putRecursiveModel", - "typetest.model.nesteddiscriminator.NestedDiscriminatorClient.get_missing_discriminator": "getMissingDiscriminator", - "typetest.model.nesteddiscriminator.NestedDiscriminatorClient.get_wrong_discriminator": "getWrongDiscriminator" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/apiview_mapping_python.json deleted file mode 100644 index a4c1a33b87..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Inheritance.NotDiscriminated", - "CrossLanguageDefinitionId": { - "typetest.model.notdiscriminated.models.Pet": "Type.Model.Inheritance.NotDiscriminated.Pet", - "typetest.model.notdiscriminated.models.Cat": "Type.Model.Inheritance.NotDiscriminated.Cat", - "typetest.model.notdiscriminated.models.Siamese": "Type.Model.Inheritance.NotDiscriminated.Siamese", - "typetest.model.notdiscriminated.NotDiscriminatedClient.post_valid": "postValid", - "typetest.model.notdiscriminated.NotDiscriminatedClient.get_valid": "getValid", - "typetest.model.notdiscriminated.NotDiscriminatedClient.put_valid": "putValid" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/apiview_mapping_python.json deleted file mode 100644 index 68b65f9bec..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/apiview_mapping_python.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Inheritance.Recursive", - "CrossLanguageDefinitionId": { - "typetest.model.recursive.models.Element": "Type.Model.Inheritance.Recursive.Element", - "typetest.model.recursive.models.Extension": "Type.Model.Inheritance.Recursive.Extension", - "typetest.model.recursive.RecursiveClient.put": "put", - "typetest.model.recursive.RecursiveClient.get": "get" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/apiview_mapping_python.json deleted file mode 100644 index 60a2d4be50..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/apiview_mapping_python.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Inheritance.SingleDiscriminator", - "CrossLanguageDefinitionId": { - "typetest.model.singlediscriminator.models.Bird": "Type.Model.Inheritance.SingleDiscriminator.Bird", - "typetest.model.singlediscriminator.models.Dinosaur": "Type.Model.Inheritance.SingleDiscriminator.Dinosaur", - "typetest.model.singlediscriminator.models.Eagle": "Type.Model.Inheritance.SingleDiscriminator.Eagle", - "typetest.model.singlediscriminator.models.Goose": "Type.Model.Inheritance.SingleDiscriminator.Goose", - "typetest.model.singlediscriminator.models.SeaGull": "Type.Model.Inheritance.SingleDiscriminator.SeaGull", - "typetest.model.singlediscriminator.models.Sparrow": "Type.Model.Inheritance.SingleDiscriminator.Sparrow", - "typetest.model.singlediscriminator.models.TRex": "Type.Model.Inheritance.SingleDiscriminator.TRex", - "typetest.model.singlediscriminator.SingleDiscriminatorClient.get_model": "getModel", - "typetest.model.singlediscriminator.SingleDiscriminatorClient.put_model": "putModel", - "typetest.model.singlediscriminator.SingleDiscriminatorClient.get_recursive_model": "getRecursiveModel", - "typetest.model.singlediscriminator.SingleDiscriminatorClient.put_recursive_model": "putRecursiveModel", - "typetest.model.singlediscriminator.SingleDiscriminatorClient.get_missing_discriminator": "getMissingDiscriminator", - "typetest.model.singlediscriminator.SingleDiscriminatorClient.get_wrong_discriminator": "getWrongDiscriminator", - "typetest.model.singlediscriminator.SingleDiscriminatorClient.get_legacy_model": "getLegacyModel" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/apiview_mapping_python.json deleted file mode 100644 index 4b24dbdeb4..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/apiview_mapping_python.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Usage", - "CrossLanguageDefinitionId": { - "typetest.model.usage.models.InputOutputRecord": "Type.Model.Usage.InputOutputRecord", - "typetest.model.usage.models.InputRecord": "Type.Model.Usage.InputRecord", - "typetest.model.usage.models.OutputRecord": "Type.Model.Usage.OutputRecord", - "typetest.model.usage.UsageClient.input": "input", - "typetest.model.usage.UsageClient.output": "output", - "typetest.model.usage.UsageClient.input_and_output": "inputAndOutput" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/apiview_mapping_python.json deleted file mode 100644 index 797875b8ae..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/apiview_mapping_python.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Model.Visibility", - "CrossLanguageDefinitionId": { - "typetest.model.visibility.models.VisibilityModel": "Type.Model.Visibility.VisibilityModel", - "typetest.model.visibility.VisibilityClient.get_model": "getModel", - "typetest.model.visibility.VisibilityClient.head_model": "headModel", - "typetest.model.visibility.VisibilityClient.put_model": "putModel", - "typetest.model.visibility.VisibilityClient.patch_model": "patchModel", - "typetest.model.visibility.VisibilityClient.post_model": "postModel", - "typetest.model.visibility.VisibilityClient.delete_model": "deleteModel" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/apiview_mapping_python.json deleted file mode 100644 index 3f7b955993..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/apiview_mapping_python.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Property.Nullable", - "CrossLanguageDefinitionId": { - "typetest.property.nullable.models.BytesProperty": "Type.Property.Nullable.BytesProperty", - "typetest.property.nullable.models.CollectionsByteProperty": "Type.Property.Nullable.CollectionsByteProperty", - "typetest.property.nullable.models.CollectionsModelProperty": "Type.Property.Nullable.CollectionsModelProperty", - "typetest.property.nullable.models.DatetimeProperty": "Type.Property.Nullable.DatetimeProperty", - "typetest.property.nullable.models.DurationProperty": "Type.Property.Nullable.DurationProperty", - "typetest.property.nullable.models.InnerModel": "Type.Property.Nullable.InnerModel", - "typetest.property.nullable.models.StringProperty": "Type.Property.Nullable.StringProperty", - "typetest.property.nullable.NullableClient.string.get_non_null": "getNonNull", - "typetest.property.nullable.NullableClient.string.get_null": "getNull", - "typetest.property.nullable.NullableClient.string.patch_non_null": "patchNonNull", - "typetest.property.nullable.NullableClient.string.patch_null": "patchNull", - "typetest.property.nullable.NullableClient.bytes.get_non_null": "getNonNull", - "typetest.property.nullable.NullableClient.bytes.get_null": "getNull", - "typetest.property.nullable.NullableClient.bytes.patch_non_null": "patchNonNull", - "typetest.property.nullable.NullableClient.bytes.patch_null": "patchNull", - "typetest.property.nullable.NullableClient.datetime.get_non_null": "getNonNull", - "typetest.property.nullable.NullableClient.datetime.get_null": "getNull", - "typetest.property.nullable.NullableClient.datetime.patch_non_null": "patchNonNull", - "typetest.property.nullable.NullableClient.datetime.patch_null": "patchNull", - "typetest.property.nullable.NullableClient.duration.get_non_null": "getNonNull", - "typetest.property.nullable.NullableClient.duration.get_null": "getNull", - "typetest.property.nullable.NullableClient.duration.patch_non_null": "patchNonNull", - "typetest.property.nullable.NullableClient.duration.patch_null": "patchNull", - "typetest.property.nullable.NullableClient.collections_byte.get_non_null": "getNonNull", - "typetest.property.nullable.NullableClient.collections_byte.get_null": "getNull", - "typetest.property.nullable.NullableClient.collections_byte.patch_non_null": "patchNonNull", - "typetest.property.nullable.NullableClient.collections_byte.patch_null": "patchNull", - "typetest.property.nullable.NullableClient.collections_model.get_non_null": "getNonNull", - "typetest.property.nullable.NullableClient.collections_model.get_null": "getNull", - "typetest.property.nullable.NullableClient.collections_model.patch_non_null": "patchNonNull", - "typetest.property.nullable.NullableClient.collections_model.patch_null": "patchNull" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/apiview_mapping_python.json deleted file mode 100644 index caf17e56bd..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/apiview_mapping_python.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Property.Optional", - "CrossLanguageDefinitionId": { - "typetest.property.optional.models.BooleanLiteralProperty": "Type.Property.Optional.BooleanLiteralProperty", - "typetest.property.optional.models.BytesProperty": "Type.Property.Optional.BytesProperty", - "typetest.property.optional.models.CollectionsByteProperty": "Type.Property.Optional.CollectionsByteProperty", - "typetest.property.optional.models.CollectionsModelProperty": "Type.Property.Optional.CollectionsModelProperty", - "typetest.property.optional.models.DatetimeProperty": "Type.Property.Optional.DatetimeProperty", - "typetest.property.optional.models.DurationProperty": "Type.Property.Optional.DurationProperty", - "typetest.property.optional.models.FloatLiteralProperty": "Type.Property.Optional.FloatLiteralProperty", - "typetest.property.optional.models.IntLiteralProperty": "Type.Property.Optional.IntLiteralProperty", - "typetest.property.optional.models.RequiredAndOptionalProperty": "Type.Property.Optional.RequiredAndOptionalProperty", - "typetest.property.optional.models.StringLiteralProperty": "Type.Property.Optional.StringLiteralProperty", - "typetest.property.optional.models.StringProperty": "Type.Property.Optional.StringProperty", - "typetest.property.optional.models.UnionFloatLiteralProperty": "Type.Property.Optional.UnionFloatLiteralProperty", - "typetest.property.optional.models.UnionIntLiteralProperty": "Type.Property.Optional.UnionIntLiteralProperty", - "typetest.property.optional.models.UnionStringLiteralProperty": "Type.Property.Optional.UnionStringLiteralProperty", - "typetest.property.optional.OptionalClient.string.get_all": "getAll", - "typetest.property.optional.OptionalClient.string.get_default": "getDefault", - "typetest.property.optional.OptionalClient.string.put_all": "putAll", - "typetest.property.optional.OptionalClient.string.put_default": "putDefault", - "typetest.property.optional.OptionalClient.bytes.get_all": "getAll", - "typetest.property.optional.OptionalClient.bytes.get_default": "getDefault", - "typetest.property.optional.OptionalClient.bytes.put_all": "putAll", - "typetest.property.optional.OptionalClient.bytes.put_default": "putDefault", - "typetest.property.optional.OptionalClient.datetime.get_all": "getAll", - "typetest.property.optional.OptionalClient.datetime.get_default": "getDefault", - "typetest.property.optional.OptionalClient.datetime.put_all": "putAll", - "typetest.property.optional.OptionalClient.datetime.put_default": "putDefault", - "typetest.property.optional.OptionalClient.duration.get_all": "getAll", - "typetest.property.optional.OptionalClient.duration.get_default": "getDefault", - "typetest.property.optional.OptionalClient.duration.put_all": "putAll", - "typetest.property.optional.OptionalClient.duration.put_default": "putDefault", - "typetest.property.optional.OptionalClient.collections_byte.get_all": "getAll", - "typetest.property.optional.OptionalClient.collections_byte.get_default": "getDefault", - "typetest.property.optional.OptionalClient.collections_byte.put_all": "putAll", - "typetest.property.optional.OptionalClient.collections_byte.put_default": "putDefault", - "typetest.property.optional.OptionalClient.collections_model.get_all": "getAll", - "typetest.property.optional.OptionalClient.collections_model.get_default": "getDefault", - "typetest.property.optional.OptionalClient.collections_model.put_all": "putAll", - "typetest.property.optional.OptionalClient.collections_model.put_default": "putDefault", - "typetest.property.optional.OptionalClient.string_literal.get_all": "getAll", - "typetest.property.optional.OptionalClient.string_literal.get_default": "getDefault", - "typetest.property.optional.OptionalClient.string_literal.put_all": "putAll", - "typetest.property.optional.OptionalClient.string_literal.put_default": "putDefault", - "typetest.property.optional.OptionalClient.int_literal.get_all": "getAll", - "typetest.property.optional.OptionalClient.int_literal.get_default": "getDefault", - "typetest.property.optional.OptionalClient.int_literal.put_all": "putAll", - "typetest.property.optional.OptionalClient.int_literal.put_default": "putDefault", - "typetest.property.optional.OptionalClient.float_literal.get_all": "getAll", - "typetest.property.optional.OptionalClient.float_literal.get_default": "getDefault", - "typetest.property.optional.OptionalClient.float_literal.put_all": "putAll", - "typetest.property.optional.OptionalClient.float_literal.put_default": "putDefault", - "typetest.property.optional.OptionalClient.boolean_literal.get_all": "getAll", - "typetest.property.optional.OptionalClient.boolean_literal.get_default": "getDefault", - "typetest.property.optional.OptionalClient.boolean_literal.put_all": "putAll", - "typetest.property.optional.OptionalClient.boolean_literal.put_default": "putDefault", - "typetest.property.optional.OptionalClient.union_string_literal.get_all": "getAll", - "typetest.property.optional.OptionalClient.union_string_literal.get_default": "getDefault", - "typetest.property.optional.OptionalClient.union_string_literal.put_all": "putAll", - "typetest.property.optional.OptionalClient.union_string_literal.put_default": "putDefault", - "typetest.property.optional.OptionalClient.union_int_literal.get_all": "getAll", - "typetest.property.optional.OptionalClient.union_int_literal.get_default": "getDefault", - "typetest.property.optional.OptionalClient.union_int_literal.put_all": "putAll", - "typetest.property.optional.OptionalClient.union_int_literal.put_default": "putDefault", - "typetest.property.optional.OptionalClient.union_float_literal.get_all": "getAll", - "typetest.property.optional.OptionalClient.union_float_literal.get_default": "getDefault", - "typetest.property.optional.OptionalClient.union_float_literal.put_all": "putAll", - "typetest.property.optional.OptionalClient.union_float_literal.put_default": "putDefault", - "typetest.property.optional.OptionalClient.required_and_optional.get_all": "getAll", - "typetest.property.optional.OptionalClient.required_and_optional.get_required_only": "getRequiredOnly", - "typetest.property.optional.OptionalClient.required_and_optional.put_all": "putAll", - "typetest.property.optional.OptionalClient.required_and_optional.put_required_only": "putRequiredOnly" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/apiview_mapping_python.json deleted file mode 100644 index b5a3d48df0..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/apiview_mapping_python.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Scalar", - "CrossLanguageDefinitionId": { - "typetest.scalar.ScalarClient.string.get": "get", - "typetest.scalar.ScalarClient.string.put": "put", - "typetest.scalar.ScalarClient.boolean.get": "get", - "typetest.scalar.ScalarClient.boolean.put": "put", - "typetest.scalar.ScalarClient.unknown.get": "get", - "typetest.scalar.ScalarClient.unknown.put": "put", - "typetest.scalar.ScalarClient.decimal_type.response_body": "responseBody", - "typetest.scalar.ScalarClient.decimal_type.request_body": "requestBody", - "typetest.scalar.ScalarClient.decimal_type.request_parameter": "requestParameter", - "typetest.scalar.ScalarClient.decimal128_type.response_body": "responseBody", - "typetest.scalar.ScalarClient.decimal128_type.request_body": "requestBody", - "typetest.scalar.ScalarClient.decimal128_type.request_parameter": "requestParameter", - "typetest.scalar.ScalarClient.decimal_verify.prepare_verify": "prepareVerify", - "typetest.scalar.ScalarClient.decimal_verify.verify": "verify", - "typetest.scalar.ScalarClient.decimal128_verify.prepare_verify": "prepareVerify", - "typetest.scalar.ScalarClient.decimal128_verify.verify": "verify" - } -} \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/apiview_mapping_python.json b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/apiview_mapping_python.json deleted file mode 100644 index c844318fab..0000000000 --- a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/apiview_mapping_python.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "CrossLanguagePackageId": "Type.Union", - "CrossLanguageDefinitionId": { - "typetest.union.models.Cat": "Type.Union.Cat", - "typetest.union.models.Dog": "Type.Union.Dog", - "typetest.union.models.EnumsOnlyCases": "Type.Union.EnumsOnlyCases", - "typetest.union.models.GetResponse": "Type.Union.", - "typetest.union.models.GetResponse1": "Type.Union.", - "typetest.union.models.GetResponse2": "Type.Union.", - "typetest.union.models.GetResponse3": "Type.Union.", - "typetest.union.models.GetResponse4": "Type.Union.", - "typetest.union.models.GetResponse5": "Type.Union.", - "typetest.union.models.GetResponse6": "Type.Union.", - "typetest.union.models.GetResponse7": "Type.Union.", - "typetest.union.models.GetResponse8": "Type.Union.", - "typetest.union.models.GetResponse9": "Type.Union.", - "typetest.union.models.MixedLiteralsCases": "Type.Union.MixedLiteralsCases", - "typetest.union.models.MixedTypesCases": "Type.Union.MixedTypesCases", - "typetest.union.models.SendRequest": "Type.Union.", - "typetest.union.models.SendRequest1": "Type.Union.", - "typetest.union.models.SendRequest2": "Type.Union.", - "typetest.union.models.SendRequest3": "Type.Union.", - "typetest.union.models.SendRequest4": "Type.Union.", - "typetest.union.models.SendRequest5": "Type.Union.", - "typetest.union.models.SendRequest6": "Type.Union.", - "typetest.union.models.SendRequest7": "Type.Union.", - "typetest.union.models.SendRequest8": "Type.Union.", - "typetest.union.models.SendRequest9": "Type.Union.", - "typetest.union.models.StringAndArrayCases": "Type.Union.StringAndArrayCases", - "typetest.union.models.StringExtensibleNamedUnion": "Type.Union.StringExtensibleNamedUnion", - "typetest.union.UnionClient.strings_only.get": "get", - "typetest.union.UnionClient.strings_only.send": "send", - "typetest.union.UnionClient.string_extensible.get": "get", - "typetest.union.UnionClient.string_extensible.send": "send", - "typetest.union.UnionClient.string_extensible_named.get": "get", - "typetest.union.UnionClient.string_extensible_named.send": "send", - "typetest.union.UnionClient.ints_only.get": "get", - "typetest.union.UnionClient.ints_only.send": "send", - "typetest.union.UnionClient.floats_only.get": "get", - "typetest.union.UnionClient.floats_only.send": "send", - "typetest.union.UnionClient.models_only.get": "get", - "typetest.union.UnionClient.models_only.send": "send", - "typetest.union.UnionClient.enums_only.get": "get", - "typetest.union.UnionClient.enums_only.send": "send", - "typetest.union.UnionClient.string_and_array.get": "get", - "typetest.union.UnionClient.string_and_array.send": "send", - "typetest.union.UnionClient.mixed_literals.get": "get", - "typetest.union.UnionClient.mixed_literals.send": "send", - "typetest.union.UnionClient.mixed_types.get": "get", - "typetest.union.UnionClient.mixed_types.send": "send" - } -} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19b124f088..419d35d46d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,6 +66,9 @@ importers: '@microsoft.azure/autorest.testserver': specifier: ^3.3.46 version: 3.3.46(encoding@0.1.13) + chalk: + specifier: 5.3.0 + version: 5.3.0 typescript: specifier: ~5.1.3 version: 5.1.3 @@ -139,6 +142,9 @@ importers: c8: specifier: ~7.13.0 version: 7.13.0 + chalk: + specifier: 5.3.0 + version: 5.3.0 rimraf: specifier: ~5.0.0 version: 5.0.0 @@ -1292,6 +1298,10 @@ packages: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} + chalk@5.3.0: + resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + change-case@5.4.4: resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==} @@ -5144,6 +5154,8 @@ snapshots: ansi-styles: 4.3.0 supports-color: 7.2.0 + chalk@5.3.0: {} + change-case@5.4.4: {} chownr@2.0.0: {}