-
Notifications
You must be signed in to change notification settings - Fork 81
Missing interface in RLC code generation #3839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
v-jiaodi
wants to merge
1
commit into
Azure:main
Choose a base branch
from
v-jiaodi:test0311
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/LICENSE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| Copyright (c) Microsoft Corporation. | ||
|
|
||
| MIT License | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
53 changes: 53 additions & 0 deletions
53
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # TestService REST client library for JavaScript | ||
|
|
||
|
|
||
|
|
||
| **Please rely heavily on our [REST client docs](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/rest-clients.md) to use this library** | ||
|
|
||
| Key links: | ||
|
|
||
| - [Package (NPM)](https://www.npmjs.com/package/@msinternal/test) | ||
|
|
||
| ## Getting started | ||
|
|
||
| ### Currently supported environments | ||
|
|
||
| - LTS versions of Node.js | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - You must have an [Azure subscription](https://azure.microsoft.com/free/) to use this package. | ||
|
|
||
| ### Install the `@msinternal/test` package | ||
|
|
||
| Install the TestService REST client REST client library for JavaScript with `npm`: | ||
|
|
||
| ```bash | ||
| npm install @msinternal/test | ||
| ``` | ||
|
|
||
| ### Create and authenticate a `TestServiceClient` | ||
|
|
||
| To use an [Azure Active Directory (AAD) token credential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token), | ||
| provide an instance of the desired credential type obtained from the | ||
| [@azure/identity](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) library. | ||
|
|
||
| To authenticate with AAD, you must first `npm` install [`@azure/identity`](https://www.npmjs.com/package/@azure/identity) | ||
|
|
||
| After setup, you can choose which type of [credential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#credentials) from `@azure/identity` to use. | ||
| As an example, [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential) | ||
| can be used to authenticate the client. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Logging | ||
|
|
||
| Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: | ||
|
|
||
| ```ts | ||
| import { setLogLevel } from "@azure/logger"; | ||
|
|
||
| setLogLevel("info"); | ||
| ``` | ||
|
|
||
| For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). |
18 changes: 18 additions & 0 deletions
18
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/api-extractor.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
| "mainEntryPointFilePath": "dist/esm/index.d.ts", | ||
| "docModel": { "enabled": true }, | ||
| "apiReport": { "enabled": true, "reportFolder": "./review" }, | ||
| "dtsRollup": { | ||
| "enabled": true, | ||
| "untrimmedFilePath": "", | ||
| "publicTrimmedFilePath": "dist/test.d.ts" | ||
| }, | ||
| "messages": { | ||
| "tsdocMessageReporting": { "default": { "logLevel": "none" } }, | ||
| "extractorMessageReporting": { | ||
| "ae-missing-release-tag": { "logLevel": "none" }, | ||
| "ae-unresolved-link": { "logLevel": "none" } | ||
| } | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/eslint.config.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; | ||
|
|
||
| export default azsdkEslint.config([ | ||
| { | ||
| rules: { | ||
| "@azure/azure-sdk/ts-modules-only-named": "warn", | ||
| "@azure/azure-sdk/ts-package-json-types": "warn", | ||
| "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", | ||
| "@azure/azure-sdk/ts-package-json-files-required": "off", | ||
| "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", | ||
| "tsdoc/syntax": "warn" | ||
| } | ||
| } | ||
| ]); |
51 changes: 51 additions & 0 deletions
51
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| { | ||
| "name": "@msinternal/test", | ||
| "version": "1.0.0-beta.1", | ||
| "description": "A generated SDK for TestServiceClient.", | ||
| "engines": { | ||
| "node": ">=20.0.0" | ||
| }, | ||
| "sideEffects": false, | ||
| "autoPublish": false, | ||
| "tshy": { | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": "./src/index.ts" | ||
| }, | ||
| "dialects": ["esm", "commonjs"], | ||
| "esmDialects": ["browser", "react-native"], | ||
| "selfLink": false | ||
| }, | ||
| "type": "module", | ||
| "browser": "./dist/browser/index.js", | ||
| "react-native": "./dist/react-native/index.js", | ||
| "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], | ||
| "author": "Microsoft Corporation", | ||
| "license": "MIT", | ||
| "files": ["dist/", "!dist/**/*.d.*ts.map", "README.md", "LICENSE"], | ||
| "dependencies": { | ||
| "@azure-rest/core-client": "^2.3.1", | ||
| "@azure/core-auth": "^1.6.0", | ||
| "@azure/core-rest-pipeline": "^1.5.0", | ||
| "@azure/logger": "^1.0.0", | ||
| "tslib": "^2.6.2" | ||
| }, | ||
| "devDependencies": { | ||
| "dotenv": "^16.0.0", | ||
| "@types/node": "^20.0.0", | ||
| "eslint": "^9.9.0", | ||
| "typescript": "~5.8.2", | ||
| "tshy": "^2.0.0", | ||
| "@microsoft/api-extractor": "^7.40.3", | ||
| "rimraf": "^5.0.5", | ||
| "mkdirp": "^3.0.1" | ||
| }, | ||
| "scripts": { | ||
| "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", | ||
| "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local", | ||
| "pack": "npm pack 2>&1", | ||
| "lint": "eslint package.json api-extractor.json src", | ||
| "lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]", | ||
| "build": "npm run clean && tshy && npm run extract-api" | ||
| } | ||
| } |
117 changes: 117 additions & 0 deletions
117
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/rollup.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import nodeResolve from "@rollup/plugin-node-resolve"; | ||
| import cjs from "@rollup/plugin-commonjs"; | ||
| import sourcemaps from "rollup-plugin-sourcemaps"; | ||
| import multiEntry from "@rollup/plugin-multi-entry"; | ||
| import json from "@rollup/plugin-json"; | ||
|
|
||
| import nodeBuiltins from "builtin-modules"; | ||
|
|
||
| // #region Warning Handler | ||
|
|
||
| /** | ||
| * A function that can determine whether a rollup warning should be ignored. If | ||
| * the function returns `true`, then the warning will not be displayed. | ||
| */ | ||
|
|
||
| function ignoreNiseSinonEval(warning) { | ||
| return ( | ||
| warning.code === "EVAL" && | ||
| warning.id && | ||
| (warning.id.includes("node_modules/nise") || warning.id.includes("node_modules/sinon")) === true | ||
| ); | ||
| } | ||
|
|
||
| function ignoreChaiCircularDependency(warning) { | ||
| return ( | ||
| warning.code === "CIRCULAR_DEPENDENCY" && | ||
| warning.importer && | ||
| warning.importer.includes("node_modules/chai") === true | ||
| ); | ||
| } | ||
|
|
||
| const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; | ||
|
|
||
| /** | ||
| * Construct a warning handler for the shared rollup configuration | ||
| * that ignores certain warnings that are not relevant to testing. | ||
| */ | ||
| function makeOnWarnForTesting() { | ||
| return (warning, warn) => { | ||
| // If every inhibitor returns false (i.e. no inhibitors), then show the warning | ||
| if (warningInhibitors.every((inhib) => !inhib(warning))) { | ||
| warn(warning); | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| // #endregion | ||
|
|
||
| function makeBrowserTestConfig() { | ||
| const config = { | ||
| input: { | ||
| include: ["dist-esm/test/**/*.spec.js"], | ||
| exclude: ["dist-esm/test/**/node/**"], | ||
| }, | ||
| output: { | ||
| file: `dist-test/index.browser.js`, | ||
| format: "umd", | ||
| sourcemap: true, | ||
| }, | ||
| preserveSymlinks: false, | ||
| plugins: [ | ||
| multiEntry({ exports: false }), | ||
| nodeResolve({ | ||
| mainFields: ["module", "browser"], | ||
| }), | ||
| cjs(), | ||
| json(), | ||
| sourcemaps(), | ||
| //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) | ||
| ], | ||
| onwarn: makeOnWarnForTesting(), | ||
| // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, | ||
| // rollup started respecting the "sideEffects" field in package.json. Since | ||
| // our package.json sets "sideEffects=false", this also applies to test | ||
| // code, which causes all tests to be removed by tree-shaking. | ||
| treeshake: false, | ||
| }; | ||
|
|
||
| return config; | ||
| } | ||
|
|
||
| const defaultConfigurationOptions = { | ||
| disableBrowserBundle: false, | ||
| }; | ||
|
|
||
| export function makeConfig(pkg, options) { | ||
| options = { | ||
| ...defaultConfigurationOptions, | ||
| ...(options || {}), | ||
| }; | ||
|
|
||
| const baseConfig = { | ||
| // Use the package's module field if it has one | ||
| input: pkg["module"] || "dist-esm/src/index.js", | ||
| external: [ | ||
| ...nodeBuiltins, | ||
| ...Object.keys(pkg.dependencies), | ||
| ...Object.keys(pkg.devDependencies), | ||
| ], | ||
| output: { file: "dist/index.js", format: "cjs", sourcemap: true }, | ||
| preserveSymlinks: false, | ||
| plugins: [sourcemaps(), nodeResolve()], | ||
| }; | ||
|
|
||
| const config = [baseConfig]; | ||
|
|
||
| if (!options.disableBrowserBundle) { | ||
| config.push(makeBrowserTestConfig()); | ||
| } | ||
|
|
||
| return config; | ||
| } | ||
|
|
||
| export default makeConfig(require("./package.json")); |
29 changes: 29 additions & 0 deletions
29
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/src/clientDefinitions.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import type { GlobalModelGetPetSettingsParameters } from "./parameters.js"; | ||
| import type { GlobalModelGetPetSettings200Response } from "./responses.js"; | ||
| import type { Client, StreamableMethod } from "@azure-rest/core-client"; | ||
|
|
||
| /** Contains operations for GlobalModel operations */ | ||
| export interface GlobalModelOperations { | ||
| getPetSettings( | ||
| options?: GlobalModelGetPetSettingsParameters, | ||
| ): StreamableMethod<GlobalModelGetPetSettings200Response>; | ||
| } | ||
|
|
||
| export interface GetPetSettings { | ||
| get( | ||
| options?: GlobalModelGetPetSettingsParameters, | ||
| ): StreamableMethod<GlobalModelGetPetSettings200Response>; | ||
| } | ||
|
|
||
| export interface Routes { | ||
| /** Resource for '/' has methods for the following verbs: get */ | ||
| (path: "/"): GetPetSettings; | ||
| } | ||
|
|
||
| export type TestServiceClient = Client & { | ||
| path: Routes; | ||
| globalModel: GlobalModelOperations; | ||
| }; |
12 changes: 12 additions & 0 deletions
12
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/src/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import TestServiceClient from "./testServiceClient.js"; | ||
|
|
||
| export * from "./testServiceClient.js"; | ||
| export * from "./parameters.js"; | ||
| export * from "./responses.js"; | ||
| export * from "./clientDefinitions.js"; | ||
| export * from "./outputModels.js"; | ||
|
|
||
| export default TestServiceClient; |
5 changes: 5 additions & 0 deletions
5
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/src/logger.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { createClientLogger } from "@azure/logger"; | ||
| export const logger = createClientLogger("test"); |
6 changes: 6 additions & 0 deletions
6
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/src/outputModels.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| export interface PetSettingsOutput { | ||
| petList?: { cat?: Array<CatDefOutput> }; | ||
| } | ||
6 changes: 6 additions & 0 deletions
6
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/src/parameters.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import type { RequestParameters } from "@azure-rest/core-client"; | ||
|
|
||
| export type GlobalModelGetPetSettingsParameters = RequestParameters; |
11 changes: 11 additions & 0 deletions
11
packages/typespec-test/test/testRlcGenerate/generated/typespec-ts/src/responses.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import type { HttpResponse } from "@azure-rest/core-client"; | ||
| import type { PetSettingsOutput } from "./outputModels.js"; | ||
|
|
||
| /** The request has succeeded. */ | ||
| export interface GlobalModelGetPetSettings200Response extends HttpResponse { | ||
| status: "200"; | ||
| body: PetSettingsOutput; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typespec: