Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-multipart-diagnos…
Browse files Browse the repository at this point in the history
…tics
  • Loading branch information
tadelesh committed Sep 19, 2024
2 parents 1b192c7 + 2b288d0 commit 51a1b18
Show file tree
Hide file tree
Showing 251 changed files with 2,877 additions and 2,157 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@azure-tools/typespec-autorest"
---

Added support to use Scalar and Object as default types
7 changes: 7 additions & 0 deletions .chronus/changes/commonTypeManagedId-2024-8-17-8-36-58.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-azure-resource-manager"
---

Correct ManagedServiceIdentityType versioning issue
1 change: 0 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"arrowParens": "always",
"trailingComma": "es5",
"bracketSpacing": true,
"endOfLine": "lf",
"printWidth": 100,
Expand Down
2 changes: 1 addition & 1 deletion core
Submodule core updated 600 files
8 changes: 4 additions & 4 deletions docs/howtos/Client Generation/05union.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ export type DemoServiceContext = Client & {
queryParameters: {
mode: "strict" | "lenient";
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<Analyze200Response | AnalyzeDefaultResponse>;
};
/** Resource for '/completions' has methods for the following verbs: post */
(path: "/completions"): {
post(
options: {
body: CompletionInput;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<Completions200Response | CompletionsDefaultResponse>;
};
};
Expand Down Expand Up @@ -209,14 +209,14 @@ export type DemoServiceContext = Client & {
body?: {
x: number;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<A200Response>;
post(
options?: {
body?: {
x: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<B200Response>;
};
};
Expand Down
34 changes: 17 additions & 17 deletions docs/howtos/Client Generation/07tcgcTypes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ import { PythonSdkContext } from "./lib.js";
import { PythonSdkClientType } from "./interfaces.js";

function linkSubClients<TServiceOperation extends PythonSdkServiceOperation>(
sdkContext: PythonSdkContext<TServiceOperation>
sdkContext: PythonSdkContext<TServiceOperation>,
): void {
for (const client of sdkContext.clients) {
client.subclients = client.methods
Expand Down Expand Up @@ -601,7 +601,7 @@ interface SdkServiceMethodBase<TServiceOperation extends SdkServiceOperation>
```ts
function serializeServiceMethod<TServiceOperation extends PythonSdkServiceOperation>(
context: PythonSdkContext<TServiceOperation>,
method: SdkServiceMethod<TServiceOperation>
method: SdkServiceMethod<TServiceOperation>,
): PythonSdkServiceMethod {
switch (method.kind) {
case "basic":
Expand Down Expand Up @@ -968,7 +968,7 @@ const sdkHttpOperation = {
function serializeServiceOperation<TServiceOperation extends PythonSdkServiceOperation>(
context: PythonSdkContext<TServiceOperation>,
method: SdkServiceMethod<TServiceOperation>,
operation: TServiceOperation
operation: TServiceOperation,
): TServiceOperation {
switch (operation.kind) {
case "http":
Expand Down Expand Up @@ -1252,7 +1252,7 @@ import { getPythonSdkType } from "./types.js";

function serializeMethodResponse<TServiceOperation extends SdkServiceOperation>(
context: PythonSdkContext<TServiceOperation>,
response: SdkMethodResponse
response: SdkMethodResponse,
): PythonSdkMethodResponse {
return {
...response,
Expand Down Expand Up @@ -1699,7 +1699,7 @@ const sdkHttpOperationExample = {
```ts
function serializeServiceOperationExample(
context: PythonSdkContext<SdkHttpOperation>,
operation: SdkHttpOperation
operation: SdkHttpOperation,
): PythonSdkHttpOperationExample {
for (const example of operation.examples) {
return {
Expand All @@ -1720,15 +1720,15 @@ function serializeServiceOperationExample(
})),
bodyValue: serializeTypeExample(context, value.bodyValue),
},
])
]),
),
};
}
}

function serializeTypeExample(
context: PythonSdkContext<SdkHttpOperation>,
example: SdkTypeExample
example: SdkTypeExample,
): PythonSdkTypeExample {
switch (example.kind) {
case "string":
Expand Down Expand Up @@ -1770,7 +1770,7 @@ function serializeTypeExample(
Object.entries(example.value).map(([key, value]) => [
key,
serializeTypeExample(context, value),
])
]),
),
};
case "union":
Expand All @@ -1786,14 +1786,14 @@ function serializeTypeExample(
Object.entries(example.value).map(([key, value]) => [
key,
serializeTypeExample(context, value),
])
]),
),
additionalPropertiesValue: example.additionalPropertiesValue
? Object.fromEntries(
Object.entries(example.additionalPropertiesValue).map(([key, value]) => [
key,
serializeTypeExample(context, value),
])
]),
)
: undefined,
};
Expand Down Expand Up @@ -1862,12 +1862,12 @@ export async function $onEmit(context: EmitContext<PythonEmitterOptions>) {

function serializeClient<TServiceOperation extends PythonSdkServiceOperation>(
sdkContext: PythonSdkContext<TServiceOperation>,
client: SdkClientType<TServiceOperation>
client: SdkClientType<TServiceOperation>,
): PythonSdkClientType {
const pythonClient = {
...client,
parameters: client.initialization?.properties.map((x) =>
getSdkModelPropertyType(sdkContext, x)
getSdkModelPropertyType(sdkContext, x),
),
subClients: client.methods
.filter((x) => x.kind === "clientaccessor")
Expand All @@ -1882,7 +1882,7 @@ function serializeClient<TServiceOperation extends PythonSdkServiceOperation>(
}

function linkSubClients<TServiceOperation extends PythonSdkServiceOperation>(
sdkContext: PythonSdkContext<TServiceOperation>
sdkContext: PythonSdkContext<TServiceOperation>,
): void {
for (const client of sdkContext.clients) {
client.subclients = client.methods
Expand Down Expand Up @@ -2037,7 +2037,7 @@ import { getPythonSdkType, getSdkModelPropertyType } from "./types.js";
function serializeHttpServiceOperation(
context: PythonSdkContext<SdkHttpOperation>,
method: SdkServiceMethod<SdkHttpOperation>,
operation: SdkHttpOperation
operation: SdkHttpOperation,
): PythonSdkHttpOperation {
return {
...operation,
Expand All @@ -2046,16 +2046,16 @@ function serializeHttpServiceOperation(
? getSdkModelPropertyType(context, operation.bodyParam)
: undefined,
responses: Object.entries(operation.responses).map(([statusCode, responses]) =>
serializeHttpResponse(context, method, statusCode, responses)
serializeHttpResponse(context, method, statusCode, responses),
),
exceptions: Object.entries(operation.exceptions).map(([statusCode, exceptions]) =>
serializeHttpResponse(context, method, statusCode, exceptions)
serializeHttpResponse(context, method, statusCode, exceptions),
),
};

function serializeHttpResponse(
context: PythonSdkContext<SdkHttpOperation>,
response: SdkHttpResponse
response: SdkHttpResponse,
): PythonSdkHttpResponse {
return {
...response,
Expand Down
42 changes: 21 additions & 21 deletions docs/howtos/Client Generation/08methodInputs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type DemoServiceContext = Client & {
/** Resource for '/analyze' has methods for the following verbs: post */
(path: "/users"): {
get(
options: RequestParameters
options: RequestParameters,
): StreamableMethod<GetUser200Response | GetUserDefaultResponse>;
};
};
Expand Down Expand Up @@ -152,7 +152,7 @@ export type DemoServiceContext = Client & {
post(
options: {
body: User;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand Down Expand Up @@ -252,7 +252,7 @@ export type DemoServiceContext = Client & {
firstName: string;
lastName: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -262,7 +262,7 @@ export type DemoServiceContext = Client & {
export async function upload(
firstName: string,
lastName: string,
options: UploadOptionalParams
options: UploadOptionalParams,
): Promise<void>;

// Modular classical client layer
Expand Down Expand Up @@ -344,15 +344,15 @@ export type DemoServiceContext = Client & {
/** Resource for '/completions' has methods for the following verbs: post */
(
path: "/users/{id}",
id
id,
): {
post(
options: {
body: {
firstName: string;
lastName: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -363,7 +363,7 @@ export async function upload(
id: string,
firstName: string,
lastName: string,
options: UploadOptionalParams
options: UploadOptionalParams,
): Promise<void>;

// Modular classical client layer
Expand All @@ -372,7 +372,7 @@ export class DemoServiceClient {
id: string,
firstName: string,
lastName: string,
options: UploadOptionalParams
options: UploadOptionalParams,
): Promise<void>;
}
```
Expand Down Expand Up @@ -458,7 +458,7 @@ export type DemoServiceContext = Client & {
firstName: string;
lastName: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -468,7 +468,7 @@ export type DemoServiceContext = Client & {
export async function upload(
firstName: string,
lastName: string,
options: UploadOptionalParams
options: UploadOptionalParams,
): Promise<void>;

// Modular classical client layer
Expand Down Expand Up @@ -561,7 +561,7 @@ export type DemoServiceContext = Client & {
post(
options: {
body: User;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand Down Expand Up @@ -775,7 +775,7 @@ export type DemoServiceContext = Client & {
body: {
schema: string;
};
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -789,7 +789,7 @@ export interface Schema {
// Modular api layer
export async function register(
body: Schema,
options: GetBlobPropertiesOptionalParams
options: GetBlobPropertiesOptionalParams,
): Promise<void>;

// Modular classical client layer
Expand Down Expand Up @@ -901,12 +901,12 @@ export type WidgetServiceContext = Client & {
path: {
(
path: "/widgets/{widgetName}:scheduleRepairs",
widgetName: string
widgetName: string,
): {
post(
options: {
body: RepairInfo;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -918,7 +918,7 @@ export async function scheduleRepairs(
widgetName: string,
problem: string,
contact: string,
options: ScheduleRepairsOptionalParams = { requestOptions: {} }
options: ScheduleRepairsOptionalParams = { requestOptions: {} },
): Promise<RepairResult>;

// Modular classical client layer
Expand All @@ -927,7 +927,7 @@ export class WidgetServiceClient {
widgetName: string,
problem: string,
contact: string,
options: ScheduleRepairsOptionalParams = { requestOptions: {} }
options: ScheduleRepairsOptionalParams = { requestOptions: {} },
): Promise<RepairResult>;
}
```
Expand Down Expand Up @@ -1070,12 +1070,12 @@ export type WidgetServiceContext = Client & {
path: {
(
path: "/widgets/{widgetName}:scheduleRepairs",
widgetName: string
widgetName: string,
): {
post(
options: {
body: RepairInfo;
} & RequestParameters
} & RequestParameters,
): StreamableMethod<PostUserDefaultResponse>;
};
};
Expand All @@ -1086,15 +1086,15 @@ export async function scheduleRepairs(
context: Client,
widgetName: string,
body: RepairInfo,
options: ScheduleRepairsOptionalParams = { requestOptions: {} }
options: ScheduleRepairsOptionalParams = { requestOptions: {} },
): Promise<RepairResult>;

// Modular classical client layer
export class WidgetServiceClient {
scheduleRepairs(
widgetName: string,
body: RepairInfo,
options: ScheduleRepairsOptionalParams = { requestOptions: {} }
options: ScheduleRepairsOptionalParams = { requestOptions: {} },
): Promise<RepairResult>;
}
```
Expand Down
Loading

0 comments on commit 51a1b18

Please sign in to comment.