Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Binder models tcgc #2759

Draft
wants to merge 57 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
10267e1
Generate models from TCGC and use binder
joheredi Aug 15, 2024
1d0e542
generic serializers
joheredi Aug 19, 2024
5522764
fix const and enum value expression
qiaozha Aug 29, 2024
ff42613
merge main and resolve conflicts
qiaozha Aug 29, 2024
fb5cc9f
merge main
qiaozha Sep 2, 2024
136a66b
fix paged result model name
qiaozha Sep 3, 2024
1205b52
Update packages/typespec-ts/src/modular/emit-models.ts
qiaozha Sep 3, 2024
e9446b3
remove old imports and refactor serializer util
qiaozha Sep 3, 2024
efe343b
fix serializer
qiaozha Sep 4, 2024
1f251c3
fix anomalydetector
qiaozha Sep 4, 2024
e8ffadb
fix readonly, enum docs missing, serializeRecord crash issues
qiaozha Sep 5, 2024
6a7e682
Update packages/typespec-ts/src/index.ts
qiaozha Sep 5, 2024
cb143cc
Merge branch 'main' into binder-models-tcgc
qiaozha Sep 5, 2024
be80522
fix extensible enum docs, knownvalue enum
qiaozha Sep 5, 2024
91e4e9e
fix known enum name
qiaozha Sep 5, 2024
c61258e
Merge branch 'main' into binder-models-tcgc
qiaozha Sep 5, 2024
92c5a25
use binder to resolve dependencies and reserve work
qiaozha Sep 5, 2024
5149443
Fix missing TokenCredential imports
joheredi Sep 5, 2024
53e235f
Fix client not found issue
joheredi Sep 5, 2024
a6384c7
fix client factory signature
qiaozha Sep 6, 2024
160aa9f
fix anonymous models and visitSdkPackage type
qiaozha Sep 7, 2024
39703d1
fix missing models and client parameters
qiaozha Sep 7, 2024
f15218b
add deserializer
qiaozha Sep 7, 2024
655e1d0
add serializer for enum and union
qiaozha Sep 7, 2024
bf9946c
do not export deserializer
qiaozha Sep 7, 2024
2da07d2
use operation template
qiaozha Sep 9, 2024
ce9bcd4
use sdkmethod to filter method level lifted parameters
qiaozha Sep 9, 2024
d2d6839
Merge branch 'main' into binder-models-tcgc
qiaozha Sep 10, 2024
207268f
fix endpoint template arguments fetching logic
qiaozha Sep 10, 2024
45cdf02
fix duplicate imports
qiaozha Sep 10, 2024
c203010
fix record serializer missing
qiaozha Sep 10, 2024
b1532c1
fix unused imports
qiaozha Sep 10, 2024
02abce0
update serializer and reserve work
qiaozha Sep 11, 2024
2b30bb3
fix body optional
qiaozha Sep 11, 2024
4d799fc
use tcgc name
qiaozha Sep 11, 2024
849dbae
fix model namespace name
qiaozha Sep 11, 2024
e673ece
smoke-test
qiaozha Sep 11, 2024
7794efc
fix extra quotes
qiaozha Sep 12, 2024
4c43a3a
fix serializer and deserializer missing
qiaozha Sep 12, 2024
2aac9f4
normalize clientOptional params
qiaozha Sep 12, 2024
4629802
add array serializer
qiaozha Sep 12, 2024
0f092a8
add array serializer
qiaozha Sep 12, 2024
1aac384
refactor operation helpers
qiaozha Sep 12, 2024
8a10a46
fix serialize value
qiaozha Sep 12, 2024
14e3118
fix smoke test
qiaozha Sep 13, 2024
aa62957
use binder for streamable and generate empty object as record of any
qiaozha Sep 13, 2024
5132824
fix docs missing
qiaozha Sep 13, 2024
cd3fe73
modular models for multi clients
qiaozha Sep 13, 2024
5fb0ae6
use modular client name as context name
qiaozha Sep 13, 2024
66dd336
move options into api folder
qiaozha Sep 13, 2024
3046174
fix docs missing
qiaozha Sep 13, 2024
9c8d698
fix unit test
qiaozha Sep 14, 2024
04f7ab5
fix some unit test and deserializer missing
qiaozha Sep 15, 2024
7022f13
refactor serializer in operationHelpers
qiaozha Sep 16, 2024
f4afc39
fix some ut and add alias description
qiaozha Sep 18, 2024
d1306cc
fix some ut description
qiaozha Sep 20, 2024
b804c19
fix duplicate union type generation
qiaozha Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
}
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[powershell]": {
"editor.defaultFormatter": "ms-vscode.powershell"
},
"[javascript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
}
}
8 changes: 4 additions & 4 deletions common/config/rush/pnpm-lock.yaml

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

6 changes: 1 addition & 5 deletions packages/rlc-common/src/helpers/nameConstructors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,10 @@ export function getImportModuleName(name: ModuleName, codeModel: RLCModel) {

export function getClientName(model: RLCModel) {
const clientName = model.libraryName;
let clientInterfaceName = clientName.endsWith("Client")
const clientInterfaceName = clientName.endsWith("Client")
? `${clientName}`
: `${clientName}Client`;

if (model.options?.isModularLibrary) {
clientInterfaceName = `${clientName.replace("Client", "")}Context`;
}

return clientInterfaceName;
}

Expand Down
8 changes: 1 addition & 7 deletions packages/rlc-common/src/metadata/buildReadmeFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RLCModel } from "../interfaces.js";
import hbs from "handlebars";
import { NameType, normalizeName } from "../helpers/nameUtils.js";
import { isAzurePackage } from "../helpers/packageUtil.js";
import { getClientName } from "../helpers/nameConstructors.js";

const azureReadmeRLCTemplate = `# {{ clientDescriptiveName }} library for JavaScript

Expand Down Expand Up @@ -430,10 +431,3 @@ function getServiceName(model: RLCModel) {
: `Azure ${simpleServiceName}`
: simpleServiceName;
}

function getClientName(model: RLCModel) {
const clientName = model.libraryName;
return clientName.endsWith("Client")
? `${clientName}`
: `${clientName}Client`;
}
7 changes: 5 additions & 2 deletions packages/typespec-test/eng/smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ async function generate(path, logger) {

// Clean up the folder before generation
if (await exists(join(path, "generated", "typespec-ts"))) {
const pathToRemove = join(path, "generated", "typespec-ts");
await rm(pathToRemove, { recursive: true, force: true });
fstat.readdirSync(join(path, "generated", "typespec-ts")).forEach((file) => {
if(file !== "node_modules") {
rm(join(path, "generated", "typespec-ts", file), { recursive: true, force: true });
}
});
}
} catch (e) {
// do nothing
Expand Down
2 changes: 1 addition & 1 deletion packages/typespec-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@typespec/http": ">=0.59.0 <1.0.0",
"@typespec/rest": ">=0.59.0 <1.0.0",
"@typespec/versioning": ">=0.59.0 <1.0.0",
"prettier": "^3.1.0"
"prettier": "^3.3.3"
},
"devDependencies": {
"ts-node": "^8.5.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
```ts

import { AbortSignalLike } from '@azure/abort-controller';
import { Client } from '@azure-rest/core-client';
import { ClientOptions } from '@azure-rest/core-client';
import { OperationOptions } from '@azure-rest/core-client';
import { OperationState } from '@azure/core-lro';
Expand Down Expand Up @@ -61,6 +62,9 @@ export type ControlState = string;
// @public
export type CreatedByType = string;

// @public (undocumented)
export function createNetworkAnalytics(credential: TokenCredential, options?: NetworkAnalyticsClientOptionalParams): NetworkAnalyticsContext;

// @public
export interface DataProduct extends TrackedResource {
identity?: ManagedServiceIdentityV4;
Expand Down Expand Up @@ -300,6 +304,10 @@ export interface DataTypeUpdateProperties {
// @public
export type DefaultAction = string;

// @public
export interface DeleteDataRequest {
qiaozha marked this conversation as resolved.
Show resolved Hide resolved
}

// @public
export interface EncryptionKeyDetails {
keyName: string;
Expand All @@ -313,6 +321,10 @@ export interface ErrorAdditionalInfo {
readonly type?: string;
}

// @public
export interface ErrorAdditionalInfoInfo {
}

// @public
export interface ErrorDetail {
readonly additionalInfo?: ErrorAdditionalInfo[];
Expand Down Expand Up @@ -407,6 +419,10 @@ export interface ListRoleAssignments {
roleAssignmentResponse: RoleAssignmentDetail[];
}

// @public
export interface ListRolesAssignmentsRequest {
}

// @public
export interface ManagedResourceGroupConfiguration {
location: string;
Expand Down Expand Up @@ -439,6 +455,10 @@ export interface NetworkAnalyticsClientOptionalParams extends ClientOptions {
apiVersion?: string;
}

// @public (undocumented)
export interface NetworkAnalyticsContext extends Client {
}

// @public
export interface Operation {
actionType?: ActionType;
Expand Down
Loading