Skip to content

Commit

Permalink
Merge branch 'main' into vitest-workspace-test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlitzelMendez authored Jan 7, 2025
2 parents 4c1467b + 797cfe8 commit 4f1ca3b
Show file tree
Hide file tree
Showing 30 changed files with 1,381 additions and 249 deletions.
18 changes: 18 additions & 0 deletions packages/typespec-client-generator-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change Log - @azure-tools/typespec-client-generator-core

## 0.49.1

### Bug Fixes

- [#2000](https://github.com/Azure/typespec-azure/pull/2000) ensure operation examples to be ordered
- [#2004](https://github.com/Azure/typespec-azure/pull/2004) get correct pageable info for azure pageable operation with inheritance return model
- [#2034](https://github.com/Azure/typespec-azure/pull/2034) refine cross language definition id logic

### Features

- [#2010](https://github.com/Azure/typespec-azure/pull/2010) add `getHttpOperationParameter` helper function
- [#1978](https://github.com/Azure/typespec-azure/pull/1978) Add `@apiVersion` decorator to override whether a parameter is an api version or not

### Breaking Changes

- [#2007](https://github.com/Azure/typespec-azure/pull/2007) fix typo of `crossLanguageDefinitionId` of method.


## 0.49.0

### Bug Fixes
Expand Down
154 changes: 94 additions & 60 deletions packages/typespec-client-generator-core/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {
* Changes the name of a method, parameter, property, or model generated in the client SDK
*
* @param rename The rename you want applied to the object
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand All @@ -43,7 +43,7 @@ export type ClientNameDecorator = (
* Whether you want to generate an operation as a convenient operation.
*
* @param value Whether to generate the operation as convenience method or not.
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand All @@ -62,7 +62,7 @@ export type ConvenientAPIDecorator = (
* Whether you want to generate an operation as a protocol operation.
*
* @param value Whether to generate the operation as protocol or not.
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand All @@ -81,7 +81,7 @@ export type ProtocolAPIDecorator = (
* Create a ClientGenerator.Core client out of a namespace or interface
*
* @param value Optional configuration for the service.
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example Basic client setting
* ```typespec
Expand Down Expand Up @@ -114,7 +114,7 @@ export type ClientDecorator = (
/**
* Create a ClientGenerator.Core operation group out of a namespace or interface
*
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand Down Expand Up @@ -146,7 +146,7 @@ export type OperationGroupDecorator = (
* otherwise a warning will be added to diagnostics list.
*
* @param value The usage info you want to set for this model.
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example Expand usage for model
* ```typespec
Expand Down Expand Up @@ -218,7 +218,7 @@ export type UsageDecorator = (
* otherwise a warning will be added to diagnostics list.
*
* @param value The access info you want to set for this model or operation.
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example Set access
* ```typespec
Expand Down Expand Up @@ -354,7 +354,7 @@ export type AccessDecorator = (
/**
* Set whether a model property should be flattened or not.
*
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand All @@ -377,7 +377,7 @@ export type FlattenPropertyDecorator = (
*
* @param original : The original service definition
* @param override : The override method definition that specifies the exact client method you want
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand Down Expand Up @@ -428,7 +428,7 @@ export type OverrideDecorator = (
/**
* Whether a model needs the custom JSON converter, this is only used for backward compatibility for csharp.
*
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand All @@ -447,7 +447,7 @@ export type UseSystemTextJsonConverterDecorator = (
/**
* Client parameters you would like to add to the client. By default, we apply endpoint, credential, and api-version parameters. If you add clientInitialization, we will append those to the default list of parameters.
*
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand Down Expand Up @@ -478,7 +478,7 @@ export type ClientInitializationDecorator = (
/**
* Alias the name of a client parameter to a different name. This permits you to have a different name for the parameter in client initialization then on individual methods and still refer to the same parameter.
*
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand Down Expand Up @@ -512,18 +512,19 @@ export type ParamAliasDecorator = (
* By default, the client namespace for them will follow the TypeSpec namespace.
*
* @param rename The rename you want applied to the object
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
* @clientNamespace("ContosoClient")
* namespace Contoso;
* ```
* @example
* ```typespec
* @clientName("ContosoJava", "java")
* @clientName("ContosoPython", "python")
* @clientName("ContosoCSharp", "csharp")
* @clientName("ContosoJavascript", "javascript")
* @clientNamespace("ContosoJava", "java")
* @clientNamespace("ContosoPython", "python")
* @clientNamespace("ContosoCSharp", "csharp")
* @clientNamespace("ContosoJavascript", "javascript")
* namespace Contoso;
* ```
*/
Expand All @@ -539,7 +540,7 @@ export type ClientNamespaceDecorator = (
*
* @param source The source type you want to apply the alternate type to. Only scalar types are supported.
* @param alternate The alternate type you want applied to the target. Only scalar types are supported.
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand Down Expand Up @@ -568,7 +569,7 @@ export type AlternateTypeDecorator = (
/**
* To define the client scope of an operation.
*
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
Expand All @@ -578,6 +579,32 @@ export type AlternateTypeDecorator = (
*/
export type ScopeDecorator = (context: DecoratorContext, target: Operation, scope?: string) => void;

/**
* Use to override default assumptions on whether a parameter is an api-version parameter or not.
* By default, we do matches with the `api-version` or `apiversion` string in the parameter name. Since api versions are
* a client parameter, we will also elevate this parameter up onto the client.
*
* @param value If true, we will treat this parameter as an api-version parameter. If false, we will not. Default is true.
* @param scope The language scope you want this decorator to apply to. If not specified, will apply to all language emitters.
* You can use "!" to specify negation such as "!(java, python)" or "!java, !python".
* @example
* ```typespec
* namespace Contoso;
*
* op test(
* @apiVersion
* @header("x-ms-version")
* version: string
* ): void;
* ```
*/
export type ApiVersionDecorator = (
context: DecoratorContext,
target: ModelProperty,
value?: boolean,
scope?: string,
) => void;

export type AzureClientGeneratorCoreDecorators = {
clientName: ClientNameDecorator;
convenientAPI: ConvenientAPIDecorator;
Expand All @@ -594,4 +621,5 @@ export type AzureClientGeneratorCoreDecorators = {
clientNamespace: ClientNamespaceDecorator;
alternateType: AlternateTypeDecorator;
scope: ScopeDecorator;
apiVersion: ApiVersionDecorator;
};
Loading

0 comments on commit 4f1ca3b

Please sign in to comment.