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

Backmerge/release/january 2025 2025 01 31 #2160

Merged
merged 11 commits into from
Jan 31, 2025

Conversation

iscai-msft
Copy link
Contributor

No description provided.

tadelesh and others added 10 commits January 17, 2025 10:56
1. Add `serializationOptions` property to `SdkModelType` and
`SdkBodyModelPropertyType`. Its type is `SerializationOptions` which
contains the info of how to serialize to Json/Xml/Multipart value.
2. Deprecate `serializedName` property in `SdkBodyModelPropertyType`,
use `serializationOptions.xxx.name` instead.
3. Deprecate `multipartOptions` in `SdkBodyModelPropertyType`, use
`serializationOptions.multipart` instead.

resolve: #1729

Add new interfaces to represent detail of the serialization info, also
will move multipart related options into it:
```typescript
export interface SerializationOptions {
  json?: JsonSerializationOptions;
  xml?: XmlSerializationOptions;
  multipart?: MultipartOptions;
}

/**
 * For Json serialization.
 * The name will come from explicit setting of `@encodedName("application/json", "NAME")`.
 */
export interface JsonSerializationOptions {
  name: string;
}

/**
 * For Xml serialization.
 * The `name`/`itemsName` will come from explicit setting of `@encodedName("application/xml", "NAME")` or `@xml.Name("NAME")`.
 * Other properties come from `@xml.attribute`, `@xml.ns`, `@xml.unwrapped`.
 * The `itemsName` and `itemsNs` are used for array items.
 */
export interface XmlSerializationOptions {
  name?: string;
  attribute?: boolean;
  ns?: {
    namespace: string;
    prefix: string;
  };
  unwrapped?: boolean;

  itemsName?: string;
  itemsNs?: {
    namespace: string;
    prefix: string;
  };
}
```
The serialization info will be added only when it is used in request
body or response body with corresponding content type.
The serialization options update logic could follow usage/access update
logic.
This change could cover all possible serialization logic with
extensibility.
1. add sub namespace example for clients
2. add sub namespace example for models
3. rearrange the sections

---------

Co-authored-by: Weidong Xu <[email protected]>
1. Deprecate `serializedName` property of `SdkEndpointParameter`. Use
`type.templateArguments[x].serializedName` or
`type.variantTypes[x].templateArguments[x].serializedName` instead.
2. Fix regression of example mapping for model with parameters.
…ackmerge/release/january-2025-2025-01-31
@azure-sdk
Copy link
Collaborator

azure-sdk commented Jan 31, 2025

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @azure-tools/typespec-client-generator-core
Show changes

@azure-sdk
Copy link
Collaborator

azure-sdk commented Jan 31, 2025

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

@iscai-msft iscai-msft added this pull request to the merge queue Jan 31, 2025
Merged via the queue into main with commit dea1bf0 Jan 31, 2025
23 checks passed
@iscai-msft iscai-msft deleted the backmerge/release/january-2025-2025-01-31 branch January 31, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants