From 95fd826835ecb335e3d0e8512cd4abfaba690c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Thu, 23 Nov 2023 19:11:58 +0000 Subject: [PATCH 001/394] Initial draft specs --- specs/kiota.config.md | 240 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) create mode 100644 specs/kiota.config.md diff --git a/specs/kiota.config.md b/specs/kiota.config.md new file mode 100644 index 0000000000..18f2c1726d --- /dev/null +++ b/specs/kiota.config.md @@ -0,0 +1,240 @@ +# Kiota Config + +Kiota generates client code for an API and stores parameters in a kiota.lock file. A project can contain multiple API clients, but they are independently managed. Kiota has no awareness that an app has a dependency on multiple APIs, even though that is a core use case. + +## Status + +| Date | Version | Author | Status | +| ------------------- | ------- | ---------------- | ------ | +| November 22nd, 2023 | v0.2 | Sébastien Levert | Draft | +| September 24th, 2023 | v0.1 | Darrel Miller | Draft | + +## Current Challenges + +- Client code generation is not reproducible if API description changes +- Kiota doesn’t have a good solution for APIs that use multiple security schemes. +- Kiota doesn’t provide any support for generating auth providers with the required permissions, partially because currently we generate one client for APIs that use different schemes. How would we know which auth provider to generate. +- Kiota doesn’t have a good story for acquiring a client identifier. e.g. apikey or OAuth2 ClientId. This could be possible if the OpenIDConnect URL pointed to a dynamic registration endpoint. +- If an application has multiple kiota clients, there is currently no way perform operations that correspond to all of the clients. + +We have previously described Kiota's approach to managing API dependencies as consistent with the way people manage packages in a project. However, currently our tooling doesn't behave that way. We treat each dependency independently. + +## Proposal + +We should introduce a new Kiota.config file that holds the input parameters required to generate the API Client code. Currently kiota.lock is used to capture what the parameters were at the time of generation and can be used to regenerate based on the parameters in the file. This creates a mixture of purposes for the file. + +We did consider creating one kiota.config file as as a peer of the language project file, however, for someone who wants to generate multiple clients for an API in different languages, this would be a bit annoying. An alternative would be to allow the kiota.config file to move further up the folder structure and support generation in multiple languages from a single file. This is more consistent with what [TypeSpec](https://aka.ms/typespec) are doing and would be helpful for generating CLI and docs as well as a library. + +Here is an example of what the kiota.config file could look like. + +```json +{ + "name": "My application", + "version": "2.0", + "apis": { + "Graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "outputs": [ + { + "language": "csharp", + "outputPath": "./generated/graph", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + }, + "usesBackingStore": true, + "includeAdditionalData": true + } + } + ] + }, + "BusinessCentral": { + "descriptionHash": "810CF81EFDB5D8E065...", + "descriptionLocation": "https://.../bcoas1.0.yaml", + "includePatterns": ["/companies#GET"], + "excludePatterns": [], + "outputs": [ + { + "language": "csharp", + "outputPath": "./generated/business-central" + }, + { + "language": "python", + "outputPath": "./generated/python/business-central" + }, + { + "language": "csharp", + "outputPath": "./generated/business-central-app", + "features": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + } + } + } + ] + } + } +} +``` + +Note that in this example we added suggestions for new parameters related to authentication. If we are to improve the generation experience so that we read the security schemes information from the OpenAPI, then we will need to have some place to configure what providers we will use for those schemes. + +The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html) file can be used as a replacement for the kiota.lock file as a place to capture a snapshot of what information was used to perform code generation and what APIs that gives the application access to. + +## Tooling commands to manage Kiota.config + +| Command | Example | Description | +| ------------------- | ------- | ---------------- | +| init | kiota init --name | Creates a kiota.config file | +| add api | kiota add api --name --openapi | Adds an entry for an API with passed parameters and default values | +| add output | kiota add output --name MyApi --lang python --outputPath ./pythonClient | Adds information about a new output artifact that should be generated | +| generate | kiota generate | Outputs kiota.apimanifest and source for each of the output objects | + +In the past we have had both a generate and an update comment. This is because if it was the first time running, generate would set defaults for all the properties that were not set on the command line. However, now that we have add output, it can be used to set the defaults and generate can just read from the kiota.config file. + +## Scenarios using the command line tool + +### Get started to generate an API + +```bash +kiota init --name Myapp +kiota add api --name MyApi --openapi // Can we add using -k ? +kiota add output --name MyApi --lang csharp --outputPath ./csharpClient +kiota generate +``` + +### Add a second language to generate an API + +```bash +kiota add output --name MyApi --lang python --outputPath ./pythonClient +kiota generate --name MyApi --lang python // Generate just the Python client for MyApi +``` + +### Remove a language + +```bash +kiota remove output --name MyApi --lang python +``` + +### Remove an API + +```bash +kiota remove api --name MyApi +``` + +## JSON Schema for Kiota.Config + +```json +{ + "$schema": "", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "apis": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "descriptionLocation": { + "type": "string" + }, + "descriptionHash": { + "type": "string" + } + }, + "descriptionHash": { + "type": "string" + }, + "descriptionLocation": { + "type": "string" + }, + "includePatterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "excludePatterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "baseUrl": { + "type": "string" + }, + "output": { + "type": "array", + "items": { + "type": "object", + "properties": { + "language": { + "type": "string" + }, + "outputPath": { + "type": "string" + }, + "clientClassName": { + "type": "string" + }, + "clientNamespaceName": { + "type": "string" + }, + "features": { + "type": "object", + "properties": { + "authenticationProvider": { + "type": "string" + }, + "authenticationParameters": { + "type": "object" + } + }, + "structuredMediaTypes": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "serializer": { + "type": "string" + }, + "deserializer": { + "type": "string" + } + } + } + } + }, + "usesBackingStore": { + "type": "boolean" + }, + "includeAdditionalData": { + "type": "boolean" + } + } + } + } + } + }, + "disabledValidationRules": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } +} +``` From accf42025abaa84e8e6ac12fa14024d3b1685c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Mon, 27 Nov 2023 16:58:17 +0000 Subject: [PATCH 002/394] Updated specs --- specs/kiota.config.md | 94 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 11 deletions(-) diff --git a/specs/kiota.config.md b/specs/kiota.config.md index 18f2c1726d..1097c38df8 100644 --- a/specs/kiota.config.md +++ b/specs/kiota.config.md @@ -4,10 +4,10 @@ Kiota generates client code for an API and stores parameters in a kiota.lock fil ## Status -| Date | Version | Author | Status | -| ------------------- | ------- | ---------------- | ------ | -| November 22nd, 2023 | v0.2 | Sébastien Levert | Draft | -| September 24th, 2023 | v0.1 | Darrel Miller | Draft | +| Date | Version | Author | Status | +| -- | -- | -- | -- | +| November 22nd, 2023 | v0.2 | Sébastien Levert | Draft | +| September 24th, 2023 | v0.1 | Darrel Miller | Draft | ## Current Challenges @@ -44,9 +44,11 @@ Here is an example of what the kiota.config file could look like. "clientClassName": "GraphClient", "clientNamespaceName": "Contoso.GraphApp", "features": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" + "authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + } }, "usesBackingStore": true, "includeAdditionalData": true @@ -72,9 +74,11 @@ Here is an example of what the kiota.config file could look like. "language": "csharp", "outputPath": "./generated/business-central-app", "features": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" + "authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + } } } } @@ -94,11 +98,79 @@ The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01. | ------------------- | ------- | ---------------- | | init | kiota init --name | Creates a kiota.config file | | add api | kiota add api --name --openapi | Adds an entry for an API with passed parameters and default values | -| add output | kiota add output --name MyApi --lang python --outputPath ./pythonClient | Adds information about a new output artifact that should be generated | +| add output | kiota add output --api-name --lang python --outputPath ./pythonClient | Adds information about a new output artifact that should be generated | | generate | kiota generate | Outputs kiota.apimanifest and source for each of the output objects | In the past we have had both a generate and an update comment. This is because if it was the first time running, generate would set defaults for all the properties that were not set on the command line. However, now that we have add output, it can be used to set the defaults and generate can just read from the kiota.config file. +## Commands + +### kiota init + +`kiota init` creates a new kiota.config file with the passed parameters. If the file already exists, it should error out and report it to the user. The initialization process has a single required parameter, the name of the application. + +> [!NOTE] +> If a project only needs a single API, using `kiota init` is not required as generating code using the `kiota generate` command should generate a `kiota.config` file with values coming from the `kiota generate` command. See [kiota generate](#kiota-generate) for more information. + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--app-name \| -n` | Yes | My application | Name of the application | + +#### Using `kiota init` + +```bash +kiota init --app-name "My application" +``` + +```json +// Creates the following kiota.config file +{ + "name": "My application", + "version": "1.0" +} +``` + +### kiota add api + +`kiota add api` allows a developer to add a new API to the kiota.config file. The command will add a new entry to the apis section of the kiota.config file. The command has two required parameters, the name of the API (key of the api map) and the location of the OpenAPI description. The command also has two optional parameters, the include and exclude patterns. If provided, these will be used to filter the paths that are included in the generation process. If not provided, all paths will be assumed. + +When executing, a new API entry will be added and will use the `--api-name` parameter as the key for the map. When loading the OpenAPI description, it will generate a hash of the description to enable change detection of the description and save it as part of the `descriptionHash` property. It will also store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--api-name \| -n` | Yes | graph | Name of the API | +| `--open-api \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | +| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | +| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | + +#### Using `kiota add api` + +```bash +kiota add api --api-name "graph" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" +``` + +```json +// Adds the following to the kiota.config file +"graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [] +} +``` + +### kiota generate + +In scenarios where a developer only needs a single API or doesn't want to go through the ceremony of executing `kiota init`, it's possible to use `kiota generate` as it will create a `kiota.config` file with the values coming from the command parameters. + +#### Using `kiota generate` + +```bash +``` + +```json +``` + ## Scenarios using the command line tool ### Get started to generate an API From 84c7d5eee3433f4277a8a3fbb203ea3b4a688ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Thu, 30 Nov 2023 16:30:03 +0000 Subject: [PATCH 003/394] Polishing spec + updated json schema --- specs/kiota.config.md | 483 +++++++++++++++++++++++++++++++++++------- 1 file changed, 409 insertions(+), 74 deletions(-) diff --git a/specs/kiota.config.md b/specs/kiota.config.md index 1097c38df8..906a8fd653 100644 --- a/specs/kiota.config.md +++ b/specs/kiota.config.md @@ -6,6 +6,7 @@ Kiota generates client code for an API and stores parameters in a kiota.lock fil | Date | Version | Author | Status | | -- | -- | -- | -- | +| November 30th, 2023 | v0.3 | Sébastien Levert | Final Draft | | November 22nd, 2023 | v0.2 | Sébastien Levert | Draft | | September 24th, 2023 | v0.1 | Darrel Miller | Draft | @@ -30,17 +31,16 @@ Here is an example of what the kiota.config file could look like. ```json { "name": "My application", - "version": "2.0", "apis": { "Graph": { "descriptionHash": "9EDF8506CB74FE44...", "descriptionLocation": "https://.../openapi.yaml", "includePatterns": ["/me/chats#GET", "/me#GET"], "excludePatterns": [], - "outputs": [ + "clients": [ { "language": "csharp", - "outputPath": "./generated/graph", + "outputPath": "./generated/graph/csharp", "clientClassName": "GraphClient", "clientNamespaceName": "Contoso.GraphApp", "features": { @@ -96,25 +96,27 @@ The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01. | Command | Example | Description | | ------------------- | ------- | ---------------- | -| init | kiota init --name | Creates a kiota.config file | -| add api | kiota add api --name --openapi | Adds an entry for an API with passed parameters and default values | -| add output | kiota add output --api-name --lang python --outputPath ./pythonClient | Adds information about a new output artifact that should be generated | +| init | kiota init --name `appName` | Creates a kiota.config file | +| api add | kiota api add --name `apiName` --openapi | Adds an entry for an API with passed parameters and default values | +| api delete | kiota api delete --api-name `apiName` | Removes the entire API entry with the provided name. | +| output add | kiota output add --api-name `apiName` --lang python --outputPath ./pythonClient | Adds information about a new output artifact that should be generated | +| output delete | kiota output delete --api-name `apiName` --client-name `clientName` | Removes the specified output. Has optional parameters to allow deleting the generated output. | | generate | kiota generate | Outputs kiota.apimanifest and source for each of the output objects | -In the past we have had both a generate and an update comment. This is because if it was the first time running, generate would set defaults for all the properties that were not set on the command line. However, now that we have add output, it can be used to set the defaults and generate can just read from the kiota.config file. +In the past we have had both a generate and an update comment. This is because if it was the first time running, generate would set defaults for all the properties that were not set on the command line. However, now that we have output add, it can be used to set the defaults and generate can just read from the kiota.config file. ## Commands ### kiota init -`kiota init` creates a new kiota.config file with the passed parameters. If the file already exists, it should error out and report it to the user. The initialization process has a single required parameter, the name of the application. +`kiota init` creates a new kiota.config file with the provided parameters. If the file already exists, it should error out and report it to the user. The initialization process has a single required parameter, the name of the application. > [!NOTE] -> If a project only needs a single API, using `kiota init` is not required as generating code using the `kiota generate` command should generate a `kiota.config` file with values coming from the `kiota generate` command. See [kiota generate](#kiota-generate) for more information. +> If a project only needs a single API, using `kiota init` is not mandatory as generating code using the `kiota generate` command could generate a `kiota.config` file with values coming from the `kiota generate` command (if no `kiota.config` is present). See [kiota generate](#kiota-generate) for more information. | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--app-name \| -n` | Yes | My application | Name of the application | +| `--app-name \| --an` | Yes | My application | Name of the application | #### Using `kiota init` @@ -122,34 +124,33 @@ In the past we have had both a generate and an update comment. This is because i kiota init --app-name "My application" ``` -```json +```jsonc // Creates the following kiota.config file { - "name": "My application", - "version": "1.0" + "name": "My application" } ``` -### kiota add api +### kiota api add -`kiota add api` allows a developer to add a new API to the kiota.config file. The command will add a new entry to the apis section of the kiota.config file. The command has two required parameters, the name of the API (key of the api map) and the location of the OpenAPI description. The command also has two optional parameters, the include and exclude patterns. If provided, these will be used to filter the paths that are included in the generation process. If not provided, all paths will be assumed. +`kiota api add` allows a developer to add a new API to the `kiota.config` file. The command will add a new entry to the `apis` section of the `kiota.config` file. The command has two required parameters, the name of the API (key of the apis map) and the location of the OpenAPI description. The command also has two optional parameters, the include and exclude patterns. If provided, these will be used to filter the paths that are included in the future generation process. If not provided, all paths will be assumed. When executing, a new API entry will be added and will use the `--api-name` parameter as the key for the map. When loading the OpenAPI description, it will generate a hash of the description to enable change detection of the description and save it as part of the `descriptionHash` property. It will also store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--api-name \| -n` | Yes | graph | Name of the API | -| `--open-api \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | +| `--api-name \| --api` | Yes | graph | Name of the API | +| `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | -#### Using `kiota add api` +#### Using `kiota api add` ```bash -kiota add api --api-name "graph" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" +kiota api add --api-name "graph" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" ``` -```json +```jsonc // Adds the following to the kiota.config file "graph": { "descriptionHash": "9EDF8506CB74FE44...", @@ -159,46 +160,382 @@ kiota add api --api-name "graph" --openapi "https://raw.githubusercontent.com/mi } ``` +The resulting `kiota.config` file will look like this: + +```jsonc +{ + "name": "My application", + "apis": { + "graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [] + } + } +} +``` + +### kiota api delete + +`kiota api delete` allows a developer to delete an existing API from the `kiota.config` file. The command will remove the entry from the `apis` section of the `kiota.config` file. The command has one required parameter, the name of the API (key of the apis map). The command also has one optional parameter, the ability to remove generated clients. If provided, kiota will delete the folder specified at the `outputPath` from the client configuration. + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--api-name \| --api` | Yes | graph | Name of the API | +| `--clean-output \| --co` | No | | Cleans the generated clients from the API | + +#### Using kiota api delete + +```bash +kiota api delete --api-name "graph" --clean-output +``` + +```jsonc +// Removes the following from the kiota.config file +"graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "clients": { + // All clients + } +} +``` + +The resulting `kiota.config` file will look like this: + +```jsonc +{ + "name": "My application", + "apis": {} +} +``` + +### kiota client add + +`kiota client add` allows a developer to add a new client for a specified API to the `kiota.config` file. The command will add a new entry to the `clients` section of the `kiota.config` file. The command has two required parameters, the name of the API (key of the apis map) and the location of the OpenAPI description. The command also has two optional parameters, the include and exclude patterns. If provided, these will be used to filter the paths that are included in the future generation process. If not provided, all paths will be assumed. The `kiota client add` command will never automatically invoke `kiota generate`. + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--api-name \| --api` | Yes | graph | Name of the API | +| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | +| `--language \| -l` | Yes | csharp | The target language for the generated code files or for the information. | +| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | +| `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | +| `--backing-store \| -b` | No | | Defaults to `false` | +| `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | +| `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | +| `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | +| `--structured-mime-types \| -m` | No | `application/json` |Any valid MIME type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | +| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | + +> [!NOTE] +> It is not required to use the CLI to ad a new clients. It is possible to add a new client by adding a new entry in the `clients` section of the `kiota.config` file. See [kiota.config](#kiotaconfig) for more information. + +#### Using kiota client add + +```bash +kiota client add --api-name "graph" --client-name "graphDelegated" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +``` + +```jsonc +// Adds the following to the kiota.config file +"clients": { + "graphDelegated": { + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + // Adding for future visibility, but not required for now + /*"authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + }, + },*/ + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } +} +``` + +The resulting `kiota.config` file will look like this: + +```jsonc +{ + "name": "My application", + "apis": { + "graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "clients": { + "graphDelegated": { + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + // Adding for future visibility, but not required for now + /*"authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + }, + },*/ + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } + } + } +} +``` + +### kiota client delete + +`kiota api client` allows a developer to delete an existing client from the `kiota.config` file. The command will remove the entry from the `clients` section of parent API within the `kiota.config` file. The command has two required parameters, the name of the API and the name of the client. The command also has one optional parameter, the ability to remove the generated client. If provided, kiota will delete the folder specified at the `outputPath` from the client configuration. + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--api-name \| --api` | Yes | graph | Name of the API | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client | +| `--clean-output \| --co` | No | | Cleans the generated client | + +#### Using kiota client delete + +```bash +kiota client delete --api-name "graph" --client-name "graphDelegated" --clean-output +``` + +```jsonc +// Removes the following from the kiota.config file +"graphDelegated": { + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + // Adding for future visibility, but not required for now + /*"authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + }, + },*/ + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } +} +``` + +The resulting `kiota.config` file will look like this: + +```jsonc +{ + "name": "My application", + "version": "1.0", + "apis": { + "graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "clients": { } + } + } +} +``` + ### kiota generate -In scenarios where a developer only needs a single API or doesn't want to go through the ceremony of executing `kiota init`, it's possible to use `kiota generate` as it will create a `kiota.config` file with the values coming from the command parameters. +Now that we have a `kiota.config` file, all the parameters required to generate the code are stored in the file. The `kiota generate` command will read the `kiota.config` file and generate the code for each of the clients. + +It's also possible to specify for which API and client the code should be generated. This is useful when a project contains multiple APIs and clients. The `kiota generate --api-name "MyAPI" --client-name "MyClient"` command will read the `kiota.config` file and generate the code for the specified API and client. If it can't find the specified API or client, it will throw an error. + +In scenarios where a developer only needs a single API or doesn't want to go through the ceremony of executing `kiota init`, it's possible to use `kiota generate` and initialize a `kiota.config` file with the values coming from the command parameters. No breaking changes are required to the existing `kiota generate` command. + +#### kiota generate Parameters -#### Using `kiota generate` +> [!INFO] +> This list is only the new parameters that `kiota generate` should support. + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--app-name \| --an` | No | My application | Name of the application | +| `--api-name \| --api` | No | graph | Name of the API | +| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | + +#### Using `kiota generate` with all parameters ```bash +kiota generate --app-name "My Application" --api-name "graph" --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" ``` ```json +{ + "name": "My application", + "apis": { + "graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "clients": { + "graphDelegated": { + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + // Adding for future visibility, but not required for now + /*"authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + }, + },*/ + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } + } + } +} ``` -## Scenarios using the command line tool +#### Using kiota generate with parameters inferred from the kiota.config file + +```bash +kiota generate +``` + +#### Using kiota generate with parameters inferred from the kiota.config file for a single API + +```bash +kiota generate --api-name "graph" --client-name "graphDelegated" +``` + +#### Using kiota generate with parameters inferred when there are no kiota.config file + +```bash +kiota generate --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +``` + +```json +// This file gets generated and then `kiota generate` is executed based on these parameters +{ + "name": "Contoso.GraphApp", // Inferred from the provided --namespace-name or its default value + "apis": { + "https://graph.microsoft.com/v1.0": { // Inferred from the first server entry in the OpenAPI description + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "clients": { + "GraphClient": { // Inferred from the provided --class-name or its default value + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + // Adding for future visibility, but not required for now + /*"authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + }, + },*/ + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } + } + } +} +``` + +## End-to-end scenarios using the CLI ### Get started to generate an API ```bash -kiota init --name Myapp -kiota add api --name MyApi --openapi // Can we add using -k ? -kiota add output --name MyApi --lang csharp --outputPath ./csharpClient +kiota init --app-name "My Application" +kiota api add --api-name "My API" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" +kiota client add --api-name "My API" --clientName "graphDelegated" --language csharp --outputPath ./csharpClient kiota generate ``` ### Add a second language to generate an API ```bash -kiota add output --name MyApi --lang python --outputPath ./pythonClient -kiota generate --name MyApi --lang python // Generate just the Python client for MyApi +kiota client add --api-name "My API" --clientName "graphPython" --language python --outputPath ./pythonClient +kiota generate --api-name "My API" --client-name "graphPython" ``` -### Remove a language +### Remove a language and delete the generated code ```bash -kiota remove output --name MyApi --lang python +kiota client delete --api-name "My API" --client=name "graphPython" --clean-output ``` ### Remove an API ```bash -kiota remove api --name MyApi +kiota api delete --name "My Api" --clean-output ``` ## JSON Schema for Kiota.Config @@ -245,54 +582,52 @@ kiota remove api --name MyApi "baseUrl": { "type": "string" }, - "output": { - "type": "array", - "items": { - "type": "object", - "properties": { - "language": { - "type": "string" - }, - "outputPath": { - "type": "string" - }, - "clientClassName": { - "type": "string" - }, - "clientNamespaceName": { - "type": "string" - }, - "features": { - "type": "object", - "properties": { - "authenticationProvider": { - "type": "string" - }, - "authenticationParameters": { - "type": "object" - } + "clients": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "language": { + "type": "string" + }, + "outputPath": { + "type": "string" + }, + "clientClassName": { + "type": "string" }, - "structuredMediaTypes": { + "clientNamespaceName": { + "type": "string" + }, + "features": { "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "properties": { - "serializer": { - "type": "string" - }, - "deserializer": { - "type": "string" - } + "properties": { + "structuredMediaTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "serializers": { + "type": "array", + "items": { + "type": "string" + } + }, + "deserializers": { + "type": "array", + "items": { + "type": "string" } + }, + "usesBackingStore": { + "type": "boolean" + }, + "includeAdditionalData": { + "type": "boolean" } } - }, - "usesBackingStore": { - "type": "boolean" - }, - "includeAdditionalData": { - "type": "boolean" } } } From a89ce5cd7ce98fc26c4eea0caf0cb314c4b76588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Thu, 30 Nov 2023 16:39:05 +0000 Subject: [PATCH 004/394] Removing the initial commands table. --- specs/kiota.config.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/specs/kiota.config.md b/specs/kiota.config.md index 906a8fd653..083fb6a702 100644 --- a/specs/kiota.config.md +++ b/specs/kiota.config.md @@ -92,19 +92,6 @@ Note that in this example we added suggestions for new parameters related to aut The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html) file can be used as a replacement for the kiota.lock file as a place to capture a snapshot of what information was used to perform code generation and what APIs that gives the application access to. -## Tooling commands to manage Kiota.config - -| Command | Example | Description | -| ------------------- | ------- | ---------------- | -| init | kiota init --name `appName` | Creates a kiota.config file | -| api add | kiota api add --name `apiName` --openapi | Adds an entry for an API with passed parameters and default values | -| api delete | kiota api delete --api-name `apiName` | Removes the entire API entry with the provided name. | -| output add | kiota output add --api-name `apiName` --lang python --outputPath ./pythonClient | Adds information about a new output artifact that should be generated | -| output delete | kiota output delete --api-name `apiName` --client-name `clientName` | Removes the specified output. Has optional parameters to allow deleting the generated output. | -| generate | kiota generate | Outputs kiota.apimanifest and source for each of the output objects | - -In the past we have had both a generate and an update comment. This is because if it was the first time running, generate would set defaults for all the properties that were not set on the command line. However, now that we have output add, it can be used to set the defaults and generate can just read from the kiota.config file. - ## Commands ### kiota init From 47da551a8e1a1b999097547390c425f5330500cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Thu, 30 Nov 2023 16:40:46 +0000 Subject: [PATCH 005/394] markdown edits --- specs/kiota.config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/kiota.config.md b/specs/kiota.config.md index 083fb6a702..2a36381a05 100644 --- a/specs/kiota.config.md +++ b/specs/kiota.config.md @@ -377,7 +377,7 @@ In scenarios where a developer only needs a single API or doesn't want to go thr #### kiota generate Parameters -> [!INFO] +> [!IMPORTANT] > This list is only the new parameters that `kiota generate` should support. | Parameters | Required | Example | Description | From 4f8ba43362ef70612bc5db33ceb4b8af409db157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Thu, 30 Nov 2023 16:42:55 +0000 Subject: [PATCH 006/394] Updating code blocks to support comments --- specs/kiota.config.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/specs/kiota.config.md b/specs/kiota.config.md index 2a36381a05..c35d8f4472 100644 --- a/specs/kiota.config.md +++ b/specs/kiota.config.md @@ -111,7 +111,7 @@ The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01. kiota init --app-name "My application" ``` -```jsonc +```javascript // Creates the following kiota.config file { "name": "My application" @@ -137,7 +137,7 @@ When executing, a new API entry will be added and will use the `--api-name` para kiota api add --api-name "graph" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" ``` -```jsonc +```javascript // Adds the following to the kiota.config file "graph": { "descriptionHash": "9EDF8506CB74FE44...", @@ -149,7 +149,7 @@ kiota api add --api-name "graph" --openapi "https://raw.githubusercontent.com/mi The resulting `kiota.config` file will look like this: -```jsonc +```javascript { "name": "My application", "apis": { @@ -178,7 +178,7 @@ The resulting `kiota.config` file will look like this: kiota api delete --api-name "graph" --clean-output ``` -```jsonc +```javascript // Removes the following from the kiota.config file "graph": { "descriptionHash": "9EDF8506CB74FE44...", @@ -193,7 +193,7 @@ kiota api delete --api-name "graph" --clean-output The resulting `kiota.config` file will look like this: -```jsonc +```javascript { "name": "My application", "apis": {} @@ -227,7 +227,7 @@ The resulting `kiota.config` file will look like this: kiota client add --api-name "graph" --client-name "graphDelegated" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" ``` -```jsonc +```javascript // Adds the following to the kiota.config file "clients": { "graphDelegated": { @@ -261,7 +261,7 @@ kiota client add --api-name "graph" --client-name "graphDelegated" --language cs The resulting `kiota.config` file will look like this: -```jsonc +```javascript { "name": "My application", "apis": { @@ -351,7 +351,7 @@ kiota client delete --api-name "graph" --client-name "graphDelegated" --clean-ou The resulting `kiota.config` file will look like this: -```jsonc +```javascript { "name": "My application", "version": "1.0", @@ -392,7 +392,7 @@ In scenarios where a developer only needs a single API or doesn't want to go thr kiota generate --app-name "My Application" --api-name "graph" --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" ``` -```json +```javascript { "name": "My application", "apis": { @@ -452,7 +452,7 @@ kiota generate --api-name "graph" --client-name "graphDelegated" kiota generate --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" ``` -```json +```javascript // This file gets generated and then `kiota generate` is executed based on these parameters { "name": "Contoso.GraphApp", // Inferred from the provided --namespace-name or its default value From 36b10fd16dcdbc29070421fd22124427629b316f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Wed, 6 Dec 2023 20:15:24 +0000 Subject: [PATCH 007/394] Initial restructuring of the spec --- specs/cli/client-add.md | 165 +++++++++ specs/cli/client-edit.md | 160 ++++++++ specs/cli/client-generate.md | 66 ++++ specs/cli/client-remove.md | 49 +++ specs/cli/config-init.md | 28 ++ specs/cli/config-migrate.md | 0 specs/index.md | 19 + specs/kiota.config.md | 634 -------------------------------- specs/scenarios/kiota-config.md | 194 ++++++++++ specs/schemas/kiota.config.md | 107 ++++++ 10 files changed, 788 insertions(+), 634 deletions(-) create mode 100644 specs/cli/client-add.md create mode 100644 specs/cli/client-edit.md create mode 100644 specs/cli/client-generate.md create mode 100644 specs/cli/client-remove.md create mode 100644 specs/cli/config-init.md create mode 100644 specs/cli/config-migrate.md create mode 100644 specs/index.md delete mode 100644 specs/kiota.config.md create mode 100644 specs/scenarios/kiota-config.md create mode 100644 specs/schemas/kiota.config.md diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md new file mode 100644 index 0000000000..b4930d054a --- /dev/null +++ b/specs/cli/client-add.md @@ -0,0 +1,165 @@ +# kiota client add + +## Description + +`kiota client add` allows a developer to add a new API client to the `kiota.config` file. If no `kiota.config` file is found, a new `kiota.config` file would be created. The command will add a new entry to the `clients` section of the `kiota.config` file. Once this is done, a local copy of the OpenAPI description is generated and kepts in the . + +When executing, a new API entry will be added and will use the `--client-name` parameter as the key for the map. When loading the OpenAPI description, it will generate a hash of the description to enable change detection of the description and save it as part of the `descriptionHash` property. It will also store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. + +Every time an API client is added, a copy of the OpenAPI description file will be stored in the `./.kiota` folder. The file will be named using the hash of the description. This will allow the CLI to detect changes in the description and avoid downloading the description again if it hasn't changed. + +At the same time, an [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3) file will be generated (if non existing) or edited (if already existing) to represent the surface of the API being used. This file will be named `apimanifest.json` and will be stored in the `./.kiota` folder. This file will be used to generate the code files. + +Once the `kiota.config` file is generated, the OpenAPI description file is saved locally and the API Manifest is available, the code generation will be executed. + +## Parameters + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | +| `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | +| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | +| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | +| `--language \| -l` | Yes | csharp | The target language for the generated code files or for the information. | +| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | +| `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | +| `--backing-store \| -b` | No | | Defaults to `false` | +| `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | +| `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | +| `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | +| `--structured-mime-types \| -m` | No | `application/json` |Any valid MIME type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | +| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | + +> [!NOTE] +> It is not required to use the CLI to add new clients. It is possible to add a new client by adding a new entry in the `clients` section of the `kiota.config` file. See the [kiota.config schema](../schemas/kiota.config.md) for more information. + +## Using `kiota client add` + +```bash +kiota client add --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "**/users/**" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +``` + +```json +"clients": { + "graphDelegated": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": [], + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } +} +``` + +_The resulting `kiota.config` file will look like this:_ + +```json +{ + "version": "1.0.0", + "clients": { + "graphDelegated": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": [], + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } +} +``` + +_The resulting `apimanifest.json` file will look like this:_ + +```json +{ + "publisher": { + "name": "Microsoft Graph", + "contactEmail": "graphsdkpub@microsoft.com" + }, + "apiDependencies": { + "graphDelegated": { + "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "apiDeploymentBaseUrl": "https://graph.microsoft.com", + "apiDescriptionVersion": "v1.0", + "requests": [ + { + "method": "GET", + "uriTemplate": "/users" + }, + { + "method": "POST", + "uriTemplate": "/users" + }, + { + "method": "GET", + "uriTemplate": "/users/$count" + }, + { + "method": "GET", + "uriTemplate": "/users/{user-id}" + }, + { + "method": "PATCH", + "uriTemplate": "/users/{user-id}" + }, + { + "method": "DELETE", + "uriTemplate": "/users/{user-id}" + } + ] + } + } +} +``` + +## File structure +```bash +/ + └─.kiota + └─kiota.config + └─apimanifest.json + └─definitions + └─9EDF8506CB74FE44.yaml + └─generated + └─graph + └─csharp + └─... # Generated code files + └─GraphClient.cs +``` + +## Open Questions + +- [ ] How do we determine the `name` and `contactEmail` of the `publisher` in the API Manifest? kiota config --global? +- [ ] Can we automatically generate all `authorizationRequirements` for the endpoints selected or these are left to the developers to add? \ No newline at end of file diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md new file mode 100644 index 0000000000..a46a89030a --- /dev/null +++ b/specs/cli/client-edit.md @@ -0,0 +1,160 @@ +# kiota client edit + +## Description + +`kiota client update` allows a developer to edit an existing API client int the `kiota.config` file. If either the `kiota.config` file or if the `--client-name` client can't be found within the `kiota.config` file, the command should error out and let the developer know. + +When executing, the API entry defined by the `--client-name` parameter will be modified. All parameters should be supported and the only required one is `--client-name`. All others are optional as they would only modify the configuration of the API client. If the OpenAPI description location changed, a new hash of the description will be generated saved as part of the `descriptionHash` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively and would trigger an update to the [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3). + +Once the `kiota.config` file and the API Manifest are updated, the code generation will be executed based on the newly updated API client configuration. + +## Parameters + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | +| `--openapi \| -d` | No | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | +| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | +| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | +| `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | +| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | +| `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | +| `--backing-store \| -b` | No | | Defaults to `false` | +| `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | +| `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | +| `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | +| `--structured-mime-types \| -m` | No | `application/json` |Any valid MIME type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | +| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | + +> [!NOTE] +> It is not required to use the CLI to edit clients. It is possible to edit a client by modifying its entry in the `clients` section of the `kiota.config` file. See the [kiota.config schema](../schemas/kiota.config.md) for more information. + +## Using `kiota client edit` + +```bash +kiota client edit --client-name "graphDelegated" --class-name "GraphServiceClient" --exclude-path "/users/$count" +``` + +```json +``` + +```json +"clients": { + "graphDelegated": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": ["/users/$count"], + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphServiceClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } +} +``` + +_The resulting `kiota.config` file will look like this:_ + +```json +{ + "version": "1.0.0", + "clients": { + "graphDelegated": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": [], + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphServiceClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } +} +``` + +_The resulting `apimanifest.json` file will look like this:_ + +```json +{ + "publisher": { + "name": "Microsoft Graph", + "contactEmail": "graphsdkpub@microsoft.com" + }, + "apiDependencies": { + "graphDelegated": { + "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "apiDeploymentBaseUrl": "https://graph.microsoft.com", + "apiDescriptionVersion": "v1.0", + "requests": [ + { + "method": "GET", + "uriTemplate": "/users" + }, + { + "method": "POST", + "uriTemplate": "/users" + }, + { + "method": "GET", + "uriTemplate": "/users/{user-id}" + }, + { + "method": "PATCH", + "uriTemplate": "/users/{user-id}" + }, + { + "method": "DELETE", + "uriTemplate": "/users/{user-id}" + } + ] + } + } +} +``` + +## File structure +```bash +/ + └─.kiota + └─kiota.config + └─apimanifest.json + └─definitions + └─9EDF8506CB74FE44.yaml + └─generated + └─graph + └─csharp + └─... # Generated code files + └─GraphClient.cs +``` + +## Open Questions + +- [ ] How do we determine the `name` and `contactEmail` of the `publisher` in the API Manifest? kiota config --global? +- [ ] Can we automatically generate all `authorizationRequirements` for the endpoints selected or these are left to the developers to add? \ No newline at end of file diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md new file mode 100644 index 0000000000..5fd86967fc --- /dev/null +++ b/specs/cli/client-generate.md @@ -0,0 +1,66 @@ +# kiota client generate + +Now that we have a `kiota.config` file, all the parameters required to generate the code are stored in the file. The `kiota generate` command will read the `kiota.config` file and generate the code for each of the clients. + +It's also possible to specify for which API and client the code should be generated. This is useful when a project contains multiple APIs and clients. The `kiota generate --api-name "MyAPI" --client-name "MyClient"` command will read the `kiota.config` file and generate the code for the specified API and client. If it can't find the specified API or client, it will throw an error. + +In scenarios where a developer only needs a single API or doesn't want to go through the ceremony of executing `kiota init`, it's possible to use `kiota generate` and initialize a `kiota.config` file with the values coming from the command parameters. No breaking changes are required to the existing `kiota generate` command. + +#### kiota generate Parameters + +> [!IMPORTANT] +> This list is only the new parameters that `kiota generate` should support. + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--app-name \| --an` | No | My application | Name of the application | +| `--api-name \| --api` | No | graph | Name of the API | +| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | + +#### Using `kiota generate` with all parameters + +```bash +kiota generate --app-name "My Application" --api-name "graph" --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +``` + +```javascript +{ + "name": "My application", + "apis": { + "graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "clients": { + "graphDelegated": { + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + // Adding for future visibility, but not required for now + /*"authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + }, + },*/ + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } + } + } +} +``` \ No newline at end of file diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md new file mode 100644 index 0000000000..d7d857cd6e --- /dev/null +++ b/specs/cli/client-remove.md @@ -0,0 +1,49 @@ +# kiota client remove + +## Description + +`kiota client remove` allows a developer to remove an existing client from the `kiota.config` file. The command will remove the entry from the `clients` section of `kiota.config` file. The command has a single required parameters; the name of the client. + +The command also has one optional parameter, the ability to remove the generated client. If provided, kiota will delete the folder and its content specified at the `outputPath` from the client configuration. It will also remove the local version of the OpenAPI description file (specified by the `descriptionHash` property). The API Manifest is also updated to remove the dependency from the list of dependencies. + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client | +| `--clean-output \| --co` | No | | Cleans the generated client | + +#### Using kiota client remove + +```bash +kiota client remove --client-name "graphDelegated" --clean-output +``` + +The resulting `kiota.config` file will look like this: + +```json +{ + "version": "1.0.0", + "clients": { } +} +``` + +_The resulting `apimanifest.json` file will look like this:_ + +```json +{ + "publisher": { + "name": "Microsoft Graph", + "contactEmail": "graphsdkpub@microsoft.com" + }, + "apiDependencies": { } +} +``` + +## File structure +```bash +/ + └─.kiota + └─kiota.config + └─apimanifest.json + └─generated + └─graph +``` \ No newline at end of file diff --git a/specs/cli/config-init.md b/specs/cli/config-init.md new file mode 100644 index 0000000000..f4f3d3c12a --- /dev/null +++ b/specs/cli/config-init.md @@ -0,0 +1,28 @@ +# `kiota config init` + +## Description + +`kiota config init` creates a new kiota.config file with the provided parameters. If the file already exists, it should error out and report it to the user. As the file gets created, it should be adding a `version` property with the value of the `kiota.config` current schema version. + +When `kiota config init` is executed, a `kiota.config` file would be created in the current directory where the command is being executed. If the user wants to create the file in a different directory, they should use the `--config-file` global parameter. + +> [!NOTE] +> If a project only needs a single API, using `kiota config init` is not mandatory as generating code using the `kiota client generate` command could generate a `kiota.config` file with values coming from the `kiota client generate` command (if no `kiota.config` is present). See [kiota client generate](./client-generate.md) for more information. + +## Parameters + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--config-file \| --cf` | No | ../../kiota.config | Path to an existing `kiota.config` file. Defaults to `./` | + +## Using `kiota config init` + +```bash +kiota config init +``` +_Results in the following `kiota.config` file:_ +```json +{ + "version": "1.0.0", +} +``` \ No newline at end of file diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/specs/index.md b/specs/index.md new file mode 100644 index 0000000000..fa305ee49d --- /dev/null +++ b/specs/index.md @@ -0,0 +1,19 @@ +# Kiota Specification Repository + +This repository contains the specifications for the Kiota project. The goal of this repository is to provide a place to discuss and document the Kiota project. It will evolve over time as the project evolves. +config.md) + +## CLI + +* [kiota client add](./cli/client-add.md) +* [kiota client edit](./cli/client-edit.md) +* [kiota client update](./cli/client-update.md) +* [kiota client generate](./cli/client-generate.md) +* [kiota init](./cli/init.md) +* [kiota migrate](./cli/migrate.md) + +## Extension + +## Scenarios + +* [Kiota.Config](./scenarios/kiota. \ No newline at end of file diff --git a/specs/kiota.config.md b/specs/kiota.config.md deleted file mode 100644 index c35d8f4472..0000000000 --- a/specs/kiota.config.md +++ /dev/null @@ -1,634 +0,0 @@ -# Kiota Config - -Kiota generates client code for an API and stores parameters in a kiota.lock file. A project can contain multiple API clients, but they are independently managed. Kiota has no awareness that an app has a dependency on multiple APIs, even though that is a core use case. - -## Status - -| Date | Version | Author | Status | -| -- | -- | -- | -- | -| November 30th, 2023 | v0.3 | Sébastien Levert | Final Draft | -| November 22nd, 2023 | v0.2 | Sébastien Levert | Draft | -| September 24th, 2023 | v0.1 | Darrel Miller | Draft | - -## Current Challenges - -- Client code generation is not reproducible if API description changes -- Kiota doesn’t have a good solution for APIs that use multiple security schemes. -- Kiota doesn’t provide any support for generating auth providers with the required permissions, partially because currently we generate one client for APIs that use different schemes. How would we know which auth provider to generate. -- Kiota doesn’t have a good story for acquiring a client identifier. e.g. apikey or OAuth2 ClientId. This could be possible if the OpenIDConnect URL pointed to a dynamic registration endpoint. -- If an application has multiple kiota clients, there is currently no way perform operations that correspond to all of the clients. - -We have previously described Kiota's approach to managing API dependencies as consistent with the way people manage packages in a project. However, currently our tooling doesn't behave that way. We treat each dependency independently. - -## Proposal - -We should introduce a new Kiota.config file that holds the input parameters required to generate the API Client code. Currently kiota.lock is used to capture what the parameters were at the time of generation and can be used to regenerate based on the parameters in the file. This creates a mixture of purposes for the file. - -We did consider creating one kiota.config file as as a peer of the language project file, however, for someone who wants to generate multiple clients for an API in different languages, this would be a bit annoying. An alternative would be to allow the kiota.config file to move further up the folder structure and support generation in multiple languages from a single file. This is more consistent with what [TypeSpec](https://aka.ms/typespec) are doing and would be helpful for generating CLI and docs as well as a library. - -Here is an example of what the kiota.config file could look like. - -```json -{ - "name": "My application", - "apis": { - "Graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [], - "clients": [ - { - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - "authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - } - }, - "usesBackingStore": true, - "includeAdditionalData": true - } - } - ] - }, - "BusinessCentral": { - "descriptionHash": "810CF81EFDB5D8E065...", - "descriptionLocation": "https://.../bcoas1.0.yaml", - "includePatterns": ["/companies#GET"], - "excludePatterns": [], - "outputs": [ - { - "language": "csharp", - "outputPath": "./generated/business-central" - }, - { - "language": "python", - "outputPath": "./generated/python/business-central" - }, - { - "language": "csharp", - "outputPath": "./generated/business-central-app", - "features": { - "authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - } - } - } - } - ] - } - } -} -``` - -Note that in this example we added suggestions for new parameters related to authentication. If we are to improve the generation experience so that we read the security schemes information from the OpenAPI, then we will need to have some place to configure what providers we will use for those schemes. - -The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html) file can be used as a replacement for the kiota.lock file as a place to capture a snapshot of what information was used to perform code generation and what APIs that gives the application access to. - -## Commands - -### kiota init - -`kiota init` creates a new kiota.config file with the provided parameters. If the file already exists, it should error out and report it to the user. The initialization process has a single required parameter, the name of the application. - -> [!NOTE] -> If a project only needs a single API, using `kiota init` is not mandatory as generating code using the `kiota generate` command could generate a `kiota.config` file with values coming from the `kiota generate` command (if no `kiota.config` is present). See [kiota generate](#kiota-generate) for more information. - -| Parameters | Required | Example | Description | -| -- | -- | -- | -- | -| `--app-name \| --an` | Yes | My application | Name of the application | - -#### Using `kiota init` - -```bash -kiota init --app-name "My application" -``` - -```javascript -// Creates the following kiota.config file -{ - "name": "My application" -} -``` - -### kiota api add - -`kiota api add` allows a developer to add a new API to the `kiota.config` file. The command will add a new entry to the `apis` section of the `kiota.config` file. The command has two required parameters, the name of the API (key of the apis map) and the location of the OpenAPI description. The command also has two optional parameters, the include and exclude patterns. If provided, these will be used to filter the paths that are included in the future generation process. If not provided, all paths will be assumed. - -When executing, a new API entry will be added and will use the `--api-name` parameter as the key for the map. When loading the OpenAPI description, it will generate a hash of the description to enable change detection of the description and save it as part of the `descriptionHash` property. It will also store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. - -| Parameters | Required | Example | Description | -| -- | -- | -- | -- | -| `--api-name \| --api` | Yes | graph | Name of the API | -| `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | -| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | -| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | - -#### Using `kiota api add` - -```bash -kiota api add --api-name "graph" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" -``` - -```javascript -// Adds the following to the kiota.config file -"graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [] -} -``` - -The resulting `kiota.config` file will look like this: - -```javascript -{ - "name": "My application", - "apis": { - "graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [] - } - } -} -``` - -### kiota api delete - -`kiota api delete` allows a developer to delete an existing API from the `kiota.config` file. The command will remove the entry from the `apis` section of the `kiota.config` file. The command has one required parameter, the name of the API (key of the apis map). The command also has one optional parameter, the ability to remove generated clients. If provided, kiota will delete the folder specified at the `outputPath` from the client configuration. - -| Parameters | Required | Example | Description | -| -- | -- | -- | -- | -| `--api-name \| --api` | Yes | graph | Name of the API | -| `--clean-output \| --co` | No | | Cleans the generated clients from the API | - -#### Using kiota api delete - -```bash -kiota api delete --api-name "graph" --clean-output -``` - -```javascript -// Removes the following from the kiota.config file -"graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [], - "clients": { - // All clients - } -} -``` - -The resulting `kiota.config` file will look like this: - -```javascript -{ - "name": "My application", - "apis": {} -} -``` - -### kiota client add - -`kiota client add` allows a developer to add a new client for a specified API to the `kiota.config` file. The command will add a new entry to the `clients` section of the `kiota.config` file. The command has two required parameters, the name of the API (key of the apis map) and the location of the OpenAPI description. The command also has two optional parameters, the include and exclude patterns. If provided, these will be used to filter the paths that are included in the future generation process. If not provided, all paths will be assumed. The `kiota client add` command will never automatically invoke `kiota generate`. - -| Parameters | Required | Example | Description | -| -- | -- | -- | -- | -| `--api-name \| --api` | Yes | graph | Name of the API | -| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | -| `--language \| -l` | Yes | csharp | The target language for the generated code files or for the information. | -| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | -| `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | -| `--backing-store \| -b` | No | | Defaults to `false` | -| `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | -| `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | -| `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | -| `--structured-mime-types \| -m` | No | `application/json` |Any valid MIME type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | -| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | - -> [!NOTE] -> It is not required to use the CLI to ad a new clients. It is possible to add a new client by adding a new entry in the `clients` section of the `kiota.config` file. See [kiota.config](#kiotaconfig) for more information. - -#### Using kiota client add - -```bash -kiota client add --api-name "graph" --client-name "graphDelegated" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" -``` - -```javascript -// Adds the following to the kiota.config file -"clients": { - "graphDelegated": { - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - // Adding for future visibility, but not required for now - /*"authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - }, - },*/ - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } - } -} -``` - -The resulting `kiota.config` file will look like this: - -```javascript -{ - "name": "My application", - "apis": { - "graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [], - "clients": { - "graphDelegated": { - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - // Adding for future visibility, but not required for now - /*"authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - }, - },*/ - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } - } - } - } - } -} -``` - -### kiota client delete - -`kiota api client` allows a developer to delete an existing client from the `kiota.config` file. The command will remove the entry from the `clients` section of parent API within the `kiota.config` file. The command has two required parameters, the name of the API and the name of the client. The command also has one optional parameter, the ability to remove the generated client. If provided, kiota will delete the folder specified at the `outputPath` from the client configuration. - -| Parameters | Required | Example | Description | -| -- | -- | -- | -- | -| `--api-name \| --api` | Yes | graph | Name of the API | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client | -| `--clean-output \| --co` | No | | Cleans the generated client | - -#### Using kiota client delete - -```bash -kiota client delete --api-name "graph" --client-name "graphDelegated" --clean-output -``` - -```jsonc -// Removes the following from the kiota.config file -"graphDelegated": { - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - // Adding for future visibility, but not required for now - /*"authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - }, - },*/ - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } -} -``` - -The resulting `kiota.config` file will look like this: - -```javascript -{ - "name": "My application", - "version": "1.0", - "apis": { - "graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [], - "clients": { } - } - } -} -``` - -### kiota generate - -Now that we have a `kiota.config` file, all the parameters required to generate the code are stored in the file. The `kiota generate` command will read the `kiota.config` file and generate the code for each of the clients. - -It's also possible to specify for which API and client the code should be generated. This is useful when a project contains multiple APIs and clients. The `kiota generate --api-name "MyAPI" --client-name "MyClient"` command will read the `kiota.config` file and generate the code for the specified API and client. If it can't find the specified API or client, it will throw an error. - -In scenarios where a developer only needs a single API or doesn't want to go through the ceremony of executing `kiota init`, it's possible to use `kiota generate` and initialize a `kiota.config` file with the values coming from the command parameters. No breaking changes are required to the existing `kiota generate` command. - -#### kiota generate Parameters - -> [!IMPORTANT] -> This list is only the new parameters that `kiota generate` should support. - -| Parameters | Required | Example | Description | -| -- | -- | -- | -- | -| `--app-name \| --an` | No | My application | Name of the application | -| `--api-name \| --api` | No | graph | Name of the API | -| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | - -#### Using `kiota generate` with all parameters - -```bash -kiota generate --app-name "My Application" --api-name "graph" --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" -``` - -```javascript -{ - "name": "My application", - "apis": { - "graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [], - "clients": { - "graphDelegated": { - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - // Adding for future visibility, but not required for now - /*"authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - }, - },*/ - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } - } - } - } - } -} -``` - -#### Using kiota generate with parameters inferred from the kiota.config file - -```bash -kiota generate -``` - -#### Using kiota generate with parameters inferred from the kiota.config file for a single API - -```bash -kiota generate --api-name "graph" --client-name "graphDelegated" -``` - -#### Using kiota generate with parameters inferred when there are no kiota.config file - -```bash -kiota generate --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" -``` - -```javascript -// This file gets generated and then `kiota generate` is executed based on these parameters -{ - "name": "Contoso.GraphApp", // Inferred from the provided --namespace-name or its default value - "apis": { - "https://graph.microsoft.com/v1.0": { // Inferred from the first server entry in the OpenAPI description - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [], - "clients": { - "GraphClient": { // Inferred from the provided --class-name or its default value - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - // Adding for future visibility, but not required for now - /*"authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - }, - },*/ - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } - } - } - } - } -} -``` - -## End-to-end scenarios using the CLI - -### Get started to generate an API - -```bash -kiota init --app-name "My Application" -kiota api add --api-name "My API" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" -kiota client add --api-name "My API" --clientName "graphDelegated" --language csharp --outputPath ./csharpClient -kiota generate -``` - -### Add a second language to generate an API - -```bash -kiota client add --api-name "My API" --clientName "graphPython" --language python --outputPath ./pythonClient -kiota generate --api-name "My API" --client-name "graphPython" -``` - -### Remove a language and delete the generated code - -```bash -kiota client delete --api-name "My API" --client=name "graphPython" --clean-output -``` - -### Remove an API - -```bash -kiota api delete --name "My Api" --clean-output -``` - -## JSON Schema for Kiota.Config - -```json -{ - "$schema": "", - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "apis": { - "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "properties": { - "descriptionLocation": { - "type": "string" - }, - "descriptionHash": { - "type": "string" - } - }, - "descriptionHash": { - "type": "string" - }, - "descriptionLocation": { - "type": "string" - }, - "includePatterns": { - "type": "array", - "items": { - "type": "string" - } - }, - "excludePatterns": { - "type": "array", - "items": { - "type": "string" - } - }, - "baseUrl": { - "type": "string" - }, - "clients": { - "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "properties": { - "language": { - "type": "string" - }, - "outputPath": { - "type": "string" - }, - "clientClassName": { - "type": "string" - }, - "clientNamespaceName": { - "type": "string" - }, - "features": { - "type": "object", - "properties": { - "structuredMediaTypes": { - "type": "array", - "items": { - "type": "string" - } - }, - "serializers": { - "type": "array", - "items": { - "type": "string" - } - }, - "deserializers": { - "type": "array", - "items": { - "type": "string" - } - }, - "usesBackingStore": { - "type": "boolean" - }, - "includeAdditionalData": { - "type": "boolean" - } - } - } - } - } - } - } - }, - "disabledValidationRules": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } -} -``` diff --git a/specs/scenarios/kiota-config.md b/specs/scenarios/kiota-config.md new file mode 100644 index 0000000000..cc52a50ed2 --- /dev/null +++ b/specs/scenarios/kiota-config.md @@ -0,0 +1,194 @@ +# Kiota Config + +Kiota generates client code for an API and stores parameters in a kiota.lock file. A project can contain multiple API clients, but they are independently managed. Kiota has no awareness that an app has a dependency on multiple APIs, even though that is a core use case. + +## Status + +| Date | Version | Author | Status | +| -- | -- | -- | -- | +| November 30th, 2023 | v0.3 | Sébastien Levert | Final Draft | +| November 22nd, 2023 | v0.2 | Sébastien Levert | Draft | +| September 24th, 2023 | v0.1 | Darrel Miller | Draft | + +## Current Challenges + +- Client code generation is not reproducible if API description changes +- Kiota doesn’t have a good solution for APIs that use multiple security schemes. +- Kiota doesn’t provide any support for generating auth providers with the required permissions, partially because currently we generate one client for APIs that use different schemes. How would we know which auth provider to generate. +- Kiota doesn’t have a good story for acquiring a client identifier. e.g. apikey or OAuth2 ClientId. This could be possible if the OpenIDConnect URL pointed to a dynamic registration endpoint. +- If an application has multiple kiota clients, there is currently no way perform operations that correspond to all of the clients. + +We have previously described Kiota's approach to managing API dependencies as consistent with the way people manage packages in a project. However, currently our tooling doesn't behave that way. We treat each dependency independently. + +## Proposal + +We should introduce a new Kiota.config file that holds the input parameters required to generate the API Client code. Currently kiota.lock is used to capture what the parameters were at the time of generation and can be used to regenerate based on the parameters in the file. This creates a mixture of purposes for the file. + +We did consider creating one kiota.config file as as a peer of the language project file, however, for someone who wants to generate multiple clients for an API in different languages, this would be a bit annoying. An alternative would be to allow the kiota.config file to move further up the folder structure and support generation in multiple languages from a single file. This is more consistent with what [TypeSpec](https://aka.ms/typespec) are doing and would be helpful for generating CLI and docs as well as a library. + +Here is an example of what the kiota.config file could look like. + +```json +{ + "name": "My application", + "apis": { + "Graph": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "clients": [ + { + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + } + }, + "usesBackingStore": true, + "includeAdditionalData": true + } + } + ] + }, + "BusinessCentral": { + "descriptionHash": "810CF81EFDB5D8E065...", + "descriptionLocation": "https://.../bcoas1.0.yaml", + "includePatterns": ["/companies#GET"], + "excludePatterns": [], + "outputs": [ + { + "language": "csharp", + "outputPath": "./generated/business-central" + }, + { + "language": "python", + "outputPath": "./generated/python/business-central" + }, + { + "language": "csharp", + "outputPath": "./generated/business-central-app", + "features": { + "authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + } + } + } + } + ] + } + } +} +``` + +Note that in this example we added suggestions for new parameters related to authentication. If we are to improve the generation experience so that we read the security schemes information from the OpenAPI, then we will need to have some place to configure what providers we will use for those schemes. + +The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html) file can be used as a replacement for the kiota.lock file as a place to capture a snapshot of what information was used to perform code generation and what APIs that gives the application access to. + +## Commands + +* [kiota config init](../cli/init.md) +* [kiota client add](../cli/client-add.md) +* [kiota client edit](../cli/client-edit.md) +* [kiota client generate](../cli/client-remove.md) +* [kiota client remove](../cli/client-remove.md) + +## End-to-end experience + +#### Using kiota generate with parameters inferred from the kiota.config file + +```bash +kiota generate +``` + +#### Using kiota generate with parameters inferred from the kiota.config file for a single API + +```bash +kiota generate --api-name "graph" --client-name "graphDelegated" +``` + +#### Using kiota generate with parameters inferred when there are no kiota.config file + +```bash +kiota generate --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +``` + +```javascript +// This file gets generated and then `kiota generate` is executed based on these parameters +{ + "name": "Contoso.GraphApp", // Inferred from the provided --namespace-name or its default value + "apis": { + "https://graph.microsoft.com/v1.0": { // Inferred from the first server entry in the OpenAPI description + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://.../openapi.yaml", + "includePatterns": ["/me/chats#GET", "/me#GET"], + "excludePatterns": [], + "clients": { + "GraphClient": { // Inferred from the provided --class-name or its default value + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + // Adding for future visibility, but not required for now + /*"authentication": { + "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", + "authenticationParameters": { + "clientId": "guid" + }, + },*/ + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } + } + } +} +``` + +## End-to-end scenarios using the CLI + +### Get started to generate an API + +```bash +kiota init --app-name "My Application" +kiota api add --api-name "My API" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" +kiota client add --api-name "My API" --clientName "graphDelegated" --language csharp --outputPath ./csharpClient +kiota generate +``` + +### Add a second language to generate an API + +```bash +kiota client add --api-name "My API" --clientName "graphPython" --language python --outputPath ./pythonClient +kiota generate --api-name "My API" --client-name "graphPython" +``` + +### Remove a language and delete the generated code + +```bash +kiota client delete --api-name "My API" --client=name "graphPython" --clean-output +``` + +### Remove an API + +```bash +kiota api delete --name "My Api" --clean-output +``` diff --git a/specs/schemas/kiota.config.md b/specs/schemas/kiota.config.md new file mode 100644 index 0000000000..a3ff5308ce --- /dev/null +++ b/specs/schemas/kiota.config.md @@ -0,0 +1,107 @@ +## JSON Schema for kiota.config + +```json +{ + "$schema": "", + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "apis": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "descriptionLocation": { + "type": "string" + }, + "descriptionHash": { + "type": "string" + } + }, + "descriptionHash": { + "type": "string" + }, + "descriptionLocation": { + "type": "string" + }, + "includePatterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "excludePatterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "baseUrl": { + "type": "string" + }, + "clients": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "language": { + "type": "string" + }, + "outputPath": { + "type": "string" + }, + "clientClassName": { + "type": "string" + }, + "clientNamespaceName": { + "type": "string" + }, + "features": { + "type": "object", + "properties": { + "structuredMediaTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "serializers": { + "type": "array", + "items": { + "type": "string" + } + }, + "deserializers": { + "type": "array", + "items": { + "type": "string" + } + }, + "usesBackingStore": { + "type": "boolean" + }, + "includeAdditionalData": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "disabledValidationRules": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } +} +``` \ No newline at end of file From e805390877d75a9559ead9b47f3d85f8ed63640d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Thu, 7 Dec 2023 19:23:26 +0000 Subject: [PATCH 008/394] Updated version of the spec --- specs/cli/client-add.md | 64 +++++------ specs/cli/client-edit.md | 74 ++++++------- specs/cli/client-generate.md | 73 ++++--------- specs/cli/client-remove.md | 11 +- specs/cli/config-init.md | 19 ++-- specs/cli/config-migrate.md | 185 ++++++++++++++++++++++++++++++++ specs/index.md | 8 +- specs/scenarios/kiota-config.md | 108 ++++--------------- specs/schemas/kiota.config.md | 4 +- 9 files changed, 323 insertions(+), 223 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index b4930d054a..3f085e5607 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -2,7 +2,7 @@ ## Description -`kiota client add` allows a developer to add a new API client to the `kiota.config` file. If no `kiota.config` file is found, a new `kiota.config` file would be created. The command will add a new entry to the `clients` section of the `kiota.config` file. Once this is done, a local copy of the OpenAPI description is generated and kepts in the . +`kiota client add` allows a developer to add a new API client to the `kiota-config.json` file. If no `kiota-config.json` file is found, a new `kiota-config.json` file would be created. The command will add a new entry to the `clients` section of the `kiota-config.json` file. Once this is done, a local copy of the OpenAPI description is generated and kepts in the . When executing, a new API entry will be added and will use the `--client-name` parameter as the key for the map. When loading the OpenAPI description, it will generate a hash of the description to enable change detection of the description and save it as part of the `descriptionHash` property. It will also store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. @@ -10,12 +10,13 @@ Every time an API client is added, a copy of the OpenAPI description file will b At the same time, an [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3) file will be generated (if non existing) or edited (if already existing) to represent the surface of the API being used. This file will be named `apimanifest.json` and will be stored in the `./.kiota` folder. This file will be used to generate the code files. -Once the `kiota.config` file is generated, the OpenAPI description file is saved locally and the API Manifest is available, the code generation will be executed. +Once the `kiota-config.json` file is generated, the OpenAPI description file is saved locally and the API Manifest is available, the code generation will be executed. ## Parameters | Parameters | Required | Example | Description | | -- | -- | -- | -- | +| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | | `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | @@ -28,10 +29,11 @@ Once the `kiota.config` file is generated, the OpenAPI description file is saved | `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | | `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | | `--structured-mime-types \| -m` | No | `application/json` |Any valid MIME type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | +| `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | | `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | > [!NOTE] -> It is not required to use the CLI to add new clients. It is possible to add a new client by adding a new entry in the `clients` section of the `kiota.config` file. See the [kiota.config schema](../schemas/kiota.config.md) for more information. +> It is not required to use the CLI to add new clients. It is possible to add a new client by adding a new entry in the `clients` section of the `kiota-config.json` file. See the [kiota-config.json schema](../schemas/kiota-config.json.md) for more information. ## Using `kiota client add` @@ -39,37 +41,39 @@ Once the `kiota.config` file is generated, the OpenAPI description file is saved kiota client add --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "**/users/**" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" ``` -```json -"clients": { - "graphDelegated": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", - "includePatterns": ["**/users/**"], - "excludePatterns": [], - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true +```jsonc +{ + "clients": { + "graphDelegated": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": [], + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } } } } ``` -_The resulting `kiota.config` file will look like this:_ +_The resulting `kiota-config.json` file will look like this:_ -```json +```jsonc { "version": "1.0.0", "clients": { @@ -102,7 +106,7 @@ _The resulting `kiota.config` file will look like this:_ _The resulting `apimanifest.json` file will look like this:_ -```json +```jsonc { "publisher": { "name": "Microsoft Graph", @@ -148,7 +152,7 @@ _The resulting `apimanifest.json` file will look like this:_ ```bash / └─.kiota - └─kiota.config + └─kiota-config.json └─apimanifest.json └─definitions └─9EDF8506CB74FE44.yaml diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index a46a89030a..6968831f40 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -2,16 +2,17 @@ ## Description -`kiota client update` allows a developer to edit an existing API client int the `kiota.config` file. If either the `kiota.config` file or if the `--client-name` client can't be found within the `kiota.config` file, the command should error out and let the developer know. +`kiota client update` allows a developer to edit an existing API client int the `kiota-config.json` file. If either the `kiota-config.json` file or if the `--client-name` client can't be found within the `kiota-config.json` file, the command should error out and let the developer know. When executing, the API entry defined by the `--client-name` parameter will be modified. All parameters should be supported and the only required one is `--client-name`. All others are optional as they would only modify the configuration of the API client. If the OpenAPI description location changed, a new hash of the description will be generated saved as part of the `descriptionHash` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively and would trigger an update to the [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3). -Once the `kiota.config` file and the API Manifest are updated, the code generation will be executed based on the newly updated API client configuration. +Once the `kiota-config.json` file and the API Manifest are updated, the code generation will be executed based on the newly updated API client configuration. ## Parameters | Parameters | Required | Example | Description | | -- | -- | -- | -- | +| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | | `--openapi \| -d` | No | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | @@ -24,10 +25,11 @@ Once the `kiota.config` file and the API Manifest are updated, the code generati | `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | | `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | | `--structured-mime-types \| -m` | No | `application/json` |Any valid MIME type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | +| `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | | `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | > [!NOTE] -> It is not required to use the CLI to edit clients. It is possible to edit a client by modifying its entry in the `clients` section of the `kiota.config` file. See the [kiota.config schema](../schemas/kiota.config.md) for more information. +> It is not required to use the CLI to edit clients. It is possible to edit a client by modifying its entry in the `clients` section of the `kiota-config.json` file. See the [kiota-config.json schema](../schemas/kiota-config.json.md) for more information. ## Using `kiota client edit` @@ -35,40 +37,39 @@ Once the `kiota.config` file and the API Manifest are updated, the code generati kiota client edit --client-name "graphDelegated" --class-name "GraphServiceClient" --exclude-path "/users/$count" ``` -```json -``` - -```json -"clients": { - "graphDelegated": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", - "includePatterns": ["**/users/**"], - "excludePatterns": ["/users/$count"], - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphServiceClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true +```jsonc +{ + "clients": { + "graphDelegated": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": ["/users/$count"], + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphServiceClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } } } } ``` -_The resulting `kiota.config` file will look like this:_ +_The resulting `kiota-config.json` file will look like this:_ -```json +```jsonc { "version": "1.0.0", "clients": { @@ -101,7 +102,7 @@ _The resulting `kiota.config` file will look like this:_ _The resulting `apimanifest.json` file will look like this:_ -```json +```jsonc { "publisher": { "name": "Microsoft Graph", @@ -143,7 +144,7 @@ _The resulting `apimanifest.json` file will look like this:_ ```bash / └─.kiota - └─kiota.config + └─kiota-config.json └─apimanifest.json └─definitions └─9EDF8506CB74FE44.yaml @@ -152,9 +153,4 @@ _The resulting `apimanifest.json` file will look like this:_ └─csharp └─... # Generated code files └─GraphClient.cs -``` - -## Open Questions - -- [ ] How do we determine the `name` and `contactEmail` of the `publisher` in the API Manifest? kiota config --global? -- [ ] Can we automatically generate all `authorizationRequirements` for the endpoints selected or these are left to the developers to add? \ No newline at end of file +``` \ No newline at end of file diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index 5fd86967fc..73a6274eb9 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -1,66 +1,37 @@ # kiota client generate -Now that we have a `kiota.config` file, all the parameters required to generate the code are stored in the file. The `kiota generate` command will read the `kiota.config` file and generate the code for each of the clients. +## Description -It's also possible to specify for which API and client the code should be generated. This is useful when a project contains multiple APIs and clients. The `kiota generate --api-name "MyAPI" --client-name "MyClient"` command will read the `kiota.config` file and generate the code for the specified API and client. If it can't find the specified API or client, it will throw an error. +Now that we have a `kiota-config.json` file, all the parameters required to generate the code are stored in the file. The `kiota client generate` command will read the `kiota-config.json` file and generate the code for each of the available clients. -In scenarios where a developer only needs a single API or doesn't want to go through the ceremony of executing `kiota init`, it's possible to use `kiota generate` and initialize a `kiota.config` file with the values coming from the command parameters. No breaking changes are required to the existing `kiota generate` command. +It's also possible to specify for which API and client the code should be generated. This is useful when a project contains multiple clients. The `kiota client generate --client-name "MyClient"` command will read the `kiota-config.json` file and generate the code for the specified client. If it can't find the specified API or client, it will throw an error. -#### kiota generate Parameters +In general cases, the `kiota client generate` command will generate the code for all the clients in the `kiota-config.json` file based on the cached OpenAPI description. If the `--refresh` parameter is provided, the command will refresh the cached OpenAPI description(s), update the different `descriptionHash` and then generate the code for the specified clients. -> [!IMPORTANT] -> This list is only the new parameters that `kiota generate` should support. +## Parameters | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--app-name \| --an` | No | My application | Name of the application | -| `--api-name \| --api` | No | graph | Name of the API | +| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | | `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | +| `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | -#### Using `kiota generate` with all parameters +## Usage + +### Using `kiota client generate` for a single API client + +```bash +kiota client generate --client-name "graphDelegated" +``` + +### Using `kiota client generate` for all API clients ```bash -kiota generate --app-name "My Application" --api-name "graph" --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +kiota client generate ``` -```javascript -{ - "name": "My application", - "apis": { - "graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [], - "clients": { - "graphDelegated": { - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - // Adding for future visibility, but not required for now - /*"authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - }, - },*/ - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } - } - } - } - } -} -``` \ No newline at end of file +### Using `kiota client generate` for all API clients and refresh their descriptions + +```bash +kiota client generate +``` diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md index d7d857cd6e..32cb2fea46 100644 --- a/specs/cli/client-remove.md +++ b/specs/cli/client-remove.md @@ -2,12 +2,13 @@ ## Description -`kiota client remove` allows a developer to remove an existing client from the `kiota.config` file. The command will remove the entry from the `clients` section of `kiota.config` file. The command has a single required parameters; the name of the client. +`kiota client remove` allows a developer to remove an existing client from the `kiota-config.json` file. The command will remove the entry from the `clients` section of `kiota-config.json` file. The command has a single required parameters; the name of the client. The command also has one optional parameter, the ability to remove the generated client. If provided, kiota will delete the folder and its content specified at the `outputPath` from the client configuration. It will also remove the local version of the OpenAPI description file (specified by the `descriptionHash` property). The API Manifest is also updated to remove the dependency from the list of dependencies. | Parameters | Required | Example | Description | | -- | -- | -- | -- | +| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client | | `--clean-output \| --co` | No | | Cleans the generated client | @@ -17,9 +18,9 @@ The command also has one optional parameter, the ability to remove the generated kiota client remove --client-name "graphDelegated" --clean-output ``` -The resulting `kiota.config` file will look like this: +The resulting `kiota-config.json` file will look like this: -```json +```jsonc { "version": "1.0.0", "clients": { } @@ -28,7 +29,7 @@ The resulting `kiota.config` file will look like this: _The resulting `apimanifest.json` file will look like this:_ -```json +```jsonc { "publisher": { "name": "Microsoft Graph", @@ -42,7 +43,7 @@ _The resulting `apimanifest.json` file will look like this:_ ```bash / └─.kiota - └─kiota.config + └─kiota-config.json └─apimanifest.json └─generated └─graph diff --git a/specs/cli/config-init.md b/specs/cli/config-init.md index f4f3d3c12a..3e1bc6fa09 100644 --- a/specs/cli/config-init.md +++ b/specs/cli/config-init.md @@ -2,27 +2,34 @@ ## Description -`kiota config init` creates a new kiota.config file with the provided parameters. If the file already exists, it should error out and report it to the user. As the file gets created, it should be adding a `version` property with the value of the `kiota.config` current schema version. +`kiota config init` creates a new kiota-config.json file with the provided parameters. If the file already exists, it should error out and report it to the user. As the file gets created, it should be adding a `version` property with the value of the `kiota-config.json` current schema version. -When `kiota config init` is executed, a `kiota.config` file would be created in the current directory where the command is being executed. If the user wants to create the file in a different directory, they should use the `--config-file` global parameter. +When `kiota config init` is executed, a `kiota-config.json` file would be created in the current directory where the command is being executed. If the user wants to create the file in a different directory, they should use the `--config-file` global parameter. > [!NOTE] -> If a project only needs a single API, using `kiota config init` is not mandatory as generating code using the `kiota client generate` command could generate a `kiota.config` file with values coming from the `kiota client generate` command (if no `kiota.config` is present). See [kiota client generate](./client-generate.md) for more information. +> If a project only needs a single API, using `kiota config init` is not mandatory as generating code using the `kiota client generate` command could generate a `kiota-config.json` file with values coming from the `kiota client generate` command (if no `kiota-config.json` is present). See [kiota client generate](./client-generate.md) for more information. ## Parameters | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-file \| --cf` | No | ../../kiota.config | Path to an existing `kiota.config` file. Defaults to `./` | +| `--config-file \| --cf` | No | ../../kiota-config.json | Path to an existing `kiota-config.json` file. Defaults to `./` | ## Using `kiota config init` ```bash kiota config init ``` -_Results in the following `kiota.config` file:_ -```json +_Results in the following `kiota-config.json` file:_ +```jsonc { "version": "1.0.0", } +``` + +## File structure +```bash +/ + └─.kiota + └─kiota-config.json ``` \ No newline at end of file diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index e69de29bb2..26f67bfc84 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -0,0 +1,185 @@ +# `kiota config migrate` + +This command is valuable in cases where a code base was created with Kiota v1.0 and needs to be migrated to the latest version of Kiota. The `kiota config migrate` command will identify and locate the closest `kiota-config.json` file available. If a file can't be found, it would initialize a new `kiota-config.json` file. Then, it would identify all `kiota-lock.json` files that are within this folder structure and add each of them to the `kiota-config.json` file. Adding the clients to the `kiota-config.json` file would not trigger the generation as it only affects the `kiota-config.json` file. The `kiota client generate` command would need to be executed to generate the code for the clients. + +## Parameters + +| Parameters | Required | Example | Description | +| -- | -- | -- | -- | +| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | +| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | +| `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | + +## Using `kiota config migrate` + +Assuming the following folder structure: +```bash +/ + └─generated + └─graph + └─csharp + └─... # Generated code files + └─GraphClient.cs + └─kiota-lock.json + └─python + └─... # Generated code files + └─graph_client.py + └─kiota-lock.json +``` + +```bash +kiota config migrate +``` + +_The resulting `kiota-config.json` file will look like this:_ + +```jsonc +{ + "version": "1.0.0", + "clients": { + "csharpGraphServiceClient": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": [], + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphServiceClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + }, + "pythonGraphServiceClient": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": [], + "language": "python", + "outputPath": "./generated/graph/python", + "clientClassName": "GraphServiceClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } +} +``` + +_The resulting `apimanifest.json` file will look like this:_ + +```jsonc +{ + "publisher": { + "name": "Microsoft Graph", + "contactEmail": "graphsdkpub@microsoft.com" + }, + "apiDependencies": { + "graphDelegated": { + "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "apiDeploymentBaseUrl": "https://graph.microsoft.com", + "apiDescriptionVersion": "v1.0", + "requests": [ + { + "method": "GET", + "uriTemplate": "/users" + }, + { + "method": "POST", + "uriTemplate": "/users" + }, + { + "method": "GET", + "uriTemplate": "/users/$count" + }, + { + "method": "GET", + "uriTemplate": "/users/{user-id}" + }, + { + "method": "PATCH", + "uriTemplate": "/users/{user-id}" + }, + { + "method": "DELETE", + "uriTemplate": "/users/{user-id}" + } + ] + } + } +} +``` + +## Using `kiota config migrate` for a specific `kiota-lock.json` file and a specific client name + +Assuming the following folder structure: +```bash +/ + └─generated + └─graph + └─csharp + └─... # Generated code files + └─GraphClient.cs + └─kiota-lock.json + └─python + └─... # Generated code files + └─graph_client.py + └─kiota-lock.json +``` + +```bash +kiota config migrate --lock-location ./generated/graph/csharp/kiota-lock.json --client-name graphDelegated +``` + +_The resulting `kiota-config.json` file will look like this:_ + +```jsonc +{ + "version": "1.0.0", + "clients": { + "graphDelegated": { + "descriptionHash": "9EDF8506CB74FE44...", + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], + "excludePatterns": [], + "language": "csharp", + "outputPath": "./generated/graph/csharp", + "clientClassName": "GraphServiceClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } + } + } +} \ No newline at end of file diff --git a/specs/index.md b/specs/index.md index fa305ee49d..efa47455b1 100644 --- a/specs/index.md +++ b/specs/index.md @@ -7,13 +7,13 @@ config.md) * [kiota client add](./cli/client-add.md) * [kiota client edit](./cli/client-edit.md) -* [kiota client update](./cli/client-update.md) +* [kiota client remove](./cli/client-remove.md) * [kiota client generate](./cli/client-generate.md) -* [kiota init](./cli/init.md) -* [kiota migrate](./cli/migrate.md) +* [kiota config init](./cli/config-init.md) +* [kiota config migrate](./cli/config-migrate.md) ## Extension ## Scenarios -* [Kiota.Config](./scenarios/kiota. \ No newline at end of file +* [Kiota Config](./scenarios/kiota.config.md) \ No newline at end of file diff --git a/specs/scenarios/kiota-config.md b/specs/scenarios/kiota-config.md index cc52a50ed2..34372e89ae 100644 --- a/specs/scenarios/kiota-config.md +++ b/specs/scenarios/kiota-config.md @@ -1,34 +1,24 @@ # Kiota Config -Kiota generates client code for an API and stores parameters in a kiota.lock file. A project can contain multiple API clients, but they are independently managed. Kiota has no awareness that an app has a dependency on multiple APIs, even though that is a core use case. - -## Status - -| Date | Version | Author | Status | -| -- | -- | -- | -- | -| November 30th, 2023 | v0.3 | Sébastien Levert | Final Draft | -| November 22nd, 2023 | v0.2 | Sébastien Levert | Draft | -| September 24th, 2023 | v0.1 | Darrel Miller | Draft | +Kiota generates client code for an API and stores parameters in a kiota-lock.json file. A project can contain multiple API clients, but they are independently managed. Kiota has no awareness that an app has a dependency on multiple APIs, even though that is a core use case. ## Current Challenges - Client code generation is not reproducible if API description changes -- Kiota doesn’t have a good solution for APIs that use multiple security schemes. -- Kiota doesn’t provide any support for generating auth providers with the required permissions, partially because currently we generate one client for APIs that use different schemes. How would we know which auth provider to generate. -- Kiota doesn’t have a good story for acquiring a client identifier. e.g. apikey or OAuth2 ClientId. This could be possible if the OpenIDConnect URL pointed to a dynamic registration endpoint. -- If an application has multiple kiota clients, there is currently no way perform operations that correspond to all of the clients. +- Kiota doesn't have an obvious solution for APIs that use multiple security schemes. +- Kiota doesn't have an obvious solution for projects utilizing multiple APIs. We have previously described Kiota's approach to managing API dependencies as consistent with the way people manage packages in a project. However, currently our tooling doesn't behave that way. We treat each dependency independently. ## Proposal -We should introduce a new Kiota.config file that holds the input parameters required to generate the API Client code. Currently kiota.lock is used to capture what the parameters were at the time of generation and can be used to regenerate based on the parameters in the file. This creates a mixture of purposes for the file. +We should introduce a new Kiota.config file that holds the input parameters required to generate the API Client code. Currently kiota-lock.json is used to capture what the parameters were at the time of generation and can be used to regenerate based on the parameters in the file. This creates a mixture of purposes for the file. -We did consider creating one kiota.config file as as a peer of the language project file, however, for someone who wants to generate multiple clients for an API in different languages, this would be a bit annoying. An alternative would be to allow the kiota.config file to move further up the folder structure and support generation in multiple languages from a single file. This is more consistent with what [TypeSpec](https://aka.ms/typespec) are doing and would be helpful for generating CLI and docs as well as a library. +We did consider creating one kiota-config.json file as as a peer of the language project file, however, for someone who wants to generate multiple clients for an API in different languages, this would be a bit annoying. An alternative would be to allow the kiota-config.json file to move further up the folder structure and support generation in multiple languages from a single file. This is more consistent with what [TypeSpec](https://aka.ms/typespec) are doing and would be helpful for generating CLI and docs as well as a library. -Here is an example of what the kiota.config file could look like. +Here is an example of what the kiota-config.json file could look like. -```json +```jsonc { "name": "My application", "apis": { @@ -90,105 +80,51 @@ Here is an example of what the kiota.config file could look like. Note that in this example we added suggestions for new parameters related to authentication. If we are to improve the generation experience so that we read the security schemes information from the OpenAPI, then we will need to have some place to configure what providers we will use for those schemes. -The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html) file can be used as a replacement for the kiota.lock file as a place to capture a snapshot of what information was used to perform code generation and what APIs that gives the application access to. +The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html) file can be used as a replacement for the kiota-lock.json file as a place to capture a snapshot of what information was used to perform code generation and what APIs that gives the application access to. ## Commands * [kiota config init](../cli/init.md) * [kiota client add](../cli/client-add.md) * [kiota client edit](../cli/client-edit.md) -* [kiota client generate](../cli/client-remove.md) +* [kiota client generate](../cli/client-generate.md) * [kiota client remove](../cli/client-remove.md) ## End-to-end experience -#### Using kiota generate with parameters inferred from the kiota.config file +### Migrate a project that uses Kiota v1.x ```bash -kiota generate +kiota config migrate ``` -#### Using kiota generate with parameters inferred from the kiota.config file for a single API +### Get started to generate an API client ```bash -kiota generate --api-name "graph" --client-name "graphDelegated" +kiota client init +kiota client add --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --language csharp --output "./csharpClient" ``` -#### Using kiota generate with parameters inferred when there are no kiota.config file +### Add a second API client ```bash -kiota generate --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "/me/chats#GET" --include-path "/me#GET" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +kiota client add --clientName "graphPython" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --language python --outputPath ./pythonClient ``` -```javascript -// This file gets generated and then `kiota generate` is executed based on these parameters -{ - "name": "Contoso.GraphApp", // Inferred from the provided --namespace-name or its default value - "apis": { - "https://graph.microsoft.com/v1.0": { // Inferred from the first server entry in the OpenAPI description - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], - "excludePatterns": [], - "clients": { - "GraphClient": { // Inferred from the provided --class-name or its default value - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - // Adding for future visibility, but not required for now - /*"authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - }, - },*/ - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } - } - } - } - } -} -``` - -## End-to-end scenarios using the CLI - -### Get started to generate an API +### Edit an API client ```bash -kiota init --app-name "My Application" -kiota api add --api-name "My API" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" -kiota client add --api-name "My API" --clientName "graphDelegated" --language csharp --outputPath ./csharpClient -kiota generate -``` - -### Add a second language to generate an API - -```bash -kiota client add --api-name "My API" --clientName "graphPython" --language python --outputPath ./pythonClient -kiota generate --api-name "My API" --client-name "graphPython" +kiota client edit --client-name "graphDelegated" --class-name "GraphServiceClient" --exclude-path "/users/$count" ``` ### Remove a language and delete the generated code ```bash -kiota client delete --api-name "My API" --client=name "graphPython" --clean-output +kiota client delete --client=name "graphPython" --clean-output ``` -### Remove an API +### Generate code for all API clients ```bash -kiota api delete --name "My Api" --clean-output -``` +kiota client generate +``` \ No newline at end of file diff --git a/specs/schemas/kiota.config.md b/specs/schemas/kiota.config.md index a3ff5308ce..c48437a85b 100644 --- a/specs/schemas/kiota.config.md +++ b/specs/schemas/kiota.config.md @@ -1,6 +1,6 @@ -## JSON Schema for kiota.config +## JSON Schema for kiota-config.json -```json +```jsonc { "$schema": "", "type": "object", From f304b137c0f964db19e7ea6dc64d6d29f7cca50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 8 Dec 2023 18:01:27 +0000 Subject: [PATCH 009/394] Updating specs based on review comments --- specs/cli/client-add.md | 61 ++++-------------- specs/cli/client-edit.md | 10 +-- specs/cli/client-generate.md | 2 +- specs/cli/client-remove.md | 6 +- specs/cli/config-init.md | 2 +- specs/cli/config-migrate.md | 86 ++++++++++++++++++++++--- specs/index.md | 6 +- specs/scenarios/kiota-config.md | 73 ++++++++-------------- specs/schemas/kiota-config.json | 87 ++++++++++++++++++++++++++ specs/schemas/kiota.config.md | 107 -------------------------------- 10 files changed, 217 insertions(+), 223 deletions(-) create mode 100644 specs/schemas/kiota-config.json delete mode 100644 specs/schemas/kiota.config.md diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index 3f085e5607..ef65baa62b 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -2,23 +2,24 @@ ## Description -`kiota client add` allows a developer to add a new API client to the `kiota-config.json` file. If no `kiota-config.json` file is found, a new `kiota-config.json` file would be created. The command will add a new entry to the `clients` section of the `kiota-config.json` file. Once this is done, a local copy of the OpenAPI description is generated and kepts in the . +`kiota client add` allows a developer to add a new API client to the `kiota-config.json` file. If no `kiota-config.json` file is found, a new `kiota-config.json` file would be created in thr current working directory. The command will add a new entry to the `clients` section of the `kiota-config.json` file. Once this is done, a local copy of the OpenAPI description is generated and kept in the `.kiota/descriptions` folder. When executing, a new API entry will be added and will use the `--client-name` parameter as the key for the map. When loading the OpenAPI description, it will generate a hash of the description to enable change detection of the description and save it as part of the `descriptionHash` property. It will also store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. -Every time an API client is added, a copy of the OpenAPI description file will be stored in the `./.kiota` folder. The file will be named using the hash of the description. This will allow the CLI to detect changes in the description and avoid downloading the description again if it hasn't changed. +Every time an API client is added, a copy of the OpenAPI description file will be stored in the `./.kiota/{client-name}` folder. The files will be named using the API client name. This will allow the CLI to detect changes in the description and avoid downloading the description again if it hasn't changed. -At the same time, an [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3) file will be generated (if non existing) or edited (if already existing) to represent the surface of the API being used. This file will be named `apimanifest.json` and will be stored in the `./.kiota` folder. This file will be used to generate the code files. +At the same time, an [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3) file will be generated (if non existing) or edited (if already existing) to represent the surface of the API being used. This file will be named `apimanifest.json` and next to the `kiota-config.json`. This file will be used to generate the code files. -Once the `kiota-config.json` file is generated, the OpenAPI description file is saved locally and the API Manifest is available, the code generation will be executed. +Once the `kiota-config.json` file is generated and the OpenAPI description file is saved locally, the code generation will be executed and then the API Manifest would become available. ## Parameters | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | +| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | | `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | +| `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | | `--language \| -l` | Yes | csharp | The target language for the generated code files or for the information. | @@ -41,36 +42,6 @@ Once the `kiota-config.json` file is generated, the OpenAPI description file is kiota client add --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "**/users/**" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" ``` -```jsonc -{ - "clients": { - "graphDelegated": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", - "includePatterns": ["**/users/**"], - "excludePatterns": [], - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } - } - } -} -``` - _The resulting `kiota-config.json` file will look like this:_ ```jsonc @@ -108,12 +79,9 @@ _The resulting `apimanifest.json` file will look like this:_ ```jsonc { - "publisher": { - "name": "Microsoft Graph", - "contactEmail": "graphsdkpub@microsoft.com" - }, "apiDependencies": { "graphDelegated": { + "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", @@ -152,18 +120,13 @@ _The resulting `apimanifest.json` file will look like this:_ ```bash / └─.kiota - └─kiota-config.json - └─apimanifest.json └─definitions - └─9EDF8506CB74FE44.yaml + └─graphDelegated.yaml └─generated └─graph └─csharp └─... # Generated code files - └─GraphClient.cs -``` - -## Open Questions - -- [ ] How do we determine the `name` and `contactEmail` of the `publisher` in the API Manifest? kiota config --global? -- [ ] Can we automatically generate all `authorizationRequirements` for the endpoints selected or these are left to the developers to add? \ No newline at end of file + └─GraphClient.cs + └─apimanifest.json + └─kiota-config.json +``` \ No newline at end of file diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index 6968831f40..f7567efbba 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -12,7 +12,7 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | +| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | | `--openapi \| -d` | No | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | @@ -144,13 +144,13 @@ _The resulting `apimanifest.json` file will look like this:_ ```bash / └─.kiota - └─kiota-config.json - └─apimanifest.json └─definitions - └─9EDF8506CB74FE44.yaml + └─graphDelegated.yaml └─generated └─graph └─csharp └─... # Generated code files - └─GraphClient.cs + └─GraphClient.cs + └─apimanifest.json + └─kiota-config.json ``` \ No newline at end of file diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index 73a6274eb9..0ae06afe91 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -12,7 +12,7 @@ In general cases, the `kiota client generate` command will generate the code for | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | +| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | | `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | | `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md index 32cb2fea46..fdc8fc3520 100644 --- a/specs/cli/client-remove.md +++ b/specs/cli/client-remove.md @@ -8,7 +8,7 @@ The command also has one optional parameter, the ability to remove the generated | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | +| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client | | `--clean-output \| --co` | No | | Cleans the generated client | @@ -43,8 +43,8 @@ _The resulting `apimanifest.json` file will look like this:_ ```bash / └─.kiota - └─kiota-config.json - └─apimanifest.json └─generated └─graph + └─kiota-config.json + └─apimanifest.json ``` \ No newline at end of file diff --git a/specs/cli/config-init.md b/specs/cli/config-init.md index 3e1bc6fa09..939e7c3705 100644 --- a/specs/cli/config-init.md +++ b/specs/cli/config-init.md @@ -13,7 +13,7 @@ When `kiota config init` is executed, a `kiota-config.json` file would be create | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-file \| --cf` | No | ../../kiota-config.json | Path to an existing `kiota-config.json` file. Defaults to `./` | +| `--config-location \| --cf` | No | ../../ | Path to a folder containing an existing `kiota-config.json` file. Defaults to `./` | ## Using `kiota config init` diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 26f67bfc84..ac418d206c 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -6,8 +6,8 @@ This command is valuable in cases where a code base was created with Kiota v1.0 | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./.kiota/kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./.kiota/kiota-config.json`. | -| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | +| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | +| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. In the case where conflicting API client names are created, the user would be prompted for a new client name | | `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | ## Using `kiota config migrate` @@ -91,12 +91,41 @@ _The resulting `apimanifest.json` file will look like this:_ ```jsonc { - "publisher": { - "name": "Microsoft Graph", - "contactEmail": "graphsdkpub@microsoft.com" - }, "apiDependencies": { - "graphDelegated": { + "csharpGraphServiceClient": { + "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "apiDeploymentBaseUrl": "https://graph.microsoft.com", + "apiDescriptionVersion": "v1.0", + "requests": [ + { + "method": "GET", + "uriTemplate": "/users" + }, + { + "method": "POST", + "uriTemplate": "/users" + }, + { + "method": "GET", + "uriTemplate": "/users/$count" + }, + { + "method": "GET", + "uriTemplate": "/users/{user-id}" + }, + { + "method": "PATCH", + "uriTemplate": "/users/{user-id}" + }, + { + "method": "DELETE", + "uriTemplate": "/users/{user-id}" + } + ] + }, + "pythonGraphServiceClient": { + "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", @@ -131,6 +160,27 @@ _The resulting `apimanifest.json` file will look like this:_ } ``` + +_The resulting file structure will look like this:_ + +```bash +/ + └─.kiota + └─definitions + └─csharpGraphServiceClient.yaml + └─pythonGraphServiceClient.yaml + └─generated + └─graph + └─csharp + └─... # Generated code files + └─GraphClient.cs + └─python + └─... # Generated code files + └─graph_client.py + └─apimanifest.json + └─kiota-config.json +``` + ## Using `kiota config migrate` for a specific `kiota-lock.json` file and a specific client name Assuming the following folder structure: @@ -182,4 +232,24 @@ _The resulting `kiota-config.json` file will look like this:_ } } } -} \ No newline at end of file +} +``` + + +```bash +/ + └─.kiota + └─definitions + └─graphDelegated.yaml + └─generated + └─graph + └─csharp + └─... # Generated code files + └─GraphClient.cs + └─python + └─... # Generated code files + └─graph_client.py + └─kiota-lock.json + └─apimanifest.json + └─kiota-config.json +``` \ No newline at end of file diff --git a/specs/index.md b/specs/index.md index efa47455b1..e040b18428 100644 --- a/specs/index.md +++ b/specs/index.md @@ -16,4 +16,8 @@ config.md) ## Scenarios -* [Kiota Config](./scenarios/kiota.config.md) \ No newline at end of file +* [Kiota Config](./scenarios/kiota.config.md) + +## Schemas + +* [kiota-config.json](./schemas/kiota-config.json) \ No newline at end of file diff --git a/specs/scenarios/kiota-config.md b/specs/scenarios/kiota-config.md index 34372e89ae..6a5b3acbd8 100644 --- a/specs/scenarios/kiota-config.md +++ b/specs/scenarios/kiota-config.md @@ -20,59 +20,36 @@ Here is an example of what the kiota-config.json file could look like. ```jsonc { - "name": "My application", - "apis": { - "Graph": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://.../openapi.yaml", - "includePatterns": ["/me/chats#GET", "/me#GET"], + "version": "1.0.0", + "clients": { + "graphDelegated": { + "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "includePatterns": ["**/users/**"], "excludePatterns": [], - "clients": [ - { - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - "authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - } - }, - "usesBackingStore": true, - "includeAdditionalData": true - } - } - ] + "language": "csharp", + "outputPath": "./generated/graph", + "clientClassName": "GraphClient", + "clientNamespaceName": "Contoso.GraphApp", + "features": { + "serializers": [ + "Contoso.Json.CustomSerializer" + ], + "deserializers": [ + "Contoso.Json.CustomDeserializer" + ], + "structuredMimeTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true + } }, - "BusinessCentral": { - "descriptionHash": "810CF81EFDB5D8E065...", + "businessCentral": { "descriptionLocation": "https://.../bcoas1.0.yaml", "includePatterns": ["/companies#GET"], "excludePatterns": [], - "outputs": [ - { - "language": "csharp", - "outputPath": "./generated/business-central" - }, - { - "language": "python", - "outputPath": "./generated/python/business-central" - }, - { - "language": "csharp", - "outputPath": "./generated/business-central-app", - "features": { - "authentication": { - "authenticationProvider": "Microsoft.Kiota.Authentication.AzureAuthProvider", - "authenticationParameters": { - "clientId": "guid" - } - } - } - } - ] + "language": "csharp", + "outputPath": "./generated/businessCentral" } } } diff --git a/specs/schemas/kiota-config.json b/specs/schemas/kiota-config.json new file mode 100644 index 0000000000..09290bfb3e --- /dev/null +++ b/specs/schemas/kiota-config.json @@ -0,0 +1,87 @@ +{ + "$schema": "", + "type": "object", + "properties": { + "version": { + "type": "string" + }, + "clients": { + "type": "object", + "patternProperties": { + ".*": { + "type": "object", + "properties": { + "descriptionLocation": { + "type": "string" + } + }, + "descriptionLocation": { + "type": "string" + }, + "includePatterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "excludePatterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "baseUrl": { + "type": "string" + }, + "language": { + "type": "string" + }, + "outputPath": { + "type": "string" + }, + "clientClassName": { + "type": "string" + }, + "clientNamespaceName": { + "type": "string" + }, + "features": { + "type": "object", + "properties": { + "structuredMediaTypes": { + "type": "array", + "items": { + "type": "string" + } + }, + "serializers": { + "type": "array", + "items": { + "type": "string" + } + }, + "deserializers": { + "type": "array", + "items": { + "type": "string" + } + }, + "usesBackingStore": { + "type": "boolean" + }, + "includeAdditionalData": { + "type": "boolean" + } + } + } + } + }, + "disabledValidationRules": { + "type": "array", + "items": { + "type": "string" + } + } + } + } +} diff --git a/specs/schemas/kiota.config.md b/specs/schemas/kiota.config.md deleted file mode 100644 index c48437a85b..0000000000 --- a/specs/schemas/kiota.config.md +++ /dev/null @@ -1,107 +0,0 @@ -## JSON Schema for kiota-config.json - -```jsonc -{ - "$schema": "", - "type": "object", - "properties": { - "version": { - "type": "string" - }, - "apis": { - "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "properties": { - "descriptionLocation": { - "type": "string" - }, - "descriptionHash": { - "type": "string" - } - }, - "descriptionHash": { - "type": "string" - }, - "descriptionLocation": { - "type": "string" - }, - "includePatterns": { - "type": "array", - "items": { - "type": "string" - } - }, - "excludePatterns": { - "type": "array", - "items": { - "type": "string" - } - }, - "baseUrl": { - "type": "string" - }, - "clients": { - "type": "object", - "patternProperties": { - ".*": { - "type": "object", - "properties": { - "language": { - "type": "string" - }, - "outputPath": { - "type": "string" - }, - "clientClassName": { - "type": "string" - }, - "clientNamespaceName": { - "type": "string" - }, - "features": { - "type": "object", - "properties": { - "structuredMediaTypes": { - "type": "array", - "items": { - "type": "string" - } - }, - "serializers": { - "type": "array", - "items": { - "type": "string" - } - }, - "deserializers": { - "type": "array", - "items": { - "type": "string" - } - }, - "usesBackingStore": { - "type": "boolean" - }, - "includeAdditionalData": { - "type": "boolean" - } - } - } - } - } - } - } - }, - "disabledValidationRules": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } -} -``` \ No newline at end of file From 8bd8d950b1c6e20a8a29e5902c3a8dca0234ed7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 8 Dec 2023 18:03:23 +0000 Subject: [PATCH 010/394] Updating code blocks --- specs/cli/client-edit.md | 32 +------------------------------- specs/cli/client-remove.md | 4 ---- specs/cli/config-init.md | 4 +++- specs/cli/config-migrate.md | 1 - 4 files changed, 4 insertions(+), 37 deletions(-) diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index f7567efbba..7da4cd696c 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -37,36 +37,6 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen kiota client edit --client-name "graphDelegated" --class-name "GraphServiceClient" --exclude-path "/users/$count" ``` -```jsonc -{ - "clients": { - "graphDelegated": { - "descriptionHash": "9EDF8506CB74FE44...", - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", - "includePatterns": ["**/users/**"], - "excludePatterns": ["/users/$count"], - "language": "csharp", - "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphServiceClient", - "clientNamespaceName": "Contoso.GraphApp", - "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } - } - } -} -``` - _The resulting `kiota-config.json` file will look like this:_ ```jsonc @@ -77,7 +47,7 @@ _The resulting `kiota-config.json` file will look like this:_ "descriptionHash": "9EDF8506CB74FE44...", "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], - "excludePatterns": [], + "excludePatterns": ["/users/$count"], "language": "csharp", "outputPath": "./generated/graph/csharp", "clientClassName": "GraphServiceClient", diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md index fdc8fc3520..34ad30b1e7 100644 --- a/specs/cli/client-remove.md +++ b/specs/cli/client-remove.md @@ -31,10 +31,6 @@ _The resulting `apimanifest.json` file will look like this:_ ```jsonc { - "publisher": { - "name": "Microsoft Graph", - "contactEmail": "graphsdkpub@microsoft.com" - }, "apiDependencies": { } } ``` diff --git a/specs/cli/config-init.md b/specs/cli/config-init.md index 939e7c3705..b9df504fda 100644 --- a/specs/cli/config-init.md +++ b/specs/cli/config-init.md @@ -20,7 +20,9 @@ When `kiota config init` is executed, a `kiota-config.json` file would be create ```bash kiota config init ``` -_Results in the following `kiota-config.json` file:_ + +_The resulting `kiota-config.json` file will look like this:_ + ```jsonc { "version": "1.0.0", diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index ac418d206c..788eaa8639 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -160,7 +160,6 @@ _The resulting `apimanifest.json` file will look like this:_ } ``` - _The resulting file structure will look like this:_ ```bash From a0fcaeb45ed7a81790cd5ab86235c9a7f0db07ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 8 Dec 2023 18:11:40 +0000 Subject: [PATCH 011/394] Updates to the --config-location param --- specs/cli/client-add.md | 2 +- specs/cli/client-edit.md | 2 +- specs/cli/client-generate.md | 2 +- specs/cli/client-remove.md | 2 +- specs/cli/config-init.md | 2 +- specs/cli/config-migrate.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index ef65baa62b..fad5f1f1d1 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -16,7 +16,7 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | +| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | | `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index 7da4cd696c..b802dc94cb 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -12,7 +12,7 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | +| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | | `--openapi \| -d` | No | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index 0ae06afe91..c86b27cfdb 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -12,7 +12,7 @@ In general cases, the `kiota client generate` command will generate the code for | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | +| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | | `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md index 34ad30b1e7..2f3f3ba58d 100644 --- a/specs/cli/client-remove.md +++ b/specs/cli/client-remove.md @@ -8,7 +8,7 @@ The command also has one optional parameter, the ability to remove the generated | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | +| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client | | `--clean-output \| --co` | No | | Cleans the generated client | diff --git a/specs/cli/config-init.md b/specs/cli/config-init.md index b9df504fda..9f93a90ff3 100644 --- a/specs/cli/config-init.md +++ b/specs/cli/config-init.md @@ -13,7 +13,7 @@ When `kiota config init` is executed, a `kiota-config.json` file would be create | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cf` | No | ../../ | Path to a folder containing an existing `kiota-config.json` file. Defaults to `./` | +| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | ## Using `kiota config init` diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 788eaa8639..b3db2c9598 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -6,7 +6,7 @@ This command is valuable in cases where a code base was created with Kiota v1.0 | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ./kiota-config.json | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use `./kiota-config.json`. | +| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. In the case where conflicting API client names are created, the user would be prompted for a new client name | | `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | From 130dfd168ac39ec3bdb8228e1433b892273dfc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 8 Dec 2023 18:13:51 +0000 Subject: [PATCH 012/394] Update to the migrate conflict use case --- specs/cli/config-migrate.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index b3db2c9598..734bc39353 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -2,12 +2,14 @@ This command is valuable in cases where a code base was created with Kiota v1.0 and needs to be migrated to the latest version of Kiota. The `kiota config migrate` command will identify and locate the closest `kiota-config.json` file available. If a file can't be found, it would initialize a new `kiota-config.json` file. Then, it would identify all `kiota-lock.json` files that are within this folder structure and add each of them to the `kiota-config.json` file. Adding the clients to the `kiota-config.json` file would not trigger the generation as it only affects the `kiota-config.json` file. The `kiota client generate` command would need to be executed to generate the code for the clients. +In the case where conflicting API client names would be migrated, the command will error out and invite the user to re-run the command providing more context for the `--client-name` parameter. + ## Parameters | Parameters | Required | Example | Description | | -- | -- | -- | -- | | `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | -| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. In the case where conflicting API client names are created, the user would be prompted for a new client name | +| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | | `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | ## Using `kiota config migrate` From f955ef4165673873e2fe9f1dc0e3e742a54f7e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Wed, 20 Dec 2023 18:48:31 +0000 Subject: [PATCH 013/394] Updating based on review --- specs/cli/client-add.md | 21 +++++++-------------- specs/cli/client-edit.md | 20 +++++++------------- specs/cli/config-migrate.md | 27 +++------------------------ specs/scenarios/kiota-config.md | 16 +++++----------- specs/schemas/kiota-config.json | 12 ------------ 5 files changed, 22 insertions(+), 74 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index fad5f1f1d1..32b0858e8c 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -4,7 +4,7 @@ `kiota client add` allows a developer to add a new API client to the `kiota-config.json` file. If no `kiota-config.json` file is found, a new `kiota-config.json` file would be created in thr current working directory. The command will add a new entry to the `clients` section of the `kiota-config.json` file. Once this is done, a local copy of the OpenAPI description is generated and kept in the `.kiota/descriptions` folder. -When executing, a new API entry will be added and will use the `--client-name` parameter as the key for the map. When loading the OpenAPI description, it will generate a hash of the description to enable change detection of the description and save it as part of the `descriptionHash` property. It will also store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. +When executing, a new API entry will be added and will use the `--client-name` parameter as the key for the map. When loading the OpenAPI description, it will store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. Every time an API client is added, a copy of the OpenAPI description file will be stored in the `./.kiota/{client-name}` folder. The files will be named using the API client name. This will allow the CLI to detect changes in the description and avoid downloading the description again if it hasn't changed. @@ -29,7 +29,7 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file | `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | | `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | | `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | -| `--structured-mime-types \| -m` | No | `application/json` |Any valid MIME type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | +| `--structured-media-types \| -m` | No | `application/json` |Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | | `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | | `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | @@ -49,7 +49,6 @@ _The resulting `kiota-config.json` file will look like this:_ "version": "1.0.0", "clients": { "graphDelegated": { - "descriptionHash": "9EDF8506CB74FE44...", "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], @@ -58,17 +57,11 @@ _The resulting `kiota-config.json` file will look like this:_ "clientClassName": "GraphClient", "clientNamespaceName": "Contoso.GraphApp", "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true } } } diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index b802dc94cb..495ec082df 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -24,7 +24,7 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen | `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | | `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | | `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | -| `--structured-mime-types \| -m` | No | `application/json` |Any valid MIME type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | +| `--structured-media-types \| -m` | No | `application/json` |Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | | `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | | `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | @@ -44,7 +44,6 @@ _The resulting `kiota-config.json` file will look like this:_ "version": "1.0.0", "clients": { "graphDelegated": { - "descriptionHash": "9EDF8506CB74FE44...", "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": ["/users/$count"], @@ -53,17 +52,11 @@ _The resulting `kiota-config.json` file will look like this:_ "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true } } } @@ -80,6 +73,7 @@ _The resulting `apimanifest.json` file will look like this:_ }, "apiDependencies": { "graphDelegated": { + "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 734bc39353..e97fd50ce5 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -40,7 +40,6 @@ _The resulting `kiota-config.json` file will look like this:_ "version": "1.0.0", "clients": { "csharpGraphServiceClient": { - "descriptionHash": "9EDF8506CB74FE44...", "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], @@ -49,13 +48,7 @@ _The resulting `kiota-config.json` file will look like this:_ "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ + "structuredMediaTypes": [ "application/json" ], "usesBackingStore": true, @@ -63,7 +56,6 @@ _The resulting `kiota-config.json` file will look like this:_ } }, "pythonGraphServiceClient": { - "descriptionHash": "9EDF8506CB74FE44...", "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], @@ -72,13 +64,7 @@ _The resulting `kiota-config.json` file will look like this:_ "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ + "structuredMediaTypes": [ "application/json" ], "usesBackingStore": true, @@ -210,7 +196,6 @@ _The resulting `kiota-config.json` file will look like this:_ "version": "1.0.0", "clients": { "graphDelegated": { - "descriptionHash": "9EDF8506CB74FE44...", "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], @@ -219,13 +204,7 @@ _The resulting `kiota-config.json` file will look like this:_ "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ + "structuredMediaTypes": [ "application/json" ], "usesBackingStore": true, diff --git a/specs/scenarios/kiota-config.md b/specs/scenarios/kiota-config.md index 6a5b3acbd8..8c713ba392 100644 --- a/specs/scenarios/kiota-config.md +++ b/specs/scenarios/kiota-config.md @@ -31,17 +31,11 @@ Here is an example of what the kiota-config.json file could look like. "clientClassName": "GraphClient", "clientNamespaceName": "Contoso.GraphApp", "features": { - "serializers": [ - "Contoso.Json.CustomSerializer" - ], - "deserializers": [ - "Contoso.Json.CustomDeserializer" - ], - "structuredMimeTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true } }, "businessCentral": { diff --git a/specs/schemas/kiota-config.json b/specs/schemas/kiota-config.json index 09290bfb3e..70389af1f6 100644 --- a/specs/schemas/kiota-config.json +++ b/specs/schemas/kiota-config.json @@ -54,18 +54,6 @@ "type": "string" } }, - "serializers": { - "type": "array", - "items": { - "type": "string" - } - }, - "deserializers": { - "type": "array", - "items": { - "type": "string" - } - }, "usesBackingStore": { "type": "boolean" }, From 5d0d73aaa493c8d635dfc69362790ec25f59e94c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Wed, 10 Jan 2024 20:37:21 +0000 Subject: [PATCH 014/394] Addressing PR comments --- specs/cli/client-add.md | 20 ++++----- specs/cli/client-edit.md | 16 +++---- specs/cli/client-generate.md | 1 - specs/cli/client-remove.md | 1 - specs/cli/config-init.md | 4 +- specs/cli/config-migrate.md | 39 +++++++--------- specs/schemas/kiota-config.json | 80 +++++++++++++++------------------ 7 files changed, 68 insertions(+), 93 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index 32b0858e8c..d7cd0d8cc8 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -16,7 +16,6 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | | `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | @@ -27,14 +26,12 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file | `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | | `--backing-store \| -b` | No | | Defaults to `false` | | `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | -| `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | -| `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | | `--structured-media-types \| -m` | No | `application/json` |Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | | `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | -| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | +| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. This is relative to the location of `kiota-config.json`. Defaults to `./output`. | > [!NOTE] -> It is not required to use the CLI to add new clients. It is possible to add a new client by adding a new entry in the `clients` section of the `kiota-config.json` file. See the [kiota-config.json schema](../schemas/kiota-config.json.md) for more information. +> It is not required to use the CLI to add new clients. It is possible to add a new client by adding a new entry in the `clients` section of the `kiota-config.json` file. See the [kiota-config.json schema](../schemas/kiota-config.json) for more information. Using `kiota client generate --client-name myClient` would be required to generate the code files. ## Using `kiota client add` @@ -56,13 +53,11 @@ _The resulting `kiota-config.json` file will look like this:_ "outputPath": "./generated/graph/csharp", "clientClassName": "GraphClient", "clientNamespaceName": "Contoso.GraphApp", - "features": { - "structuredMediaTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true } } } @@ -75,6 +70,7 @@ _The resulting `apimanifest.json` file will look like this:_ "apiDependencies": { "graphDelegated": { "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "x-ms-kiotaVersion": "1.11.0", "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index 495ec082df..0a6897c1c7 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -12,7 +12,6 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | | `--openapi \| -d` | No | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | @@ -22,8 +21,6 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen | `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | | `--backing-store \| -b` | No | | Defaults to `false` | | `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | -| `--serializer \| -s` | No | `Contoso.Json.CustomSerializer` | One or more module names that implements ISerializationWriterFactory. Default are documented [here](https://learn.microsoft.com/openapi/kiota/using#--serializer--s). | -| `--deserializer \| --ds` | No | `Contoso.Json.CustomDeserializer` | One or more module names that implements IParseNodeFactory. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--deserializer---ds). | | `--structured-media-types \| -m` | No | `application/json` |Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | | `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | | `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | @@ -51,13 +48,11 @@ _The resulting `kiota-config.json` file will look like this:_ "outputPath": "./generated/graph/csharp", "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", - "features": { - "structuredMediaTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true } } } @@ -74,6 +69,7 @@ _The resulting `apimanifest.json` file will look like this:_ "apiDependencies": { "graphDelegated": { "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "x-ms-kiotaVersion": "1.11.0", "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index c86b27cfdb..5b5888a7c7 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -12,7 +12,6 @@ In general cases, the `kiota client generate` command will generate the code for | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | | `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md index 2f3f3ba58d..caa83f1360 100644 --- a/specs/cli/client-remove.md +++ b/specs/cli/client-remove.md @@ -8,7 +8,6 @@ The command also has one optional parameter, the ability to remove the generated | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client | | `--clean-output \| --co` | No | | Cleans the generated client | diff --git a/specs/cli/config-init.md b/specs/cli/config-init.md index 9f93a90ff3..f91a85e310 100644 --- a/specs/cli/config-init.md +++ b/specs/cli/config-init.md @@ -11,9 +11,7 @@ When `kiota config init` is executed, a `kiota-config.json` file would be create ## Parameters -| Parameters | Required | Example | Description | -| -- | -- | -- | -- | -| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | +None. ## Using `kiota config init` diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index e97fd50ce5..9283c5ce04 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -8,7 +8,6 @@ In the case where conflicting API client names would be migrated, the command wi | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--config-location \| --cl` | No | ../../ | A location where to find or create the `kiota-config.json` file. When not specified it will find an ancestor `kiota-config.json` file and if not found, will use the defaults. Defaults to `./`. | | `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | | `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | @@ -47,13 +46,11 @@ _The resulting `kiota-config.json` file will look like this:_ "outputPath": "./generated/graph/csharp", "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", - "features": { - "structuredMediaTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true }, "pythonGraphServiceClient": { "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", @@ -63,13 +60,11 @@ _The resulting `kiota-config.json` file will look like this:_ "outputPath": "./generated/graph/python", "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", - "features": { - "structuredMediaTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true } } } @@ -82,6 +77,7 @@ _The resulting `apimanifest.json` file will look like this:_ "apiDependencies": { "csharpGraphServiceClient": { "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "x-ms-kiotaVersion": "1.11.0", "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", @@ -114,6 +110,7 @@ _The resulting `apimanifest.json` file will look like this:_ }, "pythonGraphServiceClient": { "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "x-ms-kiotaVersion": "1.11.0", "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", @@ -203,13 +200,11 @@ _The resulting `kiota-config.json` file will look like this:_ "outputPath": "./generated/graph/csharp", "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", - "features": { - "structuredMediaTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true } } } diff --git a/specs/schemas/kiota-config.json b/specs/schemas/kiota-config.json index 70389af1f6..a4797a7f3e 100644 --- a/specs/schemas/kiota-config.json +++ b/specs/schemas/kiota-config.json @@ -13,53 +13,45 @@ "properties": { "descriptionLocation": { "type": "string" - } - }, - "descriptionLocation": { - "type": "string" - }, - "includePatterns": { - "type": "array", - "items": { + }, + "includePatterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "excludePatterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "baseUrl": { "type": "string" - } - }, - "excludePatterns": { - "type": "array", - "items": { + }, + "language": { "type": "string" - } - }, - "baseUrl": { - "type": "string" - }, - "language": { - "type": "string" - }, - "outputPath": { - "type": "string" - }, - "clientClassName": { - "type": "string" - }, - "clientNamespaceName": { - "type": "string" - }, - "features": { - "type": "object", - "properties": { - "structuredMediaTypes": { - "type": "array", - "items": { - "type": "string" - } - }, - "usesBackingStore": { - "type": "boolean" - }, - "includeAdditionalData": { - "type": "boolean" + }, + "outputPath": { + "type": "string" + }, + "clientClassName": { + "type": "string" + }, + "clientNamespaceName": { + "type": "string" + }, + "structuredMediaTypes": { + "type": "array", + "items": { + "type": "string" } + }, + "usesBackingStore": { + "type": "boolean" + }, + "includeAdditionalData": { + "type": "boolean" } } } From 1a43310c07996bbbad77f7481245a2e077446b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Wed, 10 Jan 2024 20:49:47 +0000 Subject: [PATCH 015/394] Removing the class-name parameter to rely on client-name only --- specs/cli/client-add.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index d7cd0d8cc8..6fead368bf 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -16,13 +16,12 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | | `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | | `--language \| -l` | Yes | csharp | The target language for the generated code files or for the information. | -| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | | `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | | `--backing-store \| -b` | No | | Defaults to `false` | | `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | From 7e7525f24ab723678cf2d459daa4087499838001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 19 Jan 2024 18:53:38 +0000 Subject: [PATCH 016/394] Updated the logic for client config hash --- specs/cli/client-add.md | 10 +++++----- specs/cli/client-edit.md | 10 +++++----- specs/cli/client-generate.md | 2 +- specs/cli/config-migrate.md | 14 +++++++------- specs/scenarios/kiota-config.md | 6 +++--- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index 6fead368bf..3e4e9e7e9c 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -17,7 +17,7 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file | Parameters | Required | Example | Description | | -- | -- | -- | -- | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | -| `--openapi \| -d` | Yes | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | +| `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | @@ -35,7 +35,7 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file ## Using `kiota client add` ```bash -kiota client add --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --include-path "**/users/**" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +kiota client add --client-name "graphDelegated" --openapi "https://aka.ms/graph/v1.0/openapi.yaml" --include-path "**/users/**" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" ``` _The resulting `kiota-config.json` file will look like this:_ @@ -45,7 +45,7 @@ _The resulting `kiota-config.json` file will look like this:_ "version": "1.0.0", "clients": { "graphDelegated": { - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], "language": "csharp", @@ -68,9 +68,9 @@ _The resulting `apimanifest.json` file will look like this:_ { "apiDependencies": { "graphDelegated": { - "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "x-ms-kiotaHash": "9EDF8506CB74FE44...", "x-ms-kiotaVersion": "1.11.0", - "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", "requests": [ diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index 0a6897c1c7..e0260d9163 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -4,7 +4,7 @@ `kiota client update` allows a developer to edit an existing API client int the `kiota-config.json` file. If either the `kiota-config.json` file or if the `--client-name` client can't be found within the `kiota-config.json` file, the command should error out and let the developer know. -When executing, the API entry defined by the `--client-name` parameter will be modified. All parameters should be supported and the only required one is `--client-name`. All others are optional as they would only modify the configuration of the API client. If the OpenAPI description location changed, a new hash of the description will be generated saved as part of the `descriptionHash` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively and would trigger an update to the [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3). +When executing, the API entry defined by the `--client-name` parameter will be modified. All parameters should be supported and the only required one is `--client-name`. All others are optional as they would only modify the configuration of the API client. If the OpenAPI description location changed or any properties of the client entry in `kiota-config.json`, a new hash will be generated and and would trigger an update to the [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3). Once the `kiota-config.json` file and the API Manifest are updated, the code generation will be executed based on the newly updated API client configuration. @@ -13,7 +13,7 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen | Parameters | Required | Example | Description | | -- | -- | -- | -- | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | -| `--openapi \| -d` | No | https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | +| `--openapi \| -d` | No | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | | `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | @@ -41,7 +41,7 @@ _The resulting `kiota-config.json` file will look like this:_ "version": "1.0.0", "clients": { "graphDelegated": { - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": ["/users/$count"], "language": "csharp", @@ -68,9 +68,9 @@ _The resulting `apimanifest.json` file will look like this:_ }, "apiDependencies": { "graphDelegated": { - "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "x-ms-kiotaHash": "9EDF8506CB74FE44...", "x-ms-kiotaVersion": "1.11.0", - "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", "requests": [ diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index 5b5888a7c7..2496254acc 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -6,7 +6,7 @@ Now that we have a `kiota-config.json` file, all the parameters required to gene It's also possible to specify for which API and client the code should be generated. This is useful when a project contains multiple clients. The `kiota client generate --client-name "MyClient"` command will read the `kiota-config.json` file and generate the code for the specified client. If it can't find the specified API or client, it will throw an error. -In general cases, the `kiota client generate` command will generate the code for all the clients in the `kiota-config.json` file based on the cached OpenAPI description. If the `--refresh` parameter is provided, the command will refresh the cached OpenAPI description(s), update the different `descriptionHash` and then generate the code for the specified clients. +In general cases, the `kiota client generate` command will generate the code for all the clients in the `kiota-config.json` file based on the cached OpenAPI description. If the `--refresh` parameter is provided, the command will refresh the cached OpenAPI description(s), update the different `x-ms-kiotaHash` in the API Manifest and then generate the code for the specified clients. ## Parameters diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 9283c5ce04..1214bc1190 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -39,7 +39,7 @@ _The resulting `kiota-config.json` file will look like this:_ "version": "1.0.0", "clients": { "csharpGraphServiceClient": { - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], "language": "csharp", @@ -53,7 +53,7 @@ _The resulting `kiota-config.json` file will look like this:_ "includeAdditionalData": true }, "pythonGraphServiceClient": { - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], "language": "python", @@ -76,9 +76,9 @@ _The resulting `apimanifest.json` file will look like this:_ { "apiDependencies": { "csharpGraphServiceClient": { - "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "x-ms-kiotaHash": "9EDF8506CB74FE44...", "x-ms-kiotaVersion": "1.11.0", - "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", "requests": [ @@ -109,9 +109,9 @@ _The resulting `apimanifest.json` file will look like this:_ ] }, "pythonGraphServiceClient": { - "x-ms-apiDescriptionHash": "9EDF8506CB74FE44...", + "x-ms-kiotaHash": "9EDF8506CB74FE44...", "x-ms-kiotaVersion": "1.11.0", - "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", "requests": [ @@ -193,7 +193,7 @@ _The resulting `kiota-config.json` file will look like this:_ "version": "1.0.0", "clients": { "graphDelegated": { - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], "language": "csharp", diff --git a/specs/scenarios/kiota-config.md b/specs/scenarios/kiota-config.md index 8c713ba392..cf7291f4b7 100644 --- a/specs/scenarios/kiota-config.md +++ b/specs/scenarios/kiota-config.md @@ -23,7 +23,7 @@ Here is an example of what the kiota-config.json file could look like. "version": "1.0.0", "clients": { "graphDelegated": { - "descriptionLocation": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], "language": "csharp", @@ -73,13 +73,13 @@ kiota config migrate ```bash kiota client init -kiota client add --client-name "graphDelegated" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --language csharp --output "./csharpClient" +kiota client add --client-name "graphDelegated" --openapi "https://aka.ms/graph/v1.0/openapi.yaml" --language csharp --output "./csharpClient" ``` ### Add a second API client ```bash -kiota client add --clientName "graphPython" --openapi "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml" --language python --outputPath ./pythonClient +kiota client add --clientName "graphPython" --openapi "https://aka.ms/graph/v1.0/openapi.yaml" --language python --outputPath ./pythonClient ``` ### Edit an API client From a76aaca58585d2a2d1698006e24e0a3c351c5f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 19 Jan 2024 18:55:54 +0000 Subject: [PATCH 017/394] Removed the useless features node --- specs/scenarios/kiota-config.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/specs/scenarios/kiota-config.md b/specs/scenarios/kiota-config.md index cf7291f4b7..17e57e6b09 100644 --- a/specs/scenarios/kiota-config.md +++ b/specs/scenarios/kiota-config.md @@ -30,13 +30,11 @@ Here is an example of what the kiota-config.json file could look like. "outputPath": "./generated/graph", "clientClassName": "GraphClient", "clientNamespaceName": "Contoso.GraphApp", - "features": { - "structuredMediaTypes": [ - "application/json" - ], - "usesBackingStore": true, - "includeAdditionalData": true - } + "structuredMediaTypes": [ + "application/json" + ], + "usesBackingStore": true, + "includeAdditionalData": true }, "businessCentral": { "descriptionLocation": "https://.../bcoas1.0.yaml", From a3af18efe6a6dc78ea27700ac71a9a1e3811f3ab Mon Sep 17 00:00:00 2001 From: Drew Dara-Abrams Date: Tue, 23 Jan 2024 15:46:50 -0800 Subject: [PATCH 018/394] Update README.md: remove broken link to a non-existent Ruby quickstart https://learn.microsoft.com/openapi/kiota/quickstarts/ruby does not seem to exist --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7eb074d0ee..856830281e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The following table provides an overview of the languages supported by Kiota and | Java | ✔ | [✔](https://github.com/microsoft/kiota-java/tree/main/components/abstractions) | [FORM](https://github.com/microsoft/kiota-java/tree/main/components/serialization/form), [JSON](https://github.com/microsoft/kiota-java/tree/main/components/serialization/json), [MULTIPART](https://github.com/microsoft/kiota-java/tree/main/components/serialization/multipart), [TEXT](https://github.com/microsoft/kiota-java/tree/main/components/serialization/text) | [Anonymous](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/authentication/AnonymousAuthenticationProvider.java), [API Key](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/authentication/ApiKeyAuthenticationProvider.java), [Azure](https://github.com/microsoft/kiota-java/tree/main/components/authentication/azure) | [✔](https://github.com/microsoft/kiota-java/tree/main/components/http/okHttp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/java) | | PHP | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-php) | [JSON](https://github.com/microsoft/kiota-serialization-json-php), [❌ FORM](https://github.com/microsoft/kiota/issues/2074), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3029), [TEXT](https://github.com/microsoft/kiota-serialization-text-php) | [Anonymous](https://github.com/microsoft/kiota-abstractions-php/blob/main/src/Authentication/AnonymousAuthenticationProvider.php), [✔️ PHP League](https://github.com/microsoft/kiota-authentication-phpleague-php) | [✔](https://github.com/microsoft/kiota-http-guzzle-php) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/php) | | Python | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-python) | [❌ FORM](https://github.com/microsoft/kiota/issues/2075), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3030), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [✔](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) | -| Ruby | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-ruby) | [❌ FORM](https://github.com/microsoft/kiota/issues/2077), [JSON](https://github.com/microsoft/kiota-serialization-json-ruby), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3032), [❌ TEXT](https://github.com/microsoft/kiota/issues/1049) | [Anonymous](https://github.com/microsoft/kiota-abstractions-ruby/blob/main/lib/microsoft_kiota_abstractions/authentication/anonymous_authentication_provider.rb), [✔️ OAuth2](https://github.com/microsoft/kiota-authentication-oauth-ruby) | [✔](https://github.com/microsoft/kiota-http-ruby)| [link](https://learn.microsoft.com/openapi/kiota/quickstarts/ruby) | +| Ruby | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-ruby) | [❌ FORM](https://github.com/microsoft/kiota/issues/2077), [JSON](https://github.com/microsoft/kiota-serialization-json-ruby), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3032), [❌ TEXT](https://github.com/microsoft/kiota/issues/1049) | [Anonymous](https://github.com/microsoft/kiota-abstractions-ruby/blob/main/lib/microsoft_kiota_abstractions/authentication/anonymous_authentication_provider.rb), [✔️ OAuth2](https://github.com/microsoft/kiota-authentication-oauth-ruby) | [✔](https://github.com/microsoft/kiota-http-ruby)| | | CLI | ✔ | (see CSharp) + [✔](https://github.com/microsoft/kiota-cli-commons) | (see CSharp) | (see CSharp) | (see CSharp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/cli) | | Swift | [▶](https://github.com/microsoft/kiota/issues/1449) | [✔](./abstractions/swift) | [❌ FORM](https://github.com/microsoft/kiota/issues/2076), [❌ JSON](https://github.com/microsoft/kiota/issues/1451), [❌ FORM](https://github.com/microsoft/kiota/issues/3033), [❌ TEXT](https://github.com/microsoft/kiota/issues/1452) | [Anonymous](./abstractions/swift/Source/MicrosoftKiotaAbstractions/Authentication/AnonymousAuthenticationProvider.swift), [❌ Azure](https://github.com/microsoft/kiota/issues/1453) | [❌](https://github.com/microsoft/kiota/issues/1454)| | | TypeScript/JavaScript | ✔ | [✔](https://github.com/microsoft/kiota-typescript/tree/main/packages/abstractions) | [FORM](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/form), [JSON](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/json), [MULTIPART](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/multipart), [TEXT](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/text) | [Anonymous](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/authentication/anonymousAuthenticationProvider.ts), [API Key](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/authentication/apiKeyAuthenticationProvider.ts), [Azure](https://github.com/microsoft/kiota-typescript/tree/main/packages/authentication/azure), [SPFx](https://github.com/microsoft/kiota-typescript/tree/main/packages/authentication/spfx) | [✔](https://github.com/microsoft/kiota-typescript/tree/main/packages/http/fetch) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/typescript) | From f0679d206b1c41e5a3bfda2598e4f6797d8666f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 08:08:18 +0000 Subject: [PATCH 019/394] Bump @types/node from 20.11.5 to 20.11.6 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.5 to 20.11.6. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index d5cda21c41..fb2855d3ec 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", - "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", + "version": "20.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.6.tgz", + "integrity": "sha512-+EOokTnksGVgip2PbYbr3xnR7kZigh4LbybAfBAw5BpnQ+FqBYUsvCEjYd70IXKlbohQ64mzEYmMtlWUY8q//Q==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From 8b82bf67205096356bf970aecd76c372f9142f72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 08:11:20 +0000 Subject: [PATCH 020/394] Bump the kiota-dependencies group in /it/typescript with 7 updates Bumps the kiota-dependencies group in /it/typescript with 7 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/kiota-abstractions](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.36` | `1.0.0-preview.37` | | [@microsoft/kiota-authentication-azure](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.31` | `1.0.0-preview.32` | | [@microsoft/kiota-http-fetchlibrary](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.35` | `1.0.0-preview.36` | | [@microsoft/kiota-serialization-form](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.25` | `1.0.0-preview.26` | | [@microsoft/kiota-serialization-json](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.36` | `1.0.0-preview.37` | | [@microsoft/kiota-serialization-multipart](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.15` | `1.0.0-preview.16` | | [@microsoft/kiota-serialization-text](https://github.com/microsoft-typescript/kiota) | `1.0.0-preview.33` | `1.0.0-preview.34` | Updates `@microsoft/kiota-abstractions` from 1.0.0-preview.36 to 1.0.0-preview.37 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-abstractions@1.0.0-preview.36...@microsoft/kiota-abstractions@1.0.0-preview.37) Updates `@microsoft/kiota-authentication-azure` from 1.0.0-preview.31 to 1.0.0-preview.32 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-authentication-azure@1.0.0-preview.31...@microsoft/kiota-authentication-azure@1.0.0-preview.32) Updates `@microsoft/kiota-http-fetchlibrary` from 1.0.0-preview.35 to 1.0.0-preview.36 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.35...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.36) Updates `@microsoft/kiota-serialization-form` from 1.0.0-preview.25 to 1.0.0-preview.26 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-form@1.0.0-preview.25...@microsoft/kiota-serialization-form@1.0.0-preview.26) Updates `@microsoft/kiota-serialization-json` from 1.0.0-preview.36 to 1.0.0-preview.37 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-json@1.0.0-preview.36...@microsoft/kiota-serialization-json@1.0.0-preview.37) Updates `@microsoft/kiota-serialization-multipart` from 1.0.0-preview.15 to 1.0.0-preview.16 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-multipart@1.0.0-preview.15...@microsoft/kiota-serialization-multipart@1.0.0-preview.16) Updates `@microsoft/kiota-serialization-text` from 1.0.0-preview.33 to 1.0.0-preview.34 - [Commits](https://github.com/microsoft-typescript/kiota/commits) --- updated-dependencies: - dependency-name: "@microsoft/kiota-abstractions" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-authentication-azure" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-http-fetchlibrary" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-json" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-multipart" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-text" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 76 ++++++++++++++++----------------- it/typescript/package.json | 14 +++--- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index a5409b4010..7ecb2b88cb 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.36", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.31", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.35", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.25", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.36", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.15", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.33", + "@microsoft/kiota-abstractions": "^1.0.0-preview.37", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.32", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.36", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.26", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.37", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.16", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.34", "express": "^4.18.2", "node-fetch": "^2.7.0" }, @@ -678,12 +678,12 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.36", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.36.tgz", - "integrity": "sha512-pmNiSRJi4PYT2ZzGm0lUXZT8B/w0UayyYSEPufW89MsWnclDm25rsc0C1smKcltC/DqswaG1Rcu9F31kdp1WOw==", + "version": "1.0.0-preview.37", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.37.tgz", + "integrity": "sha512-YrmSKGtMgy/2/mzOQK/2LAmY8j5ThZy3TqIAtnNl3Aql4k6T9gSsBc83pU+eyzmJR80PzPa1CxJLVafI7sOfog==", "dependencies": { "@opentelemetry/api": "^1.2.0", - "@std-uritemplate/std-uritemplate": "^0.0.49", + "@std-uritemplate/std-uritemplate": "^0.0.50", "guid-typescript": "^1.0.9", "tinyduration": "^3.2.2", "tslib": "^2.3.1", @@ -699,22 +699,22 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.31", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.31.tgz", - "integrity": "sha512-thPKqMrAj8yw6mSsndFjs9XX4h4CoISu+S0KQwD76D9eEkjEqamf9pSgrYKPaZlklh9finAWtRpm8Nye3YOW/A==", + "version": "1.0.0-preview.32", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.32.tgz", + "integrity": "sha512-BaKkh5F7hFo9uymN/qos7v6eZNQFz5BTNA+VodnLqUwoqC9zCT6arVAsiZCfX9kUMflVYxJTusO5QFzcV2x/fw==", "dependencies": { "@azure/core-auth": "^1.3.2", - "@microsoft/kiota-abstractions": "^1.0.0-preview.36", + "@microsoft/kiota-abstractions": "^1.0.0-preview.37", "@opentelemetry/api": "^1.2.0", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.35", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.35.tgz", - "integrity": "sha512-/4wx03uo1Uuwp8uFhnxJHfybIn6Th9eBLfA7wAf/T7X9X8wBhiQvdGTRj90n/df3hTgBeTHs+5x2f29IRyGzEg==", + "version": "1.0.0-preview.36", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.36.tgz", + "integrity": "sha512-iZ9BXD8MQRcHIjnTqg26pmJO0sTDvrTz/X3+Wa3l8z8HhmH4N5RF2TEBRDq3YPSYQy95gMY8YQLAXcJELHpKNA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.36", + "@microsoft/kiota-abstractions": "^1.0.0-preview.37", "@opentelemetry/api": "^1.2.0", "guid-typescript": "^1.0.9", "node-fetch": "^2.6.5", @@ -722,41 +722,41 @@ } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.25", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.25.tgz", - "integrity": "sha512-knyDsOdRsPfqd1QPReGHrl0TKP7ugnFfN9IO1qJQ4q01GaEFFbT5W45Wj4yJhq4tPD9hYMNNz4jKh2uzglZT7A==", + "version": "1.0.0-preview.26", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.26.tgz", + "integrity": "sha512-JLcrLcUUOcuFodfc+cqReeH04QFIPOCQaS0CWaKzkWMM8QJMyAJAfO+XMB4HWUqFxDfJlgA/LV7x9UbmbrbOKQ==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.36", + "@microsoft/kiota-abstractions": "^1.0.0-preview.37", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.36", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.36.tgz", - "integrity": "sha512-QxorbvCLX2QW1RygnAdFz5A1cybQCt9Stuu4wEHRAjiPtWWO+ZUYIqmqH/JY53xef8YrMZAB2f0YgxEVDuP8gg==", + "version": "1.0.0-preview.37", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.37.tgz", + "integrity": "sha512-LvHoal8HgdfFlJW2eg4V5NqfXUPW5vFU2phzkbYAKMHC9zv1BvJd0d+dHgxPzCfjfc/x2am6FwxXmQzlmDllrA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.36", + "@microsoft/kiota-abstractions": "^1.0.0-preview.37", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.15", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.15.tgz", - "integrity": "sha512-TUnhPn1Au4IhZGQfd0O8NTUiCmqfNWLKHXxuF1iwo1NIMg74Y4JKGLaB53egilSvedTKquslTD2c+Oxkc11Xvw==", + "version": "1.0.0-preview.16", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.16.tgz", + "integrity": "sha512-IAcgyPglW25T3EUCE0g1PX6g6ZpulgzFpD2S6r512hkUy4w3HAMUgw+0J6aXSPQrFg1odMAawtbaDNyGo9Cmvw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.36", + "@microsoft/kiota-abstractions": "^1.0.0-preview.37", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.33", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.33.tgz", - "integrity": "sha512-vBYMlKebJ+WtJwHoWgf3B3Hi0OGgV5GqbYhZkvJWaZ2/u4holmh68jKuBXICuWKA4QEzdaY+8EL5FgRfSPkF7w==", + "version": "1.0.0-preview.34", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.34.tgz", + "integrity": "sha512-Hj7QqHRuo26mPfdb5E2RUQ12VNT+8KLy9WBUGG1xY8A2L/UgYZ//vE3dU7sKf/Zzt1WcQ6XPCwZWuG+VJKH83g==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.36", + "@microsoft/kiota-abstractions": "^1.0.0-preview.37", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } @@ -805,9 +805,9 @@ } }, "node_modules/@std-uritemplate/std-uritemplate": { - "version": "0.0.49", - "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-0.0.49.tgz", - "integrity": "sha512-alP6NIrIUEb1h4wv7LbaqFdDKjmTiR+znABuZJsc92qHjPWVEvGvmLF8fheWLl9GWe9eFswsz/AE2SFCEIA2Cg==" + "version": "0.0.50", + "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-0.0.50.tgz", + "integrity": "sha512-R0sJ3C8LnIvo0xFG9Sf1BBJn66LHeZcE36utpEwGknM7ehUaU1iEEjH1bJIjzI738bq3nf2GNpOGVE/lQ4DeJA==" }, "node_modules/@tootallnate/once": { "version": "2.0.0", diff --git a/it/typescript/package.json b/it/typescript/package.json index 7c4b456e69..b6bbee0a14 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.36", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.31", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.35", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.25", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.36", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.15", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.33", + "@microsoft/kiota-abstractions": "^1.0.0-preview.37", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.32", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.36", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.26", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.37", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.16", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.34", "express": "^4.18.2", "node-fetch": "^2.7.0" } From 95eb4b39bcbdddd73255092c86f5095b894872bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 08:11:30 +0000 Subject: [PATCH 021/394] Bump esbuild from 0.19.11 to 0.19.12 in /it/typescript Bumps [esbuild](https://github.com/evanw/esbuild) from 0.19.11 to 0.19.12. - [Release notes](https://github.com/evanw/esbuild/releases) - [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md) - [Commits](https://github.com/evanw/esbuild/compare/v0.19.11...v0.19.12) --- updated-dependencies: - dependency-name: esbuild dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 192 ++++++++++++++++---------------- it/typescript/package.json | 2 +- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index a5409b4010..d23bc7bbd2 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -25,7 +25,7 @@ "@types/node": "^20.11.5", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", - "esbuild": "^0.19.11", + "esbuild": "^0.19.12", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", @@ -221,9 +221,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", - "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", + "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", "cpu": [ "ppc64" ], @@ -237,9 +237,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", - "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", + "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", "cpu": [ "arm" ], @@ -253,9 +253,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", - "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", + "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", "cpu": [ "arm64" ], @@ -269,9 +269,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", - "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", + "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", "cpu": [ "x64" ], @@ -285,9 +285,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", - "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", + "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", "cpu": [ "arm64" ], @@ -301,9 +301,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", - "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", + "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", "cpu": [ "x64" ], @@ -317,9 +317,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", - "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", + "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", "cpu": [ "arm64" ], @@ -333,9 +333,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", - "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", + "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", "cpu": [ "x64" ], @@ -349,9 +349,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", - "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", + "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", "cpu": [ "arm" ], @@ -365,9 +365,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", - "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", + "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", "cpu": [ "arm64" ], @@ -381,9 +381,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", - "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", + "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", "cpu": [ "ia32" ], @@ -397,9 +397,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", - "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", + "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", "cpu": [ "loong64" ], @@ -413,9 +413,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", - "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", + "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", "cpu": [ "mips64el" ], @@ -429,9 +429,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", - "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", + "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", "cpu": [ "ppc64" ], @@ -445,9 +445,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", - "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", + "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", "cpu": [ "riscv64" ], @@ -461,9 +461,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", - "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", + "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", "cpu": [ "s390x" ], @@ -477,9 +477,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", - "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", + "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", "cpu": [ "x64" ], @@ -493,9 +493,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", - "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", + "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", "cpu": [ "x64" ], @@ -509,9 +509,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", - "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", + "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", "cpu": [ "x64" ], @@ -525,9 +525,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", - "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", + "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", "cpu": [ "x64" ], @@ -541,9 +541,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", - "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", + "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", "cpu": [ "arm64" ], @@ -557,9 +557,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", - "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", + "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", "cpu": [ "ia32" ], @@ -573,9 +573,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", - "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", + "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", "cpu": [ "x64" ], @@ -1463,9 +1463,9 @@ } }, "node_modules/esbuild": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", - "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", + "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", "dev": true, "hasInstallScript": true, "bin": { @@ -1475,29 +1475,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.19.11", - "@esbuild/android-arm": "0.19.11", - "@esbuild/android-arm64": "0.19.11", - "@esbuild/android-x64": "0.19.11", - "@esbuild/darwin-arm64": "0.19.11", - "@esbuild/darwin-x64": "0.19.11", - "@esbuild/freebsd-arm64": "0.19.11", - "@esbuild/freebsd-x64": "0.19.11", - "@esbuild/linux-arm": "0.19.11", - "@esbuild/linux-arm64": "0.19.11", - "@esbuild/linux-ia32": "0.19.11", - "@esbuild/linux-loong64": "0.19.11", - "@esbuild/linux-mips64el": "0.19.11", - "@esbuild/linux-ppc64": "0.19.11", - "@esbuild/linux-riscv64": "0.19.11", - "@esbuild/linux-s390x": "0.19.11", - "@esbuild/linux-x64": "0.19.11", - "@esbuild/netbsd-x64": "0.19.11", - "@esbuild/openbsd-x64": "0.19.11", - "@esbuild/sunos-x64": "0.19.11", - "@esbuild/win32-arm64": "0.19.11", - "@esbuild/win32-ia32": "0.19.11", - "@esbuild/win32-x64": "0.19.11" + "@esbuild/aix-ppc64": "0.19.12", + "@esbuild/android-arm": "0.19.12", + "@esbuild/android-arm64": "0.19.12", + "@esbuild/android-x64": "0.19.12", + "@esbuild/darwin-arm64": "0.19.12", + "@esbuild/darwin-x64": "0.19.12", + "@esbuild/freebsd-arm64": "0.19.12", + "@esbuild/freebsd-x64": "0.19.12", + "@esbuild/linux-arm": "0.19.12", + "@esbuild/linux-arm64": "0.19.12", + "@esbuild/linux-ia32": "0.19.12", + "@esbuild/linux-loong64": "0.19.12", + "@esbuild/linux-mips64el": "0.19.12", + "@esbuild/linux-ppc64": "0.19.12", + "@esbuild/linux-riscv64": "0.19.12", + "@esbuild/linux-s390x": "0.19.12", + "@esbuild/linux-x64": "0.19.12", + "@esbuild/netbsd-x64": "0.19.12", + "@esbuild/openbsd-x64": "0.19.12", + "@esbuild/sunos-x64": "0.19.12", + "@esbuild/win32-arm64": "0.19.12", + "@esbuild/win32-ia32": "0.19.12", + "@esbuild/win32-x64": "0.19.12" } }, "node_modules/escape-html": { diff --git a/it/typescript/package.json b/it/typescript/package.json index 7c4b456e69..bf34ce1a45 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -22,7 +22,7 @@ "@types/node": "^20.11.5", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", - "esbuild": "^0.19.11", + "esbuild": "^0.19.12", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", From 15f17eec417e6c9ee2fc4f2b566208e81ae5c023 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jan 2024 08:24:30 +0000 Subject: [PATCH 022/394] Bump @types/node from 20.11.5 to 20.11.6 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.5 to 20.11.6. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 7ecb2b88cb..1eb1c3877f 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.5", + "@types/node": "^20.11.6", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", "esbuild": "^0.19.11", @@ -824,9 +824,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.5.tgz", - "integrity": "sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==", + "version": "20.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.6.tgz", + "integrity": "sha512-+EOokTnksGVgip2PbYbr3xnR7kZigh4LbybAfBAw5BpnQ+FqBYUsvCEjYd70IXKlbohQ64mzEYmMtlWUY8q//Q==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index b6bbee0a14..859bdacd2a 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.5", + "@types/node": "^20.11.6", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", "esbuild": "^0.19.11", From a44332540662df24d1fd49bcb409510461e038f7 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Wed, 24 Jan 2024 09:38:50 +0100 Subject: [PATCH 023/394] Switched to a more performant locking library --- src/Kiota.Builder/Caching/DocumentCachingProvider.cs | 6 +++--- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs index 7bb280c983..31412a5da2 100644 --- a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs +++ b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs @@ -7,7 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; -using NeoSmart.AsyncLock; +using AsyncKeyedLock; namespace Kiota.Builder.Caching; @@ -39,7 +39,7 @@ private async Task GetDocumentInternalAsync(Uri documentUri, string inte { var hashedUrl = BitConverter.ToString((HashAlgorithm.Value ?? throw new InvalidOperationException("unable to get hash algorithm")).ComputeHash(Encoding.UTF8.GetBytes(documentUri.ToString()))).Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase); var target = Path.Combine(Path.GetTempPath(), Constants.TempDirectoryName, "cache", intermediateFolderName, hashedUrl, fileName); - var currentLock = _locks.GetOrAdd(target, _ => new AsyncLock()); + var currentLock = _locks.GetOrAdd(target, _ => new AsyncNonKeyedLocker()); using (await currentLock.LockAsync(token).ConfigureAwait(false)) {// if multiple clients are being updated for the same description, we'll have concurrent download of the file without the lock if (!File.Exists(target) || couldNotDelete) @@ -67,7 +67,7 @@ private async Task GetDocumentInternalAsync(Uri documentUri, string inte return await GetDocumentInternalAsync(documentUri, intermediateFolderName, fileName, couldNotDelete, accept, token).ConfigureAwait(false); } } - private static readonly ConcurrentDictionary _locks = new(StringComparer.OrdinalIgnoreCase); + private static readonly ConcurrentDictionary _locks = new(StringComparer.OrdinalIgnoreCase); private async Task DownloadDocumentFromSourceAsync(Uri documentUri, string target, string? accept, CancellationToken token) { Logger.LogDebug("cache file {CacheFile} not found, downloading from {Url}", target, documentUri); diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 2fef97de62..75cca50566 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -35,6 +35,7 @@ $(NoWarn);CS8785;NU5048;NU5104;CA1724;CA1055;CA1848;CA1308;CA1822 + @@ -47,7 +48,6 @@ - From e9287a776d6564afd9e89a5a4431ecbc2fabb0bf Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Wed, 24 Jan 2024 14:25:33 +0100 Subject: [PATCH 024/394] Update src/Kiota.Builder/Caching/DocumentCachingProvider.cs Co-authored-by: Vincent Biret --- src/Kiota.Builder/Caching/DocumentCachingProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs index 31412a5da2..eb9537cd0c 100644 --- a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs +++ b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs @@ -67,7 +67,7 @@ private async Task GetDocumentInternalAsync(Uri documentUri, string inte return await GetDocumentInternalAsync(documentUri, intermediateFolderName, fileName, couldNotDelete, accept, token).ConfigureAwait(false); } } - private static readonly ConcurrentDictionary _locks = new(StringComparer.OrdinalIgnoreCase); + private static readonly AsyncKeyedLocker _locks = new(); private async Task DownloadDocumentFromSourceAsync(Uri documentUri, string target, string? accept, CancellationToken token) { Logger.LogDebug("cache file {CacheFile} not found, downloading from {Url}", target, documentUri); From d8e2d97b976d384a08f0e8c9052f7c5822ebe123 Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Wed, 24 Jan 2024 14:25:40 +0100 Subject: [PATCH 025/394] Update src/Kiota.Builder/Caching/DocumentCachingProvider.cs Co-authored-by: Vincent Biret --- src/Kiota.Builder/Caching/DocumentCachingProvider.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs index eb9537cd0c..64a94747bf 100644 --- a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs +++ b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs @@ -39,8 +39,7 @@ private async Task GetDocumentInternalAsync(Uri documentUri, string inte { var hashedUrl = BitConverter.ToString((HashAlgorithm.Value ?? throw new InvalidOperationException("unable to get hash algorithm")).ComputeHash(Encoding.UTF8.GetBytes(documentUri.ToString()))).Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase); var target = Path.Combine(Path.GetTempPath(), Constants.TempDirectoryName, "cache", intermediateFolderName, hashedUrl, fileName); - var currentLock = _locks.GetOrAdd(target, _ => new AsyncNonKeyedLocker()); - using (await currentLock.LockAsync(token).ConfigureAwait(false)) + using (await _locks.LockAsync(target, token).ConfigureAwait(false)) {// if multiple clients are being updated for the same description, we'll have concurrent download of the file without the lock if (!File.Exists(target) || couldNotDelete) return await DownloadDocumentFromSourceAsync(documentUri, target, accept, token).ConfigureAwait(false); From f804e31ccf166464f18c7d3c2c5db257e0b3ab6e Mon Sep 17 00:00:00 2001 From: Mark Cilia Vincenti Date: Wed, 24 Jan 2024 14:28:10 +0100 Subject: [PATCH 026/394] Added pooling to keyed locking to improve performance and reduce memory allocations. --- src/Kiota.Builder/Caching/DocumentCachingProvider.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs index 64a94747bf..7a0a93fafc 100644 --- a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs +++ b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs @@ -1,13 +1,12 @@ using System; -using System.Collections.Concurrent; using System.IO; using System.Net.Http; using System.Security.Cryptography; using System.Text; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Logging; using AsyncKeyedLock; +using Microsoft.Extensions.Logging; namespace Kiota.Builder.Caching; @@ -66,7 +65,11 @@ private async Task GetDocumentInternalAsync(Uri documentUri, string inte return await GetDocumentInternalAsync(documentUri, intermediateFolderName, fileName, couldNotDelete, accept, token).ConfigureAwait(false); } } - private static readonly AsyncKeyedLocker _locks = new(); + private static readonly AsyncKeyedLocker _locks = new(o => + { + o.PoolSize = 20; + o.PoolInitialFill = 1; + }); private async Task DownloadDocumentFromSourceAsync(Uri documentUri, string target, string? accept, CancellationToken token) { Logger.LogDebug("cache file {CacheFile} not found, downloading from {Url}", target, documentUri); From 861a130c7a4ba67ac39aa0d75d60be26a8bd5349 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 24 Jan 2024 08:59:01 -0500 Subject: [PATCH 027/394] - removes path ignore for vs code extension build --- .github/workflows/build-vscode-extension.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 23eb064b40..44ad4eb9c3 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -4,23 +4,7 @@ on: workflow_dispatch: push: branches: [main] - paths-ignore: - - "abstractions/**" - - "authentication/**" - - "serialization/**" - - "http/**" - - "**.md" - - ".vscode/**" - - "**.svg" pull_request: - paths-ignore: - - "abstractions/**" - - "authentication/**" - - "serialization/**" - - "http/**" - - "**.md" - - ".vscode/**" - - "**.svg" jobs: build_extension: From a2d2ed87b0c5ccbe218fae878dfd6e854bba8401 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 24 Jan 2024 08:59:32 -0500 Subject: [PATCH 028/394] - removes path ignores for integration tests --- .github/workflows/integration-tests.yml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 307dc63e9b..53739c92f5 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -4,27 +4,7 @@ on: workflow_dispatch: push: branches: [main] - paths-ignore: - [ - "abstractions/**", - "authentication/**", - "serialization/**", - "http/**", - "**.md", - ".vscode/**", - "**.svg", - ] pull_request: - paths-ignore: - [ - "abstractions/**", - "authentication/**", - "serialization/**", - "http/**", - "**.md", - ".vscode/**", - "**.svg", - ] concurrency: # Only run once for latest commit per ref and cancel other (previous) runs. From 8e10e4a15c9027aeacd06cbec9e2d1810af5f2d0 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 24 Jan 2024 21:22:57 +0300 Subject: [PATCH 029/394] adds deprecation support Python --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 1 + .../Python/CodeClassDeclarationWriter.cs | 1 + .../Writers/Python/CodeEnumWriter.cs | 1 + .../Writers/Python/CodeMethodWriter.cs | 1 + .../Writers/Python/PythonConventionService.cs | 21 ++++++++++++++++++- 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 6a9527bb97..56c4f5c876 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -140,6 +140,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance private const string AbstractionsPackageName = "kiota_abstractions"; private static readonly AdditionalUsingEvaluator[] defaultUsingEvaluators = { new (static x => x is CodeClass, "__future__", "annotations"), + new (static x => x is CodeClass, "warnings", "warn"), new (static x => x is CodeClass, "typing", "Any, Callable, Dict, List, Optional, TYPE_CHECKING, Union"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.RequestAdapter), $"{AbstractionsPackageName}.request_adapter", "RequestAdapter"), diff --git a/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs index 9d40d35699..adef1bf4a9 100644 --- a/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs @@ -51,6 +51,7 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit _codeUsingWriter.WriteConditionalInternalImports(codeElement, writer, parentNamespace); } conventions.WriteLongDescription(parent.Documentation, writer); + conventions.WriteDeprecationWarning(parent, writer); } } } diff --git a/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs index c69c73d209..89eea849dd 100644 --- a/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs @@ -14,6 +14,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write writer.WriteLine("from enum import Enum"); writer.WriteLine(); writer.WriteLine($"class {codeElement.Name}(str, Enum):"); + conventions.WriteDeprecationWarning(codeElement, writer); writer.IncreaseIndent(); if (!codeElement.Options.Any()) { diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index 295f2cb640..0183c12f31 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -713,6 +713,7 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, st .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) .Select(x => $"param {x.Name}: {PythonConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.Description)}") .Union(new[] { returnRemark })); + conventions.WriteDeprecationWarning(code, writer); } private static readonly PythonCodeParameterOrderComparer parameterOrderComparer = new(); private void WriteMethodPrototype(CodeMethod code, LanguageWriter writer, string returnType, bool isVoid) diff --git a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs index bb2ace2a76..caa6829fd6 100644 --- a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs +++ b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using Kiota.Builder.CodeDOM; @@ -53,7 +54,9 @@ public override string GetParameterSignature(CodeParameter parameter, CodeElemen ArgumentNullException.ThrowIfNull(parameter); ArgumentNullException.ThrowIfNull(targetElement); var defaultValueSuffix = string.IsNullOrEmpty(parameter.DefaultValue) ? string.Empty : $" = {parameter.DefaultValue}"; - return $"{parameter.Name}: {(parameter.Type.IsNullable ? "Optional[" : string.Empty)}{GetTypeString(parameter.Type, targetElement, true, writer)}{(parameter.Type.IsNullable ? "] = None" : string.Empty)}{defaultValueSuffix}"; + var deprecationInfo = GetDeprecationInformation(parameter); + var deprecationSuffix = string.IsNullOrEmpty(deprecationInfo) ? string.Empty : $"# {deprecationInfo}"; + return $"{parameter.Name}: {(parameter.Type.IsNullable ? "Optional[" : string.Empty)}{GetTypeString(parameter.Type, targetElement, true, writer)}{(parameter.Type.IsNullable ? "] = None" : string.Empty)}{defaultValueSuffix}{deprecationSuffix}"; } private static string GetTypeAlias(CodeType targetType, CodeElement targetElement) { @@ -190,4 +193,20 @@ public void WriteInLineDescription(string description, LanguageWriter writer) writer.WriteLine($"{InLineCommentPrefix}{RemoveInvalidDescriptionCharacters(description)}"); } } + + private static string GetDeprecationInformation(IDeprecableElement element) + { + if (element.Deprecation is null || !element.Deprecation.IsDeprecated) return string.Empty; + + var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; + var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; + var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; + return $"{element.Deprecation.Description}{versionComment}{dateComment}{removalComment}"; + } + internal void WriteDeprecationWarning(IDeprecableElement element, LanguageWriter writer) + { + var deprecationMessage = GetDeprecationInformation(element); + if (!string.IsNullOrEmpty(deprecationMessage)) + writer.WriteLine($"warn(\"{deprecationMessage}\", DeprecationWarning)"); + } } From ee64a9bc2b1045771e163d5e56c709e9ca7d47c3 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 24 Jan 2024 21:23:20 +0300 Subject: [PATCH 030/394] adds deprecation tests Python --- .../Python/CodeClassDeclarationWriterTests.cs | 15 +++++++++++++++ .../Writers/Python/CodeMethodWriterTests.cs | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs index 78be35d001..883448dd58 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs @@ -234,4 +234,19 @@ public void WritesInternalImportsNoTypeDef() var result = tw.ToString(); Assert.DoesNotContain("from . import message", result); } + [Fact] + public void WritesModelClassDeprecationInformation() + { + parentClass.Kind = CodeClassKind.Model; + parentClass.Deprecation = new("This class is deprecated", DateTimeOffset.Parse("2024-01-01T00:00:00Z"), DateTimeOffset.Parse("2024-01-01T00:00:00Z"), "v2.0"); + codeElementWriter.WriteCodeElement(parentClass.StartBlock, writer); + var result = tw.ToString(); + Assert.Contains("@dataclass", result); + Assert.Contains("class ParentClass()", result); + Assert.Contains("warn(", result); + Assert.Contains("This class is deprecated", result); + Assert.Contains("2024-01-01", result); + Assert.Contains("2024-01-01", result); + Assert.Contains("v2.0", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index 3181cb15b8..e455d0b1b2 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -2175,4 +2175,17 @@ public void DoesntWriteReadOnlyPropertiesInSerializerBody() Assert.DoesNotContain("ReadOnlyProperty", result); AssertExtensions.CurlyBracesAreClosed(result); } + [Fact] + public void WritesDeprecationInformation() + { + setup(); + method.Deprecation = new("This method is deprecated", DateTimeOffset.Parse("2020-01-01T00:00:00Z"), DateTimeOffset.Parse("2021-01-01T00:00:00Z"), "v2.0"); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("This method is deprecated", result); + Assert.Contains("2020-01-01", result); + Assert.Contains("2021-01-01", result); + Assert.Contains("v2.0", result); + Assert.Contains("warn(", result); + } } From e486c876ed35937acc1d31c5cbd169fc3cda2512 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 24 Jan 2024 21:24:06 +0300 Subject: [PATCH 031/394] adds changelog entry for python deprecation support --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd9ae1f14e..1e4e641b8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added Japanese translations to vscode extension. +- Added support for deprecation annotations in Python. [#2798](https://github.com/microsoft/kiota/issues/2798) ### Changed From 167eaeafe75ef54e91c4cf38bd11f548d15d2cb8 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 24 Jan 2024 14:49:22 -0500 Subject: [PATCH 032/394] - fixes missing return type bug in TS Signed-off-by: Vincent Biret --- CHANGELOG.md | 1 + src/Kiota.Builder/CodeDOM/CodeParameter.cs | 4 ++++ src/Kiota.Builder/Refiners/TypeScriptRefiner.cs | 3 ++- .../Writers/TypeScript/CodeFunctionWriter.cs | 4 +++- .../TypeScript/TypeScriptConventionService.cs | 14 ++++++++++++-- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd9ae1f14e..e44fc669e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a bug where scalar error mappings would be generated even though it's not supported by the http request adapter. [#4018](https://github.com/microsoft/kiota/issues/4018) - Switched to proxy generation for TypeScript, leading to about ~44% bundle sizes reduction. [#3642](https://github.com/microsoft/kiota/issues/3642) +- Fixed a bug where TypeScript models factory methods would be missing return types. ## [1.10.1] - 2024-01-12 diff --git a/src/Kiota.Builder/CodeDOM/CodeParameter.cs b/src/Kiota.Builder/CodeDOM/CodeParameter.cs index 8499fa43a4..c283b9221a 100644 --- a/src/Kiota.Builder/CodeDOM/CodeParameter.cs +++ b/src/Kiota.Builder/CodeDOM/CodeParameter.cs @@ -52,6 +52,10 @@ public enum CodeParameterKind /// The content type of the request body when it couldn't be inferred from the description. /// RequestBodyContentType, + /// + /// When the deserialization method is replaced as a function, this is the parameter representing instance we're deserializing into. + /// + DeserializationTarget, } public class CodeParameter : CodeTerminalWithKind, ICloneable, IDocumentedElement, IDeprecableElement diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index c7ac33287d..43fdb97c1a 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -736,7 +736,8 @@ private static void AddInterfaceParamToSerializer(CodeInterface modelInterface, { Name = ReturnFinalInterfaceName(modelInterface.Name), // remove the interface suffix DefaultValue = "{}", - Type = new CodeType { Name = ReturnFinalInterfaceName(modelInterface.Name), TypeDefinition = modelInterface } + Type = new CodeType { Name = ReturnFinalInterfaceName(modelInterface.Name), TypeDefinition = modelInterface }, + Kind = CodeParameterKind.DeserializationTarget, }); if (modelInterface.Parent is not null) diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs index aa8947f083..6f302d522c 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs @@ -26,7 +26,9 @@ public override void WriteCodeElement(CodeFunction codeElement, LanguageWriter w var codeMethod = codeElement.OriginalLocalMethod; - var returnType = codeMethod.Kind != CodeMethodKind.Factory ? conventions.GetTypeString(codeMethod.ReturnType, codeElement) : string.Empty; + var returnType = codeMethod.Kind is CodeMethodKind.Factory ? + "((instance?: Parsable) => Record void>)" : + conventions.GetTypeString(codeMethod.ReturnType, codeElement); var isVoid = "void".EqualsIgnoreCase(returnType); CodeMethodWriter.WriteMethodDocumentationInternal(codeElement.OriginalLocalMethod, writer, isVoid, conventions); CodeMethodWriter.WriteMethodPrototypeInternal(codeElement.OriginalLocalMethod, writer, returnType, isVoid, conventions, true); diff --git a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs index 886ee7b49f..0c0901e5f4 100644 --- a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs +++ b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs @@ -56,8 +56,18 @@ public override string GetParameterSignature(CodeParameter parameter, CodeElemen { ArgumentNullException.ThrowIfNull(parameter); var paramType = GetTypeString(parameter.Type, targetElement); - var defaultValueSuffix = string.IsNullOrEmpty(parameter.DefaultValue) ? string.Empty : $" = {parameter.DefaultValue} as {paramType}"; - return $"{parameter.Name.ToFirstCharacterLowerCase()}{(parameter.Optional && parameter.Type.IsNullable ? "?" : string.Empty)}: {paramType}{(parameter.Type.IsNullable ? " | undefined" : string.Empty)}{defaultValueSuffix}"; + var defaultValueSuffix = (string.IsNullOrEmpty(parameter.DefaultValue), parameter.Kind) switch + { + (false, CodeParameterKind.DeserializationTarget) => $" = {parameter.DefaultValue}", + (false, _) => $" = {parameter.DefaultValue} as {paramType}", + (true, _) => string.Empty, + }; + var (partialPrefix, partialSuffix) = parameter.Kind switch + { + CodeParameterKind.DeserializationTarget => ("Partial<", ">"), + _ => (string.Empty, string.Empty), + }; + return $"{parameter.Name.ToFirstCharacterLowerCase()}{(parameter.Optional && parameter.Type.IsNullable ? "?" : string.Empty)}: {partialPrefix}{paramType}{partialSuffix}{(parameter.Type.IsNullable ? " | undefined" : string.Empty)}{defaultValueSuffix}"; } public override string GetTypeString(CodeTypeBase code, CodeElement targetElement, bool includeCollectionInformation = true, LanguageWriter? writer = null) { From 43c0e5473f58634ce419e5ec970876f5e79f6a94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 08:06:04 +0000 Subject: [PATCH 033/394] Bump the kiota-dependencies group with 1 update Bumps the kiota-dependencies group with 1 update: [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet). Updates `Microsoft.Kiota.Abstractions` from 1.7.5 to 1.7.6 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.5...v1.7.6) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 75cca50566..3b26261562 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -38,7 +38,7 @@ - + From 4fdef9e9b3944c42c0c526779777ba6747262596 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 08:20:58 +0000 Subject: [PATCH 034/394] Bump cryptography from 42.0.0 to 42.0.1 in /it/python Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.0 to 42.0.1. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/42.0.0...42.0.1) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 14ed86d35f..30cd45472f 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -82,7 +82,7 @@ azure-identity==1.15.0 cffi==1.16.0 -cryptography==42.0.0 ; python_version >= '3.7' +cryptography==42.0.1 ; python_version >= '3.7' frozenlist==1.4.1 ; python_version >= '3.7' From 6d60b4dd9aa34db33d14cb58bdabafd8dfe659dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 08:21:06 +0000 Subject: [PATCH 035/394] Bump pluggy from 1.3.0 to 1.4.0 in /it/python Bumps [pluggy](https://github.com/pytest-dev/pluggy) from 1.3.0 to 1.4.0. - [Changelog](https://github.com/pytest-dev/pluggy/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pluggy/compare/1.3.0...1.4.0) --- updated-dependencies: - dependency-name: pluggy dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 14ed86d35f..aded522d6b 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -38,7 +38,7 @@ packaging==23.2 ; python_version >= '3.7' platformdirs==4.1.0 ; python_version >= '3.7' -pluggy==1.3.0 ; python_version >= '3.7' +pluggy==1.4.0 ; python_version >= '3.7' pylint==3.0.3 From 89fb41f57c0789cc68a0c534e60b6f18cb055b62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 08:39:39 +0000 Subject: [PATCH 036/394] Bump the kiota-dependencies group in /it/csharp with 1 update Bumps the kiota-dependencies group in /it/csharp with 1 update: [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet). Updates `Microsoft.Kiota.Abstractions` from 1.7.5 to 1.7.6 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.5...v1.7.6) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 60e6a76ec7..a75543bc23 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -10,7 +10,7 @@ - + From 376156d58f18a91dc54a7db44e4bdb5b146f0f90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:00:02 +0000 Subject: [PATCH 037/394] Bump @vscode/test-electron in /vscode/microsoft-kiota Bumps [@vscode/test-electron](https://github.com/Microsoft/vscode-test) from 2.3.8 to 2.3.9. - [Changelog](https://github.com/microsoft/vscode-test/blob/main/CHANGELOG.md) - [Commits](https://github.com/Microsoft/vscode-test/commits/v2.3.9) --- updated-dependencies: - dependency-name: "@vscode/test-electron" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 8 ++++---- vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index fb2855d3ec..3fb13ac767 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -22,7 +22,7 @@ "@types/vscode": "^1.85.0", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", - "@vscode/test-electron": "^2.3.8", + "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", "mocha": "^10.1.0", @@ -793,9 +793,9 @@ "integrity": "sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==" }, "node_modules/@vscode/test-electron": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.8.tgz", - "integrity": "sha512-b4aZZsBKtMGdDljAsOPObnAi7+VWIaYl3ylCz1jTs+oV6BZ4TNHcVNC3xUn0azPeszBmwSBDQYfFESIaUQnrOg==", + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.3.9.tgz", + "integrity": "sha512-z3eiChaCQXMqBnk2aHHSEkobmC2VRalFQN0ApOAtydL172zXGxTwGrRtviT5HnUB+Q+G3vtEYFtuQkYqBzYgMA==", "dev": true, "dependencies": { "http-proxy-agent": "^4.0.1", diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 44591c487b..70aff99f81 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -429,7 +429,7 @@ "@types/vscode": "^1.85.0", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", - "@vscode/test-electron": "^2.3.8", + "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", "mocha": "^10.1.0", From 56a0bd3feac13b1e98c0c8d2b712e0152820504d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:00:12 +0000 Subject: [PATCH 038/394] Bump webpack from 5.89.0 to 5.90.0 in /vscode/microsoft-kiota Bumps [webpack](https://github.com/webpack/webpack) from 5.89.0 to 5.90.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.89.0...v5.90.0) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 102 +++++++++++------------ vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index fb2855d3ec..5fa4741f67 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -28,7 +28,7 @@ "mocha": "^10.1.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", - "webpack": "^5.89.0", + "webpack": "^5.90.0", "webpack-cli": "^5.1.4" }, "engines": { @@ -201,9 +201,9 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", "dev": true, "engines": { "node": ">=6.0.0" @@ -229,19 +229,19 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", + "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@leichtgewicht/ip-codec": { @@ -511,9 +511,9 @@ } }, "node_modules/@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, "node_modules/@types/http-cache-semantics": { @@ -1204,9 +1204,9 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.21.9", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", - "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", "dev": true, "funding": [ { @@ -1223,10 +1223,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001503", - "electron-to-chromium": "^1.4.431", - "node-releases": "^2.0.12", - "update-browserslist-db": "^1.0.11" + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" }, "bin": { "browserslist": "cli.js" @@ -1288,9 +1288,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001515", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", - "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", + "version": "1.0.30001580", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001580.tgz", + "integrity": "sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==", "dev": true, "funding": [ { @@ -1644,9 +1644,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.455", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.455.tgz", - "integrity": "sha512-8tgdX0Odl24LtmLwxotpJCVjIndN559AvaOtd67u+2mo+IDsgsTF580NB+uuDCqsHw8yFg53l5+imFV9Fw3cbA==", + "version": "1.4.645", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.645.tgz", + "integrity": "sha512-EeS1oQDCmnYsRDRy2zTeC336a/4LZ6WKqvSaM1jLocEk5ZuyszkQtCpsqvuvaIXGOUjwtvF6LTcS8WueibXvSw==", "dev": true }, "node_modules/emoji-regex": { @@ -2991,9 +2991,9 @@ "dev": true }, "node_modules/node-releases": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", - "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, "node_modules/normalize-path": { @@ -3839,9 +3839,9 @@ } }, "node_modules/terser": { - "version": "5.19.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.0.tgz", - "integrity": "sha512-JpcpGOQLOXm2jsomozdMDpd5f8ZHh1rR48OFgWUH3QsyZcfPgv2qDCYbcDEAYNd4OZRj2bWYKpwdll/udZCk/Q==", + "version": "5.27.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.0.tgz", + "integrity": "sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -3857,16 +3857,16 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.3.9", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.9.tgz", - "integrity": "sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==", + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", + "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", "dev": true, "dependencies": { - "@jridgewell/trace-mapping": "^0.3.17", + "@jridgewell/trace-mapping": "^0.3.20", "jest-worker": "^27.4.5", "schema-utils": "^3.1.1", "serialize-javascript": "^6.0.1", - "terser": "^5.16.8" + "terser": "^5.26.0" }, "engines": { "node": ">= 10.13.0" @@ -3891,9 +3891,9 @@ } }, "node_modules/terser-webpack-plugin/node_modules/serialize-javascript": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", - "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "dependencies": { "randombytes": "^2.1.0" @@ -4008,9 +4008,9 @@ "dev": true }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "dev": true, "funding": [ { @@ -4074,19 +4074,19 @@ } }, "node_modules/webpack": { - "version": "5.89.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", - "integrity": "sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==", + "version": "5.90.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.0.tgz", + "integrity": "sha512-bdmyXRCXeeNIePv6R6tGPyy20aUobw4Zy8r0LUS2EWO+U+Ke/gYDgsCh7bl5rB6jPpr4r0SZa6dPxBxLooDT3w==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", + "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.11.5", "@webassemblyjs/wasm-edit": "^1.11.5", "@webassemblyjs/wasm-parser": "^1.11.5", "acorn": "^8.7.1", "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", + "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.15.0", "es-module-lexer": "^1.2.1", @@ -4100,7 +4100,7 @@ "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", + "terser-webpack-plugin": "^5.3.10", "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 44591c487b..45bf36bf47 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -435,7 +435,7 @@ "mocha": "^10.1.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", - "webpack": "^5.89.0", + "webpack": "^5.90.0", "webpack-cli": "^5.1.4" }, "dependencies": { From ddb91a6d26afc7046dfaf69674b5681393d720fa Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 25 Jan 2024 13:08:42 +0300 Subject: [PATCH 039/394] Use conditional imports --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 56c4f5c876..cc5b593ff5 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -140,7 +140,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance private const string AbstractionsPackageName = "kiota_abstractions"; private static readonly AdditionalUsingEvaluator[] defaultUsingEvaluators = { new (static x => x is CodeClass, "__future__", "annotations"), - new (static x => x is CodeClass, "warnings", "warn"), new (static x => x is CodeClass, "typing", "Any, Callable, Dict, List, Optional, TYPE_CHECKING, Union"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.RequestAdapter), $"{AbstractionsPackageName}.request_adapter", "RequestAdapter"), @@ -170,6 +169,8 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance new (static x => x is CodeClass @class && (@class.IsOfKind(CodeClassKind.Model) || x.Parent is CodeClass), "dataclasses", "dataclass, field"), new (static x => x is CodeClass { OriginalComposedType: CodeIntersectionType intersectionType } && intersectionType.Types.Any(static y => !y.IsExternal) && intersectionType.DiscriminatorInformation.HasBasicDiscriminatorInformation, $"{AbstractionsPackageName}.serialization", "ParseNodeHelper"), + new (static x => x is IDeprecableElement element && element.Deprecation is not null && element.Deprecation.IsDeprecated, + "warnings", "warn"), }; private static void CorrectCommonNames(CodeElement currentElement) From d30ebacf0598c7eb14316783a73ad40d33d117ea Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 25 Jan 2024 13:09:16 +0300 Subject: [PATCH 040/394] Fix formatting --- .../Writers/Python/CodeClassDeclarationWriterTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs index 883448dd58..c8e7c03bf0 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs @@ -241,9 +241,10 @@ public void WritesModelClassDeprecationInformation() parentClass.Deprecation = new("This class is deprecated", DateTimeOffset.Parse("2024-01-01T00:00:00Z"), DateTimeOffset.Parse("2024-01-01T00:00:00Z"), "v2.0"); codeElementWriter.WriteCodeElement(parentClass.StartBlock, writer); var result = tw.ToString(); + Assert.Contains("from warnings import warn") Assert.Contains("@dataclass", result); Assert.Contains("class ParentClass()", result); - Assert.Contains("warn(", result); + Assert.Contains("warn(", result); Assert.Contains("This class is deprecated", result); Assert.Contains("2024-01-01", result); Assert.Contains("2024-01-01", result); From 05d5a6de9dd01daa608b3d3407ead2dc2652eeff Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 25 Jan 2024 13:11:24 +0300 Subject: [PATCH 041/394] Fix formatting --- .../Writers/Python/CodeClassDeclarationWriterTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs index c8e7c03bf0..0401595232 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs @@ -241,7 +241,7 @@ public void WritesModelClassDeprecationInformation() parentClass.Deprecation = new("This class is deprecated", DateTimeOffset.Parse("2024-01-01T00:00:00Z"), DateTimeOffset.Parse("2024-01-01T00:00:00Z"), "v2.0"); codeElementWriter.WriteCodeElement(parentClass.StartBlock, writer); var result = tw.ToString(); - Assert.Contains("from warnings import warn") + Assert.Contains("from warnings import warn"); Assert.Contains("@dataclass", result); Assert.Contains("class ParentClass()", result); Assert.Contains("warn(", result); From 0a0b9cc7e6c89986bf55b615a04cc91dc09841a6 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 25 Jan 2024 13:13:47 +0300 Subject: [PATCH 042/394] Fix failing test --- .../Writers/Python/CodeClassDeclarationWriterTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs index 0401595232..74f36a2bd1 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeClassDeclarationWriterTests.cs @@ -241,7 +241,6 @@ public void WritesModelClassDeprecationInformation() parentClass.Deprecation = new("This class is deprecated", DateTimeOffset.Parse("2024-01-01T00:00:00Z"), DateTimeOffset.Parse("2024-01-01T00:00:00Z"), "v2.0"); codeElementWriter.WriteCodeElement(parentClass.StartBlock, writer); var result = tw.ToString(); - Assert.Contains("from warnings import warn"); Assert.Contains("@dataclass", result); Assert.Contains("class ParentClass()", result); Assert.Contains("warn(", result); From 83eb08d2df63ba9df8e0dc3c025d41b14e355dcc Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 25 Jan 2024 16:42:27 +0300 Subject: [PATCH 043/394] adds marker interface to Python composed type wrappers --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 25 +++++++++++++------ .../Writers/Python/CodeMethodWriter.cs | 2 ++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index cc5b593ff5..97338241c5 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -68,6 +68,13 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance }); cancellationToken.ThrowIfCancellationRequested(); MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); + ConvertUnionTypesToWrapper(generatedCode, + _configuration.UsesBackingStore, + static s => s, + true, + $"{AbstractionsPackageName}.composed_type_wrapper", + "ComposedTypeWrapper" + ); ReplacePropertyNames(generatedCode, new() { CodePropertyKind.AdditionalData, @@ -138,6 +145,8 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance } private const string AbstractionsPackageName = "kiota_abstractions"; + private const string SerializationModuleName = $"{AbstractionsPackageName}.serialization"; + private const string StoreModuleName = $"{AbstractionsPackageName}.store"; private static readonly AdditionalUsingEvaluator[] defaultUsingEvaluators = { new (static x => x is CodeClass, "__future__", "annotations"), new (static x => x is CodeClass, "typing", "Any, Callable, Dict, List, Optional, TYPE_CHECKING, Union"), @@ -150,25 +159,25 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestGenerator), $"{AbstractionsPackageName}.request_option", "RequestOption"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.Serializer), - $"{AbstractionsPackageName}.serialization", "SerializationWriter"), + SerializationModuleName, "SerializationWriter"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.Deserializer), - $"{AbstractionsPackageName}.serialization", "ParseNode"), + SerializationModuleName, "ParseNode"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.Constructor, CodeMethodKind.ClientConstructor, CodeMethodKind.IndexerBackwardCompatibility), $"{AbstractionsPackageName}.get_path_parameters", "get_path_parameters"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestExecutor), - $"{AbstractionsPackageName}.serialization", "Parsable", "ParsableFactory"), + SerializationModuleName, "Parsable", "ParsableFactory"), new (static x => x is CodeClass @class && @class.IsOfKind(CodeClassKind.Model), - $"{AbstractionsPackageName}.serialization", "Parsable"), + SerializationModuleName, "Parsable"), new (static x => x is CodeClass @class && @class.IsOfKind(CodeClassKind.Model) && @class.Properties.Any(static x => x.IsOfKind(CodePropertyKind.AdditionalData)), - $"{AbstractionsPackageName}.serialization", "AdditionalDataHolder"), + SerializationModuleName, "AdditionalDataHolder"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.ClientConstructor) && method.Parameters.Any(y => y.IsOfKind(CodeParameterKind.BackingStore)), - $"{AbstractionsPackageName}.store", "BackingStoreFactory", "BackingStoreFactorySingleton"), + StoreModuleName, "BackingStoreFactory", "BackingStoreFactorySingleton"), new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.BackingStore), - $"{AbstractionsPackageName}.store", "BackedModel", "BackingStore", "BackingStoreFactorySingleton" ), + StoreModuleName, "BackedModel", "BackingStore", "BackingStoreFactorySingleton" ), new (static x => x is CodeClass @class && (@class.IsOfKind(CodeClassKind.Model) || x.Parent is CodeClass), "dataclasses", "dataclass, field"), new (static x => x is CodeClass { OriginalComposedType: CodeIntersectionType intersectionType } && intersectionType.Types.Any(static y => !y.IsExternal) && intersectionType.DiscriminatorInformation.HasBasicDiscriminatorInformation, - $"{AbstractionsPackageName}.serialization", "ParseNodeHelper"), + SerializationModuleName, "ParseNodeHelper"), new (static x => x is IDeprecableElement element && element.Deprecation is not null && element.Deprecation.IsDeprecated, "warnings", "warn"), }; diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index 0183c12f31..372ab8b74a 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -100,6 +100,8 @@ public override void WriteCodeElement(CodeMethod codeElement, LanguageWriter wri WriteFactoryMethodBody(codeElement, parentClass, writer); writer.CloseBlock(string.Empty); break; + case CodeMethodKind.ComposedTypeMarker: + throw new InvalidOperationException("ComposedTypeMarker is not required as interface is explicitly implemented."); case CodeMethodKind.RawUrlConstructor: throw new InvalidOperationException("RawUrlConstructor is not supported in python"); case CodeMethodKind.RequestBuilderBackwardCompatibility: From 429064c50fab80b358b6fbab06ae4d77812d1000 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 25 Jan 2024 16:42:45 +0300 Subject: [PATCH 044/394] Add tests --- .../Refiners/PythonLanguageRefinerTests.cs | 61 ++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs index ce50b0d849..cdb2048da7 100644 --- a/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs @@ -272,6 +272,66 @@ public async Task EscapesExceptionPropertiesNames() Assert.Contains("response_status_code_", exception.Properties.Select(x => x.Name)); } [Fact] + public async Task ConvertsUnionTypesToWrapper() + { + var model = root.AddClass(new CodeClass + { + Name = "model", + Kind = CodeClassKind.Model + }).First(); + var union = new CodeUnionType + { + Name = "union", + }; + union.AddType(new() + { + Name = "type1", + }, new() + { + Name = "type2" + }); + var property = model.AddProperty(new CodeProperty + { + Name = "deserialize", + Kind = CodePropertyKind.Custom, + Type = union.Clone() as CodeTypeBase, + }).First(); + var method = model.AddMethod(new CodeMethod + { + Name = "method", + ReturnType = union.Clone() as CodeTypeBase + }).First(); + var parameter = new CodeParameter + { + Name = "param1", + Type = union.Clone() as CodeTypeBase + }; + var indexer = new CodeIndexer + { + Name = "idx", + ReturnType = union.Clone() as CodeTypeBase, + IndexParameter = new() + { + Name = "id", + Type = new CodeType + { + Name = "string" + }, + } + }; + model.AddIndexer(indexer); + method.AddParameter(parameter); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Python }, root); + Assert.True(property.Type is CodeType); + Assert.True(parameter.Type is CodeType); + Assert.True(method.ReturnType is CodeType); + var resultingWrapper = root.FindChildByName("union"); + Assert.NotNull(resultingWrapper); + Assert.NotNull(resultingWrapper.OriginalComposedType); + Assert.Contains("ComposedTypeWrapper", resultingWrapper.StartBlock.Implements.Select(static x => x.Name)); + Assert.Null(resultingWrapper.Methods.SingleOrDefault(static x => x.IsOfKind(CodeMethodKind.ComposedTypeMarker))); + } + [Fact] public async Task CorrectsCoreType() { @@ -369,7 +429,6 @@ public async Task CorrectsCoreType() Assert.Empty(model.Properties.Where(x => PathParametersDefaultValue.Equals(x.DefaultValue))); Assert.Empty(model.Methods.Where(x => DeserializeDefaultName.Equals(x.ReturnType.Name))); Assert.Empty(model.Methods.SelectMany(x => x.Parameters).Where(x => serializerDefaultName.Equals(x.Type.Name))); - Assert.Single(constructorMethod.Parameters.Where(x => x.Type is CodeComposedTypeBase)); } [Fact] public async Task ReplacesDateTimeOffsetByNativeType() From 66869cc2ac00d983754f98ee9e15dad3fcc5de5d Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 25 Jan 2024 16:42:58 +0300 Subject: [PATCH 045/394] Add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b8d981fbb..e86a2d361d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Fixed serialization of scalar members in union types for Python. [#2828](https://github.com/microsoft/kiota/issues/2828) - Fixed a bug where scalar error mappings would be generated even though it's not supported by the http request adapter. [#4018](https://github.com/microsoft/kiota/issues/4018) - Switched to proxy generation for TypeScript, leading to about ~44% bundle sizes reduction. [#3642](https://github.com/microsoft/kiota/issues/3642) - Fixed a bug where TypeScript models factory methods would be missing return types. From e112fc697e46ff884723c5b4754bb058eeb4ba2d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 25 Jan 2024 10:57:29 -0500 Subject: [PATCH 046/394] - fixes minor typo in typescript generation Signed-off-by: Vincent Biret --- src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index 5b6d9acad2..f18517501a 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -229,6 +229,6 @@ private void WriteEnumObjectConstant(CodeConstant codeElement, LanguageWriter wr conventions.WriteShortDescription(x.Documentation.Description, writer); writer.WriteLine($"{x.Name.ToFirstCharacterUpperCase()}: \"{x.WireName}\","); }); - writer.CloseBlock("} as const;"); + writer.CloseBlock("} as const;"); } } From 97caea8e89f8a6439ff9cdc0d5487afe0d003ee7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jan 2024 08:16:20 +0000 Subject: [PATCH 047/394] Bump @types/node from 20.11.6 to 20.11.7 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.6 to 20.11.7. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 81c0dd73ef..b0dc19e3d3 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.6.tgz", - "integrity": "sha512-+EOokTnksGVgip2PbYbr3xnR7kZigh4LbybAfBAw5BpnQ+FqBYUsvCEjYd70IXKlbohQ64mzEYmMtlWUY8q//Q==", + "version": "20.11.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.7.tgz", + "integrity": "sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From 885fc570d7f334d3716c7e2e1e94341343af874b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jan 2024 09:02:38 +0000 Subject: [PATCH 048/394] Bump @types/node from 20.11.6 to 20.11.7 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.6 to 20.11.7. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index fd84b14173..e8e9fd5f13 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.6", + "@types/node": "^20.11.7", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", "esbuild": "^0.19.12", @@ -824,9 +824,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.6.tgz", - "integrity": "sha512-+EOokTnksGVgip2PbYbr3xnR7kZigh4LbybAfBAw5BpnQ+FqBYUsvCEjYd70IXKlbohQ64mzEYmMtlWUY8q//Q==", + "version": "20.11.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.7.tgz", + "integrity": "sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 1d27ef2ba7..1612511ec0 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.6", + "@types/node": "^20.11.7", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", "esbuild": "^0.19.12", From 49bdf8d6eef7c26895b29c7876b4c98665198ea5 Mon Sep 17 00:00:00 2001 From: Eastman Date: Fri, 26 Jan 2024 12:15:01 +0300 Subject: [PATCH 049/394] Fix broken link --- specs/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/index.md b/specs/index.md index e040b18428..78579ac2b0 100644 --- a/specs/index.md +++ b/specs/index.md @@ -16,8 +16,8 @@ config.md) ## Scenarios -* [Kiota Config](./scenarios/kiota.config.md) +* [Kiota Config](./scenarios/kiota-config.md) ## Schemas -* [kiota-config.json](./schemas/kiota-config.json) \ No newline at end of file +* [kiota-config.json](./schemas/kiota-config.json) From c5491b55ff6cc5c629197ef3b1adcdcb39fb6b8a Mon Sep 17 00:00:00 2001 From: Eastman Date: Fri, 26 Jan 2024 12:23:37 +0300 Subject: [PATCH 050/394] Update kiota-config.md --- specs/scenarios/kiota-config.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/scenarios/kiota-config.md b/specs/scenarios/kiota-config.md index 17e57e6b09..2bc2c82e9b 100644 --- a/specs/scenarios/kiota-config.md +++ b/specs/scenarios/kiota-config.md @@ -53,7 +53,7 @@ The [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01. ## Commands -* [kiota config init](../cli/init.md) +* [kiota config init](../cli/config-init.md) * [kiota client add](../cli/client-add.md) * [kiota client edit](../cli/client-edit.md) * [kiota client generate](../cli/client-generate.md) @@ -96,4 +96,4 @@ kiota client delete --client=name "graphPython" --clean-output ```bash kiota client generate -``` \ No newline at end of file +``` From 092be986b9475d7b065db17e7485763f6c7f7354 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 26 Jan 2024 17:15:13 +0300 Subject: [PATCH 051/394] File path too long --- CHANGELOG.md | 1 + .../PathSegmenters/CSharpPathSegmenter.cs | 19 +++++-- .../CSharpPathSegmenterTests.cs | 51 +++++++++++++++++++ .../PathSegmenters/JavaPathSegmenterTests.cs | 33 ++++++++++++ .../PythonPathSegmenterTests.cs | 36 +++++++++++++ .../TypeScriptPathSegmenterTests.cs | 36 +++++++++++++ 6 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 tests/Kiota.Builder.Tests/PathSegmenters/CSharpPathSegmenterTests.cs create mode 100644 tests/Kiota.Builder.Tests/PathSegmenters/JavaPathSegmenterTests.cs create mode 100644 tests/Kiota.Builder.Tests/PathSegmenters/PythonPathSegmenterTests.cs create mode 100644 tests/Kiota.Builder.Tests/PathSegmenters/TypeScriptPathSegmenterTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b8d981fbb..17625b210b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a bug where scalar error mappings would be generated even though it's not supported by the http request adapter. [#4018](https://github.com/microsoft/kiota/issues/4018) - Switched to proxy generation for TypeScript, leading to about ~44% bundle sizes reduction. [#3642](https://github.com/microsoft/kiota/issues/3642) - Fixed a bug where TypeScript models factory methods would be missing return types. +- Fixed a bug where generated paths would possibly get too long. [#3854](https://github.com/microsoft/kiota/issues/3854) ## [1.10.1] - 2024-01-12 diff --git a/src/Kiota.Builder/PathSegmenters/CSharpPathSegmenter.cs b/src/Kiota.Builder/PathSegmenters/CSharpPathSegmenter.cs index e9853e6ca6..5dcc4e0d8b 100644 --- a/src/Kiota.Builder/PathSegmenters/CSharpPathSegmenter.cs +++ b/src/Kiota.Builder/PathSegmenters/CSharpPathSegmenter.cs @@ -1,4 +1,6 @@ -using Kiota.Builder.CodeDOM; +using System; +using System.IO; +using Kiota.Builder.CodeDOM; using Kiota.Builder.Extensions; namespace Kiota.Builder.PathSegmenters; @@ -6,6 +8,17 @@ public class CSharpPathSegmenter : CommonPathSegmenter { public CSharpPathSegmenter(string rootPath, string clientNamespaceName) : base(rootPath, clientNamespaceName) { } public override string FileSuffix => ".cs"; - public override string NormalizeNamespaceSegment(string segmentName) => segmentName.ToFirstCharacterUpperCase(); - public override string NormalizeFileName(CodeElement currentElement) => GetLastFileNameSegment(currentElement).ToFirstCharacterUpperCase(); + public override string NormalizeNamespaceSegment(string segmentName) => segmentName.ToFirstCharacterUpperCase().ShortenFileName(); + public override string NormalizeFileName(CodeElement currentElement) => GetLastFileNameSegment(currentElement).ToFirstCharacterUpperCase().ShortenFileName(); + public override string NormalizePath(string fullPath) + { + if (ExceedsMaxPathLength(fullPath) && Path.GetDirectoryName(fullPath) is string directoryName) + { + var availableLength = MaxFilePathLength - (directoryName.Length + FileSuffix.Length + 2); // one for the folder separator and another to ensure its below limit + return Path.Combine(directoryName, Path.GetFileName(fullPath).ShortenFileName(availableLength)[..Math.Min(64, availableLength)]) + FileSuffix; + } + return fullPath; + } + internal const int MaxFilePathLength = 32767; + private static bool ExceedsMaxPathLength(string fullPath) => !string.IsNullOrEmpty(fullPath) && fullPath.Length > MaxFilePathLength; } diff --git a/tests/Kiota.Builder.Tests/PathSegmenters/CSharpPathSegmenterTests.cs b/tests/Kiota.Builder.Tests/PathSegmenters/CSharpPathSegmenterTests.cs new file mode 100644 index 0000000000..019c8e2da5 --- /dev/null +++ b/tests/Kiota.Builder.Tests/PathSegmenters/CSharpPathSegmenterTests.cs @@ -0,0 +1,51 @@ +using Kiota.Builder.CodeDOM; +using Kiota.Builder.PathSegmenters; +using Xunit; + +namespace Kiota.Builder.Tests.PathSegmenters +{ + public class CSharpPathSegmenterTests + { + private readonly CSharpPathSegmenter segmenter; + public CSharpPathSegmenterTests() + { + segmenter = new CSharpPathSegmenter("D:\\source\\repos\\kiota-sample", "client"); + } + + [Fact] + public void CSharpPathSegmenterGeneratesCorrectFileName() + { + var fileName = segmenter.NormalizeFileName(new CodeClass + { + Name = "testClass" + }); + Assert.Equal("TestClass", fileName);// the file name should be PascalCase + } + + [Fact] + public void CSharpPathSegmenterDoesNotGenerateNamespaceFoldersThatAreTooLong() + { + var longNamespace = "ThisIsAVeryLongNamespaceNameThatShouldBeTruncatedAsItIsLongerThanTwoHundredAndFiftySixCharactersAccordingToWindows"; + longNamespace = longNamespace + longNamespace + longNamespace; //make it more than 256 + var normalizedNamespace = segmenter.NormalizeNamespaceSegment(longNamespace); + Assert.NotEqual(longNamespace, normalizedNamespace); + Assert.Equal(64, normalizedNamespace.Length);// shortened to sha256 length + } + + [Fact] + public void CSharpPathSegmenterDoesNotGeneratePathsThatAreTooLong() + { + var rootDir = "D:\\source\\repos\\kiota-sample\\Item\\ErpBOLaborSvc\\"; + var longNamespace = "ThisIsAVeryLongNamespaceNameThatIsNotLongerThanTwoHundredAndFiftySixCharactersAccordingToWindows"; + while (rootDir.Length < CSharpPathSegmenter.MaxFilePathLength - longNamespace.Length) + { + rootDir = $"{rootDir}\\{longNamespace}"; + } + var longPathName = $"{rootDir}\\TimeWeeklyViewsWithCompanyWithEmployeeNumWithWeekBeginDateWithWeekEndDateWithQuickEntryCodeWithProjectIDWithPhaseIDWithTimeTypCdWithJobNumWithAssemblySeqWithOprSeqWithRoleCdWithIndirectCodeWithExpenseCodeWithResourceGrpIDWithResourceIDWithLaborTypePseudoWithShiftWithNewRowTypeWithTimeStatusRequestBuilder.cs"; + var normalizedPath = segmenter.NormalizePath(longPathName); + Assert.NotEqual(longPathName, normalizedPath); + Assert.True(normalizedPath.Length < longPathName.Length);//new path is shorter than the original + Assert.True(normalizedPath.Length < CSharpPathSegmenter.MaxFilePathLength); // new path is shorter than the max path length + } + } +} diff --git a/tests/Kiota.Builder.Tests/PathSegmenters/JavaPathSegmenterTests.cs b/tests/Kiota.Builder.Tests/PathSegmenters/JavaPathSegmenterTests.cs new file mode 100644 index 0000000000..d965be0a16 --- /dev/null +++ b/tests/Kiota.Builder.Tests/PathSegmenters/JavaPathSegmenterTests.cs @@ -0,0 +1,33 @@ +using Kiota.Builder.CodeDOM; +using Kiota.Builder.PathSegmenters; +using Xunit; + +namespace Kiota.Builder.Tests.PathSegmenters +{ + public class JavaPathSegmenterTests + { + private readonly JavaPathSegmenter segmenter; + public JavaPathSegmenterTests() + { + segmenter = new JavaPathSegmenter("D:\\source\\repos\\kiota-sample", "client"); + } + + [Fact] + public void JavaPathSegmenterGeneratesCorrectFileName() + { + var fileName = segmenter.NormalizeFileName(new CodeClass + { + Name = "testClass" + }); + Assert.Equal("TestClass", fileName);// the file name should be PascalCase + } + + [Fact] + public void JavaPathSegmenterGeneratesNamespaceFolderName() + { + var namespaceName = "Microsoft.Graph"; + var normalizedNamespace = segmenter.NormalizeNamespaceSegment(namespaceName); + Assert.Equal("microsoft.graph", normalizedNamespace);// the file name should be lower case + } + } +} diff --git a/tests/Kiota.Builder.Tests/PathSegmenters/PythonPathSegmenterTests.cs b/tests/Kiota.Builder.Tests/PathSegmenters/PythonPathSegmenterTests.cs new file mode 100644 index 0000000000..2944c665d2 --- /dev/null +++ b/tests/Kiota.Builder.Tests/PathSegmenters/PythonPathSegmenterTests.cs @@ -0,0 +1,36 @@ +using System.Linq; +using Kiota.Builder.CodeDOM; +using Kiota.Builder.PathSegmenters; +using Xunit; + +namespace Kiota.Builder.Tests.PathSegmenters +{ + public class PythonPathSegmenterTests + { + private readonly PythonPathSegmenter segmenter; + public PythonPathSegmenterTests() + { + segmenter = new PythonPathSegmenter("D:\\source\\repos\\kiota-sample", "client"); + } + + [Fact] + public void PythonPathSegmenterGeneratesCorrectFileName() + { + var rootNamespace = CodeNamespace.InitRootNamespace(); + var classExample = rootNamespace.AddClass(new CodeClass + { + Name = "testClass" + }).First(); + var fileName = segmenter.NormalizeFileName(classExample); + Assert.Equal("test_class", fileName);// the file name should be snake case + } + + [Fact] + public void PythonPathSegmenterGeneratesNamespaceFolderName() + { + var namespaceName = "MicrosoftGraph"; + var normalizedNamespace = segmenter.NormalizeNamespaceSegment(namespaceName); + Assert.Equal("microsoft_graph", normalizedNamespace);// the namespace name should be snake case + } + } +} diff --git a/tests/Kiota.Builder.Tests/PathSegmenters/TypeScriptPathSegmenterTests.cs b/tests/Kiota.Builder.Tests/PathSegmenters/TypeScriptPathSegmenterTests.cs new file mode 100644 index 0000000000..11054cebf7 --- /dev/null +++ b/tests/Kiota.Builder.Tests/PathSegmenters/TypeScriptPathSegmenterTests.cs @@ -0,0 +1,36 @@ +using System.Linq; +using Kiota.Builder.CodeDOM; +using Kiota.Builder.PathSegmenters; +using Xunit; + +namespace Kiota.Builder.Tests.PathSegmenters +{ + public class TypeScriptPathSegmenterTests + { + private readonly TypeScriptPathSegmenter segmenter; + public TypeScriptPathSegmenterTests() + { + segmenter = new TypeScriptPathSegmenter("D:\\source\\repos\\kiota-sample", "client"); + } + + [Fact] + public void TypeScriptPathSegmenterGeneratesCorrectFileName() + { + var rootNamespace = CodeNamespace.InitRootNamespace(); + var classExample = rootNamespace.AddClass(new CodeClass + { + Name = "testClass" + }).First(); + var fileName = segmenter.NormalizeFileName(classExample); + Assert.Equal("testClass", fileName);// the file name should be camelCase + } + + [Fact] + public void TypeScriptPathSegmenterGeneratesNamespaceFolderName() + { + var namespaceName = "MicrosoftGraph"; + var normalizedNamespace = segmenter.NormalizeNamespaceSegment(namespaceName); + Assert.Equal("microsoftGraph", normalizedNamespace);// the namespace name should be camelCase + } + } +} From d9803cbd8e18e15e009ba90a2b542b1eacac7af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 26 Jan 2024 15:51:52 +0000 Subject: [PATCH 052/394] - added more details to the kiota.config specs --- specs/cli/client-add.md | 16 +++++++--------- specs/cli/client-edit.md | 15 ++++++--------- specs/cli/client-generate.md | 4 ++-- specs/cli/client-remove.md | 6 +++--- specs/cli/config-migrate.md | 10 ++++------ specs/scenarios/kiota-config.md | 6 +++--- 6 files changed, 25 insertions(+), 32 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index 3e4e9e7e9c..03d146e764 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -2,13 +2,13 @@ ## Description -`kiota client add` allows a developer to add a new API client to the `kiota-config.json` file. If no `kiota-config.json` file is found, a new `kiota-config.json` file would be created in thr current working directory. The command will add a new entry to the `clients` section of the `kiota-config.json` file. Once this is done, a local copy of the OpenAPI description is generated and kept in the `.kiota/descriptions` folder. +`kiota client add` allows a developer to add a new API client to the `kiota-config.json` file. If no `kiota-config.json` file is found, a new `kiota-config.json` file would be created in the current working directory. The command will add a new entry to the `clients` section of the `kiota-config.json` file. Once this is done, a local copy of the OpenAPI description is generated and kept in the `.kiota/descriptions` folder. If a client with the same name already exists, the command will fail and display an actionnable error message. When executing, a new API entry will be added and will use the `--client-name` parameter as the key for the map. When loading the OpenAPI description, it will store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. Every time an API client is added, a copy of the OpenAPI description file will be stored in the `./.kiota/{client-name}` folder. The files will be named using the API client name. This will allow the CLI to detect changes in the description and avoid downloading the description again if it hasn't changed. -At the same time, an [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3) file will be generated (if non existing) or edited (if already existing) to represent the surface of the API being used. This file will be named `apimanifest.json` and next to the `kiota-config.json`. This file will be used to generate the code files. +At the same time, an [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3) file will be generated (if non existing) or edited (if already existing) to represent the surface of the API being used. This file will be named `apimanifest.json` and next to the `kiota-config.json`. This file will be used to generate the code files. A new hash composed of the Kiota version, the OpenAPI description location and the properties of the client will be generated and would trigger an update to the [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3). Once the `kiota-config.json` file is generated and the OpenAPI description file is saved locally, the code generation will be executed and then the API Manifest would become available. @@ -16,7 +16,7 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | +| `--client-name \| --cn` | Yes | GraphClient | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | | `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | @@ -35,7 +35,7 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file ## Using `kiota client add` ```bash -kiota client add --client-name "graphDelegated" --openapi "https://aka.ms/graph/v1.0/openapi.yaml" --include-path "**/users/**" --language csharp --class-name "GraphClient" --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" +kiota client add --client-name "GraphClient" --openapi "https://aka.ms/graph/v1.0/openapi.yaml" --include-path "**/users/**" --language csharp --namespace-name "Contoso.GraphApp" --backing-store --exclude-backward-compatible --serializer "Contoso.Json.CustomSerializer" --deserializer "Contoso.Json.CustomDeserializer" -structured-mime-types "application/json" --output "./generated/graph/csharp" ``` _The resulting `kiota-config.json` file will look like this:_ @@ -44,13 +44,12 @@ _The resulting `kiota-config.json` file will look like this:_ { "version": "1.0.0", "clients": { - "graphDelegated": { + "GraphClient": { "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], "language": "csharp", "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphClient", "clientNamespaceName": "Contoso.GraphApp", "structuredMediaTypes": [ "application/json" @@ -67,9 +66,8 @@ _The resulting `apimanifest.json` file will look like this:_ ```jsonc { "apiDependencies": { - "graphDelegated": { + "GraphClient": { "x-ms-kiotaHash": "9EDF8506CB74FE44...", - "x-ms-kiotaVersion": "1.11.0", "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", @@ -109,7 +107,7 @@ _The resulting `apimanifest.json` file will look like this:_ / └─.kiota └─definitions - └─graphDelegated.yaml + └─GraphClient.yaml └─generated └─graph └─csharp diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index e0260d9163..009b7d7af8 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -4,7 +4,7 @@ `kiota client update` allows a developer to edit an existing API client int the `kiota-config.json` file. If either the `kiota-config.json` file or if the `--client-name` client can't be found within the `kiota-config.json` file, the command should error out and let the developer know. -When executing, the API entry defined by the `--client-name` parameter will be modified. All parameters should be supported and the only required one is `--client-name`. All others are optional as they would only modify the configuration of the API client. If the OpenAPI description location changed or any properties of the client entry in `kiota-config.json`, a new hash will be generated and and would trigger an update to the [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3). +When executing, the API entry defined by the `--client-name` parameter will be modified. All parameters should be supported and the only required one is `--client-name`. All others are optional as they would only modify the configuration of the API client. If the OpenAPI description location changed or any properties of the client entry in `kiota-config.json`, a new hash composed of the Kiota version, the OpenAPI description location and the properties of the client will be generated and and would trigger an update to the [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3). Once the `kiota-config.json` file and the API Manifest are updated, the code generation will be executed based on the newly updated API client configuration. @@ -12,12 +12,11 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | +| `--client-name \| --cn` | Yes | GraphClient | Name of the client. Unique within the parent API. | | `--openapi \| -d` | No | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | | `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | -| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | | `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | | `--backing-store \| -b` | No | | Defaults to `false` | | `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | @@ -31,7 +30,7 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen ## Using `kiota client edit` ```bash -kiota client edit --client-name "graphDelegated" --class-name "GraphServiceClient" --exclude-path "/users/$count" +kiota client edit --client-name "GraphClient" --exclude-path "/users/$count" ``` _The resulting `kiota-config.json` file will look like this:_ @@ -40,13 +39,12 @@ _The resulting `kiota-config.json` file will look like this:_ { "version": "1.0.0", "clients": { - "graphDelegated": { + "GraphClient": { "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": ["/users/$count"], "language": "csharp", "outputPath": "./generated/graph/csharp", - "clientClassName": "GraphServiceClient", "clientNamespaceName": "Contoso.GraphApp", "structuredMediaTypes": [ "application/json" @@ -67,9 +65,8 @@ _The resulting `apimanifest.json` file will look like this:_ "contactEmail": "graphsdkpub@microsoft.com" }, "apiDependencies": { - "graphDelegated": { + "GraphClient": { "x-ms-kiotaHash": "9EDF8506CB74FE44...", - "x-ms-kiotaVersion": "1.11.0", "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", @@ -105,7 +102,7 @@ _The resulting `apimanifest.json` file will look like this:_ / └─.kiota └─definitions - └─graphDelegated.yaml + └─GraphClient.yaml └─generated └─graph └─csharp diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index 2496254acc..07d9dbffd9 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -12,7 +12,7 @@ In general cases, the `kiota client generate` command will generate the code for | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | +| `--client-name \| --cn` | No | GraphClient | Name of the client. Unique within the parent API. | | `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | ## Usage @@ -20,7 +20,7 @@ In general cases, the `kiota client generate` command will generate the code for ### Using `kiota client generate` for a single API client ```bash -kiota client generate --client-name "graphDelegated" +kiota client generate --client-name "GraphClient" ``` ### Using `kiota client generate` for all API clients diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md index caa83f1360..d76f3d911f 100644 --- a/specs/cli/client-remove.md +++ b/specs/cli/client-remove.md @@ -4,17 +4,17 @@ `kiota client remove` allows a developer to remove an existing client from the `kiota-config.json` file. The command will remove the entry from the `clients` section of `kiota-config.json` file. The command has a single required parameters; the name of the client. -The command also has one optional parameter, the ability to remove the generated client. If provided, kiota will delete the folder and its content specified at the `outputPath` from the client configuration. It will also remove the local version of the OpenAPI description file (specified by the `descriptionHash` property). The API Manifest is also updated to remove the dependency from the list of dependencies. +The command also has one optional parameter, the ability to remove the generated client. If provided, kiota will delete the folder and its content specified at the `outputPath` from the client configuration. It will also remove the local version of the OpenAPI description file (specified by the `x-ms-kiotaHash` property in the API Manifest). The API Manifest is also updated to remove the dependency from the list of dependencies. | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client | +| `--client-name \| --cn` | Yes | GraphClient | Name of the client | | `--clean-output \| --co` | No | | Cleans the generated client | #### Using kiota client remove ```bash -kiota client remove --client-name "graphDelegated" --clean-output +kiota client remove --client-name "GraphClient" --clean-output ``` The resulting `kiota-config.json` file will look like this: diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 1214bc1190..0992e3dcd8 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -9,7 +9,7 @@ In the case where conflicting API client names would be migrated, the command wi | Parameters | Required | Example | Description | | -- | -- | -- | -- | | `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | -| `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | +| `--client-name \| --cn` | No | GraphClient | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | ## Using `kiota config migrate` @@ -77,7 +77,6 @@ _The resulting `apimanifest.json` file will look like this:_ "apiDependencies": { "csharpGraphServiceClient": { "x-ms-kiotaHash": "9EDF8506CB74FE44...", - "x-ms-kiotaVersion": "1.11.0", "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", @@ -110,7 +109,6 @@ _The resulting `apimanifest.json` file will look like this:_ }, "pythonGraphServiceClient": { "x-ms-kiotaHash": "9EDF8506CB74FE44...", - "x-ms-kiotaVersion": "1.11.0", "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", @@ -183,7 +181,7 @@ Assuming the following folder structure: ``` ```bash -kiota config migrate --lock-location ./generated/graph/csharp/kiota-lock.json --client-name graphDelegated +kiota config migrate --lock-location ./generated/graph/csharp/kiota-lock.json --client-name GraphClient ``` _The resulting `kiota-config.json` file will look like this:_ @@ -192,7 +190,7 @@ _The resulting `kiota-config.json` file will look like this:_ { "version": "1.0.0", "clients": { - "graphDelegated": { + "GraphClient": { "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], @@ -215,7 +213,7 @@ _The resulting `kiota-config.json` file will look like this:_ / └─.kiota └─definitions - └─graphDelegated.yaml + └─GraphClient.yaml └─generated └─graph └─csharp diff --git a/specs/scenarios/kiota-config.md b/specs/scenarios/kiota-config.md index 17e57e6b09..4cc6b1c8a5 100644 --- a/specs/scenarios/kiota-config.md +++ b/specs/scenarios/kiota-config.md @@ -22,7 +22,7 @@ Here is an example of what the kiota-config.json file could look like. { "version": "1.0.0", "clients": { - "graphDelegated": { + "GraphClient": { "descriptionLocation": "https://aka.ms/graph/v1.0/openapi.yaml", "includePatterns": ["**/users/**"], "excludePatterns": [], @@ -71,7 +71,7 @@ kiota config migrate ```bash kiota client init -kiota client add --client-name "graphDelegated" --openapi "https://aka.ms/graph/v1.0/openapi.yaml" --language csharp --output "./csharpClient" +kiota client add --client-name "GraphClient" --openapi "https://aka.ms/graph/v1.0/openapi.yaml" --language csharp --output "./csharpClient" ``` ### Add a second API client @@ -83,7 +83,7 @@ kiota client add --clientName "graphPython" --openapi "https://aka.ms/graph/v1. ### Edit an API client ```bash -kiota client edit --client-name "graphDelegated" --class-name "GraphServiceClient" --exclude-path "/users/$count" +kiota client edit --client-name "GraphClient" --exclude-path "/users/$count" ``` ### Remove a language and delete the generated code From b07967933cd83d83d1cf0f5c0d53999f16475c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 26 Jan 2024 17:31:53 +0000 Subject: [PATCH 053/394] Specs for telemetry in kiota --- specs/cli/client-add.md | 28 ++++++----- specs/cli/client-edit.md | 26 +++++----- specs/cli/client-generate.md | 6 +-- specs/cli/client-remove.md | 6 +-- specs/cli/config-migrate.md | 4 +- specs/cli/download.md | 22 ++++++++ specs/cli/index.md | 16 ++++++ specs/cli/info.md | 98 ++++++++++++++++++++++++++++++++++++ specs/cli/login.md | 20 ++++++++ specs/cli/logout.md | 18 +++++++ specs/cli/search.md | 47 +++++++++++++++++ specs/cli/show.md | 36 +++++++++++++ specs/index.md | 8 ++- specs/scenarios/telemetry.md | 68 +++++++++++++++++++++++++ 14 files changed, 368 insertions(+), 35 deletions(-) create mode 100644 specs/cli/download.md create mode 100644 specs/cli/index.md create mode 100644 specs/cli/info.md create mode 100644 specs/cli/login.md create mode 100644 specs/cli/logout.md create mode 100644 specs/cli/search.md create mode 100644 specs/cli/show.md create mode 100644 specs/scenarios/telemetry.md diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index 3e4e9e7e9c..3385750c3d 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -14,24 +14,26 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file ## Parameters -| Parameters | Required | Example | Description | +| Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | -| `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | -| `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | -| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | -| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | -| `--language \| -l` | Yes | csharp | The target language for the generated code files or for the information. | -| `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | -| `--backing-store \| -b` | No | | Defaults to `false` | -| `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | -| `--structured-media-types \| -m` | No | `application/json` |Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | -| `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | -| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. This is relative to the location of `kiota-config.json`. Defaults to `./output`. | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | Yes, without its value | +| `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | +| `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | Yes, without its value | +| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | Yes, without its value | +| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | Yes, without its value | +| `--language \| -l` | Yes | csharp | The target language for the generated code files or for the information. | Yes | +| `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | Yes, without its value | +| `--backing-store \| -b` | No | | Defaults to `false` | Yes | +| `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | Yes | +| `--structured-media-types \| -m` | No | `application/json` | Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | Yes | +| `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. |Yes | +| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. This is relative to the location of `kiota-config.json`. Defaults to `./output`. | Yes, without its value | > [!NOTE] > It is not required to use the CLI to add new clients. It is possible to add a new client by adding a new entry in the `clients` section of the `kiota-config.json` file. See the [kiota-config.json schema](../schemas/kiota-config.json) for more information. Using `kiota client generate --client-name myClient` would be required to generate the code files. +## Telemetry + ## Using `kiota client add` ```bash diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index e0260d9163..4ce8a0cd6a 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -10,20 +10,20 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen ## Parameters -| Parameters | Required | Example | Description | +| Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | -| `--openapi \| -d` | No | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | -| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | -| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | -| `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | -| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | -| `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | -| `--backing-store \| -b` | No | | Defaults to `false` | -| `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | -| `--structured-media-types \| -m` | No | `application/json` |Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | -| `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | -| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | Yes, without its value | +| `--openapi \| -d` | No | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | +| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | Yes, without its value | +| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | Yes, without its value | +| `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | Yes | +| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | Yes, without its value | +| `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | Yes, without its value | +| `--backing-store \| -b` | No | | Defaults to `false` | Yes, without its value | +| `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | Yes | +| `--structured-media-types \| -m` | No | `application/json` |Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | Yes | +| `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | Yes | +| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | Yes | > [!NOTE] > It is not required to use the CLI to edit clients. It is possible to edit a client by modifying its entry in the `clients` section of the `kiota-config.json` file. See the [kiota-config.json schema](../schemas/kiota-config.json.md) for more information. diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index 2496254acc..0fa7dd31ce 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -10,10 +10,10 @@ In general cases, the `kiota client generate` command will generate the code for ## Parameters -| Parameters | Required | Example | Description | +| Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | -| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | -| `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | +| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | Yes | +| `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | Yes | ## Usage diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md index caa83f1360..b07421a117 100644 --- a/specs/cli/client-remove.md +++ b/specs/cli/client-remove.md @@ -6,10 +6,10 @@ The command also has one optional parameter, the ability to remove the generated client. If provided, kiota will delete the folder and its content specified at the `outputPath` from the client configuration. It will also remove the local version of the OpenAPI description file (specified by the `descriptionHash` property). The API Manifest is also updated to remove the dependency from the list of dependencies. -| Parameters | Required | Example | Description | +| Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client | -| `--clean-output \| --co` | No | | Cleans the generated client | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client | Yes, without its value | +| `--clean-output \| --co` | No | | Cleans the generated client | Yes | #### Using kiota client remove diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 1214bc1190..dde4a35fb8 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -8,8 +8,8 @@ In the case where conflicting API client names would be migrated, the command wi | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | -| `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | +| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | Yes, without its value | +| `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | Yes, without its value | ## Using `kiota config migrate` diff --git a/specs/cli/download.md b/specs/cli/download.md new file mode 100644 index 0000000000..0672da9597 --- /dev/null +++ b/specs/cli/download.md @@ -0,0 +1,22 @@ +# download + +## Description + +Downloads an API description. + +## Parameters + +| Parameters | Required | Example | Description | Telemetry | +| -- | -- | -- | -- | +| `search-term` | Yes | Graph | The term to search for. | Yes, without its value | +| `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | +| `--clear-output \| --cc` | No | true | Delete the output directory before generating the client. Defaults to `False`. | Yes | +| `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | +| `--version \| --v` | No | beta | The version of the OpenAPI document to use | Yes, without its value | +| `--output \| --o` | No | beta | The output directory or file path for the generated code files. Defaults `./output/result.json`. | Yes, without its value | + +## Usage + +```bash +kiota download apisguru::github.com +``` \ No newline at end of file diff --git a/specs/cli/index.md b/specs/cli/index.md new file mode 100644 index 0000000000..413bc0932a --- /dev/null +++ b/specs/cli/index.md @@ -0,0 +1,16 @@ +# CLI Commands + +This section contains the specifications for the Kiota CLI commands. All the commands are documented here: + +* [kiota client add](./client-add.md) +* [kiota client edit](./client-edit.md) +* [kiota client remove](./client-remove.md) +* [kiota client generate](./client-generate.md) +* [kiota config init](./config-init.md) +* [kiota config migrate](./config-migrate.md) +* [kiota download](./download.md) +* [kiota info](./info.md) +* [kiota login](./login.md) +* [kiota logout](./logout.md) +* [kiota search](./search.md) +* [kiota show](./show.md) \ No newline at end of file diff --git a/specs/cli/info.md b/specs/cli/info.md new file mode 100644 index 0000000000..feeabc1203 --- /dev/null +++ b/specs/cli/info.md @@ -0,0 +1,98 @@ +# info + +## Description + +Show languages and runtime dependencies information. + +## Parameters + +| Parameters | Required | Example | Description | Telemetry | +| -- | -- | -- | -- | +| `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | +| `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | Yes | +| `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | +| `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | +| `--version \| --v` | No | beta | The version of the OpenAPI document to use | Yes, without its value | +| `--search-key \| --k` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | Yes, without its value | + +## Usage + +```bash +kiota info +``` + +```bash +Language Maturity Level +CLI Preview +CSharp Stable +Go Stable +Java Preview +PHP Stable +Python Stable +Ruby Experimental +Swift Experimental +TypeScript Experimental +``` + +The following command with the provided options will display the following result. + +```bash +kiota info -l CSharp +``` + +```bash +The language CSharp is currently in Stable maturity level. +After generating code for this language, you need to install the following packages: +dotnet add package Microsoft.Kiota.Abstractions --version 1.6.1 +dotnet add package Microsoft.Kiota.Http.HttpClientLibrary --version 1.3.0 +dotnet add package Microsoft.Kiota.Serialization.Form --version 1.1.0 +dotnet add package Microsoft.Kiota.Serialization.Json --version 1.1.1 +dotnet add package Microsoft.Kiota.Authentication.Azure --version 1.1.0 +dotnet add package Microsoft.Kiota.Serialization.Text --version 1.1.0 +dotnet add package Microsoft.Kiota.Serialization.Multipart --version 1.1.0 +``` + +Using the `--json` optional parameter render the output in a machine parsable format: + +```bash +kiota info -l CSharp --json +``` + +```json +{ + "maturityLevel": "Stable", + "dependencyInstallCommand": "dotnet add package {0} --version {1}", + "dependencies": [ + { + "name": "Microsoft.Kiota.Abstractions", + "version": "1.6.1" + }, + { + "name": "Microsoft.Kiota.Http.HttpClientLibrary", + "version": "1.2.0" + }, + { + "name": "Microsoft.Kiota.Serialization.Form", + "version": "1.1.0" + }, + { + "name": "Microsoft.Kiota.Serialization.Json", + "version": "1.1.1" + }, + { + "name": "Microsoft.Kiota.Authentication.Azure", + "version": "1.1.0" + }, + { + "name": "Microsoft.Kiota.Serialization.Text", + "version": "1.1.0" + }, + { + "name": "Microsoft.Kiota.Serialization.Multipart", + "version": "1.1.0" + } + ], + "clientClassName": "", + "clientNamespaceName": "" +} +``` \ No newline at end of file diff --git a/specs/cli/login.md b/specs/cli/login.md new file mode 100644 index 0000000000..358ac3e3c6 --- /dev/null +++ b/specs/cli/login.md @@ -0,0 +1,20 @@ +# login + +## Description + +Use `kiota login` to sign in to private repositories and search for/display/generate clients for private API descriptions. This command makes sub-commands available to sign in to specific authentication providers. + +## Parameters + +| Parameters | Required | Example | Description | Telemetry | +| -- | -- | -- | -- | +| `search-provider` | Yes | github | The search provided to login with. | Yes | +| `type` | Yes | device | The authentication strategy to use. | Yes | +| `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | +| `--pat` | No | PAT value | The PAT used to login | Yes, without its value | + +## Usage + +```bash +kiota login github device +``` \ No newline at end of file diff --git a/specs/cli/logout.md b/specs/cli/logout.md new file mode 100644 index 0000000000..dd057a1c9c --- /dev/null +++ b/specs/cli/logout.md @@ -0,0 +1,18 @@ +# logout + +## Description + +Use kiota logout to logout from a private repository containing API descriptions. + +## Parameters + +| Parameters | Required | Example | Description | Telemetry | +| -- | -- | -- | -- | +| `search-provider` | Yes | github | The search provided to login with. | Yes | +| `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | + +## Usage + +```bash +kiota logout github +``` \ No newline at end of file diff --git a/specs/cli/search.md b/specs/cli/search.md new file mode 100644 index 0000000000..c09a612e5e --- /dev/null +++ b/specs/cli/search.md @@ -0,0 +1,47 @@ +# search + +## Description + +Search for APIs and their description from various registries. + +## Parameters + +| Parameters | Required | Example | Description | Telemetry | +| -- | -- | -- | -- | +| `search-term` | Yes | Graph | The term to search for. | Yes, without its value | +| `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | +| `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | +| `--version \| --v` | No | beta | The version of the OpenAPI document to use | Yes, without its value | + +## Usage + +```bash +kiota search github +``` + +```bash +Key Title Description Versions +apisguru::github.com GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +apisguru::github.com:api.github.com GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +apisguru::github.com:ghes-2.18 GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +apisguru::github.com:ghes-2.19 GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +apisguru::github.com:ghes-2.20 GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +apisguru::github.com:ghes-2.21 GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +apisguru::github.com:ghes-2.22 GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +apisguru::github.com:ghes-3.0 GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +apisguru::github.com:ghes-3.1 GitHub v3 REST API GitHub's v3 REST API. 1.1.4 +``` + +If the search term is an exact match with one of the results' key, the search command will display a detailed view of the result. + +```bash +kiota search apisguru::github.com +``` + +```bash +Key: apisguru::github.com +Title: GitHub v3 REST API +Description: GitHub's v3 REST API. +Service: https://support.github.com/contact +OpenAPI: https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json +``` \ No newline at end of file diff --git a/specs/cli/show.md b/specs/cli/show.md new file mode 100644 index 0000000000..2d31b53503 --- /dev/null +++ b/specs/cli/show.md @@ -0,0 +1,36 @@ +# show + +## Description + +Show the API paths tree for an API description. + +## Parameters + +| Parameters | Required | Example | Description | Telemetry | +| -- | -- | -- | -- | +| `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | +| `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | +| `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | +| `--version \| --v` | No | beta | The version of the OpenAPI document to use | Yes, without its value | +| `--search-key \| --k` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | Yes, without its value | +| `--max-depth \| --m-d` | No | 10 | The maximum depth of the tree to display. Defaults to `5`. | Yes, without its value | +| `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | Yes, without its value | +| `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | Yes, without its value | + +## Usage + +```bash +kiota show -d https://aka.ms/graph/v1.0/openapi.yaml -i **/messages + +``` + +```bash +/ + └─users + └─{user-id} + ├─mailFolders + │ └─{mailFolder-id} + │ ├─childFolders + │ └─messages + └─messages +``` \ No newline at end of file diff --git a/specs/index.md b/specs/index.md index 78579ac2b0..8c4afc475a 100644 --- a/specs/index.md +++ b/specs/index.md @@ -1,7 +1,6 @@ # Kiota Specification Repository This repository contains the specifications for the Kiota project. The goal of this repository is to provide a place to discuss and document the Kiota project. It will evolve over time as the project evolves. -config.md) ## CLI @@ -11,12 +10,19 @@ config.md) * [kiota client generate](./cli/client-generate.md) * [kiota config init](./cli/config-init.md) * [kiota config migrate](./cli/config-migrate.md) +* [kiota download](./cli/download.md) +* [kiota info](./cli/info.md) +* [kiota login](./cli/login.md) +* [kiota logout](./cli/logout.md) +* [kiota search](./cli/search.md) +* [kiota show](./cli/show.md) ## Extension ## Scenarios * [Kiota Config](./scenarios/kiota-config.md) +* [Telemetry](./scenarios/telemetry.md) ## Schemas diff --git a/specs/scenarios/telemetry.md b/specs/scenarios/telemetry.md new file mode 100644 index 0000000000..01a647e302 --- /dev/null +++ b/specs/scenarios/telemetry.md @@ -0,0 +1,68 @@ +# Telemetry + +Kiota is a tool that generates code for interacting with an API. It is used by developers to create applications that interact with an API. It is also used by API owners to create SDKs for their API. In both cases, it is important to understand how the tool is being used and what are the scenarios leveraged by our community. This document describes the telemetry we plan to collect and how we use it. + +## Current Challenges + +- Kiota doesn't have a telemetry component as part of its CLI experience. +- The Kiota team doesn't have visibility on how the tool is being used and what are the scenarios that are important to our community. +- When planning for future investments, the Kiota team doesn't have a way to prioritize scenarios based on their importance to our community. + +## Goals + +- Understand how Kiota is being used. +- Understand what scenarios are important to our community. +- Understand what are the preferred experiences for using Kiota. + +## Non-goals + +- We are not trying to collect any personally identifiable information. +- We are not trying to collect any information about the API being used. +- We are not trying to collect any information about the application using the API. +- We are not trying to collect any information during the runtime of the application. + +## Proposal + +We should introduce a new telemetry component to Kiota. This component should be enabled by default and should be able to be disabled by the user, in a very similar way that the `dotnet` CLI does (https://learn.microsoft.com/en-us/dotnet/core/tools/telemetry). The telemetry component should be able to collect information about the following scenarios: + +- Adoption of the CLI in general. +- Adoption of the different commands. +- Adoption of the different parameters for each command (without values that could be considered sensitive like the OpenAPI description, include / exclude paths, etc.). +- Adoption of the different languages. +- Adoption of the different platforms we offer support for. + +### Privacy + +We should be very careful about the information we collect. Before rolling out this feature, we should have full agreement with CELA on our approach, the way we collect and protect the data. In general: + +- We should offer a way to opt-out of the telemetry collection. +- We should not collect any information that could be considered sensitive. +- We should not collect any information that could be used to identify a person, an application, or an API. +- We should not collect any information during the runtime of the application. + +### Data collected + +#### Basic data being collected + +For every command, we should collect the following information: + +- Hashed MAC address +- Operating system +- Operating system version +- Source (CLI or extension) +- Kiota version +- VS Code extension version (if applicable) +- Command name +- Command parameters being used (without their values) +- Command execution time +- Command result (success or failure) + +#### Command-specific data being collected + +Every command has a different set of parameters. We should collect relevant parameters (and their values) for each command. The data collected shouldn't include any information that could be considered sensitive, only system-related information. Each command specification should include the list of parameters that should be collected and whether their values should be collected or not. + +The list of commands and their parameters can be found in the [CLI Commands](../cli/index.md) section. Each parameter indicates whether its value should be collected or not. + +### Opting-out + +We should offer a way to opt-out of the telemetry collection. This should be done in a very similar way that the `dotnet` CLI does (https://learn.microsoft.com/en-us/dotnet/core/tools/telemetry). To opt out of the telemetry feature, set the KIOTA_CLI_TELEMETRY_OPTOUT environment variable to 1 or true. \ No newline at end of file From 071f481cb9accbf6c9616e508e1814a5e03ead38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 26 Jan 2024 19:29:59 +0000 Subject: [PATCH 054/394] Adding more context to the "why" we need Telemetry --- specs/scenarios/telemetry.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/specs/scenarios/telemetry.md b/specs/scenarios/telemetry.md index 01a647e302..01418678ff 100644 --- a/specs/scenarios/telemetry.md +++ b/specs/scenarios/telemetry.md @@ -40,12 +40,27 @@ We should be very careful about the information we collect. Before rolling out t - We should not collect any information that could be used to identify a person, an application, or an API. - We should not collect any information during the runtime of the application. +### Examples of questions we want to answer + +- How many users are using the CLI? +- How many users are using the CLI via the extension? +- What is the current growth trajectory of the usage of kiota? +- What are the most used commands? +- How are the commands used? Which parameters are being used? +- What are the most used languages? +- What are the most used platforms? +- Is there a difference in how the CLI is being used between platforms? +- Do we have users using old versions of kiota? Why? +- When launching new capabilities, what is the adoption rate? How long does it take for users to adopt the new capabilities? +- Can we identify a spike in error being returned by Kiota? What is the impact of the error? What command generates the error? What parameters are being used? + ### Data collected #### Basic data being collected For every command, we should collect the following information: +- Timestamp - Hashed MAC address - Operating system - Operating system version From cd137f5c48e7662dd1f64644702eda4e5bd5586c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:21:22 +0000 Subject: [PATCH 055/394] Bump @types/node from 20.11.7 to 20.11.10 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.7 to 20.11.10. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index b0dc19e3d3..c869f8cea9 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.7.tgz", - "integrity": "sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==", + "version": "20.11.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.10.tgz", + "integrity": "sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From ebcb62a96057bfc2086e306142235445cf8901c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:42:34 +0000 Subject: [PATCH 056/394] Bump the kiota-dependencies group in /it/typescript with 7 updates Bumps the kiota-dependencies group in /it/typescript with 7 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/kiota-abstractions](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.37` | `1.0.0-preview.38` | | [@microsoft/kiota-authentication-azure](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.32` | `1.0.0-preview.33` | | [@microsoft/kiota-http-fetchlibrary](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.36` | `1.0.0-preview.37` | | [@microsoft/kiota-serialization-form](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.26` | `1.0.0-preview.27` | | [@microsoft/kiota-serialization-json](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.37` | `1.0.0-preview.38` | | [@microsoft/kiota-serialization-multipart](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.16` | `1.0.0-preview.17` | | [@microsoft/kiota-serialization-text](https://github.com/microsoft-typescript/kiota) | `1.0.0-preview.34` | `1.0.0-preview.35` | Updates `@microsoft/kiota-abstractions` from 1.0.0-preview.37 to 1.0.0-preview.38 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-abstractions@1.0.0-preview.37...@microsoft/kiota-abstractions@1.0.0-preview.38) Updates `@microsoft/kiota-authentication-azure` from 1.0.0-preview.32 to 1.0.0-preview.33 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-authentication-azure@1.0.0-preview.32...@microsoft/kiota-authentication-azure@1.0.0-preview.33) Updates `@microsoft/kiota-http-fetchlibrary` from 1.0.0-preview.36 to 1.0.0-preview.37 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.36...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.37) Updates `@microsoft/kiota-serialization-form` from 1.0.0-preview.26 to 1.0.0-preview.27 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-form@1.0.0-preview.26...@microsoft/kiota-serialization-form@1.0.0-preview.27) Updates `@microsoft/kiota-serialization-json` from 1.0.0-preview.37 to 1.0.0-preview.38 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-json@1.0.0-preview.37...@microsoft/kiota-serialization-json@1.0.0-preview.38) Updates `@microsoft/kiota-serialization-multipart` from 1.0.0-preview.16 to 1.0.0-preview.17 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-multipart@1.0.0-preview.16...@microsoft/kiota-serialization-multipart@1.0.0-preview.17) Updates `@microsoft/kiota-serialization-text` from 1.0.0-preview.34 to 1.0.0-preview.35 - [Commits](https://github.com/microsoft-typescript/kiota/commits) --- updated-dependencies: - dependency-name: "@microsoft/kiota-abstractions" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-authentication-azure" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-http-fetchlibrary" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-json" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-multipart" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-text" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 68 ++++++++++++++++----------------- it/typescript/package.json | 14 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index e8e9fd5f13..8e90a4e57e 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.37", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.32", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.36", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.26", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.37", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.16", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.34", + "@microsoft/kiota-abstractions": "^1.0.0-preview.38", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.33", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.37", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.27", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.38", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.17", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.35", "express": "^4.18.2", "node-fetch": "^2.7.0" }, @@ -678,9 +678,9 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.37", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.37.tgz", - "integrity": "sha512-YrmSKGtMgy/2/mzOQK/2LAmY8j5ThZy3TqIAtnNl3Aql4k6T9gSsBc83pU+eyzmJR80PzPa1CxJLVafI7sOfog==", + "version": "1.0.0-preview.38", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.38.tgz", + "integrity": "sha512-PXjQ4+wXXz+4eiAkGCK84rBPU/ahnNjrnOPxMkJ2GdA8mI3kyls9kNfAP0jvg2JkOhDJn8sTwmK7dicj5hyFpA==", "dependencies": { "@opentelemetry/api": "^1.2.0", "@std-uritemplate/std-uritemplate": "^0.0.50", @@ -699,22 +699,22 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.32", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.32.tgz", - "integrity": "sha512-BaKkh5F7hFo9uymN/qos7v6eZNQFz5BTNA+VodnLqUwoqC9zCT6arVAsiZCfX9kUMflVYxJTusO5QFzcV2x/fw==", + "version": "1.0.0-preview.33", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.33.tgz", + "integrity": "sha512-xR8vkR+DknhVP949/G8lin/BTyEnK3fkai+OqpTkyMubNW+5E0Tpynx831WvvJ4ir9YhlBb4ErQDs4k8cQK3mw==", "dependencies": { "@azure/core-auth": "^1.3.2", - "@microsoft/kiota-abstractions": "^1.0.0-preview.37", + "@microsoft/kiota-abstractions": "^1.0.0-preview.38", "@opentelemetry/api": "^1.2.0", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.36", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.36.tgz", - "integrity": "sha512-iZ9BXD8MQRcHIjnTqg26pmJO0sTDvrTz/X3+Wa3l8z8HhmH4N5RF2TEBRDq3YPSYQy95gMY8YQLAXcJELHpKNA==", + "version": "1.0.0-preview.37", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.37.tgz", + "integrity": "sha512-flgGEkMKCFr/LwuvTTk51MY5sloIS6lwm9v80VLoNaPCe8xGuYDbRcY6//KP2GIJJLWmQE+BZQhB16LG1WDrLA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.37", + "@microsoft/kiota-abstractions": "^1.0.0-preview.38", "@opentelemetry/api": "^1.2.0", "guid-typescript": "^1.0.9", "node-fetch": "^2.6.5", @@ -722,41 +722,41 @@ } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.26", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.26.tgz", - "integrity": "sha512-JLcrLcUUOcuFodfc+cqReeH04QFIPOCQaS0CWaKzkWMM8QJMyAJAfO+XMB4HWUqFxDfJlgA/LV7x9UbmbrbOKQ==", + "version": "1.0.0-preview.27", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.27.tgz", + "integrity": "sha512-sF9itqhLJA7h7vR/RLhLrQ7qaue35236Z6Bv3iS/pG34IZLS8nk51MUaejA5pgelM1FlYg75hjea0NbFKbYv4g==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.37", + "@microsoft/kiota-abstractions": "^1.0.0-preview.38", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.37", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.37.tgz", - "integrity": "sha512-LvHoal8HgdfFlJW2eg4V5NqfXUPW5vFU2phzkbYAKMHC9zv1BvJd0d+dHgxPzCfjfc/x2am6FwxXmQzlmDllrA==", + "version": "1.0.0-preview.38", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.38.tgz", + "integrity": "sha512-D1fFekgnOvCl+9sKENfZ9V5ZAIbDNqat0cD+2TL2wVJr3+5GGOPeH5xpJz0EoOpfD7hxX903mn5YrMQT/nHq/g==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.37", + "@microsoft/kiota-abstractions": "^1.0.0-preview.38", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.16", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.16.tgz", - "integrity": "sha512-IAcgyPglW25T3EUCE0g1PX6g6ZpulgzFpD2S6r512hkUy4w3HAMUgw+0J6aXSPQrFg1odMAawtbaDNyGo9Cmvw==", + "version": "1.0.0-preview.17", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.17.tgz", + "integrity": "sha512-9r90gsOtSmBrxv2vbEOSdDCrlhLj9+Puwt2sdS3K5sBejhc/crkd8+mMeYhqBXC5Ve8q0JTVKjpxKpBr7Z6bAw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.37", + "@microsoft/kiota-abstractions": "^1.0.0-preview.38", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.34", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.34.tgz", - "integrity": "sha512-Hj7QqHRuo26mPfdb5E2RUQ12VNT+8KLy9WBUGG1xY8A2L/UgYZ//vE3dU7sKf/Zzt1WcQ6XPCwZWuG+VJKH83g==", + "version": "1.0.0-preview.35", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.35.tgz", + "integrity": "sha512-jJ3+iUYH3YtjFY54wDLW4VgLpc1iCvArg7s1oLt0G9DQQK3NOFrvkn0oJGCtFfFYxQY9rRqF+inkusY0LpgV8Q==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.37", + "@microsoft/kiota-abstractions": "^1.0.0-preview.38", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } diff --git a/it/typescript/package.json b/it/typescript/package.json index 1612511ec0..686c705455 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.37", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.32", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.36", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.26", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.37", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.16", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.34", + "@microsoft/kiota-abstractions": "^1.0.0-preview.38", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.33", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.37", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.27", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.38", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.17", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.35", "express": "^4.18.2", "node-fetch": "^2.7.0" } From 20ebdaab549fdb3a5b3b8ea38941aa98d9f242cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:42:54 +0000 Subject: [PATCH 057/394] Bump esbuild from 0.19.12 to 0.20.0 in /it/typescript Bumps [esbuild](https://github.com/evanw/esbuild) from 0.19.12 to 0.20.0. - [Release notes](https://github.com/evanw/esbuild/releases) - [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md) - [Commits](https://github.com/evanw/esbuild/compare/v0.19.12...v0.20.0) --- updated-dependencies: - dependency-name: esbuild dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 192 ++++++++++++++++---------------- it/typescript/package.json | 2 +- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index e8e9fd5f13..90c970e01e 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -25,7 +25,7 @@ "@types/node": "^20.11.7", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", - "esbuild": "^0.19.12", + "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", @@ -221,9 +221,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", - "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.0.tgz", + "integrity": "sha512-fGFDEctNh0CcSwsiRPxiaqX0P5rq+AqE0SRhYGZ4PX46Lg1FNR6oCxJghf8YgY0WQEgQuh3lErUFE4KxLeRmmw==", "cpu": [ "ppc64" ], @@ -237,9 +237,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", - "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.0.tgz", + "integrity": "sha512-3bMAfInvByLHfJwYPJRlpTeaQA75n8C/QKpEaiS4HrFWFiJlNI0vzq/zCjBrhAYcPyVPG7Eo9dMrcQXuqmNk5g==", "cpu": [ "arm" ], @@ -253,9 +253,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", - "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.0.tgz", + "integrity": "sha512-aVpnM4lURNkp0D3qPoAzSG92VXStYmoVPOgXveAUoQBWRSuQzt51yvSju29J6AHPmwY1BjH49uR29oyfH1ra8Q==", "cpu": [ "arm64" ], @@ -269,9 +269,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", - "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.0.tgz", + "integrity": "sha512-uK7wAnlRvjkCPzh8jJ+QejFyrP8ObKuR5cBIsQZ+qbMunwR8sbd8krmMbxTLSrDhiPZaJYKQAU5Y3iMDcZPhyQ==", "cpu": [ "x64" ], @@ -285,9 +285,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", - "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.0.tgz", + "integrity": "sha512-AjEcivGAlPs3UAcJedMa9qYg9eSfU6FnGHJjT8s346HSKkrcWlYezGE8VaO2xKfvvlZkgAhyvl06OJOxiMgOYQ==", "cpu": [ "arm64" ], @@ -301,9 +301,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", - "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.0.tgz", + "integrity": "sha512-bsgTPoyYDnPv8ER0HqnJggXK6RyFy4PH4rtsId0V7Efa90u2+EifxytE9pZnsDgExgkARy24WUQGv9irVbTvIw==", "cpu": [ "x64" ], @@ -317,9 +317,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", - "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.0.tgz", + "integrity": "sha512-kQ7jYdlKS335mpGbMW5tEe3IrQFIok9r84EM3PXB8qBFJPSc6dpWfrtsC/y1pyrz82xfUIn5ZrnSHQQsd6jebQ==", "cpu": [ "arm64" ], @@ -333,9 +333,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", - "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.0.tgz", + "integrity": "sha512-uG8B0WSepMRsBNVXAQcHf9+Ko/Tr+XqmK7Ptel9HVmnykupXdS4J7ovSQUIi0tQGIndhbqWLaIL/qO/cWhXKyQ==", "cpu": [ "x64" ], @@ -349,9 +349,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", - "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.0.tgz", + "integrity": "sha512-2ezuhdiZw8vuHf1HKSf4TIk80naTbP9At7sOqZmdVwvvMyuoDiZB49YZKLsLOfKIr77+I40dWpHVeY5JHpIEIg==", "cpu": [ "arm" ], @@ -365,9 +365,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", - "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.0.tgz", + "integrity": "sha512-uTtyYAP5veqi2z9b6Gr0NUoNv9F/rOzI8tOD5jKcCvRUn7T60Bb+42NDBCWNhMjkQzI0qqwXkQGo1SY41G52nw==", "cpu": [ "arm64" ], @@ -381,9 +381,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", - "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.0.tgz", + "integrity": "sha512-c88wwtfs8tTffPaoJ+SQn3y+lKtgTzyjkD8NgsyCtCmtoIC8RDL7PrJU05an/e9VuAke6eJqGkoMhJK1RY6z4w==", "cpu": [ "ia32" ], @@ -397,9 +397,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", - "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.0.tgz", + "integrity": "sha512-lR2rr/128/6svngnVta6JN4gxSXle/yZEZL3o4XZ6esOqhyR4wsKyfu6qXAL04S4S5CgGfG+GYZnjFd4YiG3Aw==", "cpu": [ "loong64" ], @@ -413,9 +413,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", - "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.0.tgz", + "integrity": "sha512-9Sycc+1uUsDnJCelDf6ZNqgZQoK1mJvFtqf2MUz4ujTxGhvCWw+4chYfDLPepMEvVL9PDwn6HrXad5yOrNzIsQ==", "cpu": [ "mips64el" ], @@ -429,9 +429,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", - "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.0.tgz", + "integrity": "sha512-CoWSaaAXOZd+CjbUTdXIJE/t7Oz+4g90A3VBCHLbfuc5yUQU/nFDLOzQsN0cdxgXd97lYW/psIIBdjzQIwTBGw==", "cpu": [ "ppc64" ], @@ -445,9 +445,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", - "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.0.tgz", + "integrity": "sha512-mlb1hg/eYRJUpv8h/x+4ShgoNLL8wgZ64SUr26KwglTYnwAWjkhR2GpoKftDbPOCnodA9t4Y/b68H4J9XmmPzA==", "cpu": [ "riscv64" ], @@ -461,9 +461,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", - "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.0.tgz", + "integrity": "sha512-fgf9ubb53xSnOBqyvWEY6ukBNRl1mVX1srPNu06B6mNsNK20JfH6xV6jECzrQ69/VMiTLvHMicQR/PgTOgqJUQ==", "cpu": [ "s390x" ], @@ -477,9 +477,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", - "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.0.tgz", + "integrity": "sha512-H9Eu6MGse++204XZcYsse1yFHmRXEWgadk2N58O/xd50P9EvFMLJTQLg+lB4E1cF2xhLZU5luSWtGTb0l9UeSg==", "cpu": [ "x64" ], @@ -493,9 +493,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", - "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.0.tgz", + "integrity": "sha512-lCT675rTN1v8Fo+RGrE5KjSnfY0x9Og4RN7t7lVrN3vMSjy34/+3na0q7RIfWDAj0e0rCh0OL+P88lu3Rt21MQ==", "cpu": [ "x64" ], @@ -509,9 +509,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", - "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.0.tgz", + "integrity": "sha512-HKoUGXz/TOVXKQ+67NhxyHv+aDSZf44QpWLa3I1lLvAwGq8x1k0T+e2HHSRvxWhfJrFxaaqre1+YyzQ99KixoA==", "cpu": [ "x64" ], @@ -525,9 +525,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", - "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.0.tgz", + "integrity": "sha512-GDwAqgHQm1mVoPppGsoq4WJwT3vhnz/2N62CzhvApFD1eJyTroob30FPpOZabN+FgCjhG+AgcZyOPIkR8dfD7g==", "cpu": [ "x64" ], @@ -541,9 +541,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", - "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.0.tgz", + "integrity": "sha512-0vYsP8aC4TvMlOQYozoksiaxjlvUcQrac+muDqj1Fxy6jh9l9CZJzj7zmh8JGfiV49cYLTorFLxg7593pGldwQ==", "cpu": [ "arm64" ], @@ -557,9 +557,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", - "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.0.tgz", + "integrity": "sha512-p98u4rIgfh4gdpV00IqknBD5pC84LCub+4a3MO+zjqvU5MVXOc3hqR2UgT2jI2nh3h8s9EQxmOsVI3tyzv1iFg==", "cpu": [ "ia32" ], @@ -573,9 +573,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", - "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.0.tgz", + "integrity": "sha512-NgJnesu1RtWihtTtXGFMU5YSE6JyyHPMxCwBZK7a6/8d31GuSo9l0Ss7w1Jw5QnKUawG6UEehs883kcXf5fYwg==", "cpu": [ "x64" ], @@ -1463,9 +1463,9 @@ } }, "node_modules/esbuild": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", - "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.0.tgz", + "integrity": "sha512-6iwE3Y2RVYCME1jLpBqq7LQWK3MW6vjV2bZy6gt/WrqkY+WE74Spyc0ThAOYpMtITvnjX09CrC6ym7A/m9mebA==", "dev": true, "hasInstallScript": true, "bin": { @@ -1475,29 +1475,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.19.12", - "@esbuild/android-arm": "0.19.12", - "@esbuild/android-arm64": "0.19.12", - "@esbuild/android-x64": "0.19.12", - "@esbuild/darwin-arm64": "0.19.12", - "@esbuild/darwin-x64": "0.19.12", - "@esbuild/freebsd-arm64": "0.19.12", - "@esbuild/freebsd-x64": "0.19.12", - "@esbuild/linux-arm": "0.19.12", - "@esbuild/linux-arm64": "0.19.12", - "@esbuild/linux-ia32": "0.19.12", - "@esbuild/linux-loong64": "0.19.12", - "@esbuild/linux-mips64el": "0.19.12", - "@esbuild/linux-ppc64": "0.19.12", - "@esbuild/linux-riscv64": "0.19.12", - "@esbuild/linux-s390x": "0.19.12", - "@esbuild/linux-x64": "0.19.12", - "@esbuild/netbsd-x64": "0.19.12", - "@esbuild/openbsd-x64": "0.19.12", - "@esbuild/sunos-x64": "0.19.12", - "@esbuild/win32-arm64": "0.19.12", - "@esbuild/win32-ia32": "0.19.12", - "@esbuild/win32-x64": "0.19.12" + "@esbuild/aix-ppc64": "0.20.0", + "@esbuild/android-arm": "0.20.0", + "@esbuild/android-arm64": "0.20.0", + "@esbuild/android-x64": "0.20.0", + "@esbuild/darwin-arm64": "0.20.0", + "@esbuild/darwin-x64": "0.20.0", + "@esbuild/freebsd-arm64": "0.20.0", + "@esbuild/freebsd-x64": "0.20.0", + "@esbuild/linux-arm": "0.20.0", + "@esbuild/linux-arm64": "0.20.0", + "@esbuild/linux-ia32": "0.20.0", + "@esbuild/linux-loong64": "0.20.0", + "@esbuild/linux-mips64el": "0.20.0", + "@esbuild/linux-ppc64": "0.20.0", + "@esbuild/linux-riscv64": "0.20.0", + "@esbuild/linux-s390x": "0.20.0", + "@esbuild/linux-x64": "0.20.0", + "@esbuild/netbsd-x64": "0.20.0", + "@esbuild/openbsd-x64": "0.20.0", + "@esbuild/sunos-x64": "0.20.0", + "@esbuild/win32-arm64": "0.20.0", + "@esbuild/win32-ia32": "0.20.0", + "@esbuild/win32-x64": "0.20.0" } }, "node_modules/escape-html": { diff --git a/it/typescript/package.json b/it/typescript/package.json index 1612511ec0..775304f65c 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -22,7 +22,7 @@ "@types/node": "^20.11.7", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", - "esbuild": "^0.19.12", + "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", From b0799d997aa6b2e6a5878d9597f8ad1ff7e2a8a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:43:13 +0000 Subject: [PATCH 058/394] Bump @types/node from 20.11.7 to 20.11.10 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.7 to 20.11.10. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index e8e9fd5f13..178cc41978 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.7", + "@types/node": "^20.11.10", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", "esbuild": "^0.19.12", @@ -824,9 +824,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.7.tgz", - "integrity": "sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==", + "version": "20.11.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.10.tgz", + "integrity": "sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 1612511ec0..9b0dbbd936 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.7", + "@types/node": "^20.11.10", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", "esbuild": "^0.19.12", From 4a9bf4c02dba6f24a39d2873e79e738c51b10a51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:56:36 +0000 Subject: [PATCH 059/394] Bump the kiota-dependencies group in /it/python with 1 update Bumps the kiota-dependencies group in /it/python with 1 update: [microsoft-kiota-abstractions](https://github.com/microsoft/kiota). Updates `microsoft-kiota-abstractions` from 1.0.0 to 1.1.0 - [Release notes](https://github.com/microsoft/kiota/releases) - [Changelog](https://github.com/microsoft/kiota/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota/compare/v1.0.0...v1.1.0) --- updated-dependencies: - dependency-name: microsoft-kiota-abstractions dependency-type: direct:development update-type: version-update:semver-minor dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 13ac9510d0..1491873919 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -98,7 +98,7 @@ httpx[http2]==0.26.0 hyperframe==6.0.1 ; python_full_version >= '3.6.1' -microsoft-kiota-abstractions==1.0.0 +microsoft-kiota-abstractions==1.1.0 microsoft-kiota-authentication-azure==1.0.0 From d8f3b7f6172b3c5db5817b5ba8c51a6f377c075b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:57:07 +0000 Subject: [PATCH 060/394] Bump pytest from 7.4.4 to 8.0.0 in /it/python Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.4 to 8.0.0. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.4.4...8.0.0) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 13ac9510d0..0950bcf050 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -42,7 +42,7 @@ pluggy==1.4.0 ; python_version >= '3.7' pylint==3.0.3 -pytest==7.4.4 +pytest==8.0.0 pytest-asyncio==0.23.3 From 047d5d14dd3590d1180e85058dbc53d88c03c26e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:57:27 +0000 Subject: [PATCH 061/394] Bump pytest-asyncio from 0.23.3 to 0.23.4 in /it/python Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.3 to 0.23.4. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.3...v0.23.4) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 13ac9510d0..3f49d5577a 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -44,7 +44,7 @@ pylint==3.0.3 pytest==7.4.4 -pytest-asyncio==0.23.3 +pytest-asyncio==0.23.4 requests==2.31.0 ; python_version >= '3.7' From 8d6cc13ca5a585e3b4fe5df7c1b5a2f885a388ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:57:51 +0000 Subject: [PATCH 062/394] Bump aiohttp from 3.9.1 to 3.9.2 in /it/python Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2. - [Release notes](https://github.com/aio-libs/aiohttp/releases) - [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst) - [Commits](https://github.com/aio-libs/aiohttp/compare/v3.9.1...v3.9.2) --- updated-dependencies: - dependency-name: aiohttp dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 13ac9510d0..5e9898279f 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -66,7 +66,7 @@ yapf==0.40.2 zipp==3.17.0 ; python_version >= '3.7' -aiohttp==3.9.1 ; python_version >= '3.6' +aiohttp==3.9.2 ; python_version >= '3.6' aiosignal==1.3.1 ; python_version >= '3.7' From b1ef104751160a6fa5b580bc5013be665f5b3afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Mon, 29 Jan 2024 10:16:16 -0500 Subject: [PATCH 063/394] Update specs/cli/config-migrate.md Co-authored-by: Eastman --- specs/cli/config-migrate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 75587c2d24..35253a752f 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -6,7 +6,7 @@ In the case where conflicting API client names would be migrated, the command wi ## Parameters -| Parameters | Required | Example | Description | +| Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | | `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | Yes, without its value | | `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | Yes, without its value | From b4f4aa34cf98ee1c577b78a7fea5a3f13f8ce063 Mon Sep 17 00:00:00 2001 From: Greg Smulko Date: Sat, 20 Jan 2024 22:56:46 +0000 Subject: [PATCH 064/394] Show children nodes when filtering I find it extremely confusing when they were filtered out. --- .../microsoft-kiota/src/openApiTreeProvider.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index 38dd7eafc9..b6c66aec31 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -278,20 +278,15 @@ export class OpenApiTreeNode extends vscode.TreeItem { const lowerCaseSegment = this.label.toLowerCase(); const splatPath = trimOperation(this.path); if (tokenizedFilter.some(x => lowerCaseSegment.includes(x.toLowerCase()))) { - if (this.isOperation &&tokenizedFilter.some(x => operationsNames.has(x)) && !tokenizedFilter.some(x => splatPath.includes(x))) { + if (this.isOperation && tokenizedFilter.some(x => operationsNames.has(x)) && !tokenizedFilter.some(x => splatPath.includes(x))) { return false; } return true; } - - if (this.isOperation) { - const segments = getPathSegments(splatPath); - if (segments.length === 0) { - return false; - } - const parentSegment = segments[segments.length - 1].toLowerCase(); - return tokenizedFilter.some(x => parentSegment.includes(x)); - } - return this.children.some(x => x.isNodeVisible(tokenizedFilter)); + + const segments = getPathSegments(splatPath); + + return tokenizedFilter.some(x => segments.some(s => s.includes(x))) + || this.children.some(x => x.isNodeVisible(tokenizedFilter)); } } \ No newline at end of file From 00e2665916ef80b9f4f19e12650f8a176fad6a38 Mon Sep 17 00:00:00 2001 From: Greg Smulko Date: Sun, 21 Jan 2024 00:09:08 +0000 Subject: [PATCH 065/394] Collapse filtered nodes The idea is to expand nodes up to the filtered node (so it's visible), but collapse itself and its children (to avoid clutter). --- .../src/openApiTreeProvider.ts | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index b6c66aec31..e164816b7c 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -214,19 +214,26 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider 0; + if (!hasChildren) { + return vscode.TreeItemCollapsibleState.None; + } + if (this.tokenizedFilter.length === 0) { + return vscode.TreeItemCollapsibleState.Expanded; + } + + if (this.tokenizedFilter.some(x => node.children.some(c => c.segment.includes(x) || this.getCollapsedState(c) === vscode.TreeItemCollapsibleState.Expanded))) { + return vscode.TreeItemCollapsibleState.Expanded; + } + return vscode.TreeItemCollapsibleState.Collapsed; } getTreeNodeFromKiotaNode(node: KiotaOpenApiNode): OpenApiTreeNode { return new OpenApiTreeNode( node.path, node.segment === pathSeparator && this.apiTitle ? pathSeparator + " (" + this.apiTitle + ")" : node.segment, node.selected ?? false, - this.getCollapsedState(node.children.length > 0), + this.getCollapsedState(node), node.isOperation ?? false, node.children.map(x => this.getTreeNodeFromKiotaNode(x)), node.documentationUrl From 9c44e58000399c33f808f57b2cb938a9dc7f2a24 Mon Sep 17 00:00:00 2001 From: Greg Smulko Date: Fri, 26 Jan 2024 20:44:01 +0000 Subject: [PATCH 066/394] Make collapsibleState prop readonly --- vscode/microsoft-kiota/src/openApiTreeProvider.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index e164816b7c..7c0e723cd1 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -228,12 +228,12 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider this.getTreeNodeFromKiotaNode(x)), node.documentationUrl @@ -246,8 +246,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider x.isNodeVisible(this.tokenizedFilter)); } else { - const result = this.getTreeNodeFromKiotaNode(this.rawRootNode); - result.collapsibleState = vscode.TreeItemCollapsibleState.Expanded; + const result = this.getTreeNodeFromKiotaNode(this.rawRootNode, vscode.TreeItemCollapsibleState.Expanded); return [result]; } } @@ -269,7 +268,7 @@ export class OpenApiTreeNode extends vscode.TreeItem { public readonly path: string, public readonly label: string, selected: boolean, - public collapsibleState: vscode.TreeItemCollapsibleState, + public readonly collapsibleState: vscode.TreeItemCollapsibleState, private readonly isOperation: boolean, public readonly children: OpenApiTreeNode[] = [], public readonly documentationUrl?: string, From aaade8e8d3333f55e661b8ca8a6d023ea999774f Mon Sep 17 00:00:00 2001 From: Greg Smulko Date: Fri, 26 Jan 2024 21:06:00 +0000 Subject: [PATCH 067/394] Change getChildren() func signature As per https://code.visualstudio.com/api/extension-guides/tree-view --- vscode/microsoft-kiota/src/openApiTreeProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index 7c0e723cd1..7f0ee90261 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -239,7 +239,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider { if (!this.rawRootNode) { return []; } From f2164aaed3ec9d9fb4f7c4109c0968f582f9ffc9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 29 Jan 2024 13:57:38 -0500 Subject: [PATCH 068/394] - updates kiota releases in vscode extension --- vscode/microsoft-kiota/package-lock.json | 4 ++-- vscode/microsoft-kiota/package.json | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index c869f8cea9..a3270c1e63 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -1,12 +1,12 @@ { "name": "kiota", - "version": "1.9.100000001", + "version": "1.10.100000002", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kiota", - "version": "1.9.100000001", + "version": "1.10.100000002", "dependencies": { "@vscode/extension-telemetry": "^0.9.2", "@vscode/l10n": "^0.0.18", diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 5359add695..d93ff03042 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -3,8 +3,8 @@ "displayName": "Microsoft Kiota", "publisher": "ms-graph", "description": "Client generator for HTTP REST APIs described by OpenAPI which helps eliminate the need to take a dependency on a different API client for every API that you need to call, as well as limiting the generation to the exact API surface area you're interested in, thanks to a filtering capability.", - "version": "1.9.100000001", - "kiotaVersion": "1.9.0", + "version": "1.10.100000002", + "kiotaVersion": "1.10.1", "telemetryInstrumentationKey": "4c6357e0-daf9-42b5-bdfb-67878f8957b5", "icon": "images/logo.png", "engines": { @@ -450,23 +450,23 @@ "runtimeDependencies": [ { "platformId": "win-x64", - "sha256": "16FE8B6E48A23EE00F89697EB34714C57E996EAFB57476C0F5BFD3D473C17A83" + "sha256": "F14DA204DBB513B12995C006DD4A356C8498EFF087BA77EE84E06C18AE92A947" }, { "platformId": "win-x86", - "sha256": "FF0F55CEA4520C6B8EE8308820847C20CE5C1123B9146E943D29BBAF1BF6E8A9" + "sha256": "1E55DDEBC4EC8AC8B527C7681FD342A2CFB74150914DD1E9669B84DAF26E18D5" }, { "platformId": "linux-x64", - "sha256": "E9A445B61B9A1B2F733FAC2A47E7D0C530241535137BA98EA8AD5514CA1D5350" + "sha256": "311F765AEC73477501B1C6EA97C0EAF108144318CB1C7C39D20B3CEE4C5DF848" }, { "platformId": "osx-x64", - "sha256": "74DCC6F65D7D9FF9AC2DBA3875EFE4CBE38ADB8888D909AA206E3D67872EB8DB" + "sha256": "82843F91BEC078C9344BAFFE7D8B7FB87BDAD7160329AF221BCEBA2C10DD0B50" }, { "platformId": "osx-arm64", - "sha256": "FE98BDEB3D606016592C41ED4765D089C30F09DAF24CF1DFAC9F5392FFC57980" + "sha256": "FD8EE5E60432E2885B4DE0E650D92829EE5EA4D20C50E7CB7D3E7B2FCDCDCB9B" } ] } From aaf948b3646d86b122b26ff298d41f6cc04371d2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 29 Jan 2024 15:02:45 -0500 Subject: [PATCH 069/394] - reverts changes to initial collapsed state Signed-off-by: Vincent Biret --- .../microsoft-kiota/src/openApiTreeProvider.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index 7f0ee90261..6973d04308 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -215,18 +215,11 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider 0; - if (!hasChildren) { - return vscode.TreeItemCollapsibleState.None; - } - if (this.tokenizedFilter.length === 0) { - return vscode.TreeItemCollapsibleState.Expanded; - } - - if (this.tokenizedFilter.some(x => node.children.some(c => c.segment.includes(x) || this.getCollapsedState(c) === vscode.TreeItemCollapsibleState.Expanded))) { - return vscode.TreeItemCollapsibleState.Expanded; - } - return vscode.TreeItemCollapsibleState.Collapsed; + return node.children.length === 0 ? + vscode.TreeItemCollapsibleState.None : + (this.tokenizedFilter.length === 0 ? + vscode.TreeItemCollapsibleState.Collapsed : + vscode.TreeItemCollapsibleState.Expanded); } getTreeNodeFromKiotaNode(node: KiotaOpenApiNode, collapsibleStateOverride: vscode.TreeItemCollapsibleState | undefined = undefined): OpenApiTreeNode { return new OpenApiTreeNode( From 2b1903524d3175633b5d67d1a78c3df59c650310 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 29 Jan 2024 15:14:32 -0500 Subject: [PATCH 070/394] - adds changelog entry for vscode filtering behavior changes Signed-off-by: Vincent Biret --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17625b210b..b746b9b1fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Switched to proxy generation for TypeScript, leading to about ~44% bundle sizes reduction. [#3642](https://github.com/microsoft/kiota/issues/3642) - Fixed a bug where TypeScript models factory methods would be missing return types. - Fixed a bug where generated paths would possibly get too long. [#3854](https://github.com/microsoft/kiota/issues/3854) +- The vscode extension now also displays the children nodes when filtering. [#3998](https://github.com/microsoft/kiota/issues/3998) ## [1.10.1] - 2024-01-12 From 5813852346ccc72201b274ff14068f829f128907 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:31:39 +0000 Subject: [PATCH 071/394] Bump aiohttp from 3.9.2 to 3.9.3 in /it/python Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.2 to 3.9.3. - [Release notes](https://github.com/aio-libs/aiohttp/releases) - [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst) - [Commits](https://github.com/aio-libs/aiohttp/compare/v3.9.2...v3.9.3) --- updated-dependencies: - dependency-name: aiohttp dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index e09d3ed25b..fedbbfc7f9 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -66,7 +66,7 @@ yapf==0.40.2 zipp==3.17.0 ; python_version >= '3.7' -aiohttp==3.9.2 ; python_version >= '3.6' +aiohttp==3.9.3 ; python_version >= '3.6' aiosignal==1.3.1 ; python_version >= '3.7' From 3dbfce10de2fffa061b1aba80de618d6c9d63036 Mon Sep 17 00:00:00 2001 From: Eastman Date: Tue, 30 Jan 2024 11:44:35 +0300 Subject: [PATCH 072/394] Update requirements-dev.txt --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index fedbbfc7f9..cfc6b41898 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -42,7 +42,7 @@ pluggy==1.4.0 ; python_version >= '3.7' pylint==3.0.3 -pytest==8.0.0 +pytest==7.4.4 pytest-asyncio==0.23.4 From d817738ddad19e5fa955ff79fac0164bce3d3d17 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:52:17 +0000 Subject: [PATCH 073/394] Bump the eslint group in /vscode/microsoft-kiota with 2 updates Bumps the eslint group in /vscode/microsoft-kiota with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser). Updates `@typescript-eslint/eslint-plugin` from 6.19.1 to 6.20.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.20.0/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 6.19.1 to 6.20.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.20.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: eslint - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: eslint ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 88 ++++++++++++------------ vscode/microsoft-kiota/package.json | 4 +- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index c869f8cea9..6a1cf78629 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -20,8 +20,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.85.0", - "@typescript-eslint/eslint-plugin": "^6.19.1", - "@typescript-eslint/parser": "^6.19.1", + "@typescript-eslint/eslint-plugin": "^6.20.0", + "@typescript-eslint/parser": "^6.20.0", "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", @@ -555,16 +555,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.1.tgz", - "integrity": "sha512-roQScUGFruWod9CEyoV5KlCYrubC/fvG8/1zXuT0WTcxX87GnMMmnksMwSg99lo1xiKrBzw2icsJPMAw1OtKxg==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz", + "integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.19.1", - "@typescript-eslint/type-utils": "6.19.1", - "@typescript-eslint/utils": "6.19.1", - "@typescript-eslint/visitor-keys": "6.19.1", + "@typescript-eslint/scope-manager": "6.20.0", + "@typescript-eslint/type-utils": "6.20.0", + "@typescript-eslint/utils": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -590,15 +590,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.1.tgz", - "integrity": "sha512-WEfX22ziAh6pRE9jnbkkLGp/4RhTpffr2ZK5bJ18M8mIfA8A+k97U9ZyaXCEJRlmMHh7R9MJZWXp/r73DzINVQ==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz", + "integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.19.1", - "@typescript-eslint/types": "6.19.1", - "@typescript-eslint/typescript-estree": "6.19.1", - "@typescript-eslint/visitor-keys": "6.19.1", + "@typescript-eslint/scope-manager": "6.20.0", + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/typescript-estree": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0", "debug": "^4.3.4" }, "engines": { @@ -618,13 +618,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.1.tgz", - "integrity": "sha512-4CdXYjKf6/6aKNMSly/BP4iCSOpvMmqtDzRtqFyyAae3z5kkqEjKndR5vDHL8rSuMIIWP8u4Mw4VxLyxZW6D5w==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz", + "integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.19.1", - "@typescript-eslint/visitor-keys": "6.19.1" + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -635,13 +635,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.1.tgz", - "integrity": "sha512-0vdyld3ecfxJuddDjACUvlAeYNrHP/pDeQk2pWBR2ESeEzQhg52DF53AbI9QCBkYE23lgkhLCZNkHn2hEXXYIg==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz", + "integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.19.1", - "@typescript-eslint/utils": "6.19.1", + "@typescript-eslint/typescript-estree": "6.20.0", + "@typescript-eslint/utils": "6.20.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -662,9 +662,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.1.tgz", - "integrity": "sha512-6+bk6FEtBhvfYvpHsDgAL3uo4BfvnTnoge5LrrCj2eJN8g3IJdLTD4B/jK3Q6vo4Ql/Hoip9I8aB6fF+6RfDqg==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz", + "integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -675,13 +675,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.1.tgz", - "integrity": "sha512-aFdAxuhzBFRWhy+H20nYu19+Km+gFfwNO4TEqyszkMcgBDYQjmPJ61erHxuT2ESJXhlhrO7I5EFIlZ+qGR8oVA==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz", + "integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.19.1", - "@typescript-eslint/visitor-keys": "6.19.1", + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -727,17 +727,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.1.tgz", - "integrity": "sha512-JvjfEZuP5WoMqwh9SPAPDSHSg9FBHHGhjPugSRxu5jMfjvBpq5/sGTD+9M9aQ5sh6iJ8AY/Kk/oUYVEMAPwi7w==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz", + "integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.19.1", - "@typescript-eslint/types": "6.19.1", - "@typescript-eslint/typescript-estree": "6.19.1", + "@typescript-eslint/scope-manager": "6.20.0", + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/typescript-estree": "6.20.0", "semver": "^7.5.4" }, "engines": { @@ -752,12 +752,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.1.tgz", - "integrity": "sha512-gkdtIO+xSO/SmI0W68DBg4u1KElmIUo3vXzgHyGPs6cxgB0sa3TlptRAAE0hUY1hM6FcDKEv7aIwiTGm76cXfQ==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz", + "integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.19.1", + "@typescript-eslint/types": "6.20.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 5359add695..69a646f9ce 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -427,8 +427,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.85.0", - "@typescript-eslint/eslint-plugin": "^6.19.1", - "@typescript-eslint/parser": "^6.19.1", + "@typescript-eslint/eslint-plugin": "^6.20.0", + "@typescript-eslint/parser": "^6.20.0", "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", From 686d41de8d0436001de6da091aed52e841f5907f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:52:20 +0000 Subject: [PATCH 074/394] Bump the kiota-dependencies group in /it/typescript with 7 updates Bumps the kiota-dependencies group in /it/typescript with 7 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/kiota-abstractions](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.38` | `1.0.0-preview.39` | | [@microsoft/kiota-authentication-azure](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.33` | `1.0.0-preview.34` | | [@microsoft/kiota-http-fetchlibrary](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.37` | `1.0.0-preview.38` | | [@microsoft/kiota-serialization-form](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.27` | `1.0.0-preview.28` | | [@microsoft/kiota-serialization-json](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.38` | `1.0.0-preview.39` | | [@microsoft/kiota-serialization-multipart](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.17` | `1.0.0-preview.18` | | [@microsoft/kiota-serialization-text](https://github.com/microsoft-typescript/kiota) | `1.0.0-preview.35` | `1.0.0-preview.36` | Updates `@microsoft/kiota-abstractions` from 1.0.0-preview.38 to 1.0.0-preview.39 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-abstractions@1.0.0-preview.38...@microsoft/kiota-abstractions@1.0.0-preview.39) Updates `@microsoft/kiota-authentication-azure` from 1.0.0-preview.33 to 1.0.0-preview.34 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-authentication-azure@1.0.0-preview.33...@microsoft/kiota-authentication-azure@1.0.0-preview.34) Updates `@microsoft/kiota-http-fetchlibrary` from 1.0.0-preview.37 to 1.0.0-preview.38 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.37...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.38) Updates `@microsoft/kiota-serialization-form` from 1.0.0-preview.27 to 1.0.0-preview.28 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-form@1.0.0-preview.27...@microsoft/kiota-serialization-form@1.0.0-preview.28) Updates `@microsoft/kiota-serialization-json` from 1.0.0-preview.38 to 1.0.0-preview.39 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-json@1.0.0-preview.38...@microsoft/kiota-serialization-json@1.0.0-preview.39) Updates `@microsoft/kiota-serialization-multipart` from 1.0.0-preview.17 to 1.0.0-preview.18 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-multipart@1.0.0-preview.17...@microsoft/kiota-serialization-multipart@1.0.0-preview.18) Updates `@microsoft/kiota-serialization-text` from 1.0.0-preview.35 to 1.0.0-preview.36 - [Commits](https://github.com/microsoft-typescript/kiota/commits) --- updated-dependencies: - dependency-name: "@microsoft/kiota-abstractions" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-authentication-azure" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-http-fetchlibrary" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-json" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-multipart" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-text" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 68 ++++++++++++++++----------------- it/typescript/package.json | 14 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 4f2350cf5b..658c883883 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.38", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.33", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.37", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.27", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.38", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.17", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.35", + "@microsoft/kiota-abstractions": "^1.0.0-preview.39", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.34", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.38", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.28", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.39", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.18", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.36", "express": "^4.18.2", "node-fetch": "^2.7.0" }, @@ -678,9 +678,9 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.38", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.38.tgz", - "integrity": "sha512-PXjQ4+wXXz+4eiAkGCK84rBPU/ahnNjrnOPxMkJ2GdA8mI3kyls9kNfAP0jvg2JkOhDJn8sTwmK7dicj5hyFpA==", + "version": "1.0.0-preview.39", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.39.tgz", + "integrity": "sha512-dBoKRhhDCxi9c2olTSOwWTXL3y6ov5oO7Do+lJ9s4k78+nvdideyhZaHqeQL95UtNxK4kb8r93CHU4b1gm+qCQ==", "dependencies": { "@opentelemetry/api": "^1.2.0", "@std-uritemplate/std-uritemplate": "^0.0.50", @@ -699,22 +699,22 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.33", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.33.tgz", - "integrity": "sha512-xR8vkR+DknhVP949/G8lin/BTyEnK3fkai+OqpTkyMubNW+5E0Tpynx831WvvJ4ir9YhlBb4ErQDs4k8cQK3mw==", + "version": "1.0.0-preview.34", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.34.tgz", + "integrity": "sha512-PdtmRA6r0EiSjdFDxAHZAmJHWMSJej18e3tWbQLQEBkGBGp/hV/UFqhr3zV5HgaXS9nAYYjVHw7i2guRLU/xGw==", "dependencies": { "@azure/core-auth": "^1.3.2", - "@microsoft/kiota-abstractions": "^1.0.0-preview.38", + "@microsoft/kiota-abstractions": "^1.0.0-preview.39", "@opentelemetry/api": "^1.2.0", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.37", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.37.tgz", - "integrity": "sha512-flgGEkMKCFr/LwuvTTk51MY5sloIS6lwm9v80VLoNaPCe8xGuYDbRcY6//KP2GIJJLWmQE+BZQhB16LG1WDrLA==", + "version": "1.0.0-preview.38", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.38.tgz", + "integrity": "sha512-yT9OGXbTlsaAHajlnVBrN3wg/eaMoxy1KeKd32z2xD24ZxCx2GWJ3K5zUBRFGeEDx7twjNknEayPGir9Vu/wYw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.38", + "@microsoft/kiota-abstractions": "^1.0.0-preview.39", "@opentelemetry/api": "^1.2.0", "guid-typescript": "^1.0.9", "node-fetch": "^2.6.5", @@ -722,41 +722,41 @@ } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.27", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.27.tgz", - "integrity": "sha512-sF9itqhLJA7h7vR/RLhLrQ7qaue35236Z6Bv3iS/pG34IZLS8nk51MUaejA5pgelM1FlYg75hjea0NbFKbYv4g==", + "version": "1.0.0-preview.28", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.28.tgz", + "integrity": "sha512-Q+DhxsKyvXCiKOKCDvlM2AecsaSHAGTMYz1GWDrRhxNowed5ZThxBcqVP0WGpfeERN6qJh/Q4XGJJ/RNTM8WEw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.38", + "@microsoft/kiota-abstractions": "^1.0.0-preview.39", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.38", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.38.tgz", - "integrity": "sha512-D1fFekgnOvCl+9sKENfZ9V5ZAIbDNqat0cD+2TL2wVJr3+5GGOPeH5xpJz0EoOpfD7hxX903mn5YrMQT/nHq/g==", + "version": "1.0.0-preview.39", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.39.tgz", + "integrity": "sha512-ylL91fLmoj1/kLYkHNwvaxqIbAAVXomaMA1zI4/u+yspPLgK5VKu5lKeNjqdt67PYLDsL9IlD6FSvAdWKUHVpA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.38", + "@microsoft/kiota-abstractions": "^1.0.0-preview.39", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.17", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.17.tgz", - "integrity": "sha512-9r90gsOtSmBrxv2vbEOSdDCrlhLj9+Puwt2sdS3K5sBejhc/crkd8+mMeYhqBXC5Ve8q0JTVKjpxKpBr7Z6bAw==", + "version": "1.0.0-preview.18", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.18.tgz", + "integrity": "sha512-pC5ZihZDr1/UWZpv0VRirjoI00oFrFKOLauz8VfVUhFC9PSAMafG4uSv5cbsiwcVZmuOiTX6+z1rYWB2bBVrEQ==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.38", + "@microsoft/kiota-abstractions": "^1.0.0-preview.39", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.35", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.35.tgz", - "integrity": "sha512-jJ3+iUYH3YtjFY54wDLW4VgLpc1iCvArg7s1oLt0G9DQQK3NOFrvkn0oJGCtFfFYxQY9rRqF+inkusY0LpgV8Q==", + "version": "1.0.0-preview.36", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.36.tgz", + "integrity": "sha512-ODWxMYzpmkXqIP6TV5uf+WaBxhGQzTZQHkzUjIRMFh9yBKa39ZtiOsQpP93CV22KrvFiqYlrRBPc8wyw9kBLgQ==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.38", + "@microsoft/kiota-abstractions": "^1.0.0-preview.39", "guid-typescript": "^1.0.9", "tslib": "^2.3.1" } diff --git a/it/typescript/package.json b/it/typescript/package.json index 1dc35a6b31..630a08a0bc 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.38", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.33", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.37", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.27", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.38", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.17", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.35", + "@microsoft/kiota-abstractions": "^1.0.0-preview.39", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.34", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.38", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.28", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.39", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.18", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.36", "express": "^4.18.2", "node-fetch": "^2.7.0" } From 5daadd7ea473c903ee33c5748b906f9bfc97e303 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:52:37 +0000 Subject: [PATCH 075/394] Bump @typescript-eslint/parser from 6.19.1 to 6.20.0 in /it/typescript Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.19.1 to 6.20.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.20.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 115 +++++++++++++++++++++++++++++--- it/typescript/package.json | 2 +- 2 files changed, 108 insertions(+), 9 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 4f2350cf5b..d9e3798b8a 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -24,7 +24,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.10", "@typescript-eslint/eslint-plugin": "^6.19.1", - "@typescript-eslint/parser": "^6.19.1", + "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", @@ -874,15 +874,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.1.tgz", - "integrity": "sha512-WEfX22ziAh6pRE9jnbkkLGp/4RhTpffr2ZK5bJ18M8mIfA8A+k97U9ZyaXCEJRlmMHh7R9MJZWXp/r73DzINVQ==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz", + "integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.19.1", - "@typescript-eslint/types": "6.19.1", - "@typescript-eslint/typescript-estree": "6.19.1", - "@typescript-eslint/visitor-keys": "6.19.1", + "@typescript-eslint/scope-manager": "6.20.0", + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/typescript-estree": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0", "debug": "^4.3.4" }, "engines": { @@ -901,6 +901,105 @@ } } }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz", + "integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz", + "integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz", + "integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz", + "integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.20.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "6.19.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.1.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index 1dc35a6b31..0d2c4a6002 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -21,7 +21,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.10", "@typescript-eslint/eslint-plugin": "^6.19.1", - "@typescript-eslint/parser": "^6.19.1", + "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", From bfb8077551eb890d3ab9a9a458e411683f59acbb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:52:38 +0000 Subject: [PATCH 076/394] Bump the kiota-dependencies group with 1 update Bumps the kiota-dependencies group with 1 update: [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet). Updates `Microsoft.Kiota.Serialization.Json` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.2...v1.1.3) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 3b26261562..e1b09e9812 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -41,7 +41,7 @@ - + From 083505d7474b6f5e1aa9e92ce091fa089c8e4341 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:52:51 +0000 Subject: [PATCH 077/394] Bump the kiota-dependencies group in /it/csharp with 1 update Bumps the kiota-dependencies group in /it/csharp with 1 update: [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet). Updates `Microsoft.Kiota.Serialization.Json` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.2...v1.1.3) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index a75543bc23..253088f10c 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -14,7 +14,7 @@ - + From 31cc50ae8a42d5a0c39b6c41b7e0c17db6ec80a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 09:34:42 +0000 Subject: [PATCH 078/394] Bump @typescript-eslint/eslint-plugin in /it/typescript Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.19.1 to 6.20.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.20.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 163 +++++++------------------------- it/typescript/package.json | 2 +- 2 files changed, 33 insertions(+), 132 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index d9e3798b8a..1f36e794da 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -23,7 +23,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.10", - "@typescript-eslint/eslint-plugin": "^6.19.1", + "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", "eslint": "^8.56.0", @@ -839,16 +839,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.1.tgz", - "integrity": "sha512-roQScUGFruWod9CEyoV5KlCYrubC/fvG8/1zXuT0WTcxX87GnMMmnksMwSg99lo1xiKrBzw2icsJPMAw1OtKxg==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz", + "integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.19.1", - "@typescript-eslint/type-utils": "6.19.1", - "@typescript-eslint/utils": "6.19.1", - "@typescript-eslint/visitor-keys": "6.19.1", + "@typescript-eslint/scope-manager": "6.20.0", + "@typescript-eslint/type-utils": "6.20.0", + "@typescript-eslint/utils": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -901,7 +901,7 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "node_modules/@typescript-eslint/scope-manager": { "version": "6.20.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz", "integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==", @@ -918,113 +918,14 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz", - "integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz", - "integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz", - "integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.20.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.1.tgz", - "integrity": "sha512-4CdXYjKf6/6aKNMSly/BP4iCSOpvMmqtDzRtqFyyAae3z5kkqEjKndR5vDHL8rSuMIIWP8u4Mw4VxLyxZW6D5w==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.19.1", - "@typescript-eslint/visitor-keys": "6.19.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.1.tgz", - "integrity": "sha512-0vdyld3ecfxJuddDjACUvlAeYNrHP/pDeQk2pWBR2ESeEzQhg52DF53AbI9QCBkYE23lgkhLCZNkHn2hEXXYIg==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz", + "integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.19.1", - "@typescript-eslint/utils": "6.19.1", + "@typescript-eslint/typescript-estree": "6.20.0", + "@typescript-eslint/utils": "6.20.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1045,9 +946,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.1.tgz", - "integrity": "sha512-6+bk6FEtBhvfYvpHsDgAL3uo4BfvnTnoge5LrrCj2eJN8g3IJdLTD4B/jK3Q6vo4Ql/Hoip9I8aB6fF+6RfDqg==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz", + "integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1058,13 +959,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.1.tgz", - "integrity": "sha512-aFdAxuhzBFRWhy+H20nYu19+Km+gFfwNO4TEqyszkMcgBDYQjmPJ61erHxuT2ESJXhlhrO7I5EFIlZ+qGR8oVA==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz", + "integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.19.1", - "@typescript-eslint/visitor-keys": "6.19.1", + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/visitor-keys": "6.20.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1110,17 +1011,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.1.tgz", - "integrity": "sha512-JvjfEZuP5WoMqwh9SPAPDSHSg9FBHHGhjPugSRxu5jMfjvBpq5/sGTD+9M9aQ5sh6iJ8AY/Kk/oUYVEMAPwi7w==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz", + "integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.19.1", - "@typescript-eslint/types": "6.19.1", - "@typescript-eslint/typescript-estree": "6.19.1", + "@typescript-eslint/scope-manager": "6.20.0", + "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/typescript-estree": "6.20.0", "semver": "^7.5.4" }, "engines": { @@ -1135,12 +1036,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.19.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.1.tgz", - "integrity": "sha512-gkdtIO+xSO/SmI0W68DBg4u1KElmIUo3vXzgHyGPs6cxgB0sa3TlptRAAE0hUY1hM6FcDKEv7aIwiTGm76cXfQ==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz", + "integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.19.1", + "@typescript-eslint/types": "6.20.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/it/typescript/package.json b/it/typescript/package.json index 0d2c4a6002..349cf85002 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.10", - "@typescript-eslint/eslint-plugin": "^6.19.1", + "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", "eslint": "^8.56.0", From 5366bced0dbb549c41695a684705beff9e146dee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 09:35:32 +0000 Subject: [PATCH 079/394] Bump Microsoft.OpenApi from 1.6.12 to 1.6.13 Bumps [Microsoft.OpenApi](https://github.com/Microsoft/OpenAPI.NET) from 1.6.12 to 1.6.13. - [Release notes](https://github.com/Microsoft/OpenAPI.NET/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET/compare/1.6.12...1.6.13) --- updated-dependencies: - dependency-name: Microsoft.OpenApi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index e1b09e9812..064591af6f 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -44,7 +44,7 @@ - + From 6b8b410dabd9ddac0f72764bd3a7cc3e3ec9e59f Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 30 Jan 2024 13:40:30 +0300 Subject: [PATCH 080/394] Fix obsolete constructor --- src/Kiota.Builder/Validation/DivergentResponseSchema.cs | 2 +- src/Kiota.Builder/Validation/GetWithBody.cs | 2 +- src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs | 2 +- src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs | 2 +- src/Kiota.Builder/Validation/MissingDiscriminator.cs | 2 +- src/Kiota.Builder/Validation/MultipleServerEntries.cs | 2 +- src/Kiota.Builder/Validation/NoContentWithBody.cs | 2 +- src/Kiota.Builder/Validation/NoServerEntry.cs | 2 +- src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Kiota.Builder/Validation/DivergentResponseSchema.cs b/src/Kiota.Builder/Validation/DivergentResponseSchema.cs index 1dd519872f..203d7d8faa 100644 --- a/src/Kiota.Builder/Validation/DivergentResponseSchema.cs +++ b/src/Kiota.Builder/Validation/DivergentResponseSchema.cs @@ -11,7 +11,7 @@ public class DivergentResponseSchema : ValidationRule { private static readonly OpenApiSchemaComparer schemaComparer = new(); private static readonly HashSet validStatusCodes = new(OpenApiOperationExtensions.SuccessCodes, StringComparer.OrdinalIgnoreCase); - public DivergentResponseSchema(GenerationConfiguration configuration) : base((context, operation) => + public DivergentResponseSchema(GenerationConfiguration configuration) : base(nameof(DivergentResponseSchema),(context, operation) => { var schemas = operation.GetResponseSchemas(validStatusCodes, configuration.StructuredMimeTypes); if (schemas.GroupBy(x => x, schemaComparer).Count() > 1) diff --git a/src/Kiota.Builder/Validation/GetWithBody.cs b/src/Kiota.Builder/Validation/GetWithBody.cs index c46564356a..843fa0ac29 100644 --- a/src/Kiota.Builder/Validation/GetWithBody.cs +++ b/src/Kiota.Builder/Validation/GetWithBody.cs @@ -5,7 +5,7 @@ namespace Kiota.Builder.Validation; public class GetWithBody : ValidationRule { - public GetWithBody() : base(static (context, pathItem) => + public GetWithBody() : base(nameof(GetWithBody),static (context, pathItem) => { if (pathItem.Operations.TryGetValue(OperationType.Get, out var getOperation) && getOperation.RequestBody != null) context.CreateWarning(nameof(GetWithBody), "A GET operation with a body was found. The request body will be ignored."); diff --git a/src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs b/src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs index c3db5cd551..84ff9ade14 100644 --- a/src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs +++ b/src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs @@ -49,7 +49,7 @@ public class InconsistentTypeFormatPair : ValidationRule "null", "object", }; - public InconsistentTypeFormatPair() : base(static (context, schema) => + public InconsistentTypeFormatPair() : base(nameof(InconsistentTypeFormatPair),static (context, schema) => { if (string.IsNullOrEmpty(schema?.Type) || string.IsNullOrEmpty(schema.Format) || KnownAndNotSupportedFormats.knownAndUnsupportedFormats.Contains(schema.Format) || escapedTypes.Contains(schema.Type)) return; diff --git a/src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs b/src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs index 2eeb846eb8..df1b4f19ef 100644 --- a/src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs +++ b/src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs @@ -24,7 +24,7 @@ public class KnownAndNotSupportedFormats : ValidationRule "relative-json-pointer", "regex", }; - public KnownAndNotSupportedFormats() : base(static (context, schema) => + public KnownAndNotSupportedFormats() : base(nameof(KnownAndNotSupportedFormats),static (context, schema) => { if (!string.IsNullOrEmpty(schema.Format) && knownAndUnsupportedFormats.Contains(schema.Format)) context.CreateWarning(nameof(KnownAndNotSupportedFormats), $"The format {schema.Format} is not supported by Kiota and the string type will be used."); diff --git a/src/Kiota.Builder/Validation/MissingDiscriminator.cs b/src/Kiota.Builder/Validation/MissingDiscriminator.cs index 4284ef9660..8feaffd368 100644 --- a/src/Kiota.Builder/Validation/MissingDiscriminator.cs +++ b/src/Kiota.Builder/Validation/MissingDiscriminator.cs @@ -10,7 +10,7 @@ namespace Kiota.Builder.Validation; public class MissingDiscriminator : ValidationRule { - public MissingDiscriminator(GenerationConfiguration configuration) : base((context, document) => + public MissingDiscriminator(GenerationConfiguration configuration) : base(nameof(MissingDiscriminator),(context, document) => { var idx = new ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase); document.InitializeInheritanceIndex(idx); diff --git a/src/Kiota.Builder/Validation/MultipleServerEntries.cs b/src/Kiota.Builder/Validation/MultipleServerEntries.cs index 2a04d793c2..715df79576 100644 --- a/src/Kiota.Builder/Validation/MultipleServerEntries.cs +++ b/src/Kiota.Builder/Validation/MultipleServerEntries.cs @@ -6,7 +6,7 @@ namespace Kiota.Builder.Validation; public class MultipleServerEntries : ValidationRule { - public MultipleServerEntries() : base(static (context, document) => + public MultipleServerEntries() : base(nameof(MultipleServerEntries),static (context, document) => { if (document.Servers.GroupBy(static x => x.Url, StringComparer.OrdinalIgnoreCase).Count() > 1) context.CreateWarning(nameof(MultipleServerEntries), diff --git a/src/Kiota.Builder/Validation/NoContentWithBody.cs b/src/Kiota.Builder/Validation/NoContentWithBody.cs index acebc342ed..685a33d04e 100644 --- a/src/Kiota.Builder/Validation/NoContentWithBody.cs +++ b/src/Kiota.Builder/Validation/NoContentWithBody.cs @@ -6,7 +6,7 @@ namespace Kiota.Builder.Validation; public class NoContentWithBody : ValidationRule { - public NoContentWithBody() : base(static (context, operation) => + public NoContentWithBody() : base(nameof(NoContentWithBody),static (context, operation) => { if (operation.Responses.TryGetValue("204", out var response) && (response?.Content?.Any() ?? false)) context.CreateWarning(nameof(NoContentWithBody), "A 204 response with a body media type was found. The response body will be ignored."); diff --git a/src/Kiota.Builder/Validation/NoServerEntry.cs b/src/Kiota.Builder/Validation/NoServerEntry.cs index b5fc2b904e..6bf0e5a620 100644 --- a/src/Kiota.Builder/Validation/NoServerEntry.cs +++ b/src/Kiota.Builder/Validation/NoServerEntry.cs @@ -6,7 +6,7 @@ namespace Kiota.Builder.Validation; public class NoServerEntry : ValidationRule { - public NoServerEntry() : base(static (context, document) => + public NoServerEntry() : base(nameof(NoServerEntry),static (context, document) => { if (!document.Servers.Any() || string.IsNullOrEmpty(document.Servers.First().Url?.TrimEnd('/'))) context.CreateWarning(nameof(NoServerEntry), diff --git a/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs b/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs index 9e01570b46..ddeebdfdce 100644 --- a/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs +++ b/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs @@ -11,7 +11,7 @@ public class UrlFormEncodedComplex : ValidationRule private static readonly StructuredMimeTypesCollection validContentTypes = new() { "application/x-www-form-urlencoded", }; - public UrlFormEncodedComplex() : base(static (context, operation) => + public UrlFormEncodedComplex() : base(nameof(UrlFormEncodedComplex),static (context, operation) => { if (operation.GetRequestSchema(validContentTypes) is OpenApiSchema requestSchema) ValidateSchema(requestSchema, context, operation.OperationId, "request body"); From 7456953a844530e62de897a175ff6dd6940c40d3 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 30 Jan 2024 13:45:53 +0300 Subject: [PATCH 081/394] Format --- src/Kiota.Builder/Validation/DivergentResponseSchema.cs | 2 +- src/Kiota.Builder/Validation/GetWithBody.cs | 2 +- src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs | 2 +- src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs | 2 +- src/Kiota.Builder/Validation/MissingDiscriminator.cs | 2 +- src/Kiota.Builder/Validation/MultipleServerEntries.cs | 2 +- src/Kiota.Builder/Validation/NoContentWithBody.cs | 2 +- src/Kiota.Builder/Validation/NoServerEntry.cs | 2 +- src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Kiota.Builder/Validation/DivergentResponseSchema.cs b/src/Kiota.Builder/Validation/DivergentResponseSchema.cs index 203d7d8faa..0ca25bd314 100644 --- a/src/Kiota.Builder/Validation/DivergentResponseSchema.cs +++ b/src/Kiota.Builder/Validation/DivergentResponseSchema.cs @@ -11,7 +11,7 @@ public class DivergentResponseSchema : ValidationRule { private static readonly OpenApiSchemaComparer schemaComparer = new(); private static readonly HashSet validStatusCodes = new(OpenApiOperationExtensions.SuccessCodes, StringComparer.OrdinalIgnoreCase); - public DivergentResponseSchema(GenerationConfiguration configuration) : base(nameof(DivergentResponseSchema),(context, operation) => + public DivergentResponseSchema(GenerationConfiguration configuration) : base(nameof(DivergentResponseSchema), (context, operation) => { var schemas = operation.GetResponseSchemas(validStatusCodes, configuration.StructuredMimeTypes); if (schemas.GroupBy(x => x, schemaComparer).Count() > 1) diff --git a/src/Kiota.Builder/Validation/GetWithBody.cs b/src/Kiota.Builder/Validation/GetWithBody.cs index 843fa0ac29..a4f60dee96 100644 --- a/src/Kiota.Builder/Validation/GetWithBody.cs +++ b/src/Kiota.Builder/Validation/GetWithBody.cs @@ -5,7 +5,7 @@ namespace Kiota.Builder.Validation; public class GetWithBody : ValidationRule { - public GetWithBody() : base(nameof(GetWithBody),static (context, pathItem) => + public GetWithBody() : base(nameof(GetWithBody), static (context, pathItem) => { if (pathItem.Operations.TryGetValue(OperationType.Get, out var getOperation) && getOperation.RequestBody != null) context.CreateWarning(nameof(GetWithBody), "A GET operation with a body was found. The request body will be ignored."); diff --git a/src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs b/src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs index 84ff9ade14..636bf96689 100644 --- a/src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs +++ b/src/Kiota.Builder/Validation/InconsistentTypeFormatPair.cs @@ -49,7 +49,7 @@ public class InconsistentTypeFormatPair : ValidationRule "null", "object", }; - public InconsistentTypeFormatPair() : base(nameof(InconsistentTypeFormatPair),static (context, schema) => + public InconsistentTypeFormatPair() : base(nameof(InconsistentTypeFormatPair), static (context, schema) => { if (string.IsNullOrEmpty(schema?.Type) || string.IsNullOrEmpty(schema.Format) || KnownAndNotSupportedFormats.knownAndUnsupportedFormats.Contains(schema.Format) || escapedTypes.Contains(schema.Type)) return; diff --git a/src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs b/src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs index df1b4f19ef..4dc4c5922d 100644 --- a/src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs +++ b/src/Kiota.Builder/Validation/KnownAndNotSupportedFormats.cs @@ -24,7 +24,7 @@ public class KnownAndNotSupportedFormats : ValidationRule "relative-json-pointer", "regex", }; - public KnownAndNotSupportedFormats() : base(nameof(KnownAndNotSupportedFormats),static (context, schema) => + public KnownAndNotSupportedFormats() : base(nameof(KnownAndNotSupportedFormats), static (context, schema) => { if (!string.IsNullOrEmpty(schema.Format) && knownAndUnsupportedFormats.Contains(schema.Format)) context.CreateWarning(nameof(KnownAndNotSupportedFormats), $"The format {schema.Format} is not supported by Kiota and the string type will be used."); diff --git a/src/Kiota.Builder/Validation/MissingDiscriminator.cs b/src/Kiota.Builder/Validation/MissingDiscriminator.cs index 8feaffd368..ad12d74ea2 100644 --- a/src/Kiota.Builder/Validation/MissingDiscriminator.cs +++ b/src/Kiota.Builder/Validation/MissingDiscriminator.cs @@ -10,7 +10,7 @@ namespace Kiota.Builder.Validation; public class MissingDiscriminator : ValidationRule { - public MissingDiscriminator(GenerationConfiguration configuration) : base(nameof(MissingDiscriminator),(context, document) => + public MissingDiscriminator(GenerationConfiguration configuration) : base(nameof(MissingDiscriminator), (context, document) => { var idx = new ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase); document.InitializeInheritanceIndex(idx); diff --git a/src/Kiota.Builder/Validation/MultipleServerEntries.cs b/src/Kiota.Builder/Validation/MultipleServerEntries.cs index 715df79576..05ff96e5c5 100644 --- a/src/Kiota.Builder/Validation/MultipleServerEntries.cs +++ b/src/Kiota.Builder/Validation/MultipleServerEntries.cs @@ -6,7 +6,7 @@ namespace Kiota.Builder.Validation; public class MultipleServerEntries : ValidationRule { - public MultipleServerEntries() : base(nameof(MultipleServerEntries),static (context, document) => + public MultipleServerEntries() : base(nameof(MultipleServerEntries), static (context, document) => { if (document.Servers.GroupBy(static x => x.Url, StringComparer.OrdinalIgnoreCase).Count() > 1) context.CreateWarning(nameof(MultipleServerEntries), diff --git a/src/Kiota.Builder/Validation/NoContentWithBody.cs b/src/Kiota.Builder/Validation/NoContentWithBody.cs index 685a33d04e..539c4430e7 100644 --- a/src/Kiota.Builder/Validation/NoContentWithBody.cs +++ b/src/Kiota.Builder/Validation/NoContentWithBody.cs @@ -6,7 +6,7 @@ namespace Kiota.Builder.Validation; public class NoContentWithBody : ValidationRule { - public NoContentWithBody() : base(nameof(NoContentWithBody),static (context, operation) => + public NoContentWithBody() : base(nameof(NoContentWithBody), static (context, operation) => { if (operation.Responses.TryGetValue("204", out var response) && (response?.Content?.Any() ?? false)) context.CreateWarning(nameof(NoContentWithBody), "A 204 response with a body media type was found. The response body will be ignored."); diff --git a/src/Kiota.Builder/Validation/NoServerEntry.cs b/src/Kiota.Builder/Validation/NoServerEntry.cs index 6bf0e5a620..17513ed4f7 100644 --- a/src/Kiota.Builder/Validation/NoServerEntry.cs +++ b/src/Kiota.Builder/Validation/NoServerEntry.cs @@ -6,7 +6,7 @@ namespace Kiota.Builder.Validation; public class NoServerEntry : ValidationRule { - public NoServerEntry() : base(nameof(NoServerEntry),static (context, document) => + public NoServerEntry() : base(nameof(NoServerEntry), static (context, document) => { if (!document.Servers.Any() || string.IsNullOrEmpty(document.Servers.First().Url?.TrimEnd('/'))) context.CreateWarning(nameof(NoServerEntry), diff --git a/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs b/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs index ddeebdfdce..0257c53902 100644 --- a/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs +++ b/src/Kiota.Builder/Validation/UrlFormEncodedComplex.cs @@ -11,7 +11,7 @@ public class UrlFormEncodedComplex : ValidationRule private static readonly StructuredMimeTypesCollection validContentTypes = new() { "application/x-www-form-urlencoded", }; - public UrlFormEncodedComplex() : base(nameof(UrlFormEncodedComplex),static (context, operation) => + public UrlFormEncodedComplex() : base(nameof(UrlFormEncodedComplex), static (context, operation) => { if (operation.GetRequestSchema(validContentTypes) is OpenApiSchema requestSchema) ValidateSchema(requestSchema, context, operation.OperationId, "request body"); From c56960f86d64db052a7dad0634d26a6507cec873 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Tue, 30 Jan 2024 11:06:40 +0300 Subject: [PATCH 082/394] Update Apple developer certificate ID --- .azure-pipelines/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 0907c3ab4d..04e0492407 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -371,7 +371,7 @@ stages: echo "$(graph-cli-apple-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12 security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(graph-cli-apple-developer-certificate-password)" -T /usr/bin/codesign security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain - codesign -s 26745KVN9Q --deep --force --options runtime --entitlements scripts/entitlements.plist $(Build.ArtifactStagingDirectory)/binaries/$(architecture)/kiota + codesign -s 6V7V694XP3 --deep --force --options runtime --entitlements scripts/entitlements.plist $(Build.ArtifactStagingDirectory)/binaries/$(architecture)/kiota displayName: Set Hardened Entitlements condition: and(succeeded(), startsWith(variables['architecture'], 'osx')) From 477c25422d2d952a8081570bd2a4f04b53cccbfb Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 30 Jan 2024 09:02:28 -0500 Subject: [PATCH 083/394] - fixes collapsed state not being reset between filters --- vscode/microsoft-kiota/src/openApiTreeProvider.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vscode/microsoft-kiota/src/openApiTreeProvider.ts b/vscode/microsoft-kiota/src/openApiTreeProvider.ts index 6973d04308..881be00ba2 100644 --- a/vscode/microsoft-kiota/src/openApiTreeProvider.ts +++ b/vscode/microsoft-kiota/src/openApiTreeProvider.ts @@ -170,7 +170,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider x !== '').map(x => x.trim().toLowerCase()); + this.tokenizedFilter = filterText.length === 0 ? [] : filterText.split(' ').filter(x => x !== '').map(x => x.trim().toLowerCase()).sort(); this.refreshView(); } public get filter(): string { @@ -228,6 +228,7 @@ export class OpenApiTreeProvider implements vscode.TreeDataProvider this.getTreeNodeFromKiotaNode(x)), node.documentationUrl ); @@ -263,10 +264,12 @@ export class OpenApiTreeNode extends vscode.TreeItem { selected: boolean, public readonly collapsibleState: vscode.TreeItemCollapsibleState, private readonly isOperation: boolean, + filterTokens: string[], public readonly children: OpenApiTreeNode[] = [], public readonly documentationUrl?: string, ) { super(label, collapsibleState); + this.id = `${path}_${filterTokens.join('_')}`; // so the collapsed state is NOT persisted between filter changes this.contextValue = documentationUrl; this.iconPath = selected ? OpenApiTreeNode.selectedSet : OpenApiTreeNode.unselectedSet; } From 75f091e92135ea594b528317287ca541db93b9c2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 30 Jan 2024 11:35:21 -0500 Subject: [PATCH 084/394] - adds support for none key for serializer arguments Signed-off-by: Vincent Biret --- CHANGELOG.md | 1 + src/Kiota.Builder/KiotaBuilder.cs | 10 ++++-- src/kiota/KiotaHost.cs | 10 +++--- .../Kiota.Builder.Tests/KiotaBuilderTests.cs | 36 +++++++++++++++++++ 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b746b9b1fb..7955a9f104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added 'none' key for serializer and deserializer arguments to enable portable clients generation. [#3796](https://github.com/microsoft/kiota/issues/3796) - Added Japanese translations to vscode extension. - Added support for deprecation annotations in Python. [#2798](https://github.com/microsoft/kiota/issues/2798) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index bd618c9e94..cc032871ef 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -941,8 +941,8 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr currentClass.AddProperty(pathParametersProperty); if (isApiClientClass) { - constructor.SerializerModules = config.Serializers; - constructor.DeserializerModules = config.Deserializers; + constructor.SerializerModules = ReplaceNoneSerializersByEmptySet(config.Serializers); + constructor.DeserializerModules = ReplaceNoneSerializersByEmptySet(config.Deserializers); constructor.BaseUrl = config.ApiRootUrl ?? string.Empty; pathParametersProperty.DefaultValue = $"new {pathParametersProperty.Type.Name}()"; } @@ -1007,6 +1007,12 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr currentClass.AddMethod(overloadCtor); } } + private static HashSet ReplaceNoneSerializersByEmptySet(HashSet serializers) + { + if (serializers.Count == 1 && serializers.Contains("none")) return []; + return serializers; + } + private static readonly Func shortestNamespaceOrder = x => x.GetNamespaceDepth(); /// /// Remaps definitions to custom types so they can be used later in generation or in refiners diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index d62b428369..473a563fde 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -355,15 +355,15 @@ private static Command GetGenerateCommand() var serializerOption = new Option>( "--serializer", - () => defaultConfiguration.Serializers.ToList(), - "The fully qualified class names for serializers. Accepts multiple values."); + () => [.. defaultConfiguration.Serializers], + "The fully qualified class names for serializers. Accepts multiple values. Use `none` to generate a client without any serializer."); serializerOption.AddAlias("-s"); serializerOption.ArgumentHelpName = "classes"; var deserializerOption = new Option>( "--deserializer", - () => defaultConfiguration.Deserializers.ToList(), - "The fully qualified class names for deserializers. Accepts multiple values."); + () => [.. defaultConfiguration.Deserializers], + "The fully qualified class names for deserializers. Accepts multiple values. Use `none` to generate a client without any deserializer."); deserializerOption.AddAlias("--ds"); deserializerOption.ArgumentHelpName = "classes"; @@ -371,7 +371,7 @@ private static Command GetGenerateCommand() var structuredMimeTypesOption = new Option>( "--structured-mime-types", - () => defaultConfiguration.StructuredMimeTypes.ToList(), + () => [.. defaultConfiguration.StructuredMimeTypes], "The MIME types with optional priorities as defined in RFC9110 Accept header to use for structured data model generation. Accepts multiple values."); structuredMimeTypesOption.AddAlias("-m"); diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index 8521c78141..228f8886d7 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -73,6 +73,42 @@ await File.WriteAllTextAsync(tempFilePath, @$"openapi: 3.0.1 Assert.Equal(expected, constructor.BaseUrl); } [Fact] + public async Task HonoursNoneKeyForSerialization() + { + var tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()); + await File.WriteAllTextAsync(tempFilePath, @$"openapi: 3.0.1 +info: + title: OData Service for namespace microsoft.graph + description: This OData service is located at https://graph.microsoft.com/v1.0 + version: 1.0.1 +servers: + - url: https://graph.microsoft.com/v1.0 +paths: + /enumeration: + get: + responses: + '200': + content: + application/json: + schema: + type: string"); + var mockLogger = new Mock>(); + var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", OpenAPIFilePath = "https://graph.microsoft.com/description.yaml", Serializers = ["none"], Deserializers = ["none"] }, _httpClient); + await using var fs = new FileStream(tempFilePath, FileMode.Open); + var document = await builder.CreateOpenApiDocumentAsync(fs); + var node = builder.CreateUriSpace(document); + builder.SetApiRootUrl(); + var codeModel = builder.CreateSourceModel(node); + var rootNS = codeModel.FindNamespaceByName("ApiSdk"); + Assert.NotNull(rootNS); + var clientBuilder = rootNS.FindChildByName("Graph", false); + Assert.NotNull(clientBuilder); + var constructor = clientBuilder.Methods.FirstOrDefault(static x => x.IsOfKind(CodeMethodKind.ClientConstructor)); + Assert.NotNull(constructor); + Assert.Empty(constructor.SerializerModules); + Assert.Empty(constructor.DeserializerModules); + } + [Fact] public async Task DeduplicatesHostNames() { var tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()); From 54e925351e52e361b99ae1060c018cb3633ca726 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Tue, 30 Jan 2024 21:20:55 +0300 Subject: [PATCH 085/394] Reorder method calls in refiner --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 80 +++++++++---------- .../Writers/Python/CodeMethodWriter.cs | 4 +- 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 97338241c5..933627eeb6 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Data.Common; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -17,11 +16,11 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance return Task.Run(() => { cancellationToken.ThrowIfCancellationRequested(); - CorrectCommonNames(generatedCode); - RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor); - AddDefaultImports(generatedCode, defaultUsingEvaluators); - DisableActionOf(generatedCode, - CodeParameterKind.RequestConfiguration); + AddPrimaryErrorMessage(generatedCode, + "primary_message", + () => new CodeType { Name = "str", IsNullable = false, IsExternal = true }, + true + ); MoveRequestBuilderPropertiesToBaseType(generatedCode, new CodeUsing { @@ -32,13 +31,37 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance IsExternal = true } }, AccessModifier.Public); + RemoveRequestConfigurationClassesCommonProperties(generatedCode, + new CodeUsing + { + Name = "BaseRequestConfiguration", + Declaration = new CodeType + { + Name = $"{AbstractionsPackageName}.base_request_configuration", + IsExternal = true + } + }); + AddDefaultImports(generatedCode, defaultUsingEvaluators); + MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); + ConvertUnionTypesToWrapper(generatedCode, + _configuration.UsesBackingStore, + static s => s, + true, + $"{AbstractionsPackageName}.composed_type_wrapper", + "ComposedTypeWrapper" + ); cancellationToken.ThrowIfCancellationRequested(); + RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor); + DisableActionOf(generatedCode, + CodeParameterKind.RequestConfiguration); ReplaceIndexersByMethodsWithParameter(generatedCode, false, static x => $"by_{x.ToSnakeCase()}", static x => x.ToSnakeCase(), GenerationLanguage.Python); + cancellationToken.ThrowIfCancellationRequested(); RemoveCancellationParameter(generatedCode); + CorrectCommonNames(generatedCode); CorrectCoreType(generatedCode, CorrectMethodType, CorrectPropertyType, CorrectImplements); cancellationToken.ThrowIfCancellationRequested(); CorrectCoreTypesForBackingStore(generatedCode, "field(default_factory=BackingStoreFactorySingleton(backing_store_factory=None).backing_store_factory.create_backing_store, repr=False)"); @@ -56,25 +79,10 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance new PythonExceptionsReservedNamesProvider(), static x => $"{x}_" ); - RemoveRequestConfigurationClassesCommonProperties(generatedCode, - new CodeUsing - { - Name = "BaseRequestConfiguration", - Declaration = new CodeType - { - Name = $"{AbstractionsPackageName}.base_request_configuration", - IsExternal = true - } - }); + cancellationToken.ThrowIfCancellationRequested(); - MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); - ConvertUnionTypesToWrapper(generatedCode, - _configuration.UsesBackingStore, - static s => s, - true, - $"{AbstractionsPackageName}.composed_type_wrapper", - "ComposedTypeWrapper" - ); + + ReplacePropertyNames(generatedCode, new() { CodePropertyKind.AdditionalData, @@ -136,11 +144,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance addUsings: true, includeParentNamespace: true ); - AddPrimaryErrorMessage(generatedCode, - "primary_message", - () => new CodeType { Name = "str", IsNullable = false, IsExternal = true }, - true - ); + }, cancellationToken); } @@ -267,7 +271,7 @@ private static void CorrectPropertyType(CodeProperty currentProperty) else if (currentProperty.IsOfKind(CodePropertyKind.PathParameters)) { currentProperty.Type.IsNullable = false; - currentProperty.Type.Name = "Dict[str, Any]"; + currentProperty.Type.Name = "Union[str, Dict[str, Any]]"; if (!string.IsNullOrEmpty(currentProperty.DefaultValue)) currentProperty.DefaultValue = "{}"; } @@ -290,20 +294,8 @@ private static void CorrectMethodType(CodeMethod currentMethod) if (urlTplParams != null && urlTplParams.Type is CodeType originalType) { - originalType.Name = "Dict[str, Any]"; - urlTplParams.Documentation.Description = "The raw url or the Url template parameters for the request."; - var unionType = new CodeUnionType - { - Name = "raw_url_or_template_parameters", - IsNullable = true, - }; - unionType.AddType(originalType, new() - { - Name = "str", - IsNullable = true, - IsExternal = true, - }); - urlTplParams.Type = unionType; + originalType.Name = "Union[str, Dict[str, Any]]"; + urlTplParams.Documentation.Description = "The raw url or the url-template parameters for the request."; } } CorrectCoreTypes(currentMethod.Parent as CodeClass, DateTypesReplacements, currentMethod.Parameters diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index 372ab8b74a..e07e941239 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -724,12 +724,12 @@ private void WriteMethodPrototype(CodeMethod code, LanguageWriter writer, string writer.WriteLine("@staticmethod"); var accessModifier = conventions.GetAccessModifier(code.Access); var isConstructor = code.IsOfKind(CodeMethodKind.Constructor, CodeMethodKind.ClientConstructor); - var methodName = (code.Kind switch + var methodName = code.Kind switch { _ when code.IsAccessor => code.AccessedProperty?.Name, _ when isConstructor => "__init__", _ => code.Name, - }); + }; var asyncPrefix = code.IsAsync && code.Kind is CodeMethodKind.RequestExecutor ? "async " : string.Empty; var instanceReference = code.IsOfKind(CodeMethodKind.Factory) ? string.Empty : "self,"; var parameters = string.Join(", ", code.Parameters.OrderBy(x => x, parameterOrderComparer) From 9db865ab5a86f463056ecb52ce33011d20da88a1 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Tue, 30 Jan 2024 21:25:29 +0300 Subject: [PATCH 086/394] Fix method order in refiner --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 28 ++++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 933627eeb6..8f9af4d20c 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -16,10 +16,12 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance return Task.Run(() => { cancellationToken.ThrowIfCancellationRequested(); - AddPrimaryErrorMessage(generatedCode, - "primary_message", - () => new CodeType { Name = "str", IsNullable = false, IsExternal = true }, - true + ConvertUnionTypesToWrapper(generatedCode, + _configuration.UsesBackingStore, + static s => s, + true, + $"{AbstractionsPackageName}.composed_type_wrapper", + "ComposedTypeWrapper" ); MoveRequestBuilderPropertiesToBaseType(generatedCode, new CodeUsing @@ -41,17 +43,9 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance IsExternal = true } }); - AddDefaultImports(generatedCode, defaultUsingEvaluators); - MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); - ConvertUnionTypesToWrapper(generatedCode, - _configuration.UsesBackingStore, - static s => s, - true, - $"{AbstractionsPackageName}.composed_type_wrapper", - "ComposedTypeWrapper" - ); cancellationToken.ThrowIfCancellationRequested(); RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor); + AddDefaultImports(generatedCode, defaultUsingEvaluators); DisableActionOf(generatedCode, CodeParameterKind.RequestConfiguration); ReplaceIndexersByMethodsWithParameter(generatedCode, @@ -81,7 +75,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance ); cancellationToken.ThrowIfCancellationRequested(); - + MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); ReplacePropertyNames(generatedCode, new() { @@ -144,7 +138,11 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance addUsings: true, includeParentNamespace: true ); - + AddPrimaryErrorMessage(generatedCode, + "primary_message", + () => new CodeType { Name = "str", IsNullable = false, IsExternal = true }, + true + ); }, cancellationToken); } From 7420252364187e197782245e119cb22666c83329 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Tue, 30 Jan 2024 21:31:56 +0300 Subject: [PATCH 087/394] Use correct module name for composed type wrapper --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 8f9af4d20c..e80c64f4d4 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -20,7 +20,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance _configuration.UsesBackingStore, static s => s, true, - $"{AbstractionsPackageName}.composed_type_wrapper", + $"{SerializationModuleName}.composed_type_wrapper", "ComposedTypeWrapper" ); MoveRequestBuilderPropertiesToBaseType(generatedCode, From c4f3c905f007492fc899b858905bc282463f4de5 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Tue, 30 Jan 2024 21:43:38 +0300 Subject: [PATCH 088/394] Fix failing integration tests --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index e80c64f4d4..aa96eae600 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -48,6 +48,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance AddDefaultImports(generatedCode, defaultUsingEvaluators); DisableActionOf(generatedCode, CodeParameterKind.RequestConfiguration); + CorrectCommonNames(generatedCode); ReplaceIndexersByMethodsWithParameter(generatedCode, false, static x => $"by_{x.ToSnakeCase()}", @@ -55,7 +56,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance GenerationLanguage.Python); cancellationToken.ThrowIfCancellationRequested(); RemoveCancellationParameter(generatedCode); - CorrectCommonNames(generatedCode); CorrectCoreType(generatedCode, CorrectMethodType, CorrectPropertyType, CorrectImplements); cancellationToken.ThrowIfCancellationRequested(); CorrectCoreTypesForBackingStore(generatedCode, "field(default_factory=BackingStoreFactorySingleton(backing_store_factory=None).backing_store_factory.create_backing_store, repr=False)"); From ea36d9b910e620c4f403d306ec2d16cbb8b7e6ac Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Tue, 30 Jan 2024 23:38:32 +0300 Subject: [PATCH 089/394] Bugfix integration tests --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 33 ++++++++++----------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index aa96eae600..335f728c02 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -23,6 +23,10 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance $"{SerializationModuleName}.composed_type_wrapper", "ComposedTypeWrapper" ); + CorrectCommonNames(generatedCode); + RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor); + DisableActionOf(generatedCode, + CodeParameterKind.RequestConfiguration); MoveRequestBuilderPropertiesToBaseType(generatedCode, new CodeUsing { @@ -33,29 +37,14 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance IsExternal = true } }, AccessModifier.Public); - RemoveRequestConfigurationClassesCommonProperties(generatedCode, - new CodeUsing - { - Name = "BaseRequestConfiguration", - Declaration = new CodeType - { - Name = $"{AbstractionsPackageName}.base_request_configuration", - IsExternal = true - } - }); cancellationToken.ThrowIfCancellationRequested(); - RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor); - AddDefaultImports(generatedCode, defaultUsingEvaluators); - DisableActionOf(generatedCode, - CodeParameterKind.RequestConfiguration); - CorrectCommonNames(generatedCode); ReplaceIndexersByMethodsWithParameter(generatedCode, false, static x => $"by_{x.ToSnakeCase()}", static x => x.ToSnakeCase(), GenerationLanguage.Python); - cancellationToken.ThrowIfCancellationRequested(); RemoveCancellationParameter(generatedCode); + AddDefaultImports(generatedCode, defaultUsingEvaluators); CorrectCoreType(generatedCode, CorrectMethodType, CorrectPropertyType, CorrectImplements); cancellationToken.ThrowIfCancellationRequested(); CorrectCoreTypesForBackingStore(generatedCode, "field(default_factory=BackingStoreFactorySingleton(backing_store_factory=None).backing_store_factory.create_backing_store, repr=False)"); @@ -73,10 +62,18 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance new PythonExceptionsReservedNamesProvider(), static x => $"{x}_" ); - + RemoveRequestConfigurationClassesCommonProperties(generatedCode, + new CodeUsing + { + Name = "BaseRequestConfiguration", + Declaration = new CodeType + { + Name = $"{AbstractionsPackageName}.base_request_configuration", + IsExternal = true + } + }); cancellationToken.ThrowIfCancellationRequested(); MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); - ReplacePropertyNames(generatedCode, new() { CodePropertyKind.AdditionalData, From 31201d5142bd09a349077caeff56e6487f059c89 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 31 Jan 2024 00:33:37 +0300 Subject: [PATCH 090/394] Import ParsenodeHelper for composed types --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 335f728c02..3312727fa7 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -175,7 +175,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance new (static x => x is CodeProperty prop && prop.IsOfKind(CodePropertyKind.BackingStore), StoreModuleName, "BackedModel", "BackingStore", "BackingStoreFactorySingleton" ), new (static x => x is CodeClass @class && (@class.IsOfKind(CodeClassKind.Model) || x.Parent is CodeClass), "dataclasses", "dataclass, field"), - new (static x => x is CodeClass { OriginalComposedType: CodeIntersectionType intersectionType } && intersectionType.Types.Any(static y => !y.IsExternal) && intersectionType.DiscriminatorInformation.HasBasicDiscriminatorInformation, + new (static x => x is CodeClass @class && @class.OriginalComposedType is CodeIntersectionType intersectionType && intersectionType.Types.Any(static y => !y.IsExternal), SerializationModuleName, "ParseNodeHelper"), new (static x => x is IDeprecableElement element && element.Deprecation is not null && element.Deprecation.IsDeprecated, "warnings", "warn"), From f781b87f89e14389dda4a14e5eef2691e412e712 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:09:43 +0000 Subject: [PATCH 091/394] Bump @types/node from 20.11.10 to 20.11.13 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.10 to 20.11.13. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 90f8b62a43..0e7669d379 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.10", + "@types/node": "^20.11.13", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", @@ -824,9 +824,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.10.tgz", - "integrity": "sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==", + "version": "20.11.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.13.tgz", + "integrity": "sha512-5G4zQwdiQBSWYTDAH1ctw2eidqdhMJaNsiIDKHFr55ihz5Trl2qqR8fdrT732yPBho5gkNxXm67OxWFBqX9aPg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 83ae0da2ce..6f54fd046b 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.10", + "@types/node": "^20.11.13", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", From 82d506dac1394a1e602e41e285149232f9451f4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:16:06 +0000 Subject: [PATCH 092/394] Bump cryptography from 42.0.1 to 42.0.2 in /it/python Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.1 to 42.0.2. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/42.0.1...42.0.2) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index cfc6b41898..763d4b9c6c 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -82,7 +82,7 @@ azure-identity==1.15.0 cffi==1.16.0 -cryptography==42.0.1 ; python_version >= '3.7' +cryptography==42.0.2 ; python_version >= '3.7' frozenlist==1.4.1 ; python_version >= '3.7' From 59a1e67ea4bd4b2217feda8b27a3c6dc1b6c6c21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:16:36 +0000 Subject: [PATCH 093/394] Bump platformdirs from 4.1.0 to 4.2.0 in /it/python Bumps [platformdirs](https://github.com/platformdirs/platformdirs) from 4.1.0 to 4.2.0. - [Release notes](https://github.com/platformdirs/platformdirs/releases) - [Changelog](https://github.com/platformdirs/platformdirs/blob/main/CHANGES.rst) - [Commits](https://github.com/platformdirs/platformdirs/compare/4.1.0...4.2.0) --- updated-dependencies: - dependency-name: platformdirs dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index cfc6b41898..3a93a418c2 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -36,7 +36,7 @@ mypy-extensions==1.0.0 ; python_version >= '3.5' packaging==23.2 ; python_version >= '3.7' -platformdirs==4.1.0 ; python_version >= '3.7' +platformdirs==4.2.0 ; python_version >= '3.7' pluggy==1.4.0 ; python_version >= '3.7' From 1c6dfbc2e407eb15dc352789ea83994a35fed799 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:16:54 +0000 Subject: [PATCH 094/394] Bump urllib3 from 2.1.0 to 2.2.0 in /it/python Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.1.0 to 2.2.0. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.1.0...2.2.0) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index cfc6b41898..bc8aa67f03 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -58,7 +58,7 @@ tomlkit==0.12.3 ; python_version >= '3.7' typing-extensions==4.9.0 ; python_version >= '3.7' -urllib3==2.1.0 ; python_version >= '3.7' +urllib3==2.2.0 ; python_version >= '3.7' wrapt==1.15.0 ; python_version < '3.11' From bcf455d2cbf67c38d0cdc6def39fb7f278824b7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:26:57 +0000 Subject: [PATCH 095/394] Bump @types/node from 20.11.10 to 20.11.13 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.10 to 20.11.13. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 9aa35535e2..a826f6b224 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.10.tgz", - "integrity": "sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==", + "version": "20.11.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.13.tgz", + "integrity": "sha512-5G4zQwdiQBSWYTDAH1ctw2eidqdhMJaNsiIDKHFr55ihz5Trl2qqR8fdrT732yPBho5gkNxXm67OxWFBqX9aPg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From fbcb7807a71a759aed7ea8c10315a1e3738cd57e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:59:16 +0000 Subject: [PATCH 096/394] Bump Microsoft.OpenApi.Readers from 1.6.12 to 1.6.13 Bumps [Microsoft.OpenApi.Readers](https://github.com/Microsoft/OpenAPI.NET) from 1.6.12 to 1.6.13. - [Release notes](https://github.com/Microsoft/OpenAPI.NET/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET/compare/1.6.12...1.6.13) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.Readers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 064591af6f..fd950a9ca1 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -46,7 +46,7 @@ - + From d5cb748575ae7589e097dd739208ec5881b50b63 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 31 Jan 2024 13:09:39 +0300 Subject: [PATCH 097/394] Update tests --- tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs index cdb2048da7..5c37b2ce5d 100644 --- a/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs @@ -429,6 +429,7 @@ public async Task CorrectsCoreType() Assert.Empty(model.Properties.Where(x => PathParametersDefaultValue.Equals(x.DefaultValue))); Assert.Empty(model.Methods.Where(x => DeserializeDefaultName.Equals(x.ReturnType.Name))); Assert.Empty(model.Methods.SelectMany(x => x.Parameters).Where(x => serializerDefaultName.Equals(x.Type.Name))); + Assert.Single(constructorMethod.Parameters.Where(x => x.Type is CodeTypeBase)); } [Fact] public async Task ReplacesDateTimeOffsetByNativeType() From 1e61c90de542e866ff900252830a582e1c3acc64 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 30 Jan 2024 15:08:54 -0500 Subject: [PATCH 098/394] - projects required query parameters as required in the template Signed-off-by: Vincent Biret --- CHANGELOG.md | 1 + .../OpenApiUrlTreeNodeExtensions.cs | 19 +- .../OpenApiUrlTreeNodeExtensionsTests.cs | 271 +++++++++++++++++- 3 files changed, 280 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1ae24c9f..4039250434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed serialization of scalar members in union types for Python. [#2828](https://github.com/microsoft/kiota/issues/2828) - Fixed a bug where scalar error mappings would be generated even though it's not supported by the http request adapter. [#4018](https://github.com/microsoft/kiota/issues/4018) - Switched to proxy generation for TypeScript, leading to about ~44% bundle sizes reduction. [#3642](https://github.com/microsoft/kiota/issues/3642) +- Required query parameters are now projected as `{baseurl+}foo/bar?required={required}` instead of `{baseurl+}foo/bar{?required}` so they are automatically populated if no value is provided. [#3989](https://github.com/microsoft/kiota/issues/3989) - Fixed a bug where TypeScript models factory methods would be missing return types. - Fixed a bug where generated paths would possibly get too long. [#3854](https://github.com/microsoft/kiota/issues/3854) - The vscode extension now also displays the children nodes when filtering. [#3998](https://github.com/microsoft/kiota/issues/3998) diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index 9e45a8ba83..11a4e9d30e 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -194,16 +194,23 @@ public static string GetUrlTemplate(this OpenApiUrlTreeNode currentNode) pathItem.Operations .SelectMany(static x => x.Value.Parameters) .Where(static x => x.In == ParameterLocation.Query)) - .DistinctBy(static x => x.Name) + .DistinctBy(static x => x.Name, StringComparer.Ordinal) + .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) .ToArray(); if (parameters.Length != 0) - queryStringParameters = "{?" + - parameters.Select(static x => + { + var requiredParameters = string.Join("&", parameters.Where(static x => x.Required) + .Select(static x => + $"{x.Name}={{{x.Name.SanitizeParameterNameForUrlTemplate()}}}")); + var optionalParameters = string.Join(",", parameters.Where(static x => !x.Required) + .Select(static x => x.Name.SanitizeParameterNameForUrlTemplate() + (x.Explode ? - "*" : string.Empty)) - .Aggregate(static (x, y) => $"{x},{y}") + - '}'; + "*" : string.Empty))); + var hasRequiredParameters = !string.IsNullOrEmpty(requiredParameters); + var hasOptionalParameters = !string.IsNullOrEmpty(optionalParameters); + queryStringParameters = $"{(hasRequiredParameters ? "?" : string.Empty)}{requiredParameters}{(hasOptionalParameters ? "{" : string.Empty)}{(hasOptionalParameters && hasRequiredParameters ? "&" : string.Empty)}{(hasOptionalParameters && !hasRequiredParameters ? "?" : string.Empty)}{optionalParameters}{(hasOptionalParameters ? "}" : string.Empty)}"; + } } var pathReservedPathParametersIds = currentNode.PathItems.TryGetValue(Constants.DefaultOpenApiLabel, out var pItem) ? pItem.Parameters diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs index 8d662fb894..7db3c63544 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs @@ -131,13 +131,13 @@ public void GetUrlTemplateSelectsDistinctQueryParameters() { var doc = new OpenApiDocument { - Paths = new(), + Paths = [], }; doc.Paths.Add("{param-with-dashes}\\existing-segment", new() { Operations = new Dictionary { { OperationType.Get, new() { - Parameters = new List { + Parameters = [ new() { Name = "param-with-dashes", In = ParameterLocation.Path, @@ -155,12 +155,12 @@ public void GetUrlTemplateSelectsDistinctQueryParameters() }, Style = ParameterStyle.Simple, } - } + ] } }, { OperationType.Put, new() { - Parameters = new List { + Parameters = [ new() { Name = "param-with-dashes", In = ParameterLocation.Path, @@ -178,7 +178,7 @@ public void GetUrlTemplateSelectsDistinctQueryParameters() }, Style = ParameterStyle.Simple, } - } + ] } } } @@ -187,6 +187,267 @@ public void GetUrlTemplateSelectsDistinctQueryParameters() Assert.Equal("{+baseurl}/{param%2Dwith%2Ddashes}/existing-segment{?%24select}", node.Children.First().Value.GetUrlTemplate()); // the query parameters will be decoded by a middleware at runtime before the request is executed } + [Fact] + public void GeneratesRequiredQueryParametersAndOptionalMixInPathItem() + { + var doc = new OpenApiDocument + { + Paths = [], + }; + doc.Paths.Add("users\\{id}\\manager", new() + { + Parameters = { + new OpenApiParameter { + Name = "id", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "filter", + In = ParameterLocation.Query, + Required = false, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "apikey", + In = ParameterLocation.Query, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + } + }, + Operations = new Dictionary { + { OperationType.Get, new() { + } + }, + } + }); + var node = OpenApiUrlTreeNode.Create(doc, Label); + Assert.Equal("{+baseurl}/users/{id}/manager?apikey={apikey}{&filter*}", node.Children.First().Value.GetUrlTemplate()); + } + [Fact] + public void GeneratesRequiredQueryParametersAndOptionalMixInOperation() + { + var doc = new OpenApiDocument + { + Paths = [], + }; + doc.Paths.Add("users\\{id}\\manager", new() + { + Operations = new Dictionary { + { OperationType.Get, new() { + Parameters = { + new OpenApiParameter { + Name = "id", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "filter", + In = ParameterLocation.Query, + Required = false, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "apikey", + In = ParameterLocation.Query, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + } + }, + } + }, + } + }); + var node = OpenApiUrlTreeNode.Create(doc, Label); + Assert.Equal("{+baseurl}/users/{id}/manager?apikey={apikey}{&filter*}", node.Children.First().Value.GetUrlTemplate()); + } + [Fact] + public void GeneratesOnlyOptionalQueryParametersInPathItem() + { + var doc = new OpenApiDocument + { + Paths = [], + }; + doc.Paths.Add("users\\{id}\\manager", new() + { + Parameters = { + new OpenApiParameter { + Name = "id", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "filter", + In = ParameterLocation.Query, + Required = false, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "apikey", + In = ParameterLocation.Query, + Schema = new OpenApiSchema { + Type = "string" + } + } + }, + Operations = new Dictionary { + { OperationType.Get, new() { + } + }, + } + }); + var node = OpenApiUrlTreeNode.Create(doc, Label); + Assert.Equal("{+baseurl}/users/{id}/manager{?apikey*,filter*}", node.Children.First().Value.GetUrlTemplate()); + } + [Fact] + public void GeneratesOnlyOptionalQueryParametersInOperation() + { + var doc = new OpenApiDocument + { + Paths = [], + }; + doc.Paths.Add("users\\{id}\\manager", new() + { + Operations = new Dictionary { + { OperationType.Get, new() { + Parameters = { + new OpenApiParameter { + Name = "id", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "filter", + In = ParameterLocation.Query, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "apikey", + In = ParameterLocation.Query, + Schema = new OpenApiSchema { + Type = "string" + } + } + }, + } + }, + } + }); + var node = OpenApiUrlTreeNode.Create(doc, Label); + Assert.Equal("{+baseurl}/users/{id}/manager{?apikey*,filter*}", node.Children.First().Value.GetUrlTemplate()); + } + [Fact] + public void GeneratesOnlyRequiredQueryParametersInPathItem() + { + var doc = new OpenApiDocument + { + Paths = [], + }; + doc.Paths.Add("users\\{id}\\manager", new() + { + Parameters = { + new OpenApiParameter { + Name = "id", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "filter", + In = ParameterLocation.Query, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "apikey", + Required = true, + In = ParameterLocation.Query, + Schema = new OpenApiSchema { + Type = "string" + } + } + }, + Operations = new Dictionary { + { OperationType.Get, new() { + } + }, + } + }); + var node = OpenApiUrlTreeNode.Create(doc, Label); + Assert.Equal("{+baseurl}/users/{id}/manager?apikey={apikey}&filter={filter}", node.Children.First().Value.GetUrlTemplate()); + } + [Fact] + public void GeneratesOnlyRequiredQueryParametersInOperation() + { + var doc = new OpenApiDocument + { + Paths = [], + }; + doc.Paths.Add("users\\{id}\\manager", new() + { + Operations = new Dictionary { + { OperationType.Get, new() { + Parameters = { + new OpenApiParameter { + Name = "id", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "filter", + Required = true, + In = ParameterLocation.Query, + Schema = new OpenApiSchema { + Type = "string" + } + }, + new OpenApiParameter { + Name = "apikey", + Required = true, + In = ParameterLocation.Query, + Schema = new OpenApiSchema { + Type = "string" + } + } + }, + } + }, + } + }); + var node = OpenApiUrlTreeNode.Create(doc, Label); + Assert.Equal("{+baseurl}/users/{id}/manager?apikey={apikey}&filter={filter}", node.Children.First().Value.GetUrlTemplate()); + } [Fact] public void GetUrlTemplateCleansInvalidParameters() From 355500a8b2c21bab7a8a949bd9bb07c996c3bf0d Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 31 Jan 2024 18:08:21 +0300 Subject: [PATCH 099/394] Move to configure method in request generator --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 17 ++++++++++- .../Writers/Python/CodeMethodWriter.cs | 29 ++++--------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 3312727fa7..80faf834d0 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -20,7 +20,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance _configuration.UsesBackingStore, static s => s, true, - $"{SerializationModuleName}.composed_type_wrapper", + $"{SerializationModuleName}", "ComposedTypeWrapper" ); CorrectCommonNames(generatedCode); @@ -44,6 +44,21 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance static x => x.ToSnakeCase(), GenerationLanguage.Python); RemoveCancellationParameter(generatedCode); + RemoveRequestConfigurationClasses(generatedCode, + new CodeUsing + { + Name = "RequestConfiguration", + Declaration = new CodeType + { + Name = $"{AbstractionsPackageName}.request_configuration", + IsExternal = true + } + }, + new CodeType + { + Name = "QueryParameters", + IsExternal = true, + }); AddDefaultImports(generatedCode, defaultUsingEvaluators); CorrectCoreType(generatedCode, CorrectMethodType, CorrectPropertyType, CorrectImplements); cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index e07e941239..39af4fe555 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -612,13 +612,11 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req { if (codeElement.HttpMethod == null) throw new InvalidOperationException("http method cannot be null"); - writer.WriteLine($"{RequestInfoVarName} = RequestInformation()"); - UpdateRequestInformationFromRequestConfiguration(requestParams, writer); - if (currentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty urlTemplateParamsProperty && - currentClass.GetPropertyOfKind(CodePropertyKind.UrlTemplate) is CodeProperty urlTemplateProperty) - writer.WriteLines($"{RequestInfoVarName}.url_template = {GetPropertyCall(urlTemplateProperty, "''")}", - $"{RequestInfoVarName}.path_parameters = {GetPropertyCall(urlTemplateParamsProperty, "''")}"); - writer.WriteLine($"{RequestInfoVarName}.http_method = Method.{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}"); + if (currentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is not CodeProperty urlTemplateParamsProperty) throw new InvalidOperationException("path parameters cannot be null"); + if (currentClass.GetPropertyOfKind(CodePropertyKind.UrlTemplate) is not CodeProperty urlTemplateProperty) throw new InvalidOperationException("url template cannot be null"); + writer.WriteLine($"{RequestInfoVarName} = RequestInformation(Method.{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}, {GetPropertyCall(urlTemplateProperty, "''")}, {GetPropertyCall(urlTemplateParamsProperty, "''")})"); + if (requestParams.requestConfiguration != null) + writer.WriteLine($"{RequestInfoVarName}.configure({requestParams.requestConfiguration.Name})"); if (codeElement.ShouldAddAcceptHeader) writer.WriteLine($"{RequestInfoVarName}.headers.try_add(\"Accept\", \"{codeElement.AcceptHeaderValue}\")"); if (currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) @@ -820,23 +818,6 @@ private string GetSendRequestMethodName(bool isVoid, bool isStream, bool isColle if (isStream || conventions.IsPrimitiveType(returnType)) return "send_primitive_async"; return "send_async"; } - - private static void UpdateRequestInformationFromRequestConfiguration(RequestParams requestParams, LanguageWriter writer) - { - if (requestParams.requestConfiguration != null) - { - writer.StartBlock($"if {requestParams.requestConfiguration.Name}:"); - var headers = requestParams.Headers?.Name ?? "headers"; - writer.WriteLine($"{RequestInfoVarName}.headers.add_all({requestParams.requestConfiguration.Name}.{headers})"); - var queryString = requestParams.QueryParameters; - if (queryString != null) - writer.WriteLines($"{RequestInfoVarName}.set_query_string_parameters_from_raw_object({requestParams.requestConfiguration.Name}.{queryString.Name})"); - var options = requestParams.Options?.Name ?? "options"; - writer.WriteLine($"{RequestInfoVarName}.add_request_options({requestParams.requestConfiguration.Name}.{options})"); - writer.DecreaseIndent(); - } - } - private void UpdateRequestInformationFromRequestBody(CodeMethod codeElement, RequestParams requestParams, CodeProperty requestAdapterProperty, LanguageWriter writer) { if (requestParams.requestBody != null) From a6009d1a543c8635a0a11973ae694ca8497f7fb0 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 31 Jan 2024 18:08:31 +0300 Subject: [PATCH 100/394] Update tests --- .../Writers/Python/CodeMethodWriterTests.cs | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index e455d0b1b2..f7b8b52117 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -668,14 +668,9 @@ public void WritesRequestGeneratorBodyForScalar() method.AcceptedResponseTypes.Add("text/plain"); writer.Write(method); var result = tw.ToString(); - Assert.Contains("request_info = RequestInformation()", result); - Assert.Contains("request_info.http_method = Method", result); - Assert.Contains("request_info.url_template = ", result); - Assert.Contains("request_info.path_parameters = ", result); + Assert.Contains("request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters)", result); Assert.Contains("request_info.headers.try_add(\"Accept\", \"application/json, text/plain\")", result); - Assert.Contains("if c:", result); - Assert.Contains("request_info.add_request_options", result); - Assert.Contains("request_info.set_query_string_parameters_from_raw_object", result); + Assert.Contains("request_info.configure(c)", result); Assert.Contains("set_content_from_scalar", result); Assert.Contains("return request_info", result); AssertExtensions.CurlyBracesAreClosed(result); @@ -692,16 +687,9 @@ public void WritesRequestGeneratorBodyForParsable() method.AcceptedResponseTypes.Add("text/plain"); writer.Write(method); var result = tw.ToString(); - Assert.Contains("request_info = RequestInformation()", result); - Assert.Contains("request_info.http_method = Method", result); - Assert.Contains("if c:", result); - Assert.Contains("request_info.headers.add_all(c.h)", result); - Assert.Contains("request_info.url_template = ", result); - Assert.Contains("request_info.path_parameters = ", result); + Assert.Contains("request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters", result); Assert.Contains("request_info.headers.try_add(\"Accept\", \"application/json, text/plain\")", result); - Assert.Contains("if c:", result); - Assert.Contains("request_info.add_request_options", result); - Assert.Contains("request_info.set_query_string_parameters_from_raw_object", result); + Assert.Contains("request_info.configure(c)", result); Assert.Contains("set_content_from_parsable", result); Assert.Contains("return request_info", result); } From d6291f9041d06a68ff4389567bfb12f90c2e2596 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 10:08:46 -0500 Subject: [PATCH 101/394] - fixes failing unit test Signed-off-by: Vincent Biret --- .../Extensions/OpenApiUrlTreeNodeExtensionsTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs index 7db3c63544..2ad8c46606 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs @@ -454,13 +454,13 @@ public void GetUrlTemplateCleansInvalidParameters() { var doc = new OpenApiDocument { - Paths = new(), + Paths = [], }; doc.Paths.Add("{param-with-dashes}\\existing-segment", new() { Operations = new Dictionary { { OperationType.Get, new() { - Parameters = new List { + Parameters = [ new() { Name = "param-with-dashes", In = ParameterLocation.Path, @@ -502,13 +502,13 @@ public void GetUrlTemplateCleansInvalidParameters() }, Style = ParameterStyle.Simple, } - } + ] } } } }); var node = OpenApiUrlTreeNode.Create(doc, Label); - Assert.Equal("{+baseurl}/{param%2Dwith%2Ddashes}/existing-segment{?%24select,api%2Dversion,api%7Etopic,api%2Eencoding}", node.Children.First().Value.GetUrlTemplate()); + Assert.Equal("{+baseurl}/{param%2Dwith%2Ddashes}/existing-segment{?%24select,api%2Dversion,api%2Eencoding,api%7Etopic}", node.Children.First().Value.GetUrlTemplate()); // the query parameters will be decoded by a middleware at runtime before the request is executed } [InlineData("\\reviews\\search.json", "reviews.searchJson")] From 3a2cd5551b0b5d9e3ab98995d85a9c48efc1eceb Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 31 Jan 2024 18:10:57 +0300 Subject: [PATCH 102/394] Add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef1ae24c9f..ac947d32da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a bug where TypeScript models factory methods would be missing return types. - Fixed a bug where generated paths would possibly get too long. [#3854](https://github.com/microsoft/kiota/issues/3854) - The vscode extension now also displays the children nodes when filtering. [#3998](https://github.com/microsoft/kiota/issues/3998) +- Generator method code reduction in Python. [#3695](https://github.com/microsoft/kiota/issues/3695) ## [1.10.1] - 2024-01-12 From 637738df675d19daec014425337549bc068a2f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Wed, 31 Jan 2024 17:15:45 +0000 Subject: [PATCH 103/394] Update location of kiota-config and cached descriptions --- specs/cli/client-add.md | 6 +++--- specs/cli/client-edit.md | 2 +- specs/cli/config-init.md | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index 03d146e764..6f46ee464e 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -2,11 +2,11 @@ ## Description -`kiota client add` allows a developer to add a new API client to the `kiota-config.json` file. If no `kiota-config.json` file is found, a new `kiota-config.json` file would be created in the current working directory. The command will add a new entry to the `clients` section of the `kiota-config.json` file. Once this is done, a local copy of the OpenAPI description is generated and kept in the `.kiota/descriptions` folder. If a client with the same name already exists, the command will fail and display an actionnable error message. +`kiota client add` allows a developer to add a new API client to the `kiota-config.json` file. If no `kiota-config.json` file is found, a new `kiota-config.json` file would be created in the current working directory. The command will add a new entry to the `clients` section of the `kiota-config.json` file. Once this is done, a local copy of the OpenAPI description is generated and kept in the `.kiota/clients` folder. If a client with the same name already exists, the command will fail and display an actionnable error message. When executing, a new API entry will be added and will use the `--client-name` parameter as the key for the map. When loading the OpenAPI description, it will store the location of the description in the `descriptionLocation` property. If `--include-path` or `--exclude-path` are provided, they will be stored in the `includePatterns` and `excludePatterns` properties respectively. -Every time an API client is added, a copy of the OpenAPI description file will be stored in the `./.kiota/{client-name}` folder. The files will be named using the API client name. This will allow the CLI to detect changes in the description and avoid downloading the description again if it hasn't changed. +Every time an API client is added, a copy of the OpenAPI description file will be stored in the `./.kiota/clients/{client-name}.yaml|json` folder. The files will be named using the API client name. This will allow the CLI to detect changes in the description and avoid downloading the description again if it hasn't changed. At the same time, an [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3) file will be generated (if non existing) or edited (if already existing) to represent the surface of the API being used. This file will be named `apimanifest.json` and next to the `kiota-config.json`. This file will be used to generate the code files. A new hash composed of the Kiota version, the OpenAPI description location and the properties of the client will be generated and would trigger an update to the [API Manifest](https://www.ietf.org/archive/id/draft-miller-api-manifest-01.html#section-2.5-3). @@ -106,7 +106,7 @@ _The resulting `apimanifest.json` file will look like this:_ ```bash / └─.kiota - └─definitions + └─clients └─GraphClient.yaml └─generated └─graph diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index 009b7d7af8..d1e4993283 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -101,7 +101,7 @@ _The resulting `apimanifest.json` file will look like this:_ ```bash / └─.kiota - └─definitions + └─clients └─GraphClient.yaml └─generated └─graph diff --git a/specs/cli/config-init.md b/specs/cli/config-init.md index f91a85e310..e924df339e 100644 --- a/specs/cli/config-init.md +++ b/specs/cli/config-init.md @@ -30,6 +30,5 @@ _The resulting `kiota-config.json` file will look like this:_ ## File structure ```bash / - └─.kiota - └─kiota-config.json + └─kiota-config.json ``` \ No newline at end of file From 2dfa9474471f178102e79c9fd8a3fd7b5455e27b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:19:45 +0000 Subject: [PATCH 104/394] Bump the kiota-dependencies group with 2 updates Bumps the kiota-dependencies group with 2 updates: [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) and [Microsoft.Kiota.Serialization.Text](https://github.com/microsoft/kiota-serialization-text-dotnet). Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.2 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.2) Updates `Microsoft.Kiota.Serialization.Text` from 1.1.1 to 1.1.2 - [Release notes](https://github.com/microsoft/kiota-serialization-text-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-text-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-text-dotnet/compare/v1.1.1...v1.1.2) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Text dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index fd950a9ca1..197f428734 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -42,7 +42,7 @@ - + From ea494930768de3bf13b248e9fab85876bbd027ba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:44:56 +0000 Subject: [PATCH 105/394] Bump @types/node from 20.11.13 to 20.11.14 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.13 to 20.11.14. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 0e7669d379..454255df27 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.13", + "@types/node": "^20.11.14", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", @@ -824,9 +824,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.13.tgz", - "integrity": "sha512-5G4zQwdiQBSWYTDAH1ctw2eidqdhMJaNsiIDKHFr55ihz5Trl2qqR8fdrT732yPBho5gkNxXm67OxWFBqX9aPg==", + "version": "20.11.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.14.tgz", + "integrity": "sha512-w3yWCcwULefjP9DmDDsgUskrMoOy5Z8MiwKHr1FvqGPtx7CvJzQvxD7eKpxNtklQxLruxSXWddyeRtyud0RcXQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 6f54fd046b..fbdd984faf 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.13", + "@types/node": "^20.11.14", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", From 35a64bd1e79d03a4cabe6688ba903cc21a9fb6d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:51:37 +0000 Subject: [PATCH 106/394] Bump @types/node from 20.11.13 to 20.11.14 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.13 to 20.11.14. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index a826f6b224..c9f1fb13c8 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.13.tgz", - "integrity": "sha512-5G4zQwdiQBSWYTDAH1ctw2eidqdhMJaNsiIDKHFr55ihz5Trl2qqR8fdrT732yPBho5gkNxXm67OxWFBqX9aPg==", + "version": "20.11.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.14.tgz", + "integrity": "sha512-w3yWCcwULefjP9DmDDsgUskrMoOy5Z8MiwKHr1FvqGPtx7CvJzQvxD7eKpxNtklQxLruxSXWddyeRtyud0RcXQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From 55e92730f3fe4a445c5d36c447891f5b4ccb863f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:55:32 +0000 Subject: [PATCH 107/394] Bump the kiota-dependencies group in /it/csharp with 3 updates Bumps the kiota-dependencies group in /it/csharp with 3 updates: [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet), [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet) and [Microsoft.Kiota.Serialization.Text](https://github.com/microsoft/kiota-serialization-text-dotnet). Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.2 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.2) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Serialization.Text` from 1.1.1 to 1.1.2 - [Release notes](https://github.com/microsoft/kiota-serialization-text-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-text-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-text-dotnet/compare/v1.1.1...v1.1.2) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Text dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 253088f10c..590ffc87fc 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -16,7 +16,7 @@ - + From 3d6bed618e7ab86e698d100745bc6de9eb8fbbb8 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 1 Feb 2024 13:48:13 +0300 Subject: [PATCH 108/394] Align with abstractions package --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 80faf834d0..f653736152 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -47,16 +47,16 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance RemoveRequestConfigurationClasses(generatedCode, new CodeUsing { - Name = "RequestConfiguration", + Name = "BaseRequestConfiguration", Declaration = new CodeType { - Name = $"{AbstractionsPackageName}.request_configuration", + Name = $"{AbstractionsPackageName}.base_request_configuration", IsExternal = true } }, new CodeType { - Name = "QueryParameters", + Name = "GetQueryParameters", IsExternal = true, }); AddDefaultImports(generatedCode, defaultUsingEvaluators); From e7a196c71b72019edac1b3d3cb130a6a4d635f66 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 1 Feb 2024 09:58:24 -0500 Subject: [PATCH 109/394] - bumps version for release 1.11 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4039250434..eed696d4bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +### Changed + +## [1.11.0] - 2024-02-01 + +### Added + - Added 'none' key for serializer and deserializer arguments to enable portable clients generation. [#3796](https://github.com/microsoft/kiota/issues/3796) - Added Japanese translations to vscode extension. - Added support for deprecation annotations in Python. [#2798](https://github.com/microsoft/kiota/issues/2798) @@ -1234,3 +1240,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial GitHub release + From 7953c74bfcc6e4c3f538873b701613ef33535b48 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 1 Feb 2024 10:45:17 -0500 Subject: [PATCH 110/394] - bumps version for preview 1.12 --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- src/kiota/kiota.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 197f428734..4d54441d94 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Kiota.Builder Microsoft.OpenApi.Kiota.Builder ./nupkg - 1.11.0 + 1.12.0 $(VersionSuffix) https://github.com/microsoft/kiota/releases diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index 27ab25fe88..1bd171dfbd 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Kiota Microsoft.OpenApi.Kiota ./nupkg - 1.11.0 + 1.12.0 $(VersionSuffix) https://github.com/microsoft/kiota/releases From 850f385b7acb880de86f5c33037a8cf43fa44331 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Thu, 1 Feb 2024 19:16:01 +0300 Subject: [PATCH 111/394] Use correct name for QueryParameters class --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index f653736152..2a39f6bded 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -56,7 +56,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance }, new CodeType { - Name = "GetQueryParameters", + Name = "QueryParameters", IsExternal = true, }); AddDefaultImports(generatedCode, defaultUsingEvaluators); @@ -77,17 +77,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance new PythonExceptionsReservedNamesProvider(), static x => $"{x}_" ); - RemoveRequestConfigurationClassesCommonProperties(generatedCode, - new CodeUsing - { - Name = "BaseRequestConfiguration", - Declaration = new CodeType - { - Name = $"{AbstractionsPackageName}.base_request_configuration", - IsExternal = true - } - }); - cancellationToken.ThrowIfCancellationRequested(); MoveClassesWithNamespaceNamesUnderNamespace(generatedCode); ReplacePropertyNames(generatedCode, new() { From 1978f4f35e336d73926d76d9a5b9e7feae72f467 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 1 Feb 2024 15:01:41 -0500 Subject: [PATCH 112/394] - fixes a deadlock on update command when updating multiple clients with the same local source description --- src/Kiota.Builder/KiotaBuilder.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index cc032871ef..a001466ca7 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -12,6 +12,7 @@ using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using AsyncKeyedLock; using DotNet.Globbing; using Kiota.Builder.Caching; using Kiota.Builder.CodeDOM; @@ -396,6 +397,11 @@ private void StopLogAndReset(Stopwatch sw, string prefix) sw.Reset(); } + private static readonly AsyncKeyedLocker localFilesLock = new(o => + { + o.PoolSize = 20; + o.PoolInitialFill = 1; + }); private async Task LoadStream(string inputPath, CancellationToken cancellationToken) { @@ -424,7 +430,14 @@ private async Task LoadStream(string inputPath, CancellationToken cancel try { #pragma warning disable CA2000 // disposed by caller - input = new FileStream(inputPath, FileMode.Open); + var inMemoryStream = new MemoryStream(); + using (await localFilesLock.LockAsync(inputPath, cancellationToken).ConfigureAwait(false)) + {// To avoid deadlocking on update with multiple clients for the same local description + using var fileStream = new FileStream(inputPath, FileMode.Open); + await fileStream.CopyToAsync(inMemoryStream, cancellationToken).ConfigureAwait(false); + } + inMemoryStream.Position = 0; + input = inMemoryStream; #pragma warning restore CA2000 } catch (Exception ex) when (ex is FileNotFoundException || From 1c2b716b003b571608d75bced66add996d6e5f54 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 1 Feb 2024 15:02:14 -0500 Subject: [PATCH 113/394] - adds changelog entry for deadlock fix Signed-off-by: Vincent Biret --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eed696d4bc..e13b1a75f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Fixed a deadlock on update for multiple clients targeting the same local file. + ## [1.11.0] - 2024-02-01 ### Added From 01b75e3a037321eb75791c4dd02b665cff3a62f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 2 Feb 2024 04:19:02 +0000 Subject: [PATCH 114/394] Update CLI command parameter tables and review updates --- specs/cli/client-add.md | 2 +- specs/cli/client-edit.md | 3 +-- specs/cli/client-generate.md | 2 +- specs/cli/client-remove.md | 2 +- specs/cli/config-migrate.md | 4 ++-- specs/cli/download.md | 2 +- specs/cli/info.md | 2 +- specs/cli/login.md | 2 +- specs/cli/logout.md | 2 +- specs/cli/search.md | 2 +- specs/cli/show.md | 2 +- specs/scenarios/telemetry.md | 14 ++++++++++++-- 12 files changed, 24 insertions(+), 15 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index 95898aa523..f17c855f08 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -15,7 +15,7 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | Yes, without its value | | `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | | `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | Yes, without its value | diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index 7306516f9c..7192c489aa 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -11,13 +11,12 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client. Unique within the parent API. If not provided, defaults to --class-name or its default. | Yes, without its value | | `--openapi \| -d` | No | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | Yes, without its value | | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | Yes, without its value | | `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | Yes | -| `--class-name \| -c` | No | GraphClient | The name of the client class. Defaults to `Client`. | Yes, without its value | | `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | Yes, without its value | | `--backing-store \| -b` | No | | Defaults to `false` | Yes, without its value | | `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | Yes | diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index a7afa91ca7..b65f9df35c 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -11,7 +11,7 @@ In general cases, the `kiota client generate` command will generate the code for ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | Yes | | `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | Yes | diff --git a/specs/cli/client-remove.md b/specs/cli/client-remove.md index 9ab3dbb5c4..4ce0465b29 100644 --- a/specs/cli/client-remove.md +++ b/specs/cli/client-remove.md @@ -7,7 +7,7 @@ The command also has one optional parameter, the ability to remove the generated client. If provided, kiota will delete the folder and its content specified at the `outputPath` from the client configuration. It will also remove the local version of the OpenAPI description file (specified by the `x-ms-kiotaHash` property in the API Manifest). The API Manifest is also updated to remove the dependency from the list of dependencies. | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `--client-name \| --cn` | Yes | graphDelegated | Name of the client | Yes, without its value | | `--clean-output \| --co` | No | | Cleans the generated client | Yes | diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 35253a752f..18eb53a3f2 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -6,8 +6,8 @@ In the case where conflicting API client names would be migrated, the command wi ## Parameters -| Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| Parameters | Required | Example | Description | Telemetry | +| -- | -- | -- | -- | -- | | `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | Yes, without its value | | `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | Yes, without its value | diff --git a/specs/cli/download.md b/specs/cli/download.md index 0672da9597..fa1d9719fc 100644 --- a/specs/cli/download.md +++ b/specs/cli/download.md @@ -7,7 +7,7 @@ Downloads an API description. ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `search-term` | Yes | Graph | The term to search for. | Yes, without its value | | `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | | `--clear-output \| --cc` | No | true | Delete the output directory before generating the client. Defaults to `False`. | Yes | diff --git a/specs/cli/info.md b/specs/cli/info.md index feeabc1203..bb12f225e0 100644 --- a/specs/cli/info.md +++ b/specs/cli/info.md @@ -7,7 +7,7 @@ Show languages and runtime dependencies information. ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | | `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | Yes | | `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | diff --git a/specs/cli/login.md b/specs/cli/login.md index 358ac3e3c6..e0db1af5d1 100644 --- a/specs/cli/login.md +++ b/specs/cli/login.md @@ -7,7 +7,7 @@ Use `kiota login` to sign in to private repositories and search for/display/gene ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `search-provider` | Yes | github | The search provided to login with. | Yes | | `type` | Yes | device | The authentication strategy to use. | Yes | | `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | diff --git a/specs/cli/logout.md b/specs/cli/logout.md index dd057a1c9c..5401eb9ac9 100644 --- a/specs/cli/logout.md +++ b/specs/cli/logout.md @@ -7,7 +7,7 @@ Use kiota logout to logout from a private repository containing API descriptions ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `search-provider` | Yes | github | The search provided to login with. | Yes | | `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | diff --git a/specs/cli/search.md b/specs/cli/search.md index c09a612e5e..ddb271f72b 100644 --- a/specs/cli/search.md +++ b/specs/cli/search.md @@ -7,7 +7,7 @@ Search for APIs and their description from various registries. ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `search-term` | Yes | Graph | The term to search for. | Yes, without its value | | `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | | `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | diff --git a/specs/cli/show.md b/specs/cli/show.md index 2d31b53503..d22acf405f 100644 --- a/specs/cli/show.md +++ b/specs/cli/show.md @@ -7,7 +7,7 @@ Show the API paths tree for an API description. ## Parameters | Parameters | Required | Example | Description | Telemetry | -| -- | -- | -- | -- | +| -- | -- | -- | -- | -- | | `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | | `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | | `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | diff --git a/specs/scenarios/telemetry.md b/specs/scenarios/telemetry.md index 01418678ff..c6a0545131 100644 --- a/specs/scenarios/telemetry.md +++ b/specs/scenarios/telemetry.md @@ -61,10 +61,10 @@ We should be very careful about the information we collect. Before rolling out t For every command, we should collect the following information: - Timestamp -- Hashed MAC address - Operating system - Operating system version - Source (CLI or extension) +- Acquisition channel (dotnet tool, binaries, homebrew, asdf, extension, etc.) - Kiota version - VS Code extension version (if applicable) - Command name @@ -80,4 +80,14 @@ The list of commands and their parameters can be found in the [CLI Commands](../ ### Opting-out -We should offer a way to opt-out of the telemetry collection. This should be done in a very similar way that the `dotnet` CLI does (https://learn.microsoft.com/en-us/dotnet/core/tools/telemetry). To opt out of the telemetry feature, set the KIOTA_CLI_TELEMETRY_OPTOUT environment variable to 1 or true. \ No newline at end of file +We should offer a way to opt-out of the telemetry collection. This should be done in a very similar way that the `dotnet` CLI does (https://learn.microsoft.com/en-us/dotnet/core/tools/telemetry). To opt out of the telemetry feature, set the KIOTA_CLI_TELEMETRY_OPTOUT environment variable to 1 or true. + +Every time the CLI is installed and updated, we should inform the user about the telemetry feature and how to opt-out of it. + +```bash +Telemetry +--------- +Kiota collect usage data in order to help us improve your experience. You can opt-out of telemetry by setting the KIOTA_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell. + +Read more about Kiota telemetry: https://aka.ms/kiota/docs/telemetry +``` \ No newline at end of file From 749fd8a3d7e506c94cc7aa8e25dfa2ff2768db5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:07:10 +0000 Subject: [PATCH 115/394] Bump the kiota-dependencies group in /it/csharp with 4 updates Bumps the kiota-dependencies group in /it/csharp with 4 updates: [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet), [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet), [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) and [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet). Updates `Microsoft.Kiota.Abstractions` from 1.7.6 to 1.7.7 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.6...v1.7.7) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.5 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.5) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.2 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.2) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.3...v1.1.4) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 590ffc87fc..903ea4c166 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -14,7 +14,7 @@ - + From f289dcc3d2512be6e87a7d8700d847b519d66771 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:27:14 +0000 Subject: [PATCH 116/394] Bump webpack from 5.90.0 to 5.90.1 in /vscode/microsoft-kiota Bumps [webpack](https://github.com/webpack/webpack) from 5.90.0 to 5.90.1. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.90.0...v5.90.1) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 8 ++++---- vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index c9f1fb13c8..6e9ac90625 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -28,7 +28,7 @@ "mocha": "^10.1.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", - "webpack": "^5.90.0", + "webpack": "^5.90.1", "webpack-cli": "^5.1.4" }, "engines": { @@ -4074,9 +4074,9 @@ } }, "node_modules/webpack": { - "version": "5.90.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.0.tgz", - "integrity": "sha512-bdmyXRCXeeNIePv6R6tGPyy20aUobw4Zy8r0LUS2EWO+U+Ke/gYDgsCh7bl5rB6jPpr4r0SZa6dPxBxLooDT3w==", + "version": "5.90.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.1.tgz", + "integrity": "sha512-SstPdlAC5IvgFnhiRok8hqJo/+ArAbNv7rhU4fnWGHNVfN59HSQFaxZDSAL3IFG2YmqxuRs+IU33milSxbPlog==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index f43d1e287a..0185299e97 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -435,7 +435,7 @@ "mocha": "^10.1.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", - "webpack": "^5.90.0", + "webpack": "^5.90.1", "webpack-cli": "^5.1.4" }, "dependencies": { From 58e416b0b2f841ed51159c6f770aa96083284fdf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:27:26 +0000 Subject: [PATCH 117/394] Bump @types/node from 20.11.14 to 20.11.16 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.14 to 20.11.16. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index c9f1fb13c8..bff27db7a5 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.14.tgz", - "integrity": "sha512-w3yWCcwULefjP9DmDDsgUskrMoOy5Z8MiwKHr1FvqGPtx7CvJzQvxD7eKpxNtklQxLruxSXWddyeRtyud0RcXQ==", + "version": "20.11.16", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", + "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From 0dc67d215f9035190172ca0deeaae2342094923e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:30:29 +0000 Subject: [PATCH 118/394] Bump the kiota-dependencies group with 4 updates Bumps the kiota-dependencies group with 4 updates: [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet), [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet), [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) and [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet). Updates `Microsoft.Kiota.Abstractions` from 1.7.6 to 1.7.7 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.6...v1.7.7) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.5 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.5) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.2 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.2) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.3...v1.1.4) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 4d54441d94..450c1881e3 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -41,7 +41,7 @@ - + From e357297c632bf25a3b58ad8662c55dd72ccd46c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:46:09 +0000 Subject: [PATCH 119/394] Bump @types/vscode from 1.85.0 to 1.86.0 in /vscode/microsoft-kiota Bumps [@types/vscode](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/vscode) from 1.85.0 to 1.86.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/vscode) --- updated-dependencies: - dependency-name: "@types/vscode" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 8 ++++---- vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 6ab88a6881..4b834242ea 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -19,7 +19,7 @@ "@types/adm-zip": "^0.5.5", "@types/mocha": "^10.0.6", "@types/node": "20.x", - "@types/vscode": "^1.85.0", + "@types/vscode": "^1.86.0", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "@vscode/test-electron": "^2.3.9", @@ -549,9 +549,9 @@ "dev": true }, "node_modules/@types/vscode": { - "version": "1.85.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.85.0.tgz", - "integrity": "sha512-CF/RBon/GXwdfmnjZj0WTUMZN5H6YITOfBCP4iEZlOtVQXuzw6t7Le7+cR+7JzdMrnlm7Mfp49Oj2TuSXIWo3g==", + "version": "1.86.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.86.0.tgz", + "integrity": "sha512-DnIXf2ftWv+9LWOB5OJeIeaLigLHF7fdXF6atfc7X5g2w/wVZBgk0amP7b+ub5xAuW1q7qP5YcFvOcit/DtyCQ==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 0185299e97..ce26d0f198 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -426,7 +426,7 @@ "@types/adm-zip": "^0.5.5", "@types/mocha": "^10.0.6", "@types/node": "20.x", - "@types/vscode": "^1.85.0", + "@types/vscode": "^1.86.0", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "@vscode/test-electron": "^2.3.9", From 35711ecac8410131a2393d3325605264b0858697 Mon Sep 17 00:00:00 2001 From: Eastman Date: Fri, 2 Feb 2024 11:49:04 +0300 Subject: [PATCH 120/394] Update package.json --- vscode/microsoft-kiota/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index ce26d0f198..e73467a842 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -8,7 +8,7 @@ "telemetryInstrumentationKey": "4c6357e0-daf9-42b5-bdfb-67878f8957b5", "icon": "images/logo.png", "engines": { - "vscode": "^1.85.0" + "vscode": "^1.86.0" }, "categories": [ "Other" From b03aa753279c827dc499384fa79d7ad74fc4d0e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:53:20 +0000 Subject: [PATCH 121/394] Bump the kiota-dependencies group in /it/typescript with 7 updates Bumps the kiota-dependencies group in /it/typescript with 7 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/kiota-abstractions](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.39` | `1.0.0-preview.40` | | [@microsoft/kiota-authentication-azure](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.34` | `1.0.0-preview.35` | | [@microsoft/kiota-http-fetchlibrary](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.38` | `1.0.0-preview.39` | | [@microsoft/kiota-serialization-form](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.28` | `1.0.0-preview.29` | | [@microsoft/kiota-serialization-json](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.39` | `1.0.0-preview.40` | | [@microsoft/kiota-serialization-multipart](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.18` | `1.0.0-preview.19` | | [@microsoft/kiota-serialization-text](https://github.com/microsoft-typescript/kiota) | `1.0.0-preview.36` | `1.0.0-preview.37` | Updates `@microsoft/kiota-abstractions` from 1.0.0-preview.39 to 1.0.0-preview.40 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-abstractions@1.0.0-preview.39...@microsoft/kiota-abstractions@1.0.0-preview.40) Updates `@microsoft/kiota-authentication-azure` from 1.0.0-preview.34 to 1.0.0-preview.35 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-authentication-azure@1.0.0-preview.34...@microsoft/kiota-authentication-azure@1.0.0-preview.35) Updates `@microsoft/kiota-http-fetchlibrary` from 1.0.0-preview.38 to 1.0.0-preview.39 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.38...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.39) Updates `@microsoft/kiota-serialization-form` from 1.0.0-preview.28 to 1.0.0-preview.29 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-form@1.0.0-preview.28...@microsoft/kiota-serialization-form@1.0.0-preview.29) Updates `@microsoft/kiota-serialization-json` from 1.0.0-preview.39 to 1.0.0-preview.40 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-json@1.0.0-preview.39...@microsoft/kiota-serialization-json@1.0.0-preview.40) Updates `@microsoft/kiota-serialization-multipart` from 1.0.0-preview.18 to 1.0.0-preview.19 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-multipart@1.0.0-preview.18...@microsoft/kiota-serialization-multipart@1.0.0-preview.19) Updates `@microsoft/kiota-serialization-text` from 1.0.0-preview.36 to 1.0.0-preview.37 - [Commits](https://github.com/microsoft-typescript/kiota/commits) --- updated-dependencies: - dependency-name: "@microsoft/kiota-abstractions" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-authentication-azure" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-http-fetchlibrary" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-json" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-multipart" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-text" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 118 +++++++++++++++++--------------- it/typescript/package.json | 14 ++-- 2 files changed, 68 insertions(+), 64 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 454255df27..7ca2a4ba30 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.39", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.34", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.38", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.28", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.39", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.18", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.36", + "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.35", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.39", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.29", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.40", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.19", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.37", "express": "^4.18.2", "node-fetch": "^2.7.0" }, @@ -678,87 +678,91 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.39", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.39.tgz", - "integrity": "sha512-dBoKRhhDCxi9c2olTSOwWTXL3y6ov5oO7Do+lJ9s4k78+nvdideyhZaHqeQL95UtNxK4kb8r93CHU4b1gm+qCQ==", + "version": "1.0.0-preview.40", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.40.tgz", + "integrity": "sha512-HtRPKA+xw8Gqapu1iDPMrYF1V0oQLGwFBcLjWG5y4L3OOx4llDn+xz2clSdHga2cPKCGWUh2hUwiVYhE7fEXSQ==", "dependencies": { - "@opentelemetry/api": "^1.2.0", + "@opentelemetry/api": "^1.7.0", "@std-uritemplate/std-uritemplate": "^0.0.50", "guid-typescript": "^1.0.9", - "tinyduration": "^3.2.2", - "tslib": "^2.3.1", - "uuid": "^9.0.0" + "tinyduration": "^3.3.0", + "tslib": "^2.6.2", + "uuid": "^9.0.1" } }, "node_modules/@microsoft/kiota-abstractions/node_modules/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.34", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.34.tgz", - "integrity": "sha512-PdtmRA6r0EiSjdFDxAHZAmJHWMSJej18e3tWbQLQEBkGBGp/hV/UFqhr3zV5HgaXS9nAYYjVHw7i2guRLU/xGw==", + "version": "1.0.0-preview.35", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.35.tgz", + "integrity": "sha512-WA4jeiJ5wsXlCBelbue+PthF2BPPqQPracrJIH4CctOdDf6zYazGVLiJau+G3PScVRg0eEkq4RxSdg3g/45pNg==", "dependencies": { - "@azure/core-auth": "^1.3.2", - "@microsoft/kiota-abstractions": "^1.0.0-preview.39", - "@opentelemetry/api": "^1.2.0", - "tslib": "^2.3.1" + "@azure/core-auth": "^1.5.0", + "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@opentelemetry/api": "^1.7.0", + "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.38", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.38.tgz", - "integrity": "sha512-yT9OGXbTlsaAHajlnVBrN3wg/eaMoxy1KeKd32z2xD24ZxCx2GWJ3K5zUBRFGeEDx7twjNknEayPGir9Vu/wYw==", + "version": "1.0.0-preview.39", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.39.tgz", + "integrity": "sha512-1QEcXlNYDmt/x/AO8Q9kjiQkIUBy0MsKD1CkihgS66uXZReesT70j+4LM8QjL3opetBQgF6QTXn9tfydv/wuLA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.39", - "@opentelemetry/api": "^1.2.0", + "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@opentelemetry/api": "^1.7.0", "guid-typescript": "^1.0.9", - "node-fetch": "^2.6.5", - "tslib": "^2.3.1" + "node-fetch": "^2.7.0", + "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.28", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.28.tgz", - "integrity": "sha512-Q+DhxsKyvXCiKOKCDvlM2AecsaSHAGTMYz1GWDrRhxNowed5ZThxBcqVP0WGpfeERN6qJh/Q4XGJJ/RNTM8WEw==", + "version": "1.0.0-preview.29", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.29.tgz", + "integrity": "sha512-hHmeMVLQOpyOHZIu4nOGX9qpowYSE4ZP+BD3SnPh94bUwanMHxgsvK8eisE0b+wO36+282i3LlIn4LyDxspiJA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.39", + "@microsoft/kiota-abstractions": "^1.0.0-preview.40", "guid-typescript": "^1.0.9", - "tslib": "^2.3.1" + "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.39", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.39.tgz", - "integrity": "sha512-ylL91fLmoj1/kLYkHNwvaxqIbAAVXomaMA1zI4/u+yspPLgK5VKu5lKeNjqdt67PYLDsL9IlD6FSvAdWKUHVpA==", + "version": "1.0.0-preview.40", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.40.tgz", + "integrity": "sha512-3uqCg5itMMkdPyKMIy+QMZp9/6SMSfL91D4f3YgIntv8ud5M+RJEKt+Xd7/3hrSeTZXw8Q2LG5hxlVfCI+9FwA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.39", + "@microsoft/kiota-abstractions": "^1.0.0-preview.40", "guid-typescript": "^1.0.9", - "tslib": "^2.3.1" + "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.18", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.18.tgz", - "integrity": "sha512-pC5ZihZDr1/UWZpv0VRirjoI00oFrFKOLauz8VfVUhFC9PSAMafG4uSv5cbsiwcVZmuOiTX6+z1rYWB2bBVrEQ==", + "version": "1.0.0-preview.19", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.19.tgz", + "integrity": "sha512-0Z2tWLeoTu1jLDKfxxmLdcOEI3YFMlhkk9vPb0XNAUr+NhW+7H4MkU19s/YH6TOjoLC8cLCFqeIVIfhcWS87hQ==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.39", + "@microsoft/kiota-abstractions": "^1.0.0-preview.40", "guid-typescript": "^1.0.9", - "tslib": "^2.3.1" + "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.36", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.36.tgz", - "integrity": "sha512-ODWxMYzpmkXqIP6TV5uf+WaBxhGQzTZQHkzUjIRMFh9yBKa39ZtiOsQpP93CV22KrvFiqYlrRBPc8wyw9kBLgQ==", + "version": "1.0.0-preview.37", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.37.tgz", + "integrity": "sha512-KX7IajZfBd7TfcvqrIDDdyofgm4NY5sqMLWpNXw5LPad0gLioj83mo+r/gehx4eR4Nw7C3vVW8GYq7PA+cjBAw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.39", + "@microsoft/kiota-abstractions": "^1.0.0-preview.40", "guid-typescript": "^1.0.9", - "tslib": "^2.3.1" + "tslib": "^2.6.2" } }, "node_modules/@nodelib/fs.scandir": { @@ -797,9 +801,9 @@ } }, "node_modules/@opentelemetry/api": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.4.1.tgz", - "integrity": "sha512-O2yRJce1GOc6PAy3QxFM4NzFiWzvScDC1/5ihYBL6BUEVdq0XMWN01sppE+H6bBXbaFYipjwFLEWLg5PaSOThA==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.7.0.tgz", + "integrity": "sha512-AdY5wvN0P2vXBi3b29hxZgSFvdhdxPB9+f0B6s//P9Q8nibRWeA3cHm8UmLpio9ABigkVHJ5NMPk+Mz8VCCyrw==", "engines": { "node": ">=8.0.0" } @@ -3097,9 +3101,9 @@ } }, "node_modules/tslib": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/type-check": { "version": "0.4.0", diff --git a/it/typescript/package.json b/it/typescript/package.json index fbdd984faf..c6316d3b24 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.39", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.34", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.38", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.28", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.39", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.18", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.36", + "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.35", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.39", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.29", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.40", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.19", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.37", "express": "^4.18.2", "node-fetch": "^2.7.0" } From b6676c86c31c709ce9c669cc1fa87753517c5ed3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:05:25 +0000 Subject: [PATCH 122/394] Bump certifi from 2023.11.17 to 2024.2.2 in /it/python Bumps [certifi](https://github.com/certifi/python-certifi) from 2023.11.17 to 2024.2.2. - [Commits](https://github.com/certifi/python-certifi/compare/2023.11.17...2024.02.02) --- updated-dependencies: - dependency-name: certifi dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 26dbf2faf3..6c12ac63e5 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -2,7 +2,7 @@ astroid==3.0.2 ; python_full_version >= '3.7.2' -certifi==2023.11.17 ; python_version >= '3.6' +certifi==2024.2.2 ; python_version >= '3.6' charset-normalizer==3.3.2 ; python_full_version >= '3.7.0' From da0d9b7dde37ea38eeb07a3cb7b5d547379e7154 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:06:23 +0000 Subject: [PATCH 123/394] Bump azure-core from 1.29.7 to 1.30.0 in /it/python Bumps [azure-core](https://github.com/Azure/azure-sdk-for-python) from 1.29.7 to 1.30.0. - [Release notes](https://github.com/Azure/azure-sdk-for-python/releases) - [Changelog](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/esrp_release.md) - [Commits](https://github.com/Azure/azure-sdk-for-python/compare/azure-core_1.29.7...azure-core_1.30.0) --- updated-dependencies: - dependency-name: azure-core dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 26dbf2faf3..26227c1f6c 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -76,7 +76,7 @@ async-timeout==4.0.3 ; python_version >= '3.6' attrs==23.2.0 ; python_version >= '3.7' -azure-core==1.29.7 ; python_version >= '3.7' +azure-core==1.30.0 ; python_version >= '3.7' azure-identity==1.15.0 From 95f707e62c28b4d5be04424ba263651bcfd9f264 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:06:45 +0000 Subject: [PATCH 124/394] Bump multidict from 6.0.4 to 6.0.5 in /it/python Bumps [multidict](https://github.com/aio-libs/multidict) from 6.0.4 to 6.0.5. - [Release notes](https://github.com/aio-libs/multidict/releases) - [Changelog](https://github.com/aio-libs/multidict/blob/master/CHANGES.rst) - [Commits](https://github.com/aio-libs/multidict/compare/v6.0.4...v6.0.5) --- updated-dependencies: - dependency-name: multidict dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 26dbf2faf3..0da692099f 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -112,7 +112,7 @@ msal==1.26.0 msal-extensions==1.1.0 -multidict==6.0.4 ; python_version >= '3.7' +multidict==6.0.5 ; python_version >= '3.7' portalocker==2.8.2 ; python_version >= '3.5' and platform_system == 'Windows' From 2c1f1325c4773faa06bd08941719dc1a0fb69c20 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:44:07 +0000 Subject: [PATCH 125/394] Bump @types/node from 20.11.14 to 20.11.16 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.14 to 20.11.16. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 7ca2a4ba30..17b39bf651 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.14", + "@types/node": "^20.11.16", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", @@ -828,9 +828,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.14", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.14.tgz", - "integrity": "sha512-w3yWCcwULefjP9DmDDsgUskrMoOy5Z8MiwKHr1FvqGPtx7CvJzQvxD7eKpxNtklQxLruxSXWddyeRtyud0RcXQ==", + "version": "20.11.16", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", + "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index c6316d3b24..5878278ff2 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.14", + "@types/node": "^20.11.16", "@typescript-eslint/eslint-plugin": "^6.20.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", From 924e6d651631f25b9eab9cb3728ea4d24fc4cda9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 10:29:35 -0500 Subject: [PATCH 126/394] - fixes a deadlock when evicting cached descriptions --- CHANGELOG.md | 1 + src/Kiota.Builder/Caching/DocumentCachingProvider.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e13b1a75f9..244b6b994c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Fixed a deadlock on update for multiple clients targeting the same local file. +- Fixes a deadlock when evicting cached descriptions. ## [1.11.0] - 2024-02-01 diff --git a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs index 7a0a93fafc..d7dd437b95 100644 --- a/src/Kiota.Builder/Caching/DocumentCachingProvider.cs +++ b/src/Kiota.Builder/Caching/DocumentCachingProvider.cs @@ -62,8 +62,8 @@ private async Task GetDocumentInternalAsync(Uri documentUri, string inte Logger.LogWarning("could not delete cache file {CacheFile}, reason: {Reason}", target, ex.Message); } } - return await GetDocumentInternalAsync(documentUri, intermediateFolderName, fileName, couldNotDelete, accept, token).ConfigureAwait(false); } + return await GetDocumentInternalAsync(documentUri, intermediateFolderName, fileName, couldNotDelete, accept, token).ConfigureAwait(false); } private static readonly AsyncKeyedLocker _locks = new(o => { From ed59a27a75d554daa45b41a19c255f613bdd352e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 10:31:51 -0500 Subject: [PATCH 127/394] - typo fix Signed-off-by: Vincent Biret --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 244b6b994c..75e756b817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Fixed a deadlock on update for multiple clients targeting the same local file. -- Fixes a deadlock when evicting cached descriptions. +- Fixed a deadlock when evicting cached descriptions. ## [1.11.0] - 2024-02-01 From 07944bb17f3e78d1452d15040f6b9156c012fd08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 08:37:36 +0000 Subject: [PATCH 128/394] Bump prettier from 3.2.4 to 3.2.5 in /it/typescript Bumps [prettier](https://github.com/prettier/prettier) from 3.2.4 to 3.2.5. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.2.4...3.2.5) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 17b39bf651..0d50aa4dbe 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -29,7 +29,7 @@ "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", - "prettier": "^3.2.4", + "prettier": "^3.2.5", "typescript": "^4.9.5" } }, @@ -2710,9 +2710,9 @@ } }, "node_modules/prettier": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.4.tgz", - "integrity": "sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" diff --git a/it/typescript/package.json b/it/typescript/package.json index 5878278ff2..762914dfd9 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -26,7 +26,7 @@ "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", - "prettier": "^3.2.4", + "prettier": "^3.2.5", "typescript": "^4.9.5" }, "dependencies": { From 35a5e17867c7047d8120bf1add17235a987b793f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 08:51:45 +0000 Subject: [PATCH 129/394] Bump the kiota-dependencies group in /it/csharp with 4 updates Bumps the kiota-dependencies group in /it/csharp with 4 updates: [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet), [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet), [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) and [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet). Updates `Microsoft.Kiota.Abstractions` from 1.7.6 to 1.7.9 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.6...v1.7.9) Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.6 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.6) Updates `Microsoft.Kiota.Abstractions` from 1.7.7 to 1.7.8 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.6...v1.7.9) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.2 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.2) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 903ea4c166..3504980aad 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -13,7 +13,7 @@ - + From 1f9804402f3b7a98bbb483ef35177913b6f43a12 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 08:57:37 +0000 Subject: [PATCH 130/394] Bump astroid from 3.0.2 to 3.0.3 in /it/python Bumps [astroid](https://github.com/pylint-dev/astroid) from 3.0.2 to 3.0.3. - [Release notes](https://github.com/pylint-dev/astroid/releases) - [Changelog](https://github.com/pylint-dev/astroid/blob/main/ChangeLog) - [Commits](https://github.com/pylint-dev/astroid/compare/v3.0.2...v3.0.3) --- updated-dependencies: - dependency-name: astroid dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index bb65ab60f4..09acdd3927 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -1,6 +1,6 @@ -i https://pypi.org/simple -astroid==3.0.2 ; python_full_version >= '3.7.2' +astroid==3.0.3 ; python_full_version >= '3.7.2' certifi==2024.2.2 ; python_version >= '3.6' From 845c8a4d01f95d129ee5b1f37fba3d2b12b8b0d2 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Mon, 5 Feb 2024 16:27:05 +0300 Subject: [PATCH 131/394] Use new RequestConfiguration class --- src/Kiota.Builder/Refiners/PythonRefiner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 2a39f6bded..3f1885a4bb 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -47,7 +47,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance RemoveRequestConfigurationClasses(generatedCode, new CodeUsing { - Name = "BaseRequestConfiguration", + Name = "RequestConfiguration", Declaration = new CodeType { Name = $"{AbstractionsPackageName}.base_request_configuration", From e049e453e710ec6aa3d7a4b2d13a5042e29e8fba Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 08:29:42 -0500 Subject: [PATCH 132/394] - patch release for deadlocks --- CHANGELOG.md | 7 +++++++ src/Kiota.Builder/Kiota.Builder.csproj | 2 +- src/kiota/kiota.csproj | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75e756b817..345df91aa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +## [1.11.1] - 2024-02-05 + +### Added + +### Changed + - Fixed a deadlock on update for multiple clients targeting the same local file. - Fixed a deadlock when evicting cached descriptions. @@ -1244,3 +1250,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 + diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 450c1881e3..e07e317279 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Kiota.Builder Microsoft.OpenApi.Kiota.Builder ./nupkg - 1.12.0 + 1.11.1 $(VersionSuffix) https://github.com/microsoft/kiota/releases diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index 1bd171dfbd..8efa2e5c7f 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Kiota Microsoft.OpenApi.Kiota ./nupkg - 1.12.0 + 1.11.1 $(VersionSuffix) https://github.com/microsoft/kiota/releases From 67d5107c7edf3591d7011afa7bc5735c3415cd05 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 08:36:48 -0500 Subject: [PATCH 133/394] - bumps version for preview 1.12 --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- src/kiota/kiota.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index e07e317279..450c1881e3 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Kiota.Builder Microsoft.OpenApi.Kiota.Builder ./nupkg - 1.11.1 + 1.12.0 $(VersionSuffix) https://github.com/microsoft/kiota/releases diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index 8efa2e5c7f..1bd171dfbd 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Kiota Microsoft.OpenApi.Kiota ./nupkg - 1.11.1 + 1.12.0 $(VersionSuffix) https://github.com/microsoft/kiota/releases From bcef8271d05a12c8fd7aa054c76f33d8c16503fa Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 08:38:20 -0500 Subject: [PATCH 134/394] - adds missing permissions to codeql workflow --- .github/workflows/codeql-analysis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 32a945338f..758fd2b9bd 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -40,6 +40,11 @@ on: schedule: - cron: "20 9 * * 5" +permissions: + contents: read #those permissions are required to run the codeql analysis + actions: read + security-events: write + jobs: analyze: name: Analyze From 6077e9f92ef189d8be86d6d4dc77329e136c92bd Mon Sep 17 00:00:00 2001 From: Ronald K <43806892+rkodev@users.noreply.github.com> Date: Mon, 5 Feb 2024 19:12:56 +0300 Subject: [PATCH 135/394] Fix Wrong mantis for bitwise/flaggable enums in G (#4131) * fix multivalue enums for go * Update changelog * Format code * Format code * minor: refactor if else --- CHANGELOG.md | 1 + src/Kiota.Builder/Refiners/GoRefiner.cs | 1 + .../Writers/Go/CodeEnumWriter.cs | 25 ++++++++++++------- .../Writers/Go/CodeEnumWriterTests.cs | 14 +++++++---- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 345df91aa7..41a8002bbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed +- Fixed mantis for bitwise enums in Go. [#3936](https://github.com/microsoft/kiota/issues/3936) ## [1.11.1] - 2024-02-05 diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index 6a63209638..71e2df6164 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -594,6 +594,7 @@ x.Type is CodeType pType && "github.com/microsoft/kiota-abstractions-go/store", "BackingStoreFactory"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestExecutor, CodeMethodKind.RequestGenerator) && method.Parameters.Any(static y => y.IsOfKind(CodeParameterKind.RequestBody) && y.Type.Name.Equals(MultipartBodyClassName, StringComparison.OrdinalIgnoreCase)), AbstractionsNamespaceName, MultipartBodyClassName), + new (static x => x is CodeEnum @enum && @enum.Flags,"", "math"), }; private const string MultipartBodyClassName = "MultipartBody"; private const string AbstractionsNamespaceName = "github.com/microsoft/kiota-abstractions-go"; diff --git a/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs index 546e653627..610d736db6 100644 --- a/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs @@ -28,20 +28,25 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write string.Empty, "const ("); writer.IncreaseIndent(); - var iotaSuffix = $" {typeName} = iota"; + var isMultiValue = codeElement.Flags; + var enumOptions = codeElement.Options; + int power = 0; foreach (var item in enumOptions) { if (!string.IsNullOrEmpty(item.Documentation.Description)) writer.WriteLine($"// {item.Documentation.Description}"); - writer.WriteLine($"{item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()}{iotaSuffix}"); - if (!string.IsNullOrEmpty(iotaSuffix)) - iotaSuffix = string.Empty; + + if (isMultiValue) + writer.WriteLine($"{item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()} = {(int)Math.Pow(2, power)}"); + else + writer.WriteLine($"{item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()}{(power == 0 ? $" {typeName} = iota" : string.Empty)}"); + + power++; } writer.DecreaseIndent(); writer.WriteLines(")", string.Empty); - var isMultiValue = codeElement.Flags; WriteStringFunction(codeElement, writer, isMultiValue); WriteParsableEnum(codeElement, writer, isMultiValue); WriteSerializeFunction(codeElement, writer, isMultiValue); @@ -51,7 +56,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write private void WriteStringFunction(CodeEnum codeElement, LanguageWriter writer, Boolean isMultiValue) { var typeName = codeElement.Name.ToFirstCharacterUpperCase(); - var enumOptions = codeElement.Options; + var enumOptions = codeElement.Options.ToList(); if (isMultiValue) { @@ -60,9 +65,11 @@ private void WriteStringFunction(CodeEnum codeElement, LanguageWriter writer, Bo var literalOptions = enumOptions .Select(x => $"\"{x.WireName}\"") .Aggregate((x, y) => x + ", " + y); - writer.StartBlock($"for p := {typeName}(1); p <= {enumOptions.Last().Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()}; p <<= 1 {{"); - writer.StartBlock($"if i&p == p {{"); - writer.WriteLine($"values = append(values, []string{{{literalOptions}}}[p])"); + writer.WriteLine($"options := []string{{{literalOptions}}}"); + writer.StartBlock($"for p := 0; p < {enumOptions.Count}; p++ {{"); + writer.WriteLine($"mantis := {typeName}(int(math.Pow(2, float64(p))))"); + writer.StartBlock($"if i&mantis == mantis {{"); + writer.WriteLine($"values = append(values, options[p])"); writer.CloseBlock(); writer.CloseBlock(); writer.WriteLine("return strings.Join(values, \",\")"); diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeEnumWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeEnumWriterTests.cs index a73352596c..dec80b3e33 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeEnumWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeEnumWriterTests.cs @@ -70,18 +70,22 @@ public void WritesMultiValueEnum() Flags = true }).First(); const string optionName = "option1"; - myEnum.AddOption(new CodeEnumOption { Name = optionName }); + myEnum.AddOption(new CodeEnumOption { Name = optionName }, new CodeEnumOption { Name = "option2" }, new CodeEnumOption { Name = "option3" }); writer.Write(myEnum); var result = tw.ToString(); Assert.Contains($"type MultiValueEnum int", result); Assert.Contains("const (", result); - Assert.Contains("OPTION1_MULTIVALUEENUM MultiValueEnum = iota", result); + Assert.Contains("OPTION1_MULTIVALUEENUM = 1", result); + Assert.Contains("OPTION2_MULTIVALUEENUM = 2", result); + Assert.Contains("OPTION3_MULTIVALUEENUM = 4", result); Assert.Contains("func (i", result); Assert.Contains("String() string {", result); - Assert.Contains("for p := MultiValueEnum(1); p <= OPTION1_MULTIVALUEENUM; p <<= 1 {", result); - Assert.Contains("if i&p == p {", result); - Assert.Contains("values = append(values, []string{\"option1\"}[p])", result); + Assert.Contains("options := []string{\"option1\", \"option2\", \"option3\"}", result); + Assert.Contains("for p := 0; p < 3; p++ {", result); + Assert.Contains("mantis := MultiValueEnum(int(math.Pow(2, float64(p))))", result); + Assert.Contains("if i&mantis == mantis {", result); + Assert.Contains("values = append(values, options[p])", result); Assert.Contains("for _, str := range values {", result); Assert.Contains("strings.Join(values", result); Assert.Contains("result |= OPTION1_MULTIVALUEENUM", result); From e5ab5e2bc4dcfd0532f0a4bc10b1d3ee9037ed43 Mon Sep 17 00:00:00 2001 From: Ronald K <43806892+rkodev@users.noreply.github.com> Date: Mon, 5 Feb 2024 20:55:08 +0300 Subject: [PATCH 136/394] Enums should not be escaped in Go (#4136) --- CHANGELOG.md | 1 + src/Kiota.Builder/Refiners/GoRefiner.cs | 5 +++-- tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41a8002bbd..c6a3a5b982 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Fixed mantis for bitwise enums in Go. [#3936](https://github.com/microsoft/kiota/issues/3936) +- Keyword in enum names for go should not be escaped. [#2877](https://github.com/microsoft/kiota/issues/2877) ## [1.11.1] - 2024-02-05 diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index 71e2df6164..c6b2a501f6 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -93,10 +93,11 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance generatedCode, new GoReservedNamesProvider(), x => $"{x}Escaped", - shouldReplaceCallback: x => x is not CodeProperty currentProp || + shouldReplaceCallback: x => (x is not CodeEnumOption && x is not CodeEnum) && // enums and enum options start with uppercase + (x is not CodeProperty currentProp || !(currentProp.Parent is CodeClass parentClass && parentClass.IsOfKind(CodeClassKind.QueryParameters, CodeClassKind.ParameterSet) && - currentProp.Access == AccessModifier.Public)); // Go reserved keywords are all lowercase and public properties are uppercased when we don't provide accessors (models) + currentProp.Access == AccessModifier.Public))); // Go reserved keywords are all lowercase and public properties are uppercased when we don't provide accessors (models) ReplaceReservedExceptionPropertyNames(generatedCode, new GoExceptionsReservedNamesProvider(), x => $"{x}Escaped"); cancellationToken.ThrowIfCancellationRequested(); AddPropertiesAndMethodTypesImports( diff --git a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs index f5d0297b00..49c0e45252 100644 --- a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs @@ -48,7 +48,9 @@ public async Task AddsInnerClasses() await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Go }, root); Assert.Equal(2, requestBuilder.GetChildElements(true).Count()); } - [Theory(Skip = "Fixing this test is a breaking change - https://github.com/microsoft/kiota/issues/2877")] + + + [Theory] [InlineData("break")] [InlineData("case")] public async Task EnumWithReservedName_IsNotRenamed(string input) From a3418cad4c37cbc538353329421967d6dface986 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Tue, 6 Feb 2024 06:02:23 +0300 Subject: [PATCH 137/394] Update changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5cff8ff4..9c98c551eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Fixed mantis for bitwise enums in Go. [#3936](https://github.com/microsoft/kiota/issues/3936) - Keyword in enum names for go should not be escaped. [#2877](https://github.com/microsoft/kiota/issues/2877) +- Generator method code reduction in Python. [#3695](https://github.com/microsoft/kiota/issues/3695) ## [1.11.1] - 2024-02-05 @@ -39,7 +40,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed a bug where TypeScript models factory methods would be missing return types. - Fixed a bug where generated paths would possibly get too long. [#3854](https://github.com/microsoft/kiota/issues/3854) - The vscode extension now also displays the children nodes when filtering. [#3998](https://github.com/microsoft/kiota/issues/3998) -- Generator method code reduction in Python. [#3695](https://github.com/microsoft/kiota/issues/3695) ## [1.10.1] - 2024-01-12 From 0927d4fb89363a65f1468b89387d1d6e73306af8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:09:00 +0000 Subject: [PATCH 138/394] Bump the eslint group in /vscode/microsoft-kiota with 2 updates Bumps the eslint group in /vscode/microsoft-kiota with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser). Updates `@typescript-eslint/eslint-plugin` from 6.20.0 to 6.21.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.21.0/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 6.20.0 to 6.21.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.21.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: eslint - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: eslint ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 90 ++++++++++++------------ vscode/microsoft-kiota/package.json | 4 +- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 4b834242ea..9f10454099 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -20,8 +20,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.86.0", - "@typescript-eslint/eslint-plugin": "^6.20.0", - "@typescript-eslint/parser": "^6.20.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", @@ -32,7 +32,7 @@ "webpack-cli": "^5.1.4" }, "engines": { - "vscode": "^1.85.0" + "vscode": "^1.86.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -555,16 +555,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz", - "integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/type-utils": "6.20.0", - "@typescript-eslint/utils": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -590,15 +590,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz", - "integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/typescript-estree": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4" }, "engines": { @@ -618,13 +618,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz", - "integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -635,13 +635,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz", - "integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.20.0", - "@typescript-eslint/utils": "6.20.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -662,9 +662,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz", - "integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -675,13 +675,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz", - "integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -727,17 +727,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz", - "integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/typescript-estree": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", "semver": "^7.5.4" }, "engines": { @@ -752,12 +752,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz", - "integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.20.0", + "@typescript-eslint/types": "6.21.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index e73467a842..baeb0ee83c 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -427,8 +427,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.86.0", - "@typescript-eslint/eslint-plugin": "^6.20.0", - "@typescript-eslint/parser": "^6.20.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/parser": "^6.21.0", "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", From b45676eec6f6bc6c0b566345cc9ff9291bfcd615 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:10:41 +0000 Subject: [PATCH 139/394] Bump the kiota-dependencies group in /it/ruby with 1 update Updates the requirements on [microsoft_kiota_faraday](https://github.com/microsoft/kiota-http-ruby) to permit the latest version. Updates `microsoft_kiota_faraday` to 0.13.0 - [Release notes](https://github.com/microsoft/kiota-http-ruby/releases) - [Changelog](https://github.com/microsoft/kiota-http-ruby/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-ruby/compare/v0.12.0...v0.13.0) --- updated-dependencies: - dependency-name: microsoft_kiota_faraday dependency-type: direct:production dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/ruby/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/ruby/Gemfile b/it/ruby/Gemfile index b4e0cf883c..c7ca931ed4 100644 --- a/it/ruby/Gemfile +++ b/it/ruby/Gemfile @@ -13,7 +13,7 @@ gem "rubocop", "~> 1.21" gem "microsoft_kiota_abstractions", "~> 0.14.3" -gem "microsoft_kiota_faraday", "~> 0.12.0" +gem "microsoft_kiota_faraday", "~> 0.13.0" gem "microsoft_kiota_serialization_json", "~> 0.9.1" From 2b8c0b194d99a93b2215521f171f4d911c963871 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:32:05 +0000 Subject: [PATCH 140/394] Bump the kiota-dependencies group in /it/csharp with 6 updates Bumps the kiota-dependencies group in /it/csharp with 6 updates: | Package | From | To | | --- | --- | --- | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.6` | `1.7.9` | | [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet) | `1.1.2` | `1.1.3` | | [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) | `1.3.4` | `1.3.6` | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.7` | `1.7.8` | | [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) | `1.1.2` | `1.1.3` | | [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet) | `1.1.4` | `1.1.5` | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.8` | `1.7.9` | | [Microsoft.kiota.Serialization.Multipart](https://github.com/microsoft/kiota-serialization-multipart-dotnet) | `1.1.1` | `1.1.2` | Updates `Microsoft.Kiota.Abstractions` from 1.7.6 to 1.7.9 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.6...v1.7.9) Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.6 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.6) Updates `Microsoft.Kiota.Abstractions` from 1.7.7 to 1.7.8 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.6...v1.7.9) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.4 to 1.1.5 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.4...v1.1.5) Updates `Microsoft.Kiota.Abstractions` from 1.7.8 to 1.7.9 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.6...v1.7.9) Updates `Microsoft.kiota.Serialization.Multipart` from 1.1.1 to 1.1.2 - [Release notes](https://github.com/microsoft/kiota-serialization-multipart-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-multipart-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-multipart-dotnet/compare/v1.1.1...v1.1.2) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.kiota.Serialization.Multipart dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 3504980aad..c366b28a16 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -10,12 +10,12 @@ - + - + From 09115a95697c836a423203c84723eb6be8834178 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:44:00 +0000 Subject: [PATCH 141/394] Bump @typescript-eslint/eslint-plugin in /it/typescript Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.20.0 to 6.21.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.21.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 266 +++++++++++++++++++++++++++++--- it/typescript/package.json | 2 +- 2 files changed, 248 insertions(+), 20 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 0d50aa4dbe..c787589673 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -23,7 +23,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.16", - "@typescript-eslint/eslint-plugin": "^6.20.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", "eslint": "^8.56.0", @@ -843,16 +843,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz", - "integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/type-utils": "6.20.0", - "@typescript-eslint/utils": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -877,6 +877,53 @@ } } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/parser": { "version": "6.20.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz", @@ -923,13 +970,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz", - "integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.20.0", - "@typescript-eslint/utils": "6.20.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -949,6 +996,88 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/types": { "version": "6.20.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz", @@ -1015,17 +1144,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz", - "integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/typescript-estree": "6.20.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", "semver": "^7.5.4" }, "engines": { @@ -1039,6 +1168,105 @@ "eslint": "^7.0.0 || ^8.0.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/visitor-keys": { "version": "6.20.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index 762914dfd9..71c457b766 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.16", - "@typescript-eslint/eslint-plugin": "^6.20.0", + "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.20.0", "esbuild": "^0.20.0", "eslint": "^8.56.0", From 3923fa17141256a5f0dd743a0d563f4c54add686 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:41:36 +0000 Subject: [PATCH 142/394] Bump @typescript-eslint/parser from 6.20.0 to 6.21.0 in /it/typescript Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.20.0 to 6.21.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.21.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 258 ++------------------------------ it/typescript/package.json | 2 +- 2 files changed, 16 insertions(+), 244 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index c787589673..7e0f05de3d 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -24,7 +24,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.16", "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.20.0", + "@typescript-eslint/parser": "^6.21.0", "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", @@ -877,63 +877,16 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "node_modules/@typescript-eslint/parser": { "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", "dev": true, "dependencies": { + "@typescript-eslint/scope-manager": "6.21.0", "@typescript-eslint/types": "6.21.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz", - "integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==", - "dev": true, - "dependencies": { - "@typescript-eslint/scope-manager": "6.20.0", - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/typescript-estree": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", "debug": "^4.3.4" }, "engines": { @@ -953,13 +906,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz", - "integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0" + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -996,7 +949,7 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "node_modules/@typescript-eslint/types": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", @@ -1009,7 +962,7 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "node_modules/@typescript-eslint/typescript-estree": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", @@ -1037,88 +990,6 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz", - "integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz", - "integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.20.0", - "@typescript-eslint/visitor-keys": "6.20.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -1168,65 +1039,7 @@ "eslint": "^7.0.0 || ^8.0.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", - "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "node_modules/@typescript-eslint/visitor-keys": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", @@ -1243,47 +1056,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/utils/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz", - "integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.20.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index 71c457b766..8f592315e1 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -21,7 +21,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.16", "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.20.0", + "@typescript-eslint/parser": "^6.21.0", "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", From b6b274733efd40e1487a19f095c82bc37307b94d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 08:15:51 +0000 Subject: [PATCH 143/394] Bump Microsoft.NET.Test.Sdk from 17.8.0 to 17.9.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.8.0 to 17.9.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.8.0...v17.9.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Kiota.Builder.IntegrationTests.csproj | 2 +- tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj | 2 +- tests/Kiota.Tests/Kiota.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index 6a2834f7fe..1fd27b3f25 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -14,7 +14,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj index 03da1181d3..abf92474f7 100644 --- a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj +++ b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj @@ -17,7 +17,7 @@ all - + diff --git a/tests/Kiota.Tests/Kiota.Tests.csproj b/tests/Kiota.Tests/Kiota.Tests.csproj index bb7d4496f9..e14cadca38 100644 --- a/tests/Kiota.Tests/Kiota.Tests.csproj +++ b/tests/Kiota.Tests/Kiota.Tests.csproj @@ -11,7 +11,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive From 49f90cb0fdb86b1b34d04eb81178f10bdca6057f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 08:16:09 +0000 Subject: [PATCH 144/394] Bump the kiota-dependencies group in /it/csharp with 4 updates Bumps the kiota-dependencies group in /it/csharp with 4 updates: [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet), [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet), [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) and [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet). Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.6 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.6) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.4 to 1.1.5 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.4...v1.1.5) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index c366b28a16..624e37dd52 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -14,7 +14,7 @@ - + From 6f9aac874b94a583673dffdc70f520ade5633d76 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 30 Jan 2024 16:05:33 -0500 Subject: [PATCH 145/394] - adds templating mechanism for descriptions --- src/Kiota.Builder/CodeDOM/CodeConstant.cs | 8 +- .../CodeDOM/CodeDocumentation.cs | 27 +++++- src/Kiota.Builder/KiotaBuilder.cs | 84 +++++++++---------- .../Refiners/CommonLanguageRefiner.cs | 26 +++--- src/Kiota.Builder/Refiners/GoRefiner.cs | 4 +- src/Kiota.Builder/Refiners/JavaRefiner.cs | 4 +- src/Kiota.Builder/Refiners/PhpRefiner.cs | 6 +- src/Kiota.Builder/Refiners/PythonRefiner.cs | 2 +- src/Kiota.Builder/Refiners/SwiftRefiner.cs | 2 +- .../Refiners/TypeScriptRefiner.cs | 2 +- .../Writers/CLI/CliCodeMethodWriter.cs | 2 +- .../Writers/CSharp/CSharpConventionService.cs | 2 +- .../Writers/CSharp/CodeEnumWriter.cs | 4 +- .../Writers/CSharp/CodeIndexerWriter.cs | 4 +- .../Writers/CSharp/CodeMethodWriter.cs | 2 +- .../Writers/CSharp/CodePropertyWriter.cs | 2 +- .../Writers/Go/CodeClassDeclarationWriter.cs | 2 +- .../Writers/Go/CodeEnumWriter.cs | 6 +- .../Go/CodeInterfaceDeclarationWriter.cs | 2 +- .../Writers/Go/CodeMethodWriter.cs | 2 +- .../Writers/Go/CodePropertyWriter.cs | 2 +- .../Writers/Java/CodeEnumWriter.cs | 2 +- .../Writers/Java/CodeMethodWriter.cs | 2 +- .../Writers/Java/JavaConventionService.cs | 2 +- .../Writers/Php/CodeMethodWriter.cs | 6 +- .../Writers/Php/CodePropertyWriter.cs | 4 +- .../Writers/Php/PhpConventionService.cs | 2 +- .../Writers/Python/CodeEnumWriter.cs | 2 +- .../Writers/Python/CodeMethodWriter.cs | 8 +- .../Writers/Python/CodePropertyWriter.cs | 2 +- .../Writers/Python/PythonConventionService.cs | 2 +- .../Ruby/CodeClassDeclarationWriter.cs | 2 +- .../Writers/Ruby/CodeEnumWriter.cs | 2 +- .../Writers/Ruby/CodeMethodWriter.cs | 8 +- .../Writers/Ruby/CodePropertyWriter.cs | 2 +- .../Swift/CodeClassDeclarationWriter.cs | 2 +- .../Writers/TypeScript/CodeConstantWriter.cs | 2 +- .../Writers/TypeScript/CodeMethodWriter.cs | 2 +- .../TypeScript/TypeScriptConventionService.cs | 2 +- .../CodeDOM/CodeEnumTests.cs | 2 +- .../CodeDOM/CodeIndexerTests.cs | 2 +- .../Kiota.Builder.Tests/KiotaBuilderTests.cs | 34 ++++---- .../Refiners/CSharpLanguageRefinerTests.cs | 2 +- .../Refiners/GoLanguageRefinerTests.cs | 2 +- .../Refiners/JavaLanguageRefinerTests.cs | 2 +- .../Refiners/PythonLanguageRefinerTests.cs | 2 +- .../Refiners/RubyLanguageRefinerTests.cs | 2 +- .../TypeScriptLanguageRefinerTests.cs | 2 +- .../Writers/CLI/CliCodeMethodWriterTests.cs | 22 ++--- .../Writers/CSharp/CodeEnumWriterTests.cs | 4 +- .../Writers/CSharp/CodeIndexerWriterTests.cs | 2 +- .../Writers/CSharp/CodeMethodWriterTests.cs | 12 +-- .../Writers/Go/CodeEnumWriterTests.cs | 4 +- .../Writers/Go/CodeMethodWriterTests.cs | 10 +-- .../Writers/Java/CodeEnumWriterTests.cs | 4 +- .../Writers/Java/CodeMethodWriterTests.cs | 8 +- .../Php/CodeClassDeclarationWriterTests.cs | 10 +-- .../Writers/Php/CodeMethodWriterTests.cs | 54 ++++++------ .../Writers/Php/CodePropertyWriterTests.cs | 6 +- .../Writers/Python/CodeMethodWriterTests.cs | 24 +++--- .../Writers/Python/CodePropertyWriterTests.cs | 4 +- .../Writers/Ruby/CodeMethodWriterTests.cs | 4 +- .../TypeScript/CodeConstantWriterTests.cs | 4 +- .../TypeScript/CodeFunctionWriterTests.cs | 12 +-- 64 files changed, 252 insertions(+), 231 deletions(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeConstant.cs b/src/Kiota.Builder/CodeDOM/CodeConstant.cs index 0d6ff8ed76..96d8eb93b1 100644 --- a/src/Kiota.Builder/CodeDOM/CodeConstant.cs +++ b/src/Kiota.Builder/CodeDOM/CodeConstant.cs @@ -35,7 +35,7 @@ public CodeDocumentation Documentation Kind = CodeConstantKind.QueryParametersMapper, OriginalCodeElement = source, }; - result.Documentation.Description = "Mapper for query parameters from symbol name to serialization name represented as a constant."; + result.Documentation.DescriptionTemplate = "Mapper for query parameters from symbol name to serialization name represented as a constant."; return result; } public static CodeConstant? FromCodeEnum(CodeEnum source) @@ -63,7 +63,7 @@ public CodeDocumentation Documentation UriTemplate = urlTemplateProperty.DefaultValue, OriginalCodeElement = codeClass }; - result.Documentation.Description = "Uri template for the request builder."; + result.Documentation.DescriptionTemplate = "Uri template for the request builder."; return result; } public static CodeConstant? FromRequestBuilderToNavigationMetadata(CodeClass codeClass, CodeUsing[]? usingsToAdd = default) @@ -79,7 +79,7 @@ public CodeDocumentation Documentation Kind = CodeConstantKind.NavigationMetadata, OriginalCodeElement = codeClass, }; - result.Documentation.Description = "Metadata for all the navigation properties in the request builder."; + result.Documentation.DescriptionTemplate = "Metadata for all the navigation properties in the request builder."; if (usingsToAdd is { Length: > 0 } usingsToAddList) result.AddUsing(usingsToAddList); return result; @@ -96,7 +96,7 @@ public CodeDocumentation Documentation Kind = CodeConstantKind.RequestsMetadata, OriginalCodeElement = codeClass, }; - result.Documentation.Description = "Metadata for all the requests in the request builder."; + result.Documentation.DescriptionTemplate = "Metadata for all the requests in the request builder."; if (usingsToAdd is { Length: > 0 } usingsToAddList) result.AddUsing(usingsToAddList); return result; diff --git a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs index c14c37abb0..a1aa5e095a 100644 --- a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs +++ b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; namespace Kiota.Builder.CodeDOM; @@ -10,7 +11,7 @@ public class CodeDocumentation : ICloneable /// /// The description of the current element. /// - public string Description + public string DescriptionTemplate { get; set; } = string.Empty; @@ -34,14 +35,34 @@ public object Clone() { return new CodeDocumentation { - Description = Description, + DescriptionTemplate = DescriptionTemplate, DocumentationLink = DocumentationLink == null ? null : new(DocumentationLink.ToString()), DocumentationLabel = DocumentationLabel, + TypeReferences = new(TypeReferences, StringComparer.OrdinalIgnoreCase) }; } + /// + /// References to be resolved when the description is emitted. + /// Keys MUST match the description template tokens or they will be ignored. + /// + public ConcurrentDictionary TypeReferences { get; private set; } = new(StringComparer.OrdinalIgnoreCase); + public string GetDescription(Func typeReferenceResolver) + { + ArgumentNullException.ThrowIfNull(typeReferenceResolver); + if (string.IsNullOrEmpty(DescriptionTemplate)) + return string.Empty; + var description = DescriptionTemplate; + foreach (var (key, value) in TypeReferences) + { + var resolvedValue = typeReferenceResolver(value); + if (!string.IsNullOrEmpty(resolvedValue)) + description = description.Replace($"{{{key}}}", resolvedValue, StringComparison.OrdinalIgnoreCase); + } + return description; + } public bool DescriptionAvailable { - get => !string.IsNullOrEmpty(Description); + get => !string.IsNullOrEmpty(DescriptionTemplate); } public bool ExternalDocumentationAvailable { diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index a001466ca7..a704bb096b 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -714,7 +714,7 @@ private void CreateRequestBuilderClass(CodeNamespace currentNamespace, OpenApiUr Kind = CodeClassKind.RequestBuilder, Documentation = new() { - Description = "The main entry point of the SDK, exposes the configuration and the fluent API." + DescriptionTemplate = "The main entry point of the SDK, exposes the configuration and the fluent API." }, }).First(); else @@ -727,7 +727,7 @@ private void CreateRequestBuilderClass(CodeNamespace currentNamespace, OpenApiUr Kind = CodeClassKind.RequestBuilder, Documentation = new() { - Description = currentNode.GetPathItemDescription(Constants.DefaultOpenApiLabel, $"Builds and executes requests for operations under {currentNode.Path}"), + DescriptionTemplate = currentNode.GetPathItemDescription(Constants.DefaultOpenApiLabel, $"Builds and executes requests for operations under {currentNode.Path}"), }, }).First(); } @@ -759,7 +759,7 @@ private void CreateRequestBuilderClass(CodeNamespace currentNamespace, OpenApiUr prop.Deprecation = currentNode.GetDeprecationInformation(); if (!string.IsNullOrWhiteSpace(description)) { - prop.Documentation.Description = description; + prop.Documentation.DescriptionTemplate = description; } codeClass.AddProperty(prop); } @@ -796,7 +796,7 @@ private static void CreateWithUrlMethod(OpenApiUrlTreeNode currentNode, CodeClas Kind = CodeMethodKind.RawUrlBuilder, Documentation = new() { - Description = "Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.", + DescriptionTemplate = "Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.", }, Access = AccessModifier.Public, IsAsync = false, @@ -817,7 +817,7 @@ private static void CreateWithUrlMethod(OpenApiUrlTreeNode currentNode, CodeClas Optional = false, Documentation = new() { - Description = "The raw URL to use for the request builder.", + DescriptionTemplate = "The raw URL to use for the request builder.", }, Kind = CodeParameterKind.RawUrl, }); @@ -831,7 +831,7 @@ private static void CreateMethod(string propIdentifier, string propType, CodeCla Kind = CodeMethodKind.RequestBuilderWithParameters, Documentation = new() { - Description = currentNode.GetPathItemDescription(Constants.DefaultOpenApiLabel, $"Builds and executes requests for operations under {currentNode.Path}"), + DescriptionTemplate = currentNode.GetPathItemDescription(Constants.DefaultOpenApiLabel, $"Builds and executes requests for operations under {currentNode.Path}"), }, Access = AccessModifier.Public, IsAsync = false, @@ -868,7 +868,7 @@ private static void AddPathParametersToMethod(OpenApiUrlTreeNode currentNode, Co Optional = asOptional, Documentation = new() { - Description = parameter.Description.CleanupDescription(), + DescriptionTemplate = parameter.Description.CleanupDescription(), }, Kind = CodeParameterKind.Path, SerializationName = parameter.Name.Equals(codeName, StringComparison.OrdinalIgnoreCase) ? string.Empty : parameter.Name.SanitizeParameterNameForUrlTemplate(), @@ -890,7 +890,7 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr ReadOnly = true, Documentation = new() { - Description = "Url template to use to build the URL for the current request builder", + DescriptionTemplate = "Url template to use to build the URL for the current request builder", }, Kind = CodePropertyKind.UrlTemplate, Type = new CodeType @@ -907,7 +907,7 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr Name = RequestAdapterParameterName, Documentation = new() { - Description = "The request adapter to use to execute the requests.", + DescriptionTemplate = "The request adapter to use to execute the requests.", }, Kind = CodePropertyKind.RequestAdapter, Access = AccessModifier.Private, @@ -928,7 +928,7 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr IsStatic = false, Documentation = new() { - Description = $"Instantiates a new {currentClass.Name.ToFirstCharacterUpperCase()} and sets the default values.", + DescriptionTemplate = $"Instantiates a new {currentClass.Name.ToFirstCharacterUpperCase()} and sets the default values.", }, Access = AccessModifier.Public, ReturnType = new CodeType { Name = VoidType, IsExternal = true }, @@ -939,7 +939,7 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr Name = PathParametersParameterName, Documentation = new() { - Description = "Path parameters for the request", + DescriptionTemplate = "Path parameters for the request", }, Kind = CodePropertyKind.PathParameters, Access = AccessModifier.Private, @@ -988,7 +988,7 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr Optional = true, Documentation = new() { - Description = "The backing store to use for the models.", + DescriptionTemplate = "The backing store to use for the models.", }, Kind = CodeParameterKind.BackingStore, Type = new CodeType @@ -1013,7 +1013,7 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr Optional = false, Documentation = new() { - Description = "The raw URL to use for the request builder.", + DescriptionTemplate = "The raw URL to use for the request builder.", }, Kind = CodeParameterKind.RawUrl, }); @@ -1124,7 +1124,7 @@ private CodeParameter GetIndexerParameter(OpenApiUrlTreeNode currentNode, OpenAp Name = segment.CleanupSymbolName(), Documentation = new() { - Description = parameter?.Description.CleanupDescription() is string description && !string.IsNullOrEmpty(description) ? description : "Unique identifier of the item", + DescriptionTemplate = parameter?.Description.CleanupDescription() is string description && !string.IsNullOrEmpty(description) ? description : "Unique identifier of the item", }, }; return result; @@ -1153,7 +1153,7 @@ private CodeIndexer[] CreateIndexer(string childIdentifier, string childType, Co Name = childIdentifier, Documentation = new() { - Description = currentNode.GetPathItemDescription(Constants.DefaultOpenApiLabel, $"Gets an item from the {currentNode.GetNodeNamespaceFromPath(config.ClientNamespaceName)} collection"), + DescriptionTemplate = currentNode.GetPathItemDescription(Constants.DefaultOpenApiLabel, $"Gets an item from the {currentNode.GetNodeNamespaceFromPath(config.ClientNamespaceName)} collection"), }, ReturnType = new CodeType { Name = childType }, PathSegment = parentNode.GetNodeNamespaceFromPath(string.Empty).Split('.')[^1], @@ -1189,7 +1189,7 @@ private CodeIndexer[] CreateIndexer(string childIdentifier, string childType, Co Kind = kind, Documentation = new() { - Description = propertySchema?.Description.CleanupDescription() is string description && !string.IsNullOrEmpty(description) ? + DescriptionTemplate = propertySchema?.Description.CleanupDescription() is string description && !string.IsNullOrEmpty(description) ? description : $"The {propertyName} property", }, @@ -1396,7 +1396,7 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp Kind = CodeClassKind.RequestConfiguration, Documentation = new() { - Description = "Configuration for the request such as headers, query parameters, and middleware options.", + DescriptionTemplate = "Configuration for the request such as headers, query parameters, and middleware options.", }, }).First(); @@ -1414,7 +1414,7 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp { DocumentationLink = operation.ExternalDocs?.Url, DocumentationLabel = operation.ExternalDocs?.Description ?? string.Empty, - Description = (operation.Description is string description && !string.IsNullOrEmpty(description) ? + DescriptionTemplate = (operation.Description is string description && !string.IsNullOrEmpty(description) ? description : operation.Summary) .CleanupDescription(), @@ -1445,7 +1445,7 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp Kind = CodeParameterKind.Cancellation, Documentation = new() { - Description = "Cancellation token to use when cancelling requests", + DescriptionTemplate = "Cancellation token to use when cancelling requests", }, Type = new CodeType { Name = "CancellationToken", IsExternal = true }, }; @@ -1471,7 +1471,7 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp HttpMethod = method, Documentation = new() { - Description = (operation.Description ?? operation.Summary).CleanupDescription(), + DescriptionTemplate = (operation.Description ?? operation.Summary).CleanupDescription(), }, ReturnType = new CodeType { Name = "RequestInformation", IsNullable = false, IsExternal = true }, Parent = parentClass, @@ -1514,7 +1514,7 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp Type = x.Schema is null ? GetDefaultQueryParameterType() : GetQueryParameterType(x.Schema), Documentation = new() { - Description = x.Description.CleanupDescription(), + DescriptionTemplate = x.Description.CleanupDescription(), }, Kind = x.In switch { @@ -1552,7 +1552,7 @@ private static void AddRequestConfigurationProperties(CodeClass? parameterClass, Kind = CodePropertyKind.QueryParameters, Documentation = new() { - Description = "Request query parameters", + DescriptionTemplate = "Request query parameters", }, Type = new CodeType { TypeDefinition = parameterClass }, }); @@ -1563,7 +1563,7 @@ private static void AddRequestConfigurationProperties(CodeClass? parameterClass, Kind = CodePropertyKind.Headers, Documentation = new() { - Description = "Request headers", + DescriptionTemplate = "Request headers", }, Type = new CodeType { Name = "RequestHeaders", IsExternal = true }, }, @@ -1573,7 +1573,7 @@ private static void AddRequestConfigurationProperties(CodeClass? parameterClass, Kind = CodePropertyKind.Options, Documentation = new() { - Description = "Request options", + DescriptionTemplate = "Request options", }, Type = new CodeType { Name = "IList", IsExternal = true }, }); @@ -1613,7 +1613,7 @@ private void AddRequestBuilderMethodParameters(OpenApiUrlTreeNode currentNode, O Kind = CodeParameterKind.RequestBody, Documentation = new() { - Description = requestBodySchema.Description.CleanupDescription() is string description && !string.IsNullOrEmpty(description) ? + DescriptionTemplate = requestBodySchema.Description.CleanupDescription() is string description && !string.IsNullOrEmpty(description) ? description : "The request body" }, @@ -1630,7 +1630,7 @@ private void AddRequestBuilderMethodParameters(OpenApiUrlTreeNode currentNode, O Kind = CodeParameterKind.RequestBody, Documentation = new() { - Description = "Binary request body", + DescriptionTemplate = "Binary request body", }, Type = new CodeType { @@ -1657,7 +1657,7 @@ private void AddRequestBuilderMethodParameters(OpenApiUrlTreeNode currentNode, O }, Documentation = new() { - Description = "The request body content type." + DescriptionTemplate = "The request body content type." }, PossibleValues = contentTypes.ToList() }); @@ -1670,7 +1670,7 @@ private void AddRequestBuilderMethodParameters(OpenApiUrlTreeNode currentNode, O Kind = CodeParameterKind.RequestConfiguration, Documentation = new() { - Description = "Configuration for the request such as headers, query parameters, and middleware options.", + DescriptionTemplate = "Configuration for the request such as headers, query parameters, and middleware options.", }, }); } @@ -1715,10 +1715,10 @@ private CodeType CreateInheritedModelDeclaration(OpenApiUrlTreeNode currentNode, codeDeclaration = AddModelDeclarationIfDoesntExist(currentNode, currentSchema, className, shortestNamespace, codeDeclaration as CodeClass); } if (codeDeclaration is CodeClass currentClass && - string.IsNullOrEmpty(currentClass.Documentation.Description) && + string.IsNullOrEmpty(currentClass.Documentation.DescriptionTemplate) && string.IsNullOrEmpty(schema.AllOf.LastOrDefault()?.Description) && !string.IsNullOrEmpty(schema.Description)) - currentClass.Documentation.Description = schema.Description.CleanupDescription(); // the last allof entry often is not a reference and doesn't have a description. + currentClass.Documentation.DescriptionTemplate = schema.Description.CleanupDescription(); // the last allof entry often is not a reference and doesn't have a description. return new CodeType { @@ -1918,7 +1918,7 @@ private CodeElement AddModelDeclarationIfDoesntExist(OpenApiUrlTreeNode currentN Flags = enumFlagsExtension?.IsFlags ?? false, Documentation = new() { - Description = !string.IsNullOrEmpty(schemaDescription) || !string.IsNullOrEmpty(schema.Reference?.Id) ? + DescriptionTemplate = !string.IsNullOrEmpty(schemaDescription) || !string.IsNullOrEmpty(schema.Reference?.Id) ? schemaDescription : // if it's a referenced component, we shouldn't use the path item description as it makes it indeterministic currentNode.GetPathItemDescription(Constants.DefaultOpenApiLabel), }, @@ -1949,7 +1949,7 @@ private static void SetEnumOptions(OpenApiSchema schema, CodeEnum target) SerializationName = x, Documentation = new() { - Description = optionDescription?.Description ?? string.Empty, + DescriptionTemplate = optionDescription?.Description ?? string.Empty, }, }; }) @@ -1980,7 +1980,7 @@ private CodeClass AddModelClass(OpenApiUrlTreeNode currentNode, OpenApiSchema sc { DocumentationLabel = schema.ExternalDocs?.Description ?? string.Empty, DocumentationLink = schema.ExternalDocs?.Url, - Description = (string.IsNullOrEmpty(schema.Description) ? schema.AllOf?.FirstOrDefault(static x => !x.IsReferencedSchema() && !string.IsNullOrEmpty(x.Description))?.Description : schema.Description).CleanupDescription(), + DescriptionTemplate = (string.IsNullOrEmpty(schema.Description) ? schema.AllOf?.FirstOrDefault(static x => !x.IsReferencedSchema() && !string.IsNullOrEmpty(x.Description))?.Description : schema.Description).CleanupDescription(), }, Deprecation = schema.GetDeprecationInformation(), }; @@ -2177,7 +2177,7 @@ internal static void AddDiscriminatorMethod(CodeClass newClass, string discrimin Name = refineMethodName("CreateFromDiscriminatorValue"), Documentation = new() { - Description = "Creates a new instance of the appropriate class based on discriminator value", + DescriptionTemplate = "Creates a new instance of the appropriate class based on discriminator value", }, ReturnType = new CodeType { TypeDefinition = newClass, IsNullable = false }, Kind = CodeMethodKind.Factory, @@ -2193,7 +2193,7 @@ internal static void AddDiscriminatorMethod(CodeClass newClass, string discrimin Kind = CodeParameterKind.ParseNode, Documentation = new() { - Description = "The parse node to use to read the discriminator value and create the object", + DescriptionTemplate = "The parse node to use to read the discriminator value and create the object", }, Optional = false, Type = new CodeType { Name = ParseNodeInterface, IsExternal = true }, @@ -2276,7 +2276,7 @@ internal static void AddSerializationMembers(CodeClass model, bool includeAdditi Access = AccessModifier.Public, Documentation = new() { - Description = "The deserialization information for the current model", + DescriptionTemplate = "The deserialization information for the current model", }, IsAsync = false, ReturnType = new CodeType @@ -2298,7 +2298,7 @@ internal static void AddSerializationMembers(CodeClass model, bool includeAdditi IsAsync = false, Documentation = new() { - Description = "Serializes information the current object", + DescriptionTemplate = "Serializes information the current object", }, ReturnType = new CodeType { Name = VoidType, IsNullable = false, IsExternal = true }, Parent = model, @@ -2308,7 +2308,7 @@ internal static void AddSerializationMembers(CodeClass model, bool includeAdditi Name = "writer", Documentation = new() { - Description = "Serialization writer to use to serialize this model", + DescriptionTemplate = "Serialization writer to use to serialize this model", }, Kind = CodeParameterKind.Serializer, Type = new CodeType { Name = "ISerializationWriter", IsExternal = true, IsNullable = false }, @@ -2330,7 +2330,7 @@ internal static void AddSerializationMembers(CodeClass model, bool includeAdditi Kind = CodePropertyKind.AdditionalData, Documentation = new() { - Description = "Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.", + DescriptionTemplate = "Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.", }, Type = new CodeType { @@ -2358,7 +2358,7 @@ internal static void AddSerializationMembers(CodeClass model, bool includeAdditi Kind = CodePropertyKind.BackingStore, Documentation = new() { - Description = "Stores model information.", + DescriptionTemplate = "Stores model information.", }, ReadOnly = true, Type = new CodeType @@ -2387,7 +2387,7 @@ internal static void AddSerializationMembers(CodeClass model, bool includeAdditi Kind = CodeClassKind.QueryParameters, Documentation = new() { - Description = (operation.Description is string description && !string.IsNullOrEmpty(description) ? + DescriptionTemplate = (operation.Description is string description && !string.IsNullOrEmpty(description) ? description : operation.Summary).CleanupDescription(), }, @@ -2438,7 +2438,7 @@ private void AddPropertyForQueryParameter(OpenApiUrlTreeNode node, OperationType Name = parameter.Name.SanitizeParameterNameForCodeSymbols(), Documentation = new() { - Description = parameter.Description.CleanupDescription(), + DescriptionTemplate = parameter.Description.CleanupDescription(), }, Kind = CodePropertyKind.QueryParameter, Type = resultType, diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index 8220666d32..bb168bb369 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -188,7 +188,7 @@ current.Parent is CodeClass parentClass && ReturnType = (CodeTypeBase)currentProperty.Type.Clone(), Documentation = new() { - Description = $"Gets the {currentProperty.WireName} property value. {currentProperty.Documentation.Description}", + DescriptionTemplate = $"Gets the {currentProperty.WireName} property value. {currentProperty.Documentation.DescriptionTemplate}", }, AccessedProperty = currentProperty, Deprecation = currentProperty.Deprecation, @@ -203,7 +203,7 @@ current.Parent is CodeClass parentClass && Kind = CodeMethodKind.Setter, Documentation = new() { - Description = $"Sets the {currentProperty.WireName} property value. {currentProperty.Documentation.Description}", + DescriptionTemplate = $"Sets the {currentProperty.WireName} property value. {currentProperty.Documentation.DescriptionTemplate}", }, AccessedProperty = currentProperty, ReturnType = new CodeType @@ -223,7 +223,7 @@ current.Parent is CodeClass parentClass && Kind = CodeParameterKind.SetterValue, Documentation = new() { - Description = $"Value to set for the {currentProperty.WireName} property.", + DescriptionTemplate = $"Value to set for the {currentProperty.WireName} property.", }, Optional = parameterAsOptional, Type = (CodeTypeBase)currentProperty.Type.Clone(), @@ -251,7 +251,7 @@ protected static void AddConstructorsForDefaultValues(CodeElement current, bool IsAsync = false, Documentation = new() { - Description = $"Instantiates a new {current.Name} and sets the default values.", + DescriptionTemplate = $"Instantiates a new {current.Name} and sets the default values.", }, }); CrawlTree(current, x => AddConstructorsForDefaultValues(x, addIfInherited, forceAdd, classKindsToExclude)); @@ -483,7 +483,7 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo Name = codeComposedType.Name, Documentation = new() { - Description = description, + DescriptionTemplate = description, }, Deprecation = codeComposedType.Deprecation, }).Last(); @@ -495,7 +495,7 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo Name = codeComposedType.Name, Documentation = new() { - Description = description + DescriptionTemplate = description }, }) .First(); @@ -515,7 +515,7 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo Name = codeComposedType.Name, Documentation = new() { - Description = description + DescriptionTemplate = description }, }) .First(); @@ -528,7 +528,7 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo Type = x, Documentation = new() { - Description = $"Composed type representation for type {x.Name}" + DescriptionTemplate = $"Composed type representation for type {x.Name}" }, }).ToArray()); if (codeComposedType.Types.All(static x => x.TypeDefinition is CodeClass targetClass && targetClass.IsOfKind(CodeClassKind.Model) || @@ -570,7 +570,7 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo IsStatic = false, Documentation = new() { - Description = "Determines if the current object is a wrapper around a composed type", + DescriptionTemplate = "Determines if the current object is a wrapper around a composed type", }, }); } @@ -1324,7 +1324,7 @@ public void AddQueryParameterMapperMethod(CodeElement currentElement, string met Kind = CodeMethodKind.QueryParametersMapper, Documentation = new() { - Description = "Maps the query parameters names to their encoded names for the URI template parsing.", + DescriptionTemplate = "Maps the query parameters names to their encoded names for the URI template parsing.", }, }).First(); method.AddParameter(new CodeParameter @@ -1339,7 +1339,7 @@ public void AddQueryParameterMapperMethod(CodeElement currentElement, string met Optional = false, Documentation = new() { - Description = "The original query parameter name in the class.", + DescriptionTemplate = "The original query parameter name in the class.", }, }); } @@ -1491,7 +1491,7 @@ internal static void AddPrimaryErrorMessage(CodeElement currentElement, string n Type = type(), Documentation = new() { - Description = "The primary error message.", + DescriptionTemplate = "The primary error message.", }, }); } @@ -1507,7 +1507,7 @@ internal static void AddPrimaryErrorMessage(CodeElement currentElement, string n IsStatic = false, Documentation = new() { - Description = "The primary error message.", + DescriptionTemplate = "The primary error message.", }, }); } diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index c6b2a501f6..0878379326 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -444,7 +444,7 @@ protected static void RenameCancellationParameter(CodeElement currentElement) if (currentElement is CodeMethod currentMethod && currentMethod.IsOfKind(CodeMethodKind.RequestExecutor) && currentMethod.Parameters.OfKind(CodeParameterKind.Cancellation) is CodeParameter parameter) { parameter.Name = ContextParameterName; - parameter.Documentation.Description = ContextVarDescription; + parameter.Documentation.DescriptionTemplate = ContextVarDescription; parameter.Kind = CodeParameterKind.Cancellation; parameter.Optional = false; parameter.Type.Name = conventions.ContextVarTypeName; @@ -469,7 +469,7 @@ private static void AddContextParameterToGeneratorMethods(CodeElement currentEle Kind = CodeParameterKind.Cancellation, Optional = false, Documentation = { - Description = ContextVarDescription, + DescriptionTemplate = ContextVarDescription, }, }); CrawlTree(currentElement, AddContextParameterToGeneratorMethods); diff --git a/src/Kiota.Builder/Refiners/JavaRefiner.cs b/src/Kiota.Builder/Refiners/JavaRefiner.cs index 33fe45e1d5..c6145fa812 100644 --- a/src/Kiota.Builder/Refiners/JavaRefiner.cs +++ b/src/Kiota.Builder/Refiners/JavaRefiner.cs @@ -188,7 +188,7 @@ currentMethod.Parent is CodeClass parentClass && Optional = false, Documentation = new() { - Description = "Discriminator value from the payload", + DescriptionTemplate = "Discriminator value from the payload", }, Name = "discriminatorValue" }); @@ -539,7 +539,7 @@ private void AddQueryParameterExtractorMethod(CodeElement currentElement, string Kind = CodeMethodKind.QueryParametersMapper, Documentation = new() { - Description = "Extracts the query parameters into a map for the URI template parsing.", + DescriptionTemplate = "Extracts the query parameters into a map for the URI template parsing.", }, }); } diff --git a/src/Kiota.Builder/Refiners/PhpRefiner.cs b/src/Kiota.Builder/Refiners/PhpRefiner.cs index 93df413e31..9a2df93aac 100644 --- a/src/Kiota.Builder/Refiners/PhpRefiner.cs +++ b/src/Kiota.Builder/Refiners/PhpRefiner.cs @@ -266,7 +266,7 @@ private static void CorrectParameterType(CodeElement codeElement) if (x.IsOfKind(CodeParameterKind.ParseNode)) x.Type.Name = "ParseNode"; else - x.Documentation.Description += " or a String representing the raw URL."; + x.Documentation.DescriptionTemplate += " or a String representing the raw URL."; }); currentMethod.Parameters.Where(x => x.IsOfKind(CodeParameterKind.BackingStore) && currentMethod.IsOfKind(CodeMethodKind.ClientConstructor)).ToList().ForEach(static x => @@ -356,7 +356,7 @@ private static void AddRequestConfigurationConstructors(CodeElement codeElement) IsAsync = false, Documentation = new() { - Description = $"Instantiates a new {codeClass.Name} and sets the default values.", + DescriptionTemplate = $"Instantiates a new {codeClass.Name} and sets the default values.", }, ReturnType = new CodeType { Name = "void" }, }; @@ -417,7 +417,7 @@ private static void AddQueryParameterFactoryMethod(CodeElement codeElement) Kind = CodeMethodKind.Factory, Documentation = new CodeDocumentation { - Description = $"Instantiates a new {queryParameterProperty.Type.Name}." + DescriptionTemplate = $"Instantiates a new {queryParameterProperty.Type.Name}." }, ReturnType = new CodeType { Name = queryParameterProperty.Type.Name, TypeDefinition = queryParameterProperty.Type, IsNullable = false } }; diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 3f1885a4bb..2640af6acb 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -294,7 +294,7 @@ private static void CorrectMethodType(CodeMethod currentMethod) urlTplParams.Type is CodeType originalType) { originalType.Name = "Union[str, Dict[str, Any]]"; - urlTplParams.Documentation.Description = "The raw url or the url-template parameters for the request."; + urlTplParams.Documentation.DescriptionTemplate = "The raw url or the url-template parameters for the request."; } } CorrectCoreTypes(currentMethod.Parent as CodeClass, DateTypesReplacements, currentMethod.Parameters diff --git a/src/Kiota.Builder/Refiners/SwiftRefiner.cs b/src/Kiota.Builder/Refiners/SwiftRefiner.cs index 1a2cc104c5..0d1d59ca6f 100644 --- a/src/Kiota.Builder/Refiners/SwiftRefiner.cs +++ b/src/Kiota.Builder/Refiners/SwiftRefiner.cs @@ -204,7 +204,7 @@ private void AddRootClassForExtensions(CodeElement current) Kind = CodeClassKind.BarrelInitializer, Documentation = new() { - Description = "Root class for extensions", + DescriptionTemplate = "Root class for extensions", }, }); } diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index 43fdb97c1a..6d921a56f1 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -580,7 +580,7 @@ private static void CorrectMethodType(CodeMethod currentMethod) if (currentMethod.Parameters.FirstOrDefault(x => x.IsOfKind(CodeParameterKind.PathParameters)) is CodeParameter urlTplParams && urlTplParams.Type is CodeType originalType) { originalType.Name = "Record"; - urlTplParams.Documentation.Description = "The raw url or the Url template parameters for the request."; + urlTplParams.Documentation.DescriptionTemplate = "The raw url or the Url template parameters for the request."; var unionType = new CodeUnionType { Name = "rawUrlOrTemplateParameters", diff --git a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs index dc9c76c3fc..2f68db8c62 100644 --- a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs @@ -476,7 +476,7 @@ private static void WriteCommandDescription(CodeMethod codeElement, LanguageWrit var builder = new StringBuilder(); if (documentation.DescriptionAvailable) { - builder.Append(documentation.Description); + builder.Append(documentation.DescriptionTemplate); } // Add content type values to description. diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index f7197d2894..7db7e4fba0 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -50,7 +50,7 @@ public void WriteLongDescription(CodeDocumentation documentation, LanguageWriter { writer.WriteLine($"{DocCommentPrefix}"); if (documentation.DescriptionAvailable) - writer.WriteLine($"{DocCommentPrefix}{documentation.Description.CleanupXMLString()}"); + writer.WriteLine($"{DocCommentPrefix}{documentation.DescriptionTemplate.CleanupXMLString()}"); if (documentation.ExternalDocumentationAvailable) writer.WriteLine($"{DocCommentPrefix}{documentation.DocumentationLabel} "); writer.WriteLine($"{DocCommentPrefix}"); diff --git a/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs index 9d5cff7f51..7845a9b2d4 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs @@ -29,7 +29,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write writer.WriteLine(x); writer.StartBlock($"namespace {codeNamespace.Name} {{"); } - conventions.WriteShortDescription(codeElement.Documentation.Description, writer); + conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); if (codeElement.Flags) writer.WriteLine("[Flags]"); conventions.WriteDeprecationAttribute(codeElement, writer); @@ -37,7 +37,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write var idx = 0; foreach (var option in codeElement.Options) { - conventions.WriteShortDescription(option.Documentation.Description, writer); + conventions.WriteShortDescription(option.Documentation.DescriptionTemplate, writer); if (option.IsNameEscaped) { diff --git a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs index 1fb64158b2..a7a75bbc74 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs @@ -12,8 +12,8 @@ public override void WriteCodeElement(CodeIndexer codeElement, LanguageWriter wr ArgumentNullException.ThrowIfNull(writer); if (codeElement.Parent is not CodeClass parentClass) throw new InvalidOperationException("The parent of a property should be a class"); var returnType = conventions.GetTypeString(codeElement.ReturnType, codeElement); - conventions.WriteShortDescription(codeElement.Documentation.Description, writer); - writer.WriteLine($"{conventions.DocCommentPrefix}{codeElement.IndexParameter.Documentation.Description.CleanupXMLString()}"); + conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); + writer.WriteLine($"{conventions.DocCommentPrefix}{codeElement.IndexParameter.Documentation.DescriptionTemplate.CleanupXMLString()}"); conventions.WriteDeprecationAttribute(codeElement, writer); writer.StartBlock($"public {returnType} this[{conventions.GetTypeString(codeElement.IndexParameter.Type, codeElement)} position] {{ get {{"); if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProp) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index 8ecebe7690..65c206678f 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -545,7 +545,7 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer) foreach (var paramWithDescription in code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase)) - writer.WriteLine($"{conventions.DocCommentPrefix}{paramWithDescription.Documentation.Description.CleanupXMLString()}"); + writer.WriteLine($"{conventions.DocCommentPrefix}{paramWithDescription.Documentation.DescriptionTemplate.CleanupXMLString()}"); conventions.WriteDeprecationAttribute(code, writer); } private static readonly BaseCodeParameterOrderComparer parameterOrderComparer = new(); diff --git a/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs index 48fef8fa98..b2f3aa476f 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs @@ -16,7 +16,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w && codeElement.IsOfKind( CodePropertyKind.Custom, CodePropertyKind.QueryParameter);// Other property types are appropriately constructor initialized - conventions.WriteShortDescription(codeElement.Documentation.Description, writer); + conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); conventions.WriteDeprecationAttribute(codeElement, writer); if (isNullableReferenceType) { diff --git a/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs index 79920c97cb..e609e7c11b 100644 --- a/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs @@ -15,7 +15,7 @@ protected override void WriteTypeDeclaration(ClassDeclaration codeElement, Langu ArgumentNullException.ThrowIfNull(writer); var className = codeElement.Name.ToFirstCharacterUpperCase(); if (codeElement.Parent is not CodeClass currentClass) throw new InvalidOperationException("The parent of a class declaration should be a class"); - conventions.WriteShortDescription($"{className} {currentClass.Documentation.Description.ToFirstCharacterLowerCase()}", writer); + conventions.WriteShortDescription($"{className} {currentClass.Documentation.DescriptionTemplate.ToFirstCharacterLowerCase()}", writer); conventions.WriteDeprecation(currentClass, writer); conventions.WriteLinkDescription(currentClass.Documentation, writer); writer.StartBlock($"type {className} struct {{"); diff --git a/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs index 610d736db6..903c4425cd 100644 --- a/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs @@ -22,7 +22,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write writer.CloseBlock(")"); var typeName = codeElement.Name.ToFirstCharacterUpperCase(); - conventions.WriteShortDescription(codeElement.Documentation.Description, writer); + conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); conventions.WriteDeprecation(codeElement, writer); writer.WriteLines($"type {typeName} int", string.Empty, @@ -34,8 +34,8 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write int power = 0; foreach (var item in enumOptions) { - if (!string.IsNullOrEmpty(item.Documentation.Description)) - writer.WriteLine($"// {item.Documentation.Description}"); + if (!string.IsNullOrEmpty(item.Documentation.DescriptionTemplate)) + writer.WriteLine($"// {item.Documentation.DescriptionTemplate}"); if (isMultiValue) writer.WriteLine($"{item.Name.ToUpperInvariant()}_{typeName.ToUpperInvariant()} = {(int)Math.Pow(2, power)}"); diff --git a/src/Kiota.Builder/Writers/Go/CodeInterfaceDeclarationWriter.cs b/src/Kiota.Builder/Writers/Go/CodeInterfaceDeclarationWriter.cs index d6a31487db..80e00c54c5 100644 --- a/src/Kiota.Builder/Writers/Go/CodeInterfaceDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeInterfaceDeclarationWriter.cs @@ -13,7 +13,7 @@ protected override void WriteTypeDeclaration(InterfaceDeclaration codeElement, L ArgumentNullException.ThrowIfNull(writer); if (codeElement.Parent is not CodeInterface inter) throw new InvalidOperationException("Expected the parent to be an interface"); var interName = codeElement.Name.ToFirstCharacterUpperCase(); - conventions.WriteShortDescription($"{interName} {inter.Documentation.Description.ToFirstCharacterLowerCase()}", writer); + conventions.WriteShortDescription($"{interName} {inter.Documentation.DescriptionTemplate.ToFirstCharacterLowerCase()}", writer); if (codeElement.Parent is CodeInterface currentInterface && currentInterface.OriginalClass is not null) conventions.WriteDeprecation(currentInterface.OriginalClass, writer); conventions.WriteLinkDescription(inter.Documentation, writer); diff --git a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs index 9274be5c87..e6398723a4 100644 --- a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs @@ -291,7 +291,7 @@ private void WriteFactoryMethodBodyForUnionModelForUnDiscriminatedTypes(CodeClas private void WriteMethodDocumentation(CodeMethod code, string methodName, LanguageWriter writer) { if (code.Documentation.DescriptionAvailable) - conventions.WriteShortDescription($"{methodName.ToFirstCharacterUpperCase()} {code.Documentation.Description.ToFirstCharacterLowerCase()}", writer); + conventions.WriteShortDescription($"{methodName.ToFirstCharacterUpperCase()} {code.Documentation.DescriptionTemplate.ToFirstCharacterLowerCase()}", writer); conventions.WriteDeprecation(code, writer); conventions.WriteLinkDescription(code.Documentation, writer); } diff --git a/src/Kiota.Builder/Writers/Go/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Go/CodePropertyWriter.cs index a139c2447e..3003f1d81b 100644 --- a/src/Kiota.Builder/Writers/Go/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodePropertyWriter.cs @@ -26,7 +26,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w goto default; default: var returnType = codeElement.Parent is CodeElement parent ? conventions.GetTypeString(codeElement.Type, parent) : string.Empty; - conventions.WriteShortDescription(codeElement.Documentation.Description, writer); + conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); conventions.WriteDeprecation(codeElement, writer); writer.WriteLine($"{propertyName} {returnType}{suffix}"); break; diff --git a/src/Kiota.Builder/Writers/Java/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Java/CodeEnumWriter.cs index f643363124..06ac05e55b 100644 --- a/src/Kiota.Builder/Writers/Java/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeEnumWriter.cs @@ -27,7 +27,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write var lastEnumOption = enumOptions.Last(); foreach (var enumOption in enumOptions) { - conventions.WriteShortDescription(enumOption.Documentation.Description, writer); + conventions.WriteShortDescription(enumOption.Documentation.DescriptionTemplate, writer); writer.WriteLine($"{enumOption.Name}(\"{enumOption.SerializationName}\"){(enumOption == lastEnumOption ? ";" : ",")}"); } writer.WriteLines("public final String value;", diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index 55c24cb677..c50c36e587 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -742,7 +742,7 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, st code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) - .Select(x => $"@param {x.Name} {JavaConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.Description)}") + .Select(x => $"@param {x.Name} {JavaConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.DescriptionTemplate)}") .Union(new[] { returnRemark })); if (!returnVoid) //Nullable/Nonnull annotations for returns are a part of Method Documentation writer.WriteLine(code.ReturnType.IsNullable ? "@jakarta.annotation.Nullable" : "@jakarta.annotation.Nonnull"); diff --git a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs index 7d7d749cad..fd0f8367b6 100644 --- a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs +++ b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs @@ -110,7 +110,7 @@ public void WriteLongDescription(CodeElement element, LanguageWriter writer, IEn { writer.WriteLine(DocCommentStart); if (documentation.DescriptionAvailable) - writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(documentation.Description)}"); + writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(documentation.DescriptionTemplate)}"); foreach (var additionalRemark in remarks.Where(static x => !string.IsNullOrEmpty(x))) writer.WriteLine($"{DocCommentPrefix}{additionalRemark}"); if (element is IDeprecableElement deprecableElement && deprecableElement.Deprecation is not null && deprecableElement.Deprecation.IsDeprecated) diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 8172fcbcbe..075929d5d7 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -258,7 +258,7 @@ private static void AssignPropertyFromParameter(CodeClass parentClass, CodeMetho private void WriteMethodPhpDocs(CodeMethod codeMethod, LanguageWriter writer) { - var methodDescription = codeMethod.Documentation.Description; + var methodDescription = codeMethod.Documentation.DescriptionTemplate; var methodThrows = codeMethod.IsOfKind(CodeMethodKind.RequestExecutor); var hasMethodDescription = !string.IsNullOrEmpty(methodDescription.Trim()); if (!hasMethodDescription && !codeMethod.Parameters.Any()) @@ -306,9 +306,9 @@ private string GetParameterDocString(CodeMethod codeMethod, CodeParameter x) if (codeMethod.IsOfKind(CodeMethodKind.Setter) && (codeMethod.AccessedProperty?.IsOfKind(CodePropertyKind.AdditionalData) ?? false)) { - return $"@param array $value {x?.Documentation.Description}"; + return $"@param array $value {x?.Documentation.DescriptionTemplate}"; } - return $"@param {conventions.GetParameterDocNullable(x, x)} {x?.Documentation.Description}"; + return $"@param {conventions.GetParameterDocNullable(x, x)} {x?.Documentation.DescriptionTemplate}"; } private static readonly BaseCodeParameterOrderComparer parameterOrderComparer = new(); diff --git a/src/Kiota.Builder/Writers/Php/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Php/CodePropertyWriter.cs index bc68cd145e..e29df89762 100644 --- a/src/Kiota.Builder/Writers/Php/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodePropertyWriter.cs @@ -32,7 +32,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w private void WritePropertyDocComment(CodeProperty codeProperty, LanguageWriter writer) { - var propertyDescription = codeProperty.Documentation.Description; + var propertyDescription = codeProperty.Documentation.DescriptionTemplate; var hasDescription = codeProperty.Documentation.DescriptionAvailable; var collectionKind = codeProperty.Type.IsArray || codeProperty.Type.IsCollection; @@ -63,7 +63,7 @@ private string GetCollectionDocString(CodeProperty codeProperty) private void WriteRequestBuilderBody(CodeProperty codeElement, LanguageWriter writer, string returnType, string propertyAccess, string propertyName) { - conventions.WriteShortDescription(codeElement.Documentation.Description, writer); + conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); writer.WriteLine($"{propertyAccess} function {propertyName}(): {returnType} {{"); writer.IncreaseIndent(); conventions.AddRequestBuilderBody(returnType, writer); diff --git a/src/Kiota.Builder/Writers/Php/PhpConventionService.cs b/src/Kiota.Builder/Writers/Php/PhpConventionService.cs index cf02f48669..b29e086c6b 100644 --- a/src/Kiota.Builder/Writers/Php/PhpConventionService.cs +++ b/src/Kiota.Builder/Writers/Php/PhpConventionService.cs @@ -160,7 +160,7 @@ public void WriteLongDescription(CodeDocumentation codeDocumentation, LanguageWr { writer.WriteLine(DocCommentStart); if (codeDocumentation.DescriptionAvailable) - writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(codeDocumentation.Description)}"); + writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(codeDocumentation.DescriptionTemplate)}"); foreach (var additionalRemark in enumerableArray.Where(static x => !string.IsNullOrEmpty(x))) writer.WriteLine($"{DocCommentPrefix}{additionalRemark}"); diff --git a/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs index 89eea849dd..2464a22049 100644 --- a/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs @@ -24,7 +24,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write { codeElement.Options.ToList().ForEach(x => { - conventions.WriteInLineDescription(x.Documentation.Description, writer); + conventions.WriteInLineDescription(x.Documentation.DescriptionTemplate, writer); writer.WriteLine($"{x.Name} = \"{x.WireName}\","); }); } diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index 39af4fe555..b57236d080 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -387,7 +387,7 @@ private void WriteDirectAccessProperties(CodeClass parentClass, LanguageWriter w _codeUsingWriter.WriteDeferredImport(parentClass, enumDefinition.Name, writer); defaultValue = $"{enumDefinition.Name}({defaultValue})"; } - conventions.WriteInLineDescription(propWithDefault.Documentation.Description, writer); + conventions.WriteInLineDescription(propWithDefault.Documentation.DescriptionTemplate, writer); if (parentClass.IsOfKind(CodeClassKind.Model)) { writer.WriteLine($"{propWithDefault.Name}: {(propWithDefault.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(propWithDefault.Type.IsNullable ? "]" : string.Empty)} = {defaultValue}"); @@ -416,7 +416,7 @@ private void WriteSetterAccessProperties(CodeClass parentClass, LanguageWriter w defaultValue = $"{enumDefinition.Name}({defaultValue})"; } var returnType = conventions.GetTypeString(propWithDefault.Type, propWithDefault, true, writer); - conventions.WriteInLineDescription(propWithDefault.Documentation.Description, writer); + conventions.WriteInLineDescription(propWithDefault.Documentation.DescriptionTemplate, writer); var setterString = $"{propWithDefault.Name}: {(propWithDefault.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(propWithDefault.Type.IsNullable ? "]" : string.Empty)} = {defaultValue}"; if (parentClass.IsOfKind(CodeClassKind.Model)) { @@ -434,7 +434,7 @@ private void WriteSetterAccessPropertiesWithoutDefaults(CodeClass parentClass, L .ThenBy(static x => x.Name)) { var returnType = conventions.GetTypeString(propWithoutDefault.Type, propWithoutDefault, true, writer); - conventions.WriteInLineDescription(propWithoutDefault.Documentation.Description, writer); + conventions.WriteInLineDescription(propWithoutDefault.Documentation.DescriptionTemplate, writer); if (parentClass.IsOfKind(CodeClassKind.Model)) writer.WriteLine($"{propWithoutDefault.Name}: {(propWithoutDefault.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(propWithoutDefault.Type.IsNullable ? "]" : string.Empty)} = None"); else @@ -711,7 +711,7 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, st code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) - .Select(x => $"param {x.Name}: {PythonConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.Description)}") + .Select(x => $"param {x.Name}: {PythonConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.DescriptionTemplate)}") .Union(new[] { returnRemark })); conventions.WriteDeprecationWarning(code, writer); } diff --git a/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs index 0605377453..ca963d884f 100644 --- a/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs @@ -38,7 +38,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w case CodePropertyKind.Headers: case CodePropertyKind.Options: case CodePropertyKind.QueryParameter: - conventions.WriteInLineDescription(codeElement.Documentation.Description, writer); + conventions.WriteInLineDescription(codeElement.Documentation.DescriptionTemplate, writer); writer.WriteLine($"{conventions.GetAccessModifier(codeElement.Access)}{codeElement.NamePrefix}{codeElement.Name}: {(codeElement.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(codeElement.Type.IsNullable ? "]" : string.Empty)} = None"); writer.WriteLine(); break; diff --git a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs index caa6829fd6..15776a3bfd 100644 --- a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs +++ b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs @@ -176,7 +176,7 @@ public void WriteLongDescription(CodeDocumentation documentation, LanguageWriter { writer.WriteLine(DocCommentStart); if (documentation.DescriptionAvailable) - writer.WriteLine($"{RemoveInvalidDescriptionCharacters(documentation.Description)}"); + writer.WriteLine($"{RemoveInvalidDescriptionCharacters(documentation.DescriptionTemplate)}"); foreach (var additionalRemark in additionalRemarksArray.Where(static x => !string.IsNullOrEmpty(x))) writer.WriteLine($"{additionalRemark}"); if (documentation.ExternalDocumentationAvailable) diff --git a/src/Kiota.Builder/Writers/Ruby/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeClassDeclarationWriter.cs index 4f4d6947a4..f487f14e51 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeClassDeclarationWriter.cs @@ -54,7 +54,7 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit var derivation = codeElement.Inherits == null ? string.Empty : $" < {conventions.GetNormalizedNamespacePrefixForType(codeElement.Inherits)}{codeElement.Inherits.Name.ToFirstCharacterUpperCase()}"; if (codeElement.Parent is CodeClass parentClass) - conventions.WriteShortDescription(parentClass.Documentation.Description, writer); + conventions.WriteShortDescription(parentClass.Documentation.DescriptionTemplate, writer); writer.StartBlock($"class {codeElement.Name.ToFirstCharacterUpperCase()}{derivation}"); var mixins = !codeElement.Implements.Any() ? string.Empty : $"include {codeElement.Implements.Select(static x => x.Name).Aggregate(static (x, y) => x + ", " + y)}"; writer.WriteLine($"{mixins}"); diff --git a/src/Kiota.Builder/Writers/Ruby/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeEnumWriter.cs index daaa9f5699..990ec5a4ff 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeEnumWriter.cs @@ -16,7 +16,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write return; if (codeElement.Parent is CodeNamespace ns) conventions.WriteNamespaceModules(ns, writer); - conventions.WriteShortDescription(codeElement.Documentation.Description, writer); + conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); writer.StartBlock($"{codeElement.Name.ToFirstCharacterUpperCase()} = {{"); codeElement.Options.ToList().ForEach(x => writer.WriteLine($"{x.Name.ToFirstCharacterUpperCase()}: :{x.Name.ToFirstCharacterUpperCase()},")); writer.CloseBlock(); diff --git a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs index d80ae29ec3..3d9346fa60 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs @@ -358,15 +358,15 @@ private void WriteMethodPrototype(CodeMethod code, LanguageWriter writer) } private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer) { - var isDescriptionPresent = !string.IsNullOrEmpty(code.Documentation.Description); - var parametersWithDescription = code.Parameters.Where(x => !string.IsNullOrEmpty(code.Documentation.Description)).OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase).ToArray(); + var isDescriptionPresent = !string.IsNullOrEmpty(code.Documentation.DescriptionTemplate); + var parametersWithDescription = code.Parameters.Where(x => !string.IsNullOrEmpty(code.Documentation.DescriptionTemplate)).OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase).ToArray(); if (isDescriptionPresent || parametersWithDescription.Length != 0) { writer.WriteLine(conventions.DocCommentStart); if (isDescriptionPresent) - writer.WriteLine($"{conventions.DocCommentPrefix}{RubyConventionService.RemoveInvalidDescriptionCharacters(code.Documentation.Description)}"); + writer.WriteLine($"{conventions.DocCommentPrefix}{RubyConventionService.RemoveInvalidDescriptionCharacters(code.Documentation.DescriptionTemplate)}"); foreach (var paramWithDescription in parametersWithDescription) - writer.WriteLine($"{conventions.DocCommentPrefix}@param {paramWithDescription.Name.ToSnakeCase()} {RubyConventionService.RemoveInvalidDescriptionCharacters(paramWithDescription.Documentation.Description)}"); + writer.WriteLine($"{conventions.DocCommentPrefix}@param {paramWithDescription.Name.ToSnakeCase()} {RubyConventionService.RemoveInvalidDescriptionCharacters(paramWithDescription.Documentation.DescriptionTemplate)}"); if (code.IsAsync) writer.WriteLine($"{conventions.DocCommentPrefix}@return a Fiber of {code.ReturnType.Name.ToSnakeCase()}"); diff --git a/src/Kiota.Builder/Writers/Ruby/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodePropertyWriter.cs index f4e2bd074d..12810768c6 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodePropertyWriter.cs @@ -11,7 +11,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w ArgumentNullException.ThrowIfNull(codeElement); ArgumentNullException.ThrowIfNull(writer); if (codeElement.ExistsInExternalBaseType) return; - conventions.WriteShortDescription(codeElement.Documentation.Description, writer); + conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); var returnType = conventions.GetTypeString(codeElement.Type, codeElement); if (codeElement.Parent is not CodeClass parentClass) throw new InvalidOperationException("The parent of a property should be a class"); switch (codeElement.Kind) diff --git a/src/Kiota.Builder/Writers/Swift/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Swift/CodeClassDeclarationWriter.cs index ae106e1cfd..4843c18437 100644 --- a/src/Kiota.Builder/Writers/Swift/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Swift/CodeClassDeclarationWriter.cs @@ -19,7 +19,7 @@ protected override void WriteTypeDeclaration(ClassDeclaration codeElement, Langu .ToArray(); var derivation = derivedTypes.Length != 0 ? ": " + derivedTypes.Select(x => x.ToFirstCharacterUpperCase()).Aggregate(static (x, y) => $"{x}, {y}") + " " : string.Empty; if (codeElement.Parent is CodeClass parentClass) - conventions.WriteShortDescription(parentClass.Documentation.Description, writer); + conventions.WriteShortDescription(parentClass.Documentation.DescriptionTemplate, writer); writer.WriteLine($"public class {codeElement.Name.ToFirstCharacterUpperCase()} {derivation}{{"); writer.IncreaseIndent(); } diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index f18517501a..33a17b55a0 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -226,7 +226,7 @@ private void WriteEnumObjectConstant(CodeConstant codeElement, LanguageWriter wr writer.StartBlock($"export const {codeElement.Name.ToFirstCharacterUpperCase()} = {{"); codeEnum.Options.ToList().ForEach(x => { - conventions.WriteShortDescription(x.Documentation.Description, writer); + conventions.WriteShortDescription(x.Documentation.DescriptionTemplate, writer); writer.WriteLine($"{x.Name.ToFirstCharacterUpperCase()}: \"{x.WireName}\","); }); writer.CloseBlock("} as const;"); diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs index f90f287497..ca7bab6eab 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs @@ -42,7 +42,7 @@ internal static void WriteMethodDocumentationInternal(CodeMethod code, LanguageW code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name) - .Select(x => $"@param {x.Name} {TypeScriptConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.Description)}") + .Select(x => $"@param {x.Name} {TypeScriptConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.DescriptionTemplate)}") .Union(new[] { returnRemark })); } private static readonly BaseCodeParameterOrderComparer parameterOrderComparer = new(); diff --git a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs index 0c0901e5f4..78b6b61ef1 100644 --- a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs +++ b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs @@ -150,7 +150,7 @@ public void WriteLongDescription(IDocumentedElement documentedElement, LanguageW { writer.WriteLine(DocCommentStart); if (documentedElement.Documentation.DescriptionAvailable) - writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(documentedElement.Documentation.Description)}"); + writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(documentedElement.Documentation.DescriptionTemplate)}"); foreach (var additionalRemark in remarks) writer.WriteLine($"{DocCommentPrefix}{additionalRemark}"); diff --git a/tests/Kiota.Builder.Tests/CodeDOM/CodeEnumTests.cs b/tests/Kiota.Builder.Tests/CodeDOM/CodeEnumTests.cs index 54ed7ebd66..1eb403c1b0 100644 --- a/tests/Kiota.Builder.Tests/CodeDOM/CodeEnumTests.cs +++ b/tests/Kiota.Builder.Tests/CodeDOM/CodeEnumTests.cs @@ -16,7 +16,7 @@ public void EnumInits() Name = "Enum", Documentation = new() { - Description = "some description", + DescriptionTemplate = "some description", }, Flags = true, }).First(); diff --git a/tests/Kiota.Builder.Tests/CodeDOM/CodeIndexerTests.cs b/tests/Kiota.Builder.Tests/CodeDOM/CodeIndexerTests.cs index 9828ae870a..b6f8487d3e 100644 --- a/tests/Kiota.Builder.Tests/CodeDOM/CodeIndexerTests.cs +++ b/tests/Kiota.Builder.Tests/CodeDOM/CodeIndexerTests.cs @@ -12,7 +12,7 @@ public void IndexerInits() Name = "idx", Documentation = new() { - Description = "some description", + DescriptionTemplate = "some description", }, ReturnType = new CodeType(), IndexParameter = new() { Name = "param", Type = new CodeType(), } diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index 228f8886d7..cc0f7850af 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -294,15 +294,15 @@ public async Task ParsesEnumDescriptions() var firstOption = enumDef.Options.First(); Assert.Equal("+1", firstOption.SerializationName); Assert.Equal("plus_1", firstOption.Name); - Assert.Empty(firstOption.Documentation.Description); + Assert.Empty(firstOption.Documentation.DescriptionTemplate); var secondOption = enumDef.Options.ElementAt(1); Assert.Equal("-1", secondOption.SerializationName); Assert.Equal("minus_1", secondOption.Name); - Assert.Empty(secondOption.Documentation.Description); + Assert.Empty(secondOption.Documentation.DescriptionTemplate); var thirdOption = enumDef.Options.ElementAt(2); Assert.Equal("Standard_LRS", thirdOption.SerializationName); Assert.Equal("StandardLocalRedundancy", thirdOption.Name); - Assert.NotEmpty(thirdOption.Documentation.Description); + Assert.NotEmpty(thirdOption.Documentation.DescriptionTemplate); Assert.Single(enumDef.Options.Where(static x => x.Name.Equals("Premium_LRS", StringComparison.OrdinalIgnoreCase))); } @@ -4888,7 +4888,7 @@ public void ModelsDoesntUsePathDescriptionWhenAvailable() Assert.NotNull(modelsNS); var responseClass = modelsNS.Classes.FirstOrDefault(x => x.IsOfKind(CodeClassKind.Model)); Assert.NotNull(responseClass); - Assert.Empty(responseClass.Documentation.Description); + Assert.Empty(responseClass.Documentation.DescriptionTemplate); } [Fact] public void CleansUpInvalidDescriptionCharacters() @@ -4952,7 +4952,7 @@ public void CleansUpInvalidDescriptionCharacters() Assert.NotNull(modelsNS); var responseClass = modelsNS.Classes.FirstOrDefault(x => x.IsOfKind(CodeClassKind.Model)); Assert.NotNull(responseClass); - Assert.Equal("some description with invalid characters: ", responseClass.Documentation.Description); + Assert.Equal("some description with invalid characters: ", responseClass.Documentation.DescriptionTemplate); } [InlineData("application/json")] [InlineData("application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8")] @@ -5072,7 +5072,7 @@ public void ModelsUseDescriptionWhenAvailable(bool excludeBackwardCompatible) Assert.NotNull(modelsSubNS); var responseClass = modelsSubNS.FindChildByName("AnswerGetResponse", false); Assert.NotNull(responseClass); - Assert.Equal("some description", responseClass.Documentation.Description); + Assert.Equal("some description", responseClass.Documentation.DescriptionTemplate); var obsoleteResponseClass = modelsSubNS.FindChildByName("AnswerResponse", false); if (excludeBackwardCompatible) @@ -5080,13 +5080,13 @@ public void ModelsUseDescriptionWhenAvailable(bool excludeBackwardCompatible) else { Assert.NotNull(obsoleteResponseClass); - Assert.Equal("some description", obsoleteResponseClass.Documentation.Description); + Assert.Equal("some description", obsoleteResponseClass.Documentation.DescriptionTemplate); Assert.True(obsoleteResponseClass.Deprecation.IsDeprecated); } var requestBuilderClass = modelsSubNS.Classes.FirstOrDefault(static c => c.IsOfKind(CodeClassKind.RequestBuilder)); Assert.NotNull(requestBuilderClass); - Assert.Equal("some path item description", requestBuilderClass.Documentation.Description); + Assert.Equal("some path item description", requestBuilderClass.Documentation.DescriptionTemplate); if (excludeBackwardCompatible) Assert.Single(requestBuilderClass.Methods.Where(static x => x.Kind is CodeMethodKind.RequestExecutor)); @@ -5095,7 +5095,7 @@ public void ModelsUseDescriptionWhenAvailable(bool excludeBackwardCompatible) var responseProperty = codeModel.FindNamespaceByName("TestSdk").Classes.SelectMany(c => c.Properties).FirstOrDefault(static p => p.Kind == CodePropertyKind.RequestBuilder); Assert.NotNull(responseProperty); - Assert.Equal("some path item description", responseProperty.Documentation.Description); + Assert.Equal("some path item description", responseProperty.Documentation.DescriptionTemplate); } [Fact] @@ -6219,7 +6219,7 @@ public async Task IndexerAndRequestBuilderNamesMatch() var collectionIndexer = collectionRequestBuilder.Indexer; Assert.NotNull(collectionIndexer); Assert.Equal("string", collectionIndexer.IndexParameter.Type.Name, StringComparer.OrdinalIgnoreCase); - Assert.Equal("Unique identifier of the item", collectionIndexer.IndexParameter.Documentation.Description, StringComparer.OrdinalIgnoreCase); + Assert.Equal("Unique identifier of the item", collectionIndexer.IndexParameter.Documentation.DescriptionTemplate, StringComparer.OrdinalIgnoreCase); Assert.False(collectionIndexer.Deprecation.IsDeprecated); var itemRequestBuilderNamespace = codeModel.FindNamespaceByName("ApiSdk.me.posts.item"); Assert.NotNull(itemRequestBuilderNamespace); @@ -6309,7 +6309,7 @@ public async Task IndexerTypeIsAccurateAndBackwardCompatibleIndexersAreAdded() var postsCollectionIndexer = postsCollectionRequestBuilder.Indexer; Assert.NotNull(postsCollectionIndexer); Assert.Equal("integer", postsCollectionIndexer.IndexParameter.Type.Name); - Assert.Equal("The id of the pet to retrieve", postsCollectionIndexer.IndexParameter.Documentation.Description, StringComparer.OrdinalIgnoreCase); + Assert.Equal("The id of the pet to retrieve", postsCollectionIndexer.IndexParameter.Documentation.DescriptionTemplate, StringComparer.OrdinalIgnoreCase); Assert.False(postsCollectionIndexer.IndexParameter.Type.IsNullable); Assert.False(postsCollectionIndexer.Deprecation.IsDeprecated); var postsCollectionStringIndexer = postsCollectionRequestBuilder.FindChildByName($"{postsCollectionIndexer.Name}-string"); @@ -6328,7 +6328,7 @@ public async Task IndexerTypeIsAccurateAndBackwardCompatibleIndexersAreAdded() var authorsCollectionIndexer = authorsCollectionRequestBuilder.Indexer; Assert.NotNull(authorsCollectionIndexer); Assert.Equal("Guid", authorsCollectionIndexer.IndexParameter.Type.Name); - Assert.Equal("The id of the author's posts to retrieve", authorsCollectionIndexer.IndexParameter.Documentation.Description, StringComparer.OrdinalIgnoreCase); + Assert.Equal("The id of the author's posts to retrieve", authorsCollectionIndexer.IndexParameter.Documentation.DescriptionTemplate, StringComparer.OrdinalIgnoreCase); Assert.False(authorsCollectionIndexer.IndexParameter.Type.IsNullable); Assert.False(authorsCollectionIndexer.Deprecation.IsDeprecated); var authorsCllectionStringIndexer = authorsCollectionRequestBuilder.FindChildByName($"{authorsCollectionIndexer.Name}-string"); @@ -6347,7 +6347,7 @@ public async Task IndexerTypeIsAccurateAndBackwardCompatibleIndexersAreAdded() var actorsCollectionIndexer = actorsCollectionRequestBuilder.Indexer; Assert.NotNull(actorsCollectionIndexer); Assert.Equal("Guid", actorsCollectionIndexer.IndexParameter.Type.Name); - Assert.Equal("The id of the actor", actorsCollectionIndexer.IndexParameter.Documentation.Description, StringComparer.OrdinalIgnoreCase); + Assert.Equal("The id of the actor", actorsCollectionIndexer.IndexParameter.Documentation.DescriptionTemplate, StringComparer.OrdinalIgnoreCase); Assert.False(actorsCollectionIndexer.IndexParameter.Type.IsNullable); Assert.False(actorsCollectionIndexer.Deprecation.IsDeprecated); var actorsCllectionStringIndexer = actorsCollectionRequestBuilder.FindChildByName($"{actorsCollectionIndexer.Name}-string"); @@ -6922,10 +6922,10 @@ public async Task DescriptionTakenFromAllOf() var document = await builder.CreateOpenApiDocumentAsync(fs); var node = builder.CreateUriSpace(document); var codeModel = builder.CreateSourceModel(node); - Assert.Equal("base entity", codeModel.FindChildByName("entity").Documentation.Description); - Assert.Equal("directory object", codeModel.FindChildByName("directoryObject").Documentation.Description); - Assert.Equal("sub1", codeModel.FindChildByName("sub1").Documentation.Description); - Assert.Equal("sub2", codeModel.FindChildByName("sub2").Documentation.Description); + Assert.Equal("base entity", codeModel.FindChildByName("entity").Documentation.DescriptionTemplate); + Assert.Equal("directory object", codeModel.FindChildByName("directoryObject").Documentation.DescriptionTemplate); + Assert.Equal("sub1", codeModel.FindChildByName("sub1").Documentation.DescriptionTemplate); + Assert.Equal("sub2", codeModel.FindChildByName("sub2").Documentation.DescriptionTemplate); } [Fact] public async Task CleanupSymbolNameDoesNotCauseNameConflicts() diff --git a/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs index e965caa613..85e263c2f3 100644 --- a/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/CSharpLanguageRefinerTests.cs @@ -435,7 +435,7 @@ public async Task KeepsCancellationParametersInRequestExecutors() Kind = CodeParameterKind.Cancellation, Documentation = new() { - Description = "Cancellation token to use when cancelling requests", + DescriptionTemplate = "Cancellation token to use when cancelling requests", }, Type = new CodeType { Name = "CancellationToken", IsExternal = true }, }; diff --git a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs index 49c0e45252..3d7d08a7f0 100644 --- a/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs @@ -663,7 +663,7 @@ public async Task RenamesCancellationParametersInRequestExecutors() Kind = CodeParameterKind.Cancellation, Documentation = new() { - Description = "Cancellation token to use when cancelling requests", + DescriptionTemplate = "Cancellation token to use when cancelling requests", }, Type = new CodeType { Name = "CancelletionToken", IsExternal = true }, }; diff --git a/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs index e81a45548d..b8416e1fc5 100644 --- a/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/JavaLanguageRefinerTests.cs @@ -396,7 +396,7 @@ public async Task DoesNotKeepCancellationParametersInRequestExecutors() Kind = CodeParameterKind.Cancellation, Documentation = new() { - Description = "Cancellation token to use when cancelling requests", + DescriptionTemplate = "Cancellation token to use when cancelling requests", }, Type = new CodeType { Name = "CancelletionToken", IsExternal = true }, }; diff --git a/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs index 5c37b2ce5d..432f17db69 100644 --- a/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs @@ -535,7 +535,7 @@ public async Task DoesNotKeepCancellationParametersInRequestExecutors() Kind = CodeParameterKind.Cancellation, Documentation = new() { - Description = "Cancellation token to use when cancelling requests", + DescriptionTemplate = "Cancellation token to use when cancelling requests", }, Type = new CodeType { Name = "CancellationToken", IsExternal = true }, }; diff --git a/tests/Kiota.Builder.Tests/Refiners/RubyLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/RubyLanguageRefinerTests.cs index 62539c1fdb..fc0957ceec 100644 --- a/tests/Kiota.Builder.Tests/Refiners/RubyLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/RubyLanguageRefinerTests.cs @@ -49,7 +49,7 @@ public async Task DoesNotKeepCancellationParametersInRequestExecutors() Kind = CodeParameterKind.Cancellation, Documentation = new() { - Description = "Cancellation token to use when cancelling requests", + DescriptionTemplate = "Cancellation token to use when cancelling requests", }, Type = new CodeType { Name = "CancellationToken", IsExternal = true }, }; diff --git a/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs index accd0ea3a6..b3030025e0 100644 --- a/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/TypeScriptLanguageRefinerTests.cs @@ -602,7 +602,7 @@ public async Task DoesNotKeepCancellationParametersInRequestExecutors() Kind = CodeParameterKind.Cancellation, Documentation = new() { - Description = "Cancellation token to use when cancelling requests", + DescriptionTemplate = "Cancellation token to use when cancelling requests", }, Type = new CodeType { Name = "CancellationToken", IsExternal = true }, }; diff --git a/tests/Kiota.Builder.Tests/Writers/CLI/CliCodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CLI/CliCodeMethodWriterTests.cs index a9e8a8f7ac..c211a7121c 100644 --- a/tests/Kiota.Builder.Tests/Writers/CLI/CliCodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CLI/CliCodeMethodWriterTests.cs @@ -134,7 +134,7 @@ private static void AddPathQueryAndHeaderParameters(CodeMethod method) DefaultValue = "test", Documentation = new() { - Description = "The q option", + DescriptionTemplate = "The q option", }, Optional = true }); @@ -151,7 +151,7 @@ private static void AddPathQueryAndHeaderParameters(CodeMethod method) Type = stringType, Documentation = new() { - Description = "The test header", + DescriptionTemplate = "The test header", }, }); } @@ -252,7 +252,7 @@ public void WritesIndexerCommands() public void WritesMatchingIndexerCommandsIntoExecutableCommand() { method.Kind = CodeMethodKind.CommandBuilder; - method.Documentation.Description = "Test description"; + method.Documentation.DescriptionTemplate = "Test description"; method.SimpleName = "User"; method.HttpMethod = HttpMethod.Get; var stringType = new CodeType @@ -438,7 +438,7 @@ public void WritesMatchingIndexerCommandsIntoContainerCommand() public void WritesExecutableCommandThatReusesMatchingNavCommandInstance() { method.Kind = CodeMethodKind.CommandBuilder; - method.Documentation.Description = "Test description"; + method.Documentation.DescriptionTemplate = "Test description"; method.SimpleName = "User"; method.HttpMethod = HttpMethod.Get; var stringType = new CodeType { Name = "string" }; @@ -715,7 +715,7 @@ public void WritesContainerCommandWithConflictingTypes() public void WritesExecutableCommandWithRelatedLinksInDescription() { method.Kind = CodeMethodKind.CommandBuilder; - method.Documentation.Description = "Test description"; + method.Documentation.DescriptionTemplate = "Test description"; method.Documentation.DocumentationLink = new Uri("https://test.com/help/description"); method.SimpleName = "User"; method.HttpMethod = HttpMethod.Get; @@ -768,7 +768,7 @@ public void WritesExecutableCommandWithRelatedLinksInDescription() }, Documentation = new() { - Description = "Documentation label2", + DescriptionTemplate = "Documentation label2", DocumentationLink = new Uri("https://test.com/help/description") } }); @@ -783,7 +783,7 @@ public void WritesExecutableCommandWithRelatedLinksInDescription() }, Documentation = new() { - Description = "Documentation label3", + DescriptionTemplate = "Documentation label3", DocumentationLabel = "Test label", DocumentationLink = new Uri("https://test.com/help/description") } @@ -823,7 +823,7 @@ public void WritesExecutableCommandWithRelatedLinksInDescription() public void WritesExecutableCommandForGetRequestPrimitive() { method.Kind = CodeMethodKind.CommandBuilder; - method.Documentation.Description = "Test description"; + method.Documentation.DescriptionTemplate = "Test description"; method.SimpleName = "User"; method.HttpMethod = HttpMethod.Get; var stringType = new CodeType @@ -893,7 +893,7 @@ public void WritesExecutableCommandForPagedGetRequestModel() { method.Kind = CodeMethodKind.CommandBuilder; - method.Documentation.Description = "Test description"; + method.Documentation.DescriptionTemplate = "Test description"; method.SimpleName = "User"; method.HttpMethod = HttpMethod.Get; var userClass = root.AddClass(new CodeClass @@ -966,7 +966,7 @@ public void WritesExecutableCommandForGetRequestModel() { method.Kind = CodeMethodKind.CommandBuilder; - method.Documentation.Description = "Test description"; + method.Documentation.DescriptionTemplate = "Test description"; method.SimpleName = "User"; method.HttpMethod = HttpMethod.Get; var userClass = root.AddClass(new CodeClass @@ -1142,7 +1142,7 @@ public void WritesExecutableCommandForPostRequestWithModelBodyAndContentType() Name = "contentType", Kind = CodeParameterKind.RequestBodyContentType, Type = stringType, - Documentation = new() { Description = "The request content type." }, + Documentation = new() { DescriptionTemplate = "The request content type." }, PossibleValues = new List { "application/json", "text/plain" } }; method.OriginalMethod.AddParameter(contentTypeParam); diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs index b68301d0f5..e5e6590f4f 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs @@ -113,11 +113,11 @@ public void WritesFlagsEnum() [Fact] public void WritesEnumOptionDescription() { - Option.Documentation.Description = "Some option description"; + Option.Documentation.DescriptionTemplate = "Some option description"; currentEnum.AddOption(Option); writer.Write(currentEnum); var result = tw.ToString(); - Assert.Contains($"{Option.Documentation.Description}", result); + Assert.Contains($"{Option.Documentation.DescriptionTemplate}", result); AssertExtensions.CurlyBracesAreClosed(result, 1); } [Fact] diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeIndexerWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeIndexerWriterTests.cs index cdaad32402..93bec8f238 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeIndexerWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeIndexerWriterTests.cs @@ -43,7 +43,7 @@ public CodeIndexerWriterTests() SerializationName = "id", Documentation = new() { - Description = "some description" + DescriptionTemplate = "some description" } } }; diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs index 341ce241d3..bb15cda15e 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs @@ -1232,12 +1232,12 @@ public void WritesSerializerBody() public void WritesMethodAsyncDescription() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; var parameter = new CodeParameter { Documentation = new() { - Description = ParamDescription + DescriptionTemplate = ParamDescription }, Name = ParamName, Type = new CodeType @@ -1261,13 +1261,13 @@ public void WritesMethodAsyncDescription() public void WritesMethodSyncDescription() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.IsAsync = false; var parameter = new CodeParameter { Documentation = new() { - Description = ParamDescription + DescriptionTemplate = ParamDescription }, Name = ParamName, Type = new CodeType @@ -1285,7 +1285,7 @@ public void WritesMethodSyncDescription() public void WritesMethodDescriptionLink() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.Documentation.DocumentationLabel = "see more"; method.Documentation.DocumentationLink = new("https://foo.org/docs"); method.IsAsync = false; @@ -1293,7 +1293,7 @@ public void WritesMethodDescriptionLink() { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeEnumWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeEnumWriterTests.cs index dec80b3e33..91b0c5514f 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeEnumWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeEnumWriterTests.cs @@ -128,14 +128,14 @@ public void WritesEnumOptionDescription() { Documentation = new() { - Description = "Some option description", + DescriptionTemplate = "Some option description", }, Name = "option1", }; currentEnum.AddOption(option); writer.Write(currentEnum); var result = tw.ToString(); - Assert.Contains($"// {option.Documentation.Description}", result); + Assert.Contains($"// {option.Documentation.DescriptionTemplate}", result); AssertExtensions.CurlyBracesAreClosed(result); } } diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs index fc905bcb8d..cda1087fd7 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs @@ -1563,13 +1563,13 @@ public void WritesSerializerBackingStoreBody() public void WritesMethodSyncDescription() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.IsAsync = false; var parameter = new CodeParameter { Documentation = new() { - Description = ParamDescription + DescriptionTemplate = ParamDescription }, Name = ParamName, Type = new CodeType @@ -1587,7 +1587,7 @@ public void WritesMethodSyncDescription() public void WritesMethodDescriptionLink() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.Documentation.DocumentationLabel = "see more"; method.Documentation.DocumentationLink = new("https://foo.org/docs"); method.IsAsync = false; @@ -1595,7 +1595,7 @@ public void WritesMethodDescriptionLink() { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType @@ -1748,7 +1748,7 @@ public void WritesDescription() Name = "string" } }); - method.Documentation.Description = "Some description"; + method.Documentation.DescriptionTemplate = "Some description"; writer.Write(method); var result = tw.ToString(); Assert.Contains($"// {method.Name.ToFirstCharacterUpperCase()} some description", result); diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeEnumWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeEnumWriterTests.cs index 04d4fd02b2..16138b6bc0 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeEnumWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeEnumWriterTests.cs @@ -68,14 +68,14 @@ public void WritesEnumOptionDescription() { Documentation = new() { - Description = "Some option description", + DescriptionTemplate = "Some option description", }, Name = "option1", }; currentEnum.AddOption(option); writer.Write(currentEnum); var result = tw.ToString(); - Assert.Contains($"/** {option.Documentation.Description} */", result); + Assert.Contains($"/** {option.Documentation.DescriptionTemplate} */", result); AssertExtensions.CurlyBracesAreClosed(result); } [Fact] diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index 8a81d8ea2f..635df542a1 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -1490,13 +1490,13 @@ public void WritesSerializerBody() public void WritesMethodSyncDescription() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.IsAsync = false; var parameter = new CodeParameter { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType @@ -1514,7 +1514,7 @@ public void WritesMethodSyncDescription() public void WritesMethodDescriptionLink() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.Documentation.DocumentationLabel = "see more"; method.Documentation.DocumentationLink = new("https://foo.org/docs"); method.IsAsync = false; @@ -1522,7 +1522,7 @@ public void WritesMethodDescriptionLink() { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodeClassDeclarationWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodeClassDeclarationWriterTests.cs index ef44985410..ba823a0e42 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodeClassDeclarationWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodeClassDeclarationWriterTests.cs @@ -170,7 +170,7 @@ public async Task AddsImportsToRequestConfigClasses() Kind = CodePropertyKind.QueryParameter, Documentation = new() { - Description = "Filter by start time", + DescriptionTemplate = "Filter by start time", }, Type = new CodeType { @@ -183,7 +183,7 @@ public async Task AddsImportsToRequestConfigClasses() Kind = CodePropertyKind.QueryParameter, Documentation = new() { - Description = "Filter by end time", + DescriptionTemplate = "Filter by end time", }, Type = new CodeType { @@ -196,7 +196,7 @@ public async Task AddsImportsToRequestConfigClasses() Kind = CodePropertyKind.QueryParameter, Documentation = new() { - Description = "Filter by start date", + DescriptionTemplate = "Filter by start date", }, Type = new CodeType { @@ -209,7 +209,7 @@ public async Task AddsImportsToRequestConfigClasses() Kind = CodePropertyKind.QueryParameter, Documentation = new() { - Description = "Filter by status", + DescriptionTemplate = "Filter by status", }, Type = new CodeType { @@ -225,7 +225,7 @@ public async Task AddsImportsToRequestConfigClasses() { Name = "queryParameters", Kind = CodePropertyKind.QueryParameters, - Documentation = new() { Description = "Request query parameters", }, + Documentation = new() { DescriptionTemplate = "Request query parameters", }, Type = new CodeType { Name = queryParamClass.Name, TypeDefinition = queryParamClass }, } }); diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs index 2c5646218d..f9fa005b23 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs @@ -79,7 +79,7 @@ private void setup(bool withInheritance = false) IsAsync = true, Documentation = new() { - Description = "This is a very good method to try all the good things", + DescriptionTemplate = "This is a very good method to try all the good things", }, ReturnType = new CodeType { @@ -100,7 +100,7 @@ private void AddRequestProperties() DefaultValue = "https://graph.microsoft.com/v1.0/", Documentation = new() { - Description = "The URL template", + DescriptionTemplate = "The URL template", }, Kind = CodePropertyKind.UrlTemplate, Type = new CodeType { Name = "string" } @@ -112,7 +112,7 @@ private void AddRequestProperties() DefaultValue = "[]", Documentation = new() { - Description = "The Path parameters.", + DescriptionTemplate = "The Path parameters.", }, Kind = CodePropertyKind.PathParameters, Type = new CodeType { Name = "array" } @@ -123,7 +123,7 @@ private void AddRequestProperties() Access = AccessModifier.Protected, Documentation = new() { - Description = "The request Adapter", + DescriptionTemplate = "The request Adapter", }, Kind = CodePropertyKind.RequestAdapter, Type = new CodeType @@ -213,7 +213,7 @@ public void WriteABasicMethod() public void WriteMethodWithNoDescription() { setup(); - method.Documentation.Description = string.Empty; + method.Documentation.DescriptionTemplate = string.Empty; _codeMethodWriter.WriteCodeElement(method, languageWriter); var result = stringWriter.ToString(); @@ -248,7 +248,7 @@ public async Task WriteRequestExecutor() }, Documentation = new() { - Description = "This will send a POST request", + DescriptionTemplate = "This will send a POST request", DocumentationLink = new Uri("https://learn.microsoft.com/"), DocumentationLabel = "Learning" }, @@ -342,7 +342,7 @@ public async Task WritesRequestExecutorForEnumTypes() }, Documentation = new() { - Description = "This will send a POST request", + DescriptionTemplate = "This will send a POST request", DocumentationLink = new Uri("https://learn.microsoft.com/"), DocumentationLabel = "Learning" }, @@ -410,7 +410,7 @@ public async Task WritesRequestExecutorForEnumTypes() { Name = "Status", Documentation = new() { - Description = "Status Enum", + DescriptionTemplate = "Status Enum", }, }}, Access = AccessModifier.Private }, "$writer->writeEnumValue('status', $this->getStatus());" @@ -421,7 +421,7 @@ public async Task WritesRequestExecutorForEnumTypes() { Name = "Architecture", CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Array, TypeDefinition = new CodeEnum { Name = "Architecture", Documentation = new() { - Description = "Arch Enum, accepts x64, x86, hybrid" + DescriptionTemplate = "Arch Enum, accepts x64, x86, hybrid" }, } }, Access = AccessModifier.Private, Kind = CodePropertyKind.Custom }, @@ -736,7 +736,7 @@ public async Task WriteIndexerBody() Kind = CodeMethodKind.IndexerBackwardCompatibility, Documentation = new() { - Description = "Get messages by a specific ID.", + DescriptionTemplate = "Get messages by a specific ID.", }, OriginalIndexer = new CodeIndexer { @@ -838,7 +838,7 @@ public async Task WriteIndexerBody() { Name = "EmailAddress", Kind = CodeClassKind.Model, Documentation = new() { - Description = "Email", + DescriptionTemplate = "Email", }, Parent = GetParentClassInStaticContext() }, CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Array }, Access = AccessModifier.Private}, "'users' => fn(ParseNode $n) => $o->setUsers($n->getCollectionOfObjectValues([EmailAddress::class, 'createFromDiscriminatorValue']))," @@ -873,7 +873,7 @@ public async Task WriteDeserializer(CodeProperty property, params string[] expec Kind = CodeMethodKind.Deserializer, Documentation = new() { - Description = "Just some random method", + DescriptionTemplate = "Just some random method", }, ReturnType = new CodeType { @@ -1049,7 +1049,7 @@ public async Task WriteDeserializerMergeWhenHasParent() Kind = CodeMethodKind.Deserializer, Documentation = new() { - Description = "Just some random method", + DescriptionTemplate = "Just some random method", }, ReturnType = new CodeType { @@ -1077,7 +1077,7 @@ public async Task WriteConstructorBody() Access = AccessModifier.Public, Documentation = new() { - Description = "The constructor for this class", + DescriptionTemplate = "The constructor for this class", }, ReturnType = new CodeType { Name = "void" }, Kind = CodeMethodKind.Constructor @@ -1165,7 +1165,7 @@ public void WriteGetter() Name = "getEmailAddress", Documentation = new() { - Description = "This method gets the emailAddress", + DescriptionTemplate = "This method gets the emailAddress", }, ReturnType = new CodeType { @@ -1619,7 +1619,7 @@ public async Task WritesApiClientWithBackingStoreConstructor() Optional = true, Documentation = new() { - Description = "The backing store to use for the models.", + DescriptionTemplate = "The backing store to use for the models.", }, Kind = CodeParameterKind.BackingStore, Type = new CodeType @@ -1670,7 +1670,7 @@ public async Task WritesModelWithBackingStoreConstructor() Access = AccessModifier.Public, Documentation = new() { - Description = "The constructor for this class", + DescriptionTemplate = "The constructor for this class", }, ReturnType = new CodeType { Name = "void" }, Kind = CodeMethodKind.Constructor @@ -2292,7 +2292,7 @@ public async Task WritesRequestConfigurationConstructor() { Name = "queryParameters", Kind = CodePropertyKind.QueryParameters, - Documentation = new() { Description = "Request query parameters", }, + Documentation = new() { DescriptionTemplate = "Request query parameters", }, Type = new CodeType { Name = queryParamClass.Name, TypeDefinition = queryParamClass }, }, new CodeProperty @@ -2300,14 +2300,14 @@ public async Task WritesRequestConfigurationConstructor() Name = "headers", Access = AccessModifier.Public, Kind = CodePropertyKind.Headers, - Documentation = new() { Description = "Request headers", }, + Documentation = new() { DescriptionTemplate = "Request headers", }, Type = new CodeType { Name = "RequestHeaders", IsExternal = true }, }, new CodeProperty { Name = "options", Kind = CodePropertyKind.Options, - Documentation = new() { Description = "Request options", }, + Documentation = new() { DescriptionTemplate = "Request options", }, Type = new CodeType { Name = "IList", IsExternal = true }, } }); @@ -2336,21 +2336,21 @@ public async Task WritesQueryParameterFactoryMethod() { Name = "select", Kind = CodePropertyKind.QueryParameter, - Documentation = new() { Description = "Select properties to be returned", }, + Documentation = new() { DescriptionTemplate = "Select properties to be returned", }, Type = new CodeType { Name = "string", CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Array }, }, new CodeProperty { Name = "count", Kind = CodePropertyKind.QueryParameter, - Documentation = new() { Description = "Include count of items", }, + Documentation = new() { DescriptionTemplate = "Include count of items", }, Type = new CodeType { Name = "boolean" }, }, new CodeProperty { Name = "top", Kind = CodePropertyKind.QueryParameter, - Documentation = new() { Description = "Show only the first n items", }, + Documentation = new() { DescriptionTemplate = "Show only the first n items", }, Type = new CodeType { Name = "integer" }, } }); @@ -2361,7 +2361,7 @@ public async Task WritesQueryParameterFactoryMethod() { Name = "queryParameters", Kind = CodePropertyKind.QueryParameters, - Documentation = new() { Description = "Request query parameters", }, + Documentation = new() { DescriptionTemplate = "Request query parameters", }, Type = new CodeType { Name = queryParamClass.Name, TypeDefinition = queryParamClass }, } }); @@ -2386,21 +2386,21 @@ public async Task WritesQueryParameterConstructor() { Name = "select", Kind = CodePropertyKind.QueryParameter, - Documentation = new() { Description = "Select properties to be returned", }, + Documentation = new() { DescriptionTemplate = "Select properties to be returned", }, Type = new CodeType { Name = "string", CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Array }, }, new CodeProperty { Name = "count", Kind = CodePropertyKind.QueryParameter, - Documentation = new() { Description = "Include count of items", }, + Documentation = new() { DescriptionTemplate = "Include count of items", }, Type = new CodeType { Name = "boolean" }, }, new CodeProperty { Name = "Top", Kind = CodePropertyKind.QueryParameter, - Documentation = new() { Description = "Show only the first n items", }, + Documentation = new() { DescriptionTemplate = "Show only the first n items", }, Type = new CodeType { Name = "integer" }, } }); diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodePropertyWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodePropertyWriterTests.cs index 22c125f34b..35d7d1565d 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodePropertyWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodePropertyWriterTests.cs @@ -32,7 +32,7 @@ public CodePropertyWriterTests() Name = "ParentClass", Documentation = new() { - Description = "This is an amazing class", + DescriptionTemplate = "This is an amazing class", }, Kind = CodeClassKind.Model }; @@ -68,7 +68,7 @@ public void WritePropertyRequestBuilder() Access = AccessModifier.Public, Documentation = new() { - Description = "I can get your messages.", + DescriptionTemplate = "I can get your messages.", }, Type = new CodeType { @@ -91,7 +91,7 @@ public async Task WriteCollectionKindProperty() { Documentation = new() { - Description = "Additional data dictionary", + DescriptionTemplate = "Additional data dictionary", }, Name = "additionalData", Kind = CodePropertyKind.AdditionalData, diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index f7b8b52117..70210d6f6e 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -945,14 +945,14 @@ public void WritesSerializerBody() public void WritesMethodAsyncDescription() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.Documentation.DocumentationLabel = "see more"; method.Documentation.DocumentationLink = new("https://example.org/docs"); var parameter = new CodeParameter { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType @@ -976,7 +976,7 @@ public void WritesMethodAsyncDescription() public void WritesMethodSyncDescription() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.Documentation.DocumentationLabel = "see more"; method.Documentation.DocumentationLink = new("https://example.org/docs"); method.IsAsync = false; @@ -984,7 +984,7 @@ public void WritesMethodSyncDescription() { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType @@ -1517,7 +1517,7 @@ public void WritesConstructor() Kind = CodePropertyKind.Custom, Documentation = new() { - Description = "This property has a description", + DescriptionTemplate = "This property has a description", }, Type = new CodeType { @@ -1569,7 +1569,7 @@ public void WritesConstructorForRequestBuilder() Kind = CodePropertyKind.UrlTemplate, Documentation = new() { - Description = "This property has a description", + DescriptionTemplate = "This property has a description", }, Type = new CodeType { @@ -1600,7 +1600,7 @@ public void WritesConstructorForRequestBuilderWithRequestAdapter() Kind = CodePropertyKind.UrlTemplate, Documentation = new() { - Description = "This property has a description", + DescriptionTemplate = "This property has a description", }, Type = new CodeType { @@ -1642,7 +1642,7 @@ public void WritesConstructorForRequestBuilderWithRequestAdapterAndPathParameter Kind = CodePropertyKind.UrlTemplate, Documentation = new() { - Description = "This property has a description", + DescriptionTemplate = "This property has a description", }, Type = new CodeType { @@ -1710,7 +1710,7 @@ public void DoesntWriteConstructorForModelClasses() Kind = CodePropertyKind.AdditionalData, Documentation = new() { - Description = "This property has a description", + DescriptionTemplate = "This property has a description", }, Type = new CodeType { @@ -1761,7 +1761,7 @@ public void WritesModelClassesWithDefaultEnumValue() Kind = CodePropertyKind.Custom, Documentation = new() { - Description = "This property has a description", + DescriptionTemplate = "This property has a description", }, Type = new CodeType { @@ -1845,7 +1845,7 @@ public void WritesConstructorWithInheritance() Kind = CodePropertyKind.Custom, Documentation = new() { - Description = "This property has a description", + DescriptionTemplate = "This property has a description", }, Type = new CodeType { @@ -1862,7 +1862,7 @@ public void WritesConstructorWithInheritance() Kind = CodePropertyKind.UrlTemplate, Documentation = new() { - Description = "This property has a description", + DescriptionTemplate = "This property has a description", }, Type = new CodeType { diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodePropertyWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodePropertyWriterTests.cs index 2831a01cdf..46e354959b 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodePropertyWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodePropertyWriterTests.cs @@ -81,7 +81,7 @@ public void Dispose() public void WritesRequestBuilder() { property.Kind = CodePropertyKind.RequestBuilder; - property.Documentation.Description = "This is a request builder"; + property.Documentation.DescriptionTemplate = "This is a request builder"; writer.Write(property); var result = tw.ToString(); Assert.Contains("@property", result); @@ -126,7 +126,7 @@ public void WritePrimaryErrorMessagePropertyOption2() var cls = new CodeClass { Name = "MainError", - Documentation = new CodeDocumentation { Description = "Some documentation" } + Documentation = new CodeDocumentation { DescriptionTemplate = "Some documentation" } }; cls.AddProperty(new CodeProperty { Name = "message", Type = new CodeType { Name = "str" }, IsPrimaryErrorMessage = true }); property.Type.Name = "str"; diff --git a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs index 6fbd418e75..abd965b639 100644 --- a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs @@ -704,13 +704,13 @@ public void WritesTranslatedTypesDeSerializerBody() public void WritesMethodSyncDescription() { setup(); - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.IsAsync = false; var parameter = new CodeParameter { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs index 918f4ca128..fec43b8a97 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs @@ -87,14 +87,14 @@ public void WritesEnumOptionDescription() { Documentation = new() { - Description = "Some option description", + DescriptionTemplate = "Some option description", }, Name = "option1", }; currentEnum.AddOption(option); codeConstantWriter.WriteCodeElement(currentEnum.CodeEnumObject, writer); var result = tw.ToString(); - Assert.Contains($"/** {option.Documentation.Description} */", result); + Assert.Contains($"/** {option.Documentation.DescriptionTemplate} */", result); AssertExtensions.CurlyBracesAreClosed(result, 0); } diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index 7c8fcc2960..a3bbd00f73 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -692,12 +692,12 @@ public void WritesMethodAsyncDescription() var method = TestHelper.CreateMethod(parentClass, MethodName, ReturnTypeName); method.Kind = CodeMethodKind.Factory; method.IsStatic = true; - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; var parameter = new CodeParameter { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType @@ -731,13 +731,13 @@ public void WritesMethodSyncDescription() var method = TestHelper.CreateMethod(parentClass, MethodName, ReturnTypeName); method.Kind = CodeMethodKind.Factory; method.IsStatic = true; - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.IsAsync = false; var parameter = new CodeParameter { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType @@ -764,7 +764,7 @@ public void WritesMethodDescriptionLink() var method = TestHelper.CreateMethod(parentClass, MethodName, ReturnTypeName); method.Kind = CodeMethodKind.Factory; method.IsStatic = true; - method.Documentation.Description = MethodDescription; + method.Documentation.DescriptionTemplate = MethodDescription; method.Documentation.DocumentationLabel = "see more"; method.Documentation.DocumentationLink = new("https://foo.org/docs"); method.IsAsync = false; @@ -772,7 +772,7 @@ public void WritesMethodDescriptionLink() { Documentation = new() { - Description = ParamDescription, + DescriptionTemplate = ParamDescription, }, Name = ParamName, Type = new CodeType From 168ec25572b62ba75a332bd7dc8c4173dc5b8c89 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 10:43:37 -0500 Subject: [PATCH 146/394] - adds type information to dynamic descriptions Signed-off-by: Vincent Biret --- .../CodeDOM/CodeDocumentation.cs | 18 +++++++++++- src/Kiota.Builder/KiotaBuilder.cs | 12 ++++++-- .../Refiners/CommonLanguageRefiner.cs | 29 ++++++++++++++----- src/Kiota.Builder/Refiners/PhpRefiner.cs | 12 +++++--- 4 files changed, 55 insertions(+), 16 deletions(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs index a1aa5e095a..f3865ef913 100644 --- a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs +++ b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs @@ -1,5 +1,7 @@ using System; +using System.Collections.Generic; using System.Collections.Concurrent; +using System.Linq; namespace Kiota.Builder.CodeDOM; @@ -8,6 +10,15 @@ namespace Kiota.Builder.CodeDOM; /// public class CodeDocumentation : ICloneable { + /// + /// Instantiates a new instance of the class. + /// + /// The references used by the description + public CodeDocumentation(Dictionary? typeReferences = null) + { + if (typeReferences is not null) + TypeReferences = new(typeReferences, StringComparer.OrdinalIgnoreCase); + } /// /// The description of the current element. /// @@ -54,7 +65,12 @@ public string GetDescription(Func typeReferenceResolver) var description = DescriptionTemplate; foreach (var (key, value) in TypeReferences) { - var resolvedValue = typeReferenceResolver(value); + var resolvedValue = value switch + { + CodeComposedTypeBase codeComposedTypeBase => string.Join(", ", codeComposedTypeBase.Types.Select(x => typeReferenceResolver(x)).Order(StringComparer.OrdinalIgnoreCase)) is string s && !string.IsNullOrEmpty(s) ? + s : typeReferenceResolver(value), + _ => typeReferenceResolver(value), + }; if (!string.IsNullOrEmpty(resolvedValue)) description = description.Replace($"{{{key}}}", resolvedValue, StringComparison.OrdinalIgnoreCase); } diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index a704bb096b..562e47faab 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -926,9 +926,15 @@ private void CreateUrlManagement(CodeClass currentClass, OpenApiUrlTreeNode curr Kind = isApiClientClass ? CodeMethodKind.ClientConstructor : CodeMethodKind.Constructor, IsAsync = false, IsStatic = false, - Documentation = new() - { - DescriptionTemplate = $"Instantiates a new {currentClass.Name.ToFirstCharacterUpperCase()} and sets the default values.", + Documentation = new(new() { + {"TypeName", new CodeType { + IsExternal = false, + TypeDefinition = currentClass, + } + } + }) + { + DescriptionTemplate = "Instantiates a new {TypeName} and sets the default values.", }, Access = AccessModifier.Public, ReturnType = new CodeType { Name = VoidType, IsExternal = true }, diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index bb168bb369..5df8e62b86 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -249,9 +249,14 @@ protected static void AddConstructorsForDefaultValues(CodeElement current, bool Name = "void" }, IsAsync = false, - Documentation = new() + Documentation = new(new() { + { "TypeName", new CodeType() { + IsExternal = false, + TypeDefinition = current, + }} + }) { - DescriptionTemplate = $"Instantiates a new {current.Name} and sets the default values.", + DescriptionTemplate = "Instantiates a new {TypeName} and sets the default values.", }, }); CrawlTree(current, x => AddConstructorsForDefaultValues(x, addIfInherited, forceAdd, classKindsToExclude)); @@ -472,7 +477,7 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo ArgumentNullException.ThrowIfNull(codeComposedType); CodeClass newClass; var description = - $"Composed type wrapper for classes {codeComposedType.Types.Select(static x => x.Name).Order(StringComparer.OrdinalIgnoreCase).Aggregate(static (x, y) => x + ", " + y)}"; + "Composed type wrapper for classes {TypesList}"; if (!supportsInnerClasses) { var @namespace = codeClass.GetImmediateParentOfType(); @@ -481,7 +486,9 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo newClass = @namespace.AddClass(new CodeClass { Name = codeComposedType.Name, - Documentation = new() + Documentation = new(new() { + { "TypesList", codeComposedType } + }) { DescriptionTemplate = description, }, @@ -493,7 +500,9 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo newClass = targetNamespace.AddClass(new CodeClass { Name = codeComposedType.Name, - Documentation = new() + Documentation = new(new() { + { "TypesList", codeComposedType } + }) { DescriptionTemplate = description }, @@ -513,7 +522,9 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo newClass = codeClass.AddInnerClass(new CodeClass { Name = codeComposedType.Name, - Documentation = new() + Documentation = new(new() { + { "TypesList", codeComposedType } + }) { DescriptionTemplate = description }, @@ -526,9 +537,11 @@ private static CodeType ConvertComposedTypeToWrapper(CodeClass codeClass, CodeCo { Name = x.Name, Type = x, - Documentation = new() + Documentation = new(new() { + { "TypeName", x } + }) { - DescriptionTemplate = $"Composed type representation for type {x.Name}" + DescriptionTemplate = "Composed type representation for type {TypeName}" }, }).ToArray()); if (codeComposedType.Types.All(static x => x.TypeDefinition is CodeClass targetClass && targetClass.IsOfKind(CodeClassKind.Model) || diff --git a/src/Kiota.Builder/Refiners/PhpRefiner.cs b/src/Kiota.Builder/Refiners/PhpRefiner.cs index 9a2df93aac..f8830ceeb0 100644 --- a/src/Kiota.Builder/Refiners/PhpRefiner.cs +++ b/src/Kiota.Builder/Refiners/PhpRefiner.cs @@ -354,9 +354,11 @@ private static void AddRequestConfigurationConstructors(CodeElement codeElement) Name = "constructor", Kind = CodeMethodKind.Constructor, IsAsync = false, - Documentation = new() + Documentation = new(new() { + { "TypeName", new CodeType { TypeDefinition = codeClass, IsExternal = false }} + }) { - DescriptionTemplate = $"Instantiates a new {codeClass.Name} and sets the default values.", + DescriptionTemplate = "Instantiates a new {TypeName} and sets the default values.", }, ReturnType = new CodeType { Name = "void" }, }; @@ -415,9 +417,11 @@ private static void AddQueryParameterFactoryMethod(CodeElement codeElement) IsStatic = true, Access = AccessModifier.Public, Kind = CodeMethodKind.Factory, - Documentation = new CodeDocumentation + Documentation = new(new() { + { "TypeName", queryParameterProperty.Type } + }) { - DescriptionTemplate = $"Instantiates a new {queryParameterProperty.Type.Name}." + DescriptionTemplate = "Instantiates a new {TypeName}." }, ReturnType = new CodeType { Name = queryParameterProperty.Type.Name, TypeDefinition = queryParameterProperty.Type, IsNullable = false } }; From db741621d7718389dd0e4bddc8904b99ef6cc700 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 11:01:16 -0500 Subject: [PATCH 147/394] - code linting Signed-off-by: Vincent Biret --- src/Kiota.Builder/KiotaBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 562e47faab..5fa95388b4 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -1721,7 +1721,7 @@ private CodeType CreateInheritedModelDeclaration(OpenApiUrlTreeNode currentNode, codeDeclaration = AddModelDeclarationIfDoesntExist(currentNode, currentSchema, className, shortestNamespace, codeDeclaration as CodeClass); } if (codeDeclaration is CodeClass currentClass && - string.IsNullOrEmpty(currentClass.Documentation.DescriptionTemplate) && + !currentClass.Documentation.DescriptionAvailable && string.IsNullOrEmpty(schema.AllOf.LastOrDefault()?.Description) && !string.IsNullOrEmpty(schema.Description)) currentClass.Documentation.DescriptionTemplate = schema.Description.CleanupDescription(); // the last allof entry often is not a reference and doesn't have a description. From 41d253f3f284afab3860693813561082e33e514b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 11:01:33 -0500 Subject: [PATCH 148/394] - adds missing references copy Signed-off-by: Vincent Biret --- src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index 5df8e62b86..7e142e8c48 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -186,7 +186,7 @@ current.Parent is CodeClass parentClass && IsAsync = false, Kind = CodeMethodKind.Getter, ReturnType = (CodeTypeBase)currentProperty.Type.Clone(), - Documentation = new() + Documentation = new(currentProperty.Documentation.TypeReferences.ToDictionary(static x => x.Key, static x => x.Value)) { DescriptionTemplate = $"Gets the {currentProperty.WireName} property value. {currentProperty.Documentation.DescriptionTemplate}", }, @@ -201,7 +201,7 @@ current.Parent is CodeClass parentClass && Access = AccessModifier.Public, IsAsync = false, Kind = CodeMethodKind.Setter, - Documentation = new() + Documentation = new(currentProperty.Documentation.TypeReferences.ToDictionary(static x => x.Key, static x => x.Value)) { DescriptionTemplate = $"Sets the {currentProperty.WireName} property value. {currentProperty.Documentation.DescriptionTemplate}", }, From fbd58b0bbab92e1aaae66b833b678a17cd1cdbb3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 11:01:51 -0500 Subject: [PATCH 149/394] - adds the ability to wrap the type reference with syntax Signed-off-by: Vincent Biret --- src/Kiota.Builder/CodeDOM/CodeDocumentation.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs index f3865ef913..7ddf262525 100644 --- a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs +++ b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs @@ -57,7 +57,7 @@ public object Clone() /// Keys MUST match the description template tokens or they will be ignored. /// public ConcurrentDictionary TypeReferences { get; private set; } = new(StringComparer.OrdinalIgnoreCase); - public string GetDescription(Func typeReferenceResolver) + public string GetDescription(Func typeReferenceResolver, string? typeReferencePrefix = null, string? typeReferenceSuffix = null) { ArgumentNullException.ThrowIfNull(typeReferenceResolver); if (string.IsNullOrEmpty(DescriptionTemplate)) @@ -67,9 +67,9 @@ public string GetDescription(Func typeReferenceResolver) { var resolvedValue = value switch { - CodeComposedTypeBase codeComposedTypeBase => string.Join(", ", codeComposedTypeBase.Types.Select(x => typeReferenceResolver(x)).Order(StringComparer.OrdinalIgnoreCase)) is string s && !string.IsNullOrEmpty(s) ? + CodeComposedTypeBase codeComposedTypeBase => string.Join(", ", codeComposedTypeBase.Types.Select(x => $"{typeReferencePrefix}{typeReferenceResolver(x)}{typeReferenceSuffix}").Order(StringComparer.OrdinalIgnoreCase)) is string s && !string.IsNullOrEmpty(s) ? s : typeReferenceResolver(value), - _ => typeReferenceResolver(value), + _ => $"{typeReferencePrefix}{typeReferenceResolver(value)}{typeReferenceSuffix}", }; if (!string.IsNullOrEmpty(resolvedValue)) description = description.Replace($"{{{key}}}", resolvedValue, StringComparison.OrdinalIgnoreCase); From f6d5e1c5941a66d0563ccb7f88140b3768b37ebf Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 11:20:33 -0500 Subject: [PATCH 150/394] - code linting Signed-off-by: Vincent Biret --- src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs index 903c4425cd..ee32882879 100644 --- a/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs @@ -34,7 +34,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write int power = 0; foreach (var item in enumOptions) { - if (!string.IsNullOrEmpty(item.Documentation.DescriptionTemplate)) + if (item.Documentation.DescriptionAvailable) writer.WriteLine($"// {item.Documentation.DescriptionTemplate}"); if (isMultiValue) @@ -53,7 +53,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write WriteMultiValueFunction(codeElement, writer, isMultiValue); } - private void WriteStringFunction(CodeEnum codeElement, LanguageWriter writer, Boolean isMultiValue) + private void WriteStringFunction(CodeEnum codeElement, LanguageWriter writer, bool isMultiValue) { var typeName = codeElement.Name.ToFirstCharacterUpperCase(); var enumOptions = codeElement.Options.ToList(); From 972be8fe01415f2cfc823fa8f6270e99860ac9ac Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 11:24:40 -0500 Subject: [PATCH 151/394] - adds templatization for deprecation information Signed-off-by: Vincent Biret --- .../CodeDOM/CodeDocumentation.cs | 29 +++++++------ .../CodeDOM/DeprecationInformation.cs | 11 ++++- .../Writers/CSharp/CSharpConventionService.cs | 2 +- .../Writers/Go/GoConventionService.cs | 2 +- .../Writers/Java/JavaConventionService.cs | 6 +-- .../Writers/Python/PythonConventionService.cs | 2 +- .../TypeScript/TypeScriptConventionService.cs | 2 +- ...nApiDeprecationExtensionExtensionsTests.cs | 42 +++++++++---------- 8 files changed, 55 insertions(+), 41 deletions(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs index 7ddf262525..d584cc3555 100644 --- a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs +++ b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs @@ -58,22 +58,27 @@ public object Clone() /// public ConcurrentDictionary TypeReferences { get; private set; } = new(StringComparer.OrdinalIgnoreCase); public string GetDescription(Func typeReferenceResolver, string? typeReferencePrefix = null, string? typeReferenceSuffix = null) + { + return GetDescriptionInternal(DescriptionTemplate, typeReferenceResolver, TypeReferences, typeReferencePrefix, typeReferenceSuffix); + } + internal static string GetDescriptionInternal(string descriptionTemplate, Func typeReferenceResolver, IDictionary? typeReferences = null, string? typeReferencePrefix = null, string? typeReferenceSuffix = null) { ArgumentNullException.ThrowIfNull(typeReferenceResolver); - if (string.IsNullOrEmpty(DescriptionTemplate)) + if (string.IsNullOrEmpty(descriptionTemplate)) return string.Empty; - var description = DescriptionTemplate; - foreach (var (key, value) in TypeReferences) - { - var resolvedValue = value switch + var description = descriptionTemplate; + if (typeReferences is not null) + foreach (var (key, value) in typeReferences) { - CodeComposedTypeBase codeComposedTypeBase => string.Join(", ", codeComposedTypeBase.Types.Select(x => $"{typeReferencePrefix}{typeReferenceResolver(x)}{typeReferenceSuffix}").Order(StringComparer.OrdinalIgnoreCase)) is string s && !string.IsNullOrEmpty(s) ? - s : typeReferenceResolver(value), - _ => $"{typeReferencePrefix}{typeReferenceResolver(value)}{typeReferenceSuffix}", - }; - if (!string.IsNullOrEmpty(resolvedValue)) - description = description.Replace($"{{{key}}}", resolvedValue, StringComparison.OrdinalIgnoreCase); - } + var resolvedValue = value switch + { + CodeComposedTypeBase codeComposedTypeBase => string.Join(", ", codeComposedTypeBase.Types.Select(x => $"{typeReferencePrefix}{typeReferenceResolver(x)}{typeReferenceSuffix}").Order(StringComparer.OrdinalIgnoreCase)) is string s && !string.IsNullOrEmpty(s) ? + s : typeReferenceResolver(value), + _ => $"{typeReferencePrefix}{typeReferenceResolver(value)}{typeReferenceSuffix}", + }; + if (!string.IsNullOrEmpty(resolvedValue)) + description = description.Replace($"{{{key}}}", resolvedValue, StringComparison.OrdinalIgnoreCase); + } return description; } public bool DescriptionAvailable diff --git a/src/Kiota.Builder/CodeDOM/DeprecationInformation.cs b/src/Kiota.Builder/CodeDOM/DeprecationInformation.cs index 7a06eac09e..523f7e47c3 100644 --- a/src/Kiota.Builder/CodeDOM/DeprecationInformation.cs +++ b/src/Kiota.Builder/CodeDOM/DeprecationInformation.cs @@ -1,5 +1,14 @@ using System; +using System.Collections.Generic; namespace Kiota.Builder.CodeDOM; -public record DeprecationInformation(string? Description, DateTimeOffset? Date = null, DateTimeOffset? RemovalDate = null, string? Version = "", bool IsDeprecated = true); +public record DeprecationInformation(string? DescriptionTemplate, DateTimeOffset? Date = null, DateTimeOffset? RemovalDate = null, string? Version = "", bool IsDeprecated = true, IDictionary? TypeReferences = null) +{ + public string GetDescription(Func typeReferenceResolver, string? typeReferencePrefix = null, string? typeReferenceSuffix = null) + { + if (DescriptionTemplate is null) + return string.Empty; + return CodeDocumentation.GetDescriptionInternal(DescriptionTemplate, typeReferenceResolver, TypeReferences, typeReferencePrefix, typeReferenceSuffix); + } +}; diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index 7db7e4fba0..c9a993e328 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -276,7 +276,7 @@ private static string GetDeprecationInformation(IDeprecableElement element) var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return $"[Obsolete(\"{element.Deprecation.Description}{versionComment}{dateComment}{removalComment}\")]"; + return $"[Obsolete(\"{element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}\")]"; } internal void WriteDeprecationAttribute(IDeprecableElement element, LanguageWriter writer) { diff --git a/src/Kiota.Builder/Writers/Go/GoConventionService.cs b/src/Kiota.Builder/Writers/Go/GoConventionService.cs index 559c0e5876..a7c7b073aa 100644 --- a/src/Kiota.Builder/Writers/Go/GoConventionService.cs +++ b/src/Kiota.Builder/Writers/Go/GoConventionService.cs @@ -252,6 +252,6 @@ internal void WriteDeprecation(IDeprecableElement element, LanguageWriter writer var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - WriteShortDescription($"Deprecated: {element.Deprecation.Description}{versionComment}{dateComment}{removalComment}", writer); + WriteShortDescription($"Deprecated: {element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}", writer); } } diff --git a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs index fd0f8367b6..fb387de49a 100644 --- a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs +++ b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs @@ -160,10 +160,10 @@ private string[] GetDeprecationInformationForDocumentationComment(IDeprecableEle var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return new string[] { + return [ $"@deprecated", - $"{element.Deprecation.Description}{versionComment}{dateComment}{removalComment}" - }; + $"{element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}" + ]; } internal void WriteDeprecatedAnnotation(CodeElement element, LanguageWriter writer) { diff --git a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs index 15776a3bfd..cb887fcad1 100644 --- a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs +++ b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs @@ -201,7 +201,7 @@ private static string GetDeprecationInformation(IDeprecableElement element) var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return $"{element.Deprecation.Description}{versionComment}{dateComment}{removalComment}"; + return $"{element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}"; } internal void WriteDeprecationWarning(IDeprecableElement element, LanguageWriter writer) { diff --git a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs index 78b6b61ef1..d724c79795 100644 --- a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs +++ b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs @@ -169,6 +169,6 @@ private string GetDeprecationComment(IDeprecableElement element) var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return $"@deprecated {element.Deprecation.Description}{versionComment}{dateComment}{removalComment}"; + return $"@deprecated {element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}"; } } diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiDeprecationExtensionExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiDeprecationExtensionExtensionsTests.cs index d4e8a7d746..10de8508c1 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiDeprecationExtensionExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiDeprecationExtensionExtensionsTests.cs @@ -23,7 +23,7 @@ public void ToDeprecationInformation() Date = new DateTimeOffset(2021, 05, 04, 0, 0, 0, TimeSpan.Zero), }; var deprecationInformation = openApiExtension.ToDeprecationInformation(); - Assert.Equal(openApiExtension.Description, deprecationInformation.Description); + Assert.Equal(openApiExtension.Description, deprecationInformation.DescriptionTemplate); Assert.Equal(openApiExtension.Version, deprecationInformation.Version); Assert.Equal(openApiExtension.RemovalDate.Value.Year, deprecationInformation.RemovalDate.Value.Year); Assert.Equal(openApiExtension.Date.Value.Month, deprecationInformation.Date.Value.Month); @@ -47,7 +47,7 @@ public void GetsDeprecationInformationFromOpenApiSchema() var deprecationInformation = openApiSchema.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Equal("description", deprecationInformation.Description); + Assert.Equal("description", deprecationInformation.DescriptionTemplate); } [Fact] public void GetsEmptyDeprecationInformationFromSchema() @@ -59,7 +59,7 @@ public void GetsEmptyDeprecationInformationFromSchema() var deprecationInformation = openApiSchema.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationInformationFromNonDeprecatedSchema() @@ -80,7 +80,7 @@ public void GetsNoDeprecationInformationFromNonDeprecatedSchema() var deprecationInformation = openApiSchema.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationOnOperationDirect() @@ -101,7 +101,7 @@ public void GetsDeprecationOnOperationDirect() var deprecationInformation = operation.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Equal("description", deprecationInformation.Description); + Assert.Equal("description", deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationOnNonDeprecatedOperation() @@ -122,7 +122,7 @@ public void GetsNoDeprecationOnNonDeprecatedOperation() var deprecationInformation = operation.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationOnOperationWithNullResponseContentTypeInstance() @@ -147,7 +147,7 @@ public void GetsDeprecationOnOperationWithNullResponseContentTypeInstance() var deprecationInformation = operation.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationOnOperationWithDeprecatedInlineResponseSchema() @@ -187,7 +187,7 @@ public void GetsDeprecationOnOperationWithDeprecatedInlineResponseSchema() var deprecationInformation = operation.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Equal("description", deprecationInformation.Description); + Assert.Equal("description", deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationOnOperationWithDeprecatedReferenceResponseSchema() @@ -232,7 +232,7 @@ public void GetsNoDeprecationOnOperationWithDeprecatedReferenceResponseSchema() var deprecationInformation = operation.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationOnOperationWithDeprecatedInlineRequestSchema() @@ -267,7 +267,7 @@ public void GetsDeprecationOnOperationWithDeprecatedInlineRequestSchema() var deprecationInformation = operation.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Equal("description", deprecationInformation.Description); + Assert.Equal("description", deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationOnOperationWithNullRequestBodyContentTypeInstance() @@ -287,7 +287,7 @@ public void GetsDeprecationOnOperationWithNullRequestBodyContentTypeInstance() var deprecationInformation = operation.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationOnOperationWithDeprecatedReferenceRequestSchema() @@ -327,7 +327,7 @@ public void GetsNoDeprecationOnOperationWithDeprecatedReferenceRequestSchema() var deprecationInformation = operation.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationInformationOnParameter() @@ -348,7 +348,7 @@ public void GetsDeprecationInformationOnParameter() var deprecationInformation = parameter.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Equal("description", deprecationInformation.Description); + Assert.Equal("description", deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationInformationOnNonDeprecatedParameter() @@ -369,7 +369,7 @@ public void GetsNoDeprecationInformationOnNonDeprecatedParameter() var deprecationInformation = parameter.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationInformationOnParameterWithDeprecatedInlineSchema() @@ -394,7 +394,7 @@ public void GetsDeprecationInformationOnParameterWithDeprecatedInlineSchema() var deprecationInformation = parameter.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Equal("description", deprecationInformation.Description); + Assert.Equal("description", deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationInformationOnParameterWithDeprecatedReferenceSchema() @@ -424,7 +424,7 @@ public void GetsNoDeprecationInformationOnParameterWithDeprecatedReferenceSchema var deprecationInformation = parameter.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationInformationOnParameterWithDeprecatedInlineContentSchema() @@ -455,7 +455,7 @@ public void GetsDeprecationInformationOnParameterWithDeprecatedInlineContentSche var deprecationInformation = parameter.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Equal("description", deprecationInformation.Description); + Assert.Equal("description", deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationInformationOnParameterWithDeprecatedReferenceContentSchema() @@ -491,7 +491,7 @@ public void GetsNoDeprecationInformationOnParameterWithDeprecatedReferenceConten var deprecationInformation = parameter.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsDeprecationInformationFromTreeNodeWhenAllOperationsDeprecated() @@ -518,7 +518,7 @@ public void GetsDeprecationInformationFromTreeNodeWhenAllOperationsDeprecated() var deprecationInformation = treeNode.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.True(deprecationInformation.IsDeprecated); - Assert.Equal("description", deprecationInformation.Description); + Assert.Equal("description", deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationInformationFromTreeNodeOnNoOperation() @@ -533,7 +533,7 @@ public void GetsNoDeprecationInformationFromTreeNodeOnNoOperation() var deprecationInformation = treeNode.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } [Fact] public void GetsNoDeprecationInformationFromTreeNodeWhenOneOperationNonDeprecated() @@ -563,6 +563,6 @@ public void GetsNoDeprecationInformationFromTreeNodeWhenOneOperationNonDeprecate var deprecationInformation = treeNode.GetDeprecationInformation(); Assert.NotNull(deprecationInformation); Assert.False(deprecationInformation.IsDeprecated); - Assert.Null(deprecationInformation.Description); + Assert.Null(deprecationInformation.DescriptionTemplate); } } From 44e97b8c5d0443e1f5c0483b07ca4c7c336e5c9f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 12:16:27 -0500 Subject: [PATCH 152/394] - adds type references to deprecation information Signed-off-by: Vincent Biret --- src/Kiota.Builder/CodeDOM/DeprecationInformation.cs | 2 +- src/Kiota.Builder/KiotaBuilder.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Kiota.Builder/CodeDOM/DeprecationInformation.cs b/src/Kiota.Builder/CodeDOM/DeprecationInformation.cs index 523f7e47c3..08ef9cc452 100644 --- a/src/Kiota.Builder/CodeDOM/DeprecationInformation.cs +++ b/src/Kiota.Builder/CodeDOM/DeprecationInformation.cs @@ -3,7 +3,7 @@ namespace Kiota.Builder.CodeDOM; -public record DeprecationInformation(string? DescriptionTemplate, DateTimeOffset? Date = null, DateTimeOffset? RemovalDate = null, string? Version = "", bool IsDeprecated = true, IDictionary? TypeReferences = null) +public record DeprecationInformation(string? DescriptionTemplate, DateTimeOffset? Date = null, DateTimeOffset? RemovalDate = null, string? Version = "", bool IsDeprecated = true, Dictionary? TypeReferences = null) { public string GetDescription(Func typeReferenceResolver, string? typeReferencePrefix = null, string? typeReferenceSuffix = null) { diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 5fa95388b4..c381bdd15d 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -1334,7 +1334,7 @@ private void AddErrorMappingToExecutorMethod(OpenApiUrlTreeNode currentNode, Ope { Kind = CodeClassKind.Model, Name = obsoleteTypeName, - Deprecation = new($"This class is obsolete. Use {modelType.Name} instead.", IsDeprecated: true), + Deprecation = new("This class is obsolete. Use {TypeName} instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", codeType } }), Documentation = (CodeDocumentation)codeClass.Documentation.Clone() }; var originalFactoryMethod = codeClass.Methods.First(static x => x.Kind is CodeMethodKind.Factory); @@ -1362,7 +1362,7 @@ private void AddErrorMappingToExecutorMethod(OpenApiUrlTreeNode currentNode, Ope _ => throw new InvalidOperationException("Could not create an obsolete composed type"), }; obsoleteComposedType.Name = obsoleteTypeName; - obsoleteComposedType.Deprecation = new($"This class is obsolete. Use {modelType.Name} instead.", IsDeprecated: true); + obsoleteComposedType.Deprecation = new("This class is obsolete. Use {TypeName} instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", modelType } }); return (modelType, obsoleteComposedType); } } @@ -1463,7 +1463,7 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp additionalExecutorMethod.ReturnType = returnTypes.Item2; additionalExecutorMethod.OriginalMethod = executorMethod; var newName = $"{executorMethod.Name}As{executorMethod.ReturnType.Name.ToFirstCharacterUpperCase()}"; - additionalExecutorMethod.Deprecation = new($"This method is obsolete. Use {newName} instead.", IsDeprecated: true); + additionalExecutorMethod.Deprecation = new("This method is obsolete. Use {TypeName} instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", new CodeType { TypeDefinition = executorMethod, IsExternal = false } } }); parentClass.RenameChildElement(executorMethod.Name, newName); parentClass.AddMethod(additionalExecutorMethod); } @@ -2463,7 +2463,7 @@ private void AddPropertyForQueryParameter(OpenApiUrlTreeNode node, OperationType var modernProp = (CodeProperty)prop.Clone(); modernProp.Name = $"{prop.Name}As{modernProp.Type.Name.ToFirstCharacterUpperCase()}"; modernProp.SerializationName = prop.WireName; - prop.Deprecation = new($"This property is deprecated, use {modernProp.Name} instead", IsDeprecated: true); + prop.Deprecation = new("This property is deprecated, use {TypeName} instead", IsDeprecated: true, TypeReferences: new() { { "TypeName", new CodeType { TypeDefinition = modernProp, IsExternal = false } } }); prop.Type = GetDefaultQueryParameterType(); prop.Type.CollectionKind = modernProp.Type.CollectionKind; parameterClass.AddProperty(modernProp, prop); From 2b78e231e4bcbbad95157685d279f75c1f17b3f5 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 31 Jan 2024 15:56:07 -0500 Subject: [PATCH 153/394] - switches to the type name replacement infrastructure for documentation Signed-off-by: Vincent Biret --- .../CodeDOM/CodeDocumentation.cs | 8 ++-- .../Writers/CLI/CliCodeMethodWriter.cs | 2 +- .../Writers/CSharp/CSharpConventionService.cs | 22 +++++++--- .../CSharp/CodeClassDeclarationWriter.cs | 2 +- .../Writers/CSharp/CodeEnumWriter.cs | 4 +- .../Writers/CSharp/CodeIndexerWriter.cs | 4 +- .../Writers/CSharp/CodeMethodWriter.cs | 4 +- .../Writers/CSharp/CodePropertyWriter.cs | 2 +- .../CommonLanguageConventionService.cs | 2 +- .../Writers/Go/CodeClassDeclarationWriter.cs | 2 +- .../Writers/Go/CodeEnumWriter.cs | 2 +- .../Go/CodeInterfaceDeclarationWriter.cs | 2 +- .../Writers/Go/CodeMethodWriter.cs | 3 +- .../Writers/Go/CodePropertyWriter.cs | 2 +- .../Writers/Go/GoConventionService.cs | 24 ++++++++--- .../Writers/ILanguageConventionService.cs | 2 +- .../Writers/Java/CodeEnumWriter.cs | 2 +- .../Writers/Java/CodeMethodWriter.cs | 5 ++- .../Writers/Java/JavaConventionService.cs | 21 +++++++--- .../Writers/Php/CodeClassDeclarationWriter.cs | 2 +- .../Writers/Php/CodeMethodWriter.cs | 14 +++---- .../Writers/Php/CodePropertyWriter.cs | 4 +- .../Writers/Php/PhpConventionService.cs | 41 ++++++++++-------- .../Python/CodeClassDeclarationWriter.cs | 2 +- .../Writers/Python/CodeEnumWriter.cs | 2 +- .../Writers/Python/CodeMethodWriter.cs | 12 +++--- .../Writers/Python/CodePropertyWriter.cs | 6 +-- .../Writers/Python/PythonConventionService.cs | 42 +++++++++++-------- .../Ruby/CodeClassDeclarationWriter.cs | 2 +- .../Writers/Ruby/CodeEnumWriter.cs | 4 +- .../Writers/Ruby/CodeMethodWriter.cs | 17 +++++--- .../Writers/Ruby/CodePropertyWriter.cs | 2 +- .../Writers/Ruby/RubyConventionService.cs | 14 ++++--- .../Swift/CodeClassDeclarationWriter.cs | 2 +- .../Writers/Swift/SwiftConventionService.cs | 10 +++-- .../Writers/TypeScript/CodeConstantWriter.cs | 2 +- .../Writers/TypeScript/CodeMethodWriter.cs | 4 +- .../TypeScript/TypeScriptConventionService.cs | 21 +++++++--- 38 files changed, 193 insertions(+), 125 deletions(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs index d584cc3555..2d8035fb76 100644 --- a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs +++ b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs @@ -57,16 +57,16 @@ public object Clone() /// Keys MUST match the description template tokens or they will be ignored. /// public ConcurrentDictionary TypeReferences { get; private set; } = new(StringComparer.OrdinalIgnoreCase); - public string GetDescription(Func typeReferenceResolver, string? typeReferencePrefix = null, string? typeReferenceSuffix = null) + public string GetDescription(Func typeReferenceResolver, string? typeReferencePrefix = null, string? typeReferenceSuffix = null, Func? normalizationFunc = null) { - return GetDescriptionInternal(DescriptionTemplate, typeReferenceResolver, TypeReferences, typeReferencePrefix, typeReferenceSuffix); + return GetDescriptionInternal(DescriptionTemplate, typeReferenceResolver, TypeReferences, typeReferencePrefix, typeReferenceSuffix, normalizationFunc); } - internal static string GetDescriptionInternal(string descriptionTemplate, Func typeReferenceResolver, IDictionary? typeReferences = null, string? typeReferencePrefix = null, string? typeReferenceSuffix = null) + internal static string GetDescriptionInternal(string descriptionTemplate, Func typeReferenceResolver, IDictionary? typeReferences = null, string? typeReferencePrefix = null, string? typeReferenceSuffix = null, Func? normalizationFunc = null) { ArgumentNullException.ThrowIfNull(typeReferenceResolver); if (string.IsNullOrEmpty(descriptionTemplate)) return string.Empty; - var description = descriptionTemplate; + var description = normalizationFunc is null ? descriptionTemplate : normalizationFunc(descriptionTemplate); if (typeReferences is not null) foreach (var (key, value) in typeReferences) { diff --git a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs index 2f68db8c62..eac0cb25b8 100644 --- a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs @@ -476,7 +476,7 @@ private static void WriteCommandDescription(CodeMethod codeElement, LanguageWrit var builder = new StringBuilder(); if (documentation.DescriptionAvailable) { - builder.Append(documentation.DescriptionTemplate); + builder.Append(documentation.GetDescription(static type => type.Name)); } // Add content type values to description. diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index c9a993e328..7cd4558bed 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -36,21 +36,31 @@ public static void WriteNullableClosing(LanguageWriter writer) ArgumentNullException.ThrowIfNull(writer); writer.WriteLine("#endif", false); } - public override void WriteShortDescription(string description, LanguageWriter writer) + private const string ReferenceTypePrefix = ""; + public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); - if (!string.IsNullOrEmpty(description)) - writer.WriteLine($"{DocCommentPrefix}{description.CleanupXMLString()}"); + ArgumentNullException.ThrowIfNull(element); + if (element is not CodeElement codeElement) return; + if (!element.Documentation.DescriptionAvailable) return; + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, static x => x.CleanupXMLString()); + writer.WriteLine($"{DocCommentPrefix}{prefix}{description}{suffix}"); } - public void WriteLongDescription(CodeDocumentation documentation, LanguageWriter writer) + public void WriteLongDescription(IDocumentedElement element, LanguageWriter writer) { ArgumentNullException.ThrowIfNull(writer); - if (documentation is null) return; + ArgumentNullException.ThrowIfNull(element); + if (element.Documentation is not { } documentation) return; + if (element is not CodeElement codeElement) return; if (documentation.DescriptionAvailable || documentation.ExternalDocumentationAvailable) { writer.WriteLine($"{DocCommentPrefix}"); if (documentation.DescriptionAvailable) - writer.WriteLine($"{DocCommentPrefix}{documentation.DescriptionTemplate.CleanupXMLString()}"); + { + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, static x => x.CleanupXMLString()); + writer.WriteLine($"{DocCommentPrefix}{description}"); + } if (documentation.ExternalDocumentationAvailable) writer.WriteLine($"{DocCommentPrefix}{documentation.DocumentationLabel} "); writer.WriteLine($"{DocCommentPrefix}"); diff --git a/src/Kiota.Builder/Writers/CSharp/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeClassDeclarationWriter.cs index cf1c4d97da..fbd487b882 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeClassDeclarationWriter.cs @@ -35,7 +35,7 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit .Select(static x => x.ToFirstCharacterUpperCase()) .ToArray(); var derivation = derivedTypes.Length != 0 ? ": " + derivedTypes.Aggregate(static (x, y) => $"{x}, {y}") + " " : string.Empty; - conventions.WriteLongDescription(parentClass.Documentation, writer); + conventions.WriteLongDescription(parentClass, writer); conventions.WriteDeprecationAttribute(parentClass, writer); writer.StartBlock($"public class {codeElement.Name.ToFirstCharacterUpperCase()} {derivation}{{"); } diff --git a/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs index 7845a9b2d4..92d58d64fa 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeEnumWriter.cs @@ -29,7 +29,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write writer.WriteLine(x); writer.StartBlock($"namespace {codeNamespace.Name} {{"); } - conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(codeElement, writer); if (codeElement.Flags) writer.WriteLine("[Flags]"); conventions.WriteDeprecationAttribute(codeElement, writer); @@ -37,7 +37,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write var idx = 0; foreach (var option in codeElement.Options) { - conventions.WriteShortDescription(option.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(option, writer); if (option.IsNameEscaped) { diff --git a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs index a7a75bbc74..ae27c1c982 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs @@ -12,8 +12,8 @@ public override void WriteCodeElement(CodeIndexer codeElement, LanguageWriter wr ArgumentNullException.ThrowIfNull(writer); if (codeElement.Parent is not CodeClass parentClass) throw new InvalidOperationException("The parent of a property should be a class"); var returnType = conventions.GetTypeString(codeElement.ReturnType, codeElement); - conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); - writer.WriteLine($"{conventions.DocCommentPrefix}{codeElement.IndexParameter.Documentation.DescriptionTemplate.CleanupXMLString()}"); + conventions.WriteShortDescription(codeElement, writer); + conventions.WriteShortDescription(codeElement.IndexParameter, writer, $"", ""); conventions.WriteDeprecationAttribute(codeElement, writer); writer.StartBlock($"public {returnType} this[{conventions.GetTypeString(codeElement.IndexParameter.Type, codeElement)} position] {{ get {{"); if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProp) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index 65c206678f..85b27d1c1b 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -541,11 +541,11 @@ protected string GetSendRequestMethodName(bool isVoid, CodeElement currentElemen } private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer) { - conventions.WriteLongDescription(code.Documentation, writer); + conventions.WriteLongDescription(code, writer); foreach (var paramWithDescription in code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase)) - writer.WriteLine($"{conventions.DocCommentPrefix}{paramWithDescription.Documentation.DescriptionTemplate.CleanupXMLString()}"); + conventions.WriteShortDescription(paramWithDescription, writer, $"", ""); conventions.WriteDeprecationAttribute(code, writer); } private static readonly BaseCodeParameterOrderComparer parameterOrderComparer = new(); diff --git a/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs index b2f3aa476f..e4b9efffe7 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodePropertyWriter.cs @@ -16,7 +16,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w && codeElement.IsOfKind( CodePropertyKind.Custom, CodePropertyKind.QueryParameter);// Other property types are appropriately constructor initialized - conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(codeElement, writer); conventions.WriteDeprecationAttribute(codeElement, writer); if (isNullableReferenceType) { diff --git a/src/Kiota.Builder/Writers/CommonLanguageConventionService.cs b/src/Kiota.Builder/Writers/CommonLanguageConventionService.cs index 5845573c50..313583b196 100644 --- a/src/Kiota.Builder/Writers/CommonLanguageConventionService.cs +++ b/src/Kiota.Builder/Writers/CommonLanguageConventionService.cs @@ -41,5 +41,5 @@ public string TranslateType(CodeTypeBase type) } public abstract string TranslateType(CodeType type); - public abstract void WriteShortDescription(string description, LanguageWriter writer); + public abstract void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = ""); } diff --git a/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs index e609e7c11b..b8e77e213e 100644 --- a/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs @@ -15,7 +15,7 @@ protected override void WriteTypeDeclaration(ClassDeclaration codeElement, Langu ArgumentNullException.ThrowIfNull(writer); var className = codeElement.Name.ToFirstCharacterUpperCase(); if (codeElement.Parent is not CodeClass currentClass) throw new InvalidOperationException("The parent of a class declaration should be a class"); - conventions.WriteShortDescription($"{className} {currentClass.Documentation.DescriptionTemplate.ToFirstCharacterLowerCase()}", writer); + conventions.WriteShortDescription(currentClass, writer, $"A {className}"); conventions.WriteDeprecation(currentClass, writer); conventions.WriteLinkDescription(currentClass.Documentation, writer); writer.StartBlock($"type {className} struct {{"); diff --git a/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs index ee32882879..ecb596c681 100644 --- a/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeEnumWriter.cs @@ -22,7 +22,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write writer.CloseBlock(")"); var typeName = codeElement.Name.ToFirstCharacterUpperCase(); - conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(codeElement, writer); conventions.WriteDeprecation(codeElement, writer); writer.WriteLines($"type {typeName} int", string.Empty, diff --git a/src/Kiota.Builder/Writers/Go/CodeInterfaceDeclarationWriter.cs b/src/Kiota.Builder/Writers/Go/CodeInterfaceDeclarationWriter.cs index 80e00c54c5..7bb0f7b09f 100644 --- a/src/Kiota.Builder/Writers/Go/CodeInterfaceDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeInterfaceDeclarationWriter.cs @@ -13,7 +13,7 @@ protected override void WriteTypeDeclaration(InterfaceDeclaration codeElement, L ArgumentNullException.ThrowIfNull(writer); if (codeElement.Parent is not CodeInterface inter) throw new InvalidOperationException("Expected the parent to be an interface"); var interName = codeElement.Name.ToFirstCharacterUpperCase(); - conventions.WriteShortDescription($"{interName} {inter.Documentation.DescriptionTemplate.ToFirstCharacterLowerCase()}", writer); + conventions.WriteShortDescription(inter, writer, $"A {interName}"); if (codeElement.Parent is CodeInterface currentInterface && currentInterface.OriginalClass is not null) conventions.WriteDeprecation(currentInterface.OriginalClass, writer); conventions.WriteLinkDescription(inter.Documentation, writer); diff --git a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs index e6398723a4..ee709bed1c 100644 --- a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs @@ -290,8 +290,7 @@ private void WriteFactoryMethodBodyForUnionModelForUnDiscriminatedTypes(CodeClas private void WriteMethodDocumentation(CodeMethod code, string methodName, LanguageWriter writer) { - if (code.Documentation.DescriptionAvailable) - conventions.WriteShortDescription($"{methodName.ToFirstCharacterUpperCase()} {code.Documentation.DescriptionTemplate.ToFirstCharacterLowerCase()}", writer); + conventions.WriteShortDescription(code, writer, $"{methodName.ToFirstCharacterUpperCase()} "); conventions.WriteDeprecation(code, writer); conventions.WriteLinkDescription(code.Documentation, writer); } diff --git a/src/Kiota.Builder/Writers/Go/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Go/CodePropertyWriter.cs index 3003f1d81b..9c51628129 100644 --- a/src/Kiota.Builder/Writers/Go/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodePropertyWriter.cs @@ -26,7 +26,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w goto default; default: var returnType = codeElement.Parent is CodeElement parent ? conventions.GetTypeString(codeElement.Type, parent) : string.Empty; - conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(codeElement, writer); conventions.WriteDeprecation(codeElement, writer); writer.WriteLine($"{propertyName} {returnType}{suffix}"); break; diff --git a/src/Kiota.Builder/Writers/Go/GoConventionService.cs b/src/Kiota.Builder/Writers/Go/GoConventionService.cs index a7c7b073aa..24f08cbc05 100644 --- a/src/Kiota.Builder/Writers/Go/GoConventionService.cs +++ b/src/Kiota.Builder/Writers/Go/GoConventionService.cs @@ -166,7 +166,21 @@ currentEnumDefinition.Parent is CodeNamespace enumNS && return string.Empty; } - public override void WriteShortDescription(string description, LanguageWriter writer) + public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") + { + ArgumentNullException.ThrowIfNull(writer); + ArgumentNullException.ThrowIfNull(element); + if (!element.Documentation.DescriptionAvailable) return; + if (element is not CodeElement codeElement) return; + + var description = element.Documentation.GetDescription(x => GetTypeString(x, codeElement)); + if (!string.IsNullOrEmpty(prefix)) + { + description = description.ToFirstCharacterLowerCase(); + } + WriteDescriptionItem($"{prefix}{description}{suffix}", writer); + } + public void WriteDescriptionItem(string description, LanguageWriter writer) { ArgumentNullException.ThrowIfNull(writer); writer.WriteLine($"{DocCommentPrefix}{description}"); @@ -176,9 +190,9 @@ public void WriteLinkDescription(CodeDocumentation documentation, LanguageWriter if (documentation is null) return; if (documentation.ExternalDocumentationAvailable) { - WriteShortDescription($"[{documentation.DocumentationLabel}]", writer); - WriteShortDescription(string.Empty, writer); - WriteShortDescription($"[{documentation.DocumentationLabel}]: {documentation.DocumentationLink}", writer); + WriteDescriptionItem($"[{documentation.DocumentationLabel}]", writer); + WriteDescriptionItem(string.Empty, writer); + WriteDescriptionItem($"[{documentation.DocumentationLabel}]: {documentation.DocumentationLink}", writer); } } #pragma warning disable CA1822 // Method should be static @@ -252,6 +266,6 @@ internal void WriteDeprecation(IDeprecableElement element, LanguageWriter writer var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - WriteShortDescription($"Deprecated: {element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}", writer); + WriteDescriptionItem($"Deprecated: {element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}", writer); } } diff --git a/src/Kiota.Builder/Writers/ILanguageConventionService.cs b/src/Kiota.Builder/Writers/ILanguageConventionService.cs index 30f7690a9d..8b65e9018f 100644 --- a/src/Kiota.Builder/Writers/ILanguageConventionService.cs +++ b/src/Kiota.Builder/Writers/ILanguageConventionService.cs @@ -27,5 +27,5 @@ string TempDictionaryVarName string GetTypeString(CodeTypeBase code, CodeElement targetElement, bool includeCollectionInformation = true, LanguageWriter? writer = null); string TranslateType(CodeType type); string GetParameterSignature(CodeParameter parameter, CodeElement targetElement, LanguageWriter? writer = null); - void WriteShortDescription(string description, LanguageWriter writer); + void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = ""); } diff --git a/src/Kiota.Builder/Writers/Java/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Java/CodeEnumWriter.cs index 06ac05e55b..480c4be91e 100644 --- a/src/Kiota.Builder/Writers/Java/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeEnumWriter.cs @@ -27,7 +27,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write var lastEnumOption = enumOptions.Last(); foreach (var enumOption in enumOptions) { - conventions.WriteShortDescription(enumOption.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(enumOption, writer); writer.WriteLine($"{enumOption.Name}(\"{enumOption.SerializationName}\"){(enumOption == lastEnumOption ? ";" : ",")}"); } writer.WriteLines("public final String value;", diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index c50c36e587..639f42f6de 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text; using System.Text.RegularExpressions; using Kiota.Builder.CodeDOM; using Kiota.Builder.Extensions; @@ -742,8 +743,8 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, st code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) - .Select(x => $"@param {x.Name} {JavaConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.DescriptionTemplate)}") - .Union(new[] { returnRemark })); + .Select(x => $"@param {x.Name} {x.Documentation.GetDescription(y => conventions.GetTypeString(y, code), normalizationFunc: JavaConventionService.RemoveInvalidDescriptionCharacters)}") + .Union([returnRemark])); if (!returnVoid) //Nullable/Nonnull annotations for returns are a part of Method Documentation writer.WriteLine(code.ReturnType.IsNullable ? "@jakarta.annotation.Nullable" : "@jakarta.annotation.Nonnull"); } diff --git a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs index fb387de49a..088867a10e 100644 --- a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs +++ b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs @@ -5,7 +5,6 @@ using System.Text.RegularExpressions; using Kiota.Builder.CodeDOM; -using Kiota.Builder.Extensions; using Kiota.Builder.Refiners; namespace Kiota.Builder.Writers.Java; @@ -93,24 +92,34 @@ _ when type.Name.Contains('.', StringComparison.OrdinalIgnoreCase) => type.Name, _ => type.Name is string typeName && !string.IsNullOrEmpty(typeName) ? typeName : "Object", }; } - public override void WriteShortDescription(string description, LanguageWriter writer) + private const string ReferenceTypePrefix = "{@link #"; + private const string ReferenceTypeSuffix = "}"; + public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); - if (!string.IsNullOrEmpty(description)) - writer.WriteLine($"{DocCommentStart} {RemoveInvalidDescriptionCharacters(description)}{DocCommentEnd}"); + ArgumentNullException.ThrowIfNull(element); + if (!element.Documentation.DescriptionAvailable) return; + if (element is not CodeElement codeElement) return; + + var description = element.Documentation.GetDescription(x => GetTypeString(x, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters); + + writer.WriteLine($"{DocCommentStart} {description}{DocCommentEnd}"); } public void WriteLongDescription(CodeElement element, LanguageWriter writer, IEnumerable? additionalRemarks = default) { ArgumentNullException.ThrowIfNull(writer); if (element is not IDocumentedElement documentedElement || documentedElement.Documentation is not CodeDocumentation documentation) return; if (additionalRemarks == default) - additionalRemarks = Enumerable.Empty(); + additionalRemarks = []; var remarks = additionalRemarks.ToArray(); if (documentation.DescriptionAvailable || documentation.ExternalDocumentationAvailable || remarks.Length != 0) { writer.WriteLine(DocCommentStart); if (documentation.DescriptionAvailable) - writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(documentation.DescriptionTemplate)}"); + { + var description = documentedElement.Documentation.GetDescription(x => GetTypeString(x, element), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters); + writer.WriteLine($"{DocCommentPrefix}{description}"); + } foreach (var additionalRemark in remarks.Where(static x => !string.IsNullOrEmpty(x))) writer.WriteLine($"{DocCommentPrefix}{additionalRemark}"); if (element is IDeprecableElement deprecableElement && deprecableElement.Deprecation is not null && deprecableElement.Deprecation.IsDeprecated) diff --git a/src/Kiota.Builder/Writers/Php/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Php/CodeClassDeclarationWriter.cs index 86bfb60fc1..58ecf96480 100644 --- a/src/Kiota.Builder/Writers/Php/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeClassDeclarationWriter.cs @@ -17,7 +17,7 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit conventions.WritePhpDocumentStart(writer); conventions.WriteNamespaceAndImports(codeElement, writer); if (codeElement.Parent is CodeClass parentClass) - conventions.WriteLongDescription(parentClass.Documentation, writer); + conventions.WriteLongDescription(parentClass, writer); var derivation = (codeElement.Inherits == null ? string.Empty : $" extends {codeElement.Inherits.Name.ToFirstCharacterUpperCase()}") + (!codeElement.Implements.Any() ? string.Empty : $" implements {codeElement.Implements.Select(x => x.Name).Aggregate((x, y) => x + ", " + y)}"); writer.WriteLine($"class {codeElement.Name.Split('.').Last().ToFirstCharacterUpperCase()}{derivation} "); diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 075929d5d7..fd7151dde8 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -258,7 +258,7 @@ private static void AssignPropertyFromParameter(CodeClass parentClass, CodeMetho private void WriteMethodPhpDocs(CodeMethod codeMethod, LanguageWriter writer) { - var methodDescription = codeMethod.Documentation.DescriptionTemplate; + var methodDescription = codeMethod.Documentation.GetDescription(x => conventions.GetTypeString(x, codeMethod), normalizationFunc: PhpConventionService.RemoveInvalidDescriptionCharacters); var methodThrows = codeMethod.IsOfKind(CodeMethodKind.RequestExecutor); var hasMethodDescription = !string.IsNullOrEmpty(methodDescription.Trim()); if (!hasMethodDescription && !codeMethod.Parameters.Any()) @@ -274,15 +274,15 @@ private void WriteMethodPhpDocs(CodeMethod codeMethod, LanguageWriter writer) var returnDocString = GetDocCommentReturnType(codeMethod); if (!isVoidable) { - var nullableSuffix = (codeMethod.ReturnType.IsNullable ? "|null" : ""); + var nullableSuffix = codeMethod.ReturnType.IsNullable ? "|null" : ""; returnDocString = (codeMethod.Kind == CodeMethodKind.RequestExecutor) ? $"@return Promise<{returnDocString}|null>" : $"@return {returnDocString}{nullableSuffix}"; } - else returnDocString = String.Empty; + else returnDocString = string.Empty; - var throwsArray = methodThrows ? new[] { "@throws Exception" } : Array.Empty(); - conventions.WriteLongDescription(codeMethod.Documentation, + var throwsArray = methodThrows ? ["@throws Exception"] : Array.Empty(); + conventions.WriteLongDescription(codeMethod, writer, parametersWithOrWithoutDescription.Union(new[] { returnDocString }).Union(throwsArray) ); @@ -306,9 +306,9 @@ private string GetParameterDocString(CodeMethod codeMethod, CodeParameter x) if (codeMethod.IsOfKind(CodeMethodKind.Setter) && (codeMethod.AccessedProperty?.IsOfKind(CodePropertyKind.AdditionalData) ?? false)) { - return $"@param array $value {x?.Documentation.DescriptionTemplate}"; + return $"@param array $value {x?.Documentation.GetDescription(x => conventions.GetTypeString(x, codeMethod), normalizationFunc: PhpConventionService.RemoveInvalidDescriptionCharacters)}"; } - return $"@param {conventions.GetParameterDocNullable(x, x)} {x?.Documentation.DescriptionTemplate}"; + return $"@param {conventions.GetParameterDocNullable(x, x)} {x?.Documentation.GetDescription(x => conventions.GetTypeString(x, codeMethod), normalizationFunc: PhpConventionService.RemoveInvalidDescriptionCharacters)}"; } private static readonly BaseCodeParameterOrderComparer parameterOrderComparer = new(); diff --git a/src/Kiota.Builder/Writers/Php/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Php/CodePropertyWriter.cs index e29df89762..211d3e7965 100644 --- a/src/Kiota.Builder/Writers/Php/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodePropertyWriter.cs @@ -32,7 +32,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w private void WritePropertyDocComment(CodeProperty codeProperty, LanguageWriter writer) { - var propertyDescription = codeProperty.Documentation.DescriptionTemplate; + var propertyDescription = codeProperty.Documentation.GetDescription(x => conventions.GetTypeString(x, codeProperty), normalizationFunc: PhpConventionService.RemoveInvalidDescriptionCharacters); var hasDescription = codeProperty.Documentation.DescriptionAvailable; var collectionKind = codeProperty.Type.IsArray || codeProperty.Type.IsCollection; @@ -63,7 +63,7 @@ private string GetCollectionDocString(CodeProperty codeProperty) private void WriteRequestBuilderBody(CodeProperty codeElement, LanguageWriter writer, string returnType, string propertyAccess, string propertyName) { - conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(codeElement, writer); writer.WriteLine($"{propertyAccess} function {propertyName}(): {returnType} {{"); writer.IncreaseIndent(); conventions.AddRequestBuilderBody(returnType, writer); diff --git a/src/Kiota.Builder/Writers/Php/PhpConventionService.cs b/src/Kiota.Builder/Writers/Php/PhpConventionService.cs index b29e086c6b..b2f1096153 100644 --- a/src/Kiota.Builder/Writers/Php/PhpConventionService.cs +++ b/src/Kiota.Builder/Writers/Php/PhpConventionService.cs @@ -135,37 +135,44 @@ private string GetCollectionDocString(CodeParameter codeParameter) return codeParameter.Optional ? $"{doc}|null" : doc; } - private static string RemoveInvalidDescriptionCharacters(string originalDescription) => originalDescription.Replace("\\", "/", StringComparison.OrdinalIgnoreCase); - public override void WriteShortDescription(string description, LanguageWriter writer) + internal static string RemoveInvalidDescriptionCharacters(string originalDescription) => originalDescription.Replace("\\", "/", StringComparison.OrdinalIgnoreCase); + public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); - if (!string.IsNullOrEmpty(description)) - { - writer.WriteLine(DocCommentStart); - writer.WriteLine( - $"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(description)}"); - writer.WriteLine(DocCommentEnd); - } + ArgumentNullException.ThrowIfNull(element); + if (!element.Documentation.DescriptionAvailable) return; + if (element is not CodeElement codeElement) return; + + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), normalizationFunc: RemoveInvalidDescriptionCharacters); + + writer.WriteLine(DocCommentStart); + writer.WriteLine($"{DocCommentPrefix}{description}"); + writer.WriteLine(DocCommentEnd); } - public void WriteLongDescription(CodeDocumentation codeDocumentation, LanguageWriter writer, IEnumerable? additionalRemarks = default) + public void WriteLongDescription(IDocumentedElement element, LanguageWriter writer, IEnumerable? additionalRemarks = default) { ArgumentNullException.ThrowIfNull(writer); - if (codeDocumentation is null) return; - additionalRemarks ??= Enumerable.Empty(); + ArgumentNullException.ThrowIfNull(element); + if (element.Documentation is not { } documentation) return; + if (element is not CodeElement codeElement) return; + additionalRemarks ??= []; var enumerableArray = additionalRemarks as string[] ?? additionalRemarks.ToArray(); - if (codeDocumentation.DescriptionAvailable || codeDocumentation.ExternalDocumentationAvailable || + if (documentation.DescriptionAvailable || documentation.ExternalDocumentationAvailable || enumerableArray.Length != 0) { writer.WriteLine(DocCommentStart); - if (codeDocumentation.DescriptionAvailable) - writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(codeDocumentation.DescriptionTemplate)}"); + if (documentation.DescriptionAvailable) + { + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), normalizationFunc: RemoveInvalidDescriptionCharacters); + writer.WriteLine($"{DocCommentPrefix}{description}"); + } foreach (var additionalRemark in enumerableArray.Where(static x => !string.IsNullOrEmpty(x))) writer.WriteLine($"{DocCommentPrefix}{additionalRemark}"); - if (codeDocumentation.ExternalDocumentationAvailable) - writer.WriteLine($"{DocCommentPrefix}@link {codeDocumentation.DocumentationLink} {codeDocumentation.DocumentationLabel}"); + if (documentation.ExternalDocumentationAvailable) + writer.WriteLine($"{DocCommentPrefix}@link {documentation.DocumentationLink} {documentation.DocumentationLabel}"); writer.WriteLine(DocCommentEnd); } diff --git a/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs index adef1bf4a9..765dc76942 100644 --- a/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeClassDeclarationWriter.cs @@ -50,7 +50,7 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit _codeUsingWriter.WriteExternalImports(codeElement, writer); _codeUsingWriter.WriteConditionalInternalImports(codeElement, writer, parentNamespace); } - conventions.WriteLongDescription(parent.Documentation, writer); + conventions.WriteLongDescription(parent, writer); conventions.WriteDeprecationWarning(parent, writer); } } diff --git a/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs index 2464a22049..e92e01c2f1 100644 --- a/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeEnumWriter.cs @@ -24,7 +24,7 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write { codeElement.Options.ToList().ForEach(x => { - conventions.WriteInLineDescription(x.Documentation.DescriptionTemplate, writer); + conventions.WriteInLineDescription(x, writer); writer.WriteLine($"{x.Name} = \"{x.WireName}\","); }); } diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index b57236d080..1c4f8c5814 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -387,7 +387,7 @@ private void WriteDirectAccessProperties(CodeClass parentClass, LanguageWriter w _codeUsingWriter.WriteDeferredImport(parentClass, enumDefinition.Name, writer); defaultValue = $"{enumDefinition.Name}({defaultValue})"; } - conventions.WriteInLineDescription(propWithDefault.Documentation.DescriptionTemplate, writer); + conventions.WriteInLineDescription(propWithDefault, writer); if (parentClass.IsOfKind(CodeClassKind.Model)) { writer.WriteLine($"{propWithDefault.Name}: {(propWithDefault.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(propWithDefault.Type.IsNullable ? "]" : string.Empty)} = {defaultValue}"); @@ -416,7 +416,7 @@ private void WriteSetterAccessProperties(CodeClass parentClass, LanguageWriter w defaultValue = $"{enumDefinition.Name}({defaultValue})"; } var returnType = conventions.GetTypeString(propWithDefault.Type, propWithDefault, true, writer); - conventions.WriteInLineDescription(propWithDefault.Documentation.DescriptionTemplate, writer); + conventions.WriteInLineDescription(propWithDefault, writer); var setterString = $"{propWithDefault.Name}: {(propWithDefault.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(propWithDefault.Type.IsNullable ? "]" : string.Empty)} = {defaultValue}"; if (parentClass.IsOfKind(CodeClassKind.Model)) { @@ -434,7 +434,7 @@ private void WriteSetterAccessPropertiesWithoutDefaults(CodeClass parentClass, L .ThenBy(static x => x.Name)) { var returnType = conventions.GetTypeString(propWithoutDefault.Type, propWithoutDefault, true, writer); - conventions.WriteInLineDescription(propWithoutDefault.Documentation.DescriptionTemplate, writer); + conventions.WriteInLineDescription(propWithoutDefault, writer); if (parentClass.IsOfKind(CodeClassKind.Model)) writer.WriteLine($"{propWithoutDefault.Name}: {(propWithoutDefault.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(propWithoutDefault.Type.IsNullable ? "]" : string.Empty)} = None"); else @@ -706,13 +706,13 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, st var nullablePrefix = code.ReturnType.IsNullable && !isVoid ? "Optional[" : string.Empty; var nullableSuffix = code.ReturnType.IsNullable && !isVoid ? "]" : string.Empty; var returnRemark = isVoid ? "Returns: None" : $"Returns: {nullablePrefix}{returnType}{nullableSuffix}"; - conventions.WriteLongDescription(code.Documentation, + conventions.WriteLongDescription(code, writer, code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) - .Select(x => $"param {x.Name}: {PythonConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.DescriptionTemplate)}") - .Union(new[] { returnRemark })); + .Select(x => $"param {x.Name}: {x.Documentation.GetDescription(type => conventions.GetTypeString(type, code), normalizationFunc: PythonConventionService.RemoveInvalidDescriptionCharacters)}") + .Union([returnRemark])); conventions.WriteDeprecationWarning(code, writer); } private static readonly PythonCodeParameterOrderComparer parameterOrderComparer = new(); diff --git a/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs index ca963d884f..54d775feab 100644 --- a/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs @@ -27,7 +27,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w writer.WriteLine("@property"); writer.WriteLine($"def {codeElement.Name}(self) -> {returnType}:"); writer.IncreaseIndent(); - conventions.WriteLongDescription(codeElement.Documentation, writer); + conventions.WriteLongDescription(codeElement, writer); _codeUsingWriter.WriteDeferredImport(parentClass, codeElement.Type.Name, writer); conventions.AddRequestBuilderBody(parentClass, returnType, writer); writer.CloseBlock(string.Empty); @@ -38,14 +38,14 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w case CodePropertyKind.Headers: case CodePropertyKind.Options: case CodePropertyKind.QueryParameter: - conventions.WriteInLineDescription(codeElement.Documentation.DescriptionTemplate, writer); + conventions.WriteInLineDescription(codeElement, writer); writer.WriteLine($"{conventions.GetAccessModifier(codeElement.Access)}{codeElement.NamePrefix}{codeElement.Name}: {(codeElement.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(codeElement.Type.IsNullable ? "]" : string.Empty)} = None"); writer.WriteLine(); break; case CodePropertyKind.ErrorMessageOverride when parentClass.IsErrorDefinition: writer.WriteLine("@property"); writer.StartBlock($"def {codeElement.Name}(self) -> {codeElement.Type.Name}:"); - conventions.WriteLongDescription(codeElement.Documentation, writer); + conventions.WriteLongDescription(codeElement, writer); if (parentClass.GetPrimaryMessageCodePath(static x => x.Name.ToFirstCharacterLowerCase(), static x => x.Name.ToSnakeCase()) is string primaryMessageCodePath && !string.IsNullOrEmpty(primaryMessageCodePath)) diff --git a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs index cb887fcad1..4f1a146415 100644 --- a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs +++ b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs @@ -155,28 +155,35 @@ private string WriteInlineDeclaration(CodeType currentType, CodeElement targetEl return "object"; return $"{{{innerDeclaration}}}"; } - public override void WriteShortDescription(string description, LanguageWriter writer) + public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); - if (!string.IsNullOrEmpty(description)) - { - writer.WriteLine(DocCommentStart); - writer.WriteLine($"{RemoveInvalidDescriptionCharacters(description)}"); - writer.WriteLine(DocCommentEnd); - } + ArgumentNullException.ThrowIfNull(element); + if (!element.Documentation.DescriptionAvailable) return; + if (element is not CodeElement codeElement) return; + + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), normalizationFunc: RemoveInvalidDescriptionCharacters); + writer.WriteLine(DocCommentStart); + writer.WriteLine(description); + writer.WriteLine(DocCommentEnd); } - public void WriteLongDescription(CodeDocumentation documentation, LanguageWriter writer, IEnumerable? additionalRemarks = default) + public void WriteLongDescription(IDocumentedElement element, LanguageWriter writer, IEnumerable? additionalRemarks = default) { ArgumentNullException.ThrowIfNull(writer); - if (documentation is null) return; - if (additionalRemarks == default) - additionalRemarks = Enumerable.Empty(); + ArgumentNullException.ThrowIfNull(element); + if (element.Documentation is not { } documentation) return; + if (element is not CodeElement codeElement) return; + additionalRemarks ??= []; + var additionalRemarksArray = additionalRemarks.ToArray(); if (documentation.DescriptionAvailable || documentation.ExternalDocumentationAvailable || additionalRemarksArray.Length != 0) { writer.WriteLine(DocCommentStart); if (documentation.DescriptionAvailable) - writer.WriteLine($"{RemoveInvalidDescriptionCharacters(documentation.DescriptionTemplate)}"); + { + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), normalizationFunc: RemoveInvalidDescriptionCharacters); + writer.WriteLine($"{description}"); + } foreach (var additionalRemark in additionalRemarksArray.Where(static x => !string.IsNullOrEmpty(x))) writer.WriteLine($"{additionalRemark}"); if (documentation.ExternalDocumentationAvailable) @@ -185,13 +192,14 @@ public void WriteLongDescription(CodeDocumentation documentation, LanguageWriter } } - public void WriteInLineDescription(string description, LanguageWriter writer) + public void WriteInLineDescription(IDocumentedElement element, LanguageWriter writer) { ArgumentNullException.ThrowIfNull(writer); - if (!string.IsNullOrEmpty(description)) - { - writer.WriteLine($"{InLineCommentPrefix}{RemoveInvalidDescriptionCharacters(description)}"); - } + ArgumentNullException.ThrowIfNull(element); + if (!element.Documentation.DescriptionAvailable) return; + if (element is not CodeElement codeElement) return; + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), normalizationFunc: RemoveInvalidDescriptionCharacters); + writer.WriteLine($"{InLineCommentPrefix}{description}"); } private static string GetDeprecationInformation(IDeprecableElement element) diff --git a/src/Kiota.Builder/Writers/Ruby/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeClassDeclarationWriter.cs index f487f14e51..993a0aa482 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeClassDeclarationWriter.cs @@ -54,7 +54,7 @@ public override void WriteCodeElement(ClassDeclaration codeElement, LanguageWrit var derivation = codeElement.Inherits == null ? string.Empty : $" < {conventions.GetNormalizedNamespacePrefixForType(codeElement.Inherits)}{codeElement.Inherits.Name.ToFirstCharacterUpperCase()}"; if (codeElement.Parent is CodeClass parentClass) - conventions.WriteShortDescription(parentClass.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(parentClass, writer); writer.StartBlock($"class {codeElement.Name.ToFirstCharacterUpperCase()}{derivation}"); var mixins = !codeElement.Implements.Any() ? string.Empty : $"include {codeElement.Implements.Select(static x => x.Name).Aggregate(static (x, y) => x + ", " + y)}"; writer.WriteLine($"{mixins}"); diff --git a/src/Kiota.Builder/Writers/Ruby/CodeEnumWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeEnumWriter.cs index 990ec5a4ff..9b50ea3d6e 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeEnumWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeEnumWriter.cs @@ -12,11 +12,11 @@ public override void WriteCodeElement(CodeEnum codeElement, LanguageWriter write { ArgumentNullException.ThrowIfNull(codeElement); ArgumentNullException.ThrowIfNull(writer); - if (!(codeElement?.Options.Any() ?? false)) + if (!codeElement.Options.Any()) return; if (codeElement.Parent is CodeNamespace ns) conventions.WriteNamespaceModules(ns, writer); - conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(codeElement, writer); writer.StartBlock($"{codeElement.Name.ToFirstCharacterUpperCase()} = {{"); codeElement.Options.ToList().ForEach(x => writer.WriteLine($"{x.Name.ToFirstCharacterUpperCase()}: :{x.Name.ToFirstCharacterUpperCase()},")); writer.CloseBlock(); diff --git a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs index 3d9346fa60..6ff28fe805 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs @@ -358,15 +358,20 @@ private void WriteMethodPrototype(CodeMethod code, LanguageWriter writer) } private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer) { - var isDescriptionPresent = !string.IsNullOrEmpty(code.Documentation.DescriptionTemplate); - var parametersWithDescription = code.Parameters.Where(x => !string.IsNullOrEmpty(code.Documentation.DescriptionTemplate)).OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase).ToArray(); - if (isDescriptionPresent || parametersWithDescription.Length != 0) + var parametersWithDescription = code.Parameters.Where(static x => x.Documentation.DescriptionAvailable).OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase).ToArray(); + if (code.Documentation.DescriptionAvailable || parametersWithDescription.Length != 0) { writer.WriteLine(conventions.DocCommentStart); - if (isDescriptionPresent) - writer.WriteLine($"{conventions.DocCommentPrefix}{RubyConventionService.RemoveInvalidDescriptionCharacters(code.Documentation.DescriptionTemplate)}"); + if (code.Documentation.DescriptionAvailable) + { + var description = code.Documentation.GetDescription(type => conventions.GetTypeString(type, code), normalizationFunc: RubyConventionService.RemoveInvalidDescriptionCharacters); + writer.WriteLine($"{conventions.DocCommentPrefix}{description}"); + } foreach (var paramWithDescription in parametersWithDescription) - writer.WriteLine($"{conventions.DocCommentPrefix}@param {paramWithDescription.Name.ToSnakeCase()} {RubyConventionService.RemoveInvalidDescriptionCharacters(paramWithDescription.Documentation.DescriptionTemplate)}"); + { + var description = paramWithDescription.Documentation.GetDescription(type => conventions.GetTypeString(type, code), normalizationFunc: RubyConventionService.RemoveInvalidDescriptionCharacters); + writer.WriteLine($"{conventions.DocCommentPrefix}@param {paramWithDescription.Name.ToSnakeCase()} {description}"); + } if (code.IsAsync) writer.WriteLine($"{conventions.DocCommentPrefix}@return a Fiber of {code.ReturnType.Name.ToSnakeCase()}"); diff --git a/src/Kiota.Builder/Writers/Ruby/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodePropertyWriter.cs index 12810768c6..318125d6c5 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodePropertyWriter.cs @@ -11,7 +11,7 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w ArgumentNullException.ThrowIfNull(codeElement); ArgumentNullException.ThrowIfNull(writer); if (codeElement.ExistsInExternalBaseType) return; - conventions.WriteShortDescription(codeElement.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(codeElement, writer); var returnType = conventions.GetTypeString(codeElement.Type, codeElement); if (codeElement.Parent is not CodeClass parentClass) throw new InvalidOperationException("The parent of a property should be a class"); switch (codeElement.Kind) diff --git a/src/Kiota.Builder/Writers/Ruby/RubyConventionService.cs b/src/Kiota.Builder/Writers/Ruby/RubyConventionService.cs index da307044b6..ea89e6c986 100644 --- a/src/Kiota.Builder/Writers/Ruby/RubyConventionService.cs +++ b/src/Kiota.Builder/Writers/Ruby/RubyConventionService.cs @@ -52,14 +52,16 @@ public override string TranslateType(CodeType type) _ => type.Name.ToFirstCharacterUpperCase() is string typeName && !string.IsNullOrEmpty(typeName) ? typeName : "object", }; } - public override void WriteShortDescription(string description, LanguageWriter writer) + public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); - if (!string.IsNullOrEmpty(description)) - { - writer.WriteLine($"{DocCommentPrefix}"); - writer.WriteLine($"# {description}"); - } + ArgumentNullException.ThrowIfNull(element); + if (!element.Documentation.DescriptionAvailable) return; + if (element is not CodeElement codeElement) return; + + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement)); + writer.WriteLine($"{DocCommentPrefix}"); + writer.WriteLine($"# {description}"); } #pragma warning disable CA1822 // Method should be static public string GetNormalizedNamespacePrefixForType(CodeTypeBase type) diff --git a/src/Kiota.Builder/Writers/Swift/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Swift/CodeClassDeclarationWriter.cs index 4843c18437..5411c52dbe 100644 --- a/src/Kiota.Builder/Writers/Swift/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Swift/CodeClassDeclarationWriter.cs @@ -19,7 +19,7 @@ protected override void WriteTypeDeclaration(ClassDeclaration codeElement, Langu .ToArray(); var derivation = derivedTypes.Length != 0 ? ": " + derivedTypes.Select(x => x.ToFirstCharacterUpperCase()).Aggregate(static (x, y) => $"{x}, {y}") + " " : string.Empty; if (codeElement.Parent is CodeClass parentClass) - conventions.WriteShortDescription(parentClass.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(parentClass, writer); writer.WriteLine($"public class {codeElement.Name.ToFirstCharacterUpperCase()} {derivation}{{"); writer.IncreaseIndent(); } diff --git a/src/Kiota.Builder/Writers/Swift/SwiftConventionService.cs b/src/Kiota.Builder/Writers/Swift/SwiftConventionService.cs index d0ef135b86..62edbb6dd2 100644 --- a/src/Kiota.Builder/Writers/Swift/SwiftConventionService.cs +++ b/src/Kiota.Builder/Writers/Swift/SwiftConventionService.cs @@ -20,11 +20,15 @@ public SwiftConventionService(string clientNamespaceName) public static readonly char NullableMarker = '?'; public static string NullableMarkerAsString => "?"; public override string ParseNodeInterfaceName => "ParseNode"; - public override void WriteShortDescription(string description, LanguageWriter writer) + public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); - if (!string.IsNullOrEmpty(description)) - writer.WriteLine($"{DocCommentPrefix}{description}"); + ArgumentNullException.ThrowIfNull(element); + if (!element.Documentation.DescriptionAvailable) return; + if (element is not CodeElement codeElement) return; + + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement)); + writer.WriteLine($"{DocCommentPrefix}{prefix}{description}{prefix}"); } public override string GetAccessModifier(AccessModifier access) { diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index 33a17b55a0..09388ac8ef 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -226,7 +226,7 @@ private void WriteEnumObjectConstant(CodeConstant codeElement, LanguageWriter wr writer.StartBlock($"export const {codeElement.Name.ToFirstCharacterUpperCase()} = {{"); codeEnum.Options.ToList().ForEach(x => { - conventions.WriteShortDescription(x.Documentation.DescriptionTemplate, writer); + conventions.WriteShortDescription(x, writer); writer.WriteLine($"{x.Name.ToFirstCharacterUpperCase()}: \"{x.WireName}\","); }); writer.CloseBlock("} as const;"); diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs index ca7bab6eab..1df04c8940 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs @@ -42,8 +42,8 @@ internal static void WriteMethodDocumentationInternal(CodeMethod code, LanguageW code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name) - .Select(x => $"@param {x.Name} {TypeScriptConventionService.RemoveInvalidDescriptionCharacters(x.Documentation.DescriptionTemplate)}") - .Union(new[] { returnRemark })); + .Select(x => $"@param {x.Name} {x.Documentation.GetDescription(type => typeScriptConventionService.GetTypeString(type, code), TypeScriptConventionService.ReferenceTypePrefix, TypeScriptConventionService.ReferenceTypeSuffix, TypeScriptConventionService.RemoveInvalidDescriptionCharacters)}") + .Union([returnRemark])); } private static readonly BaseCodeParameterOrderComparer parameterOrderComparer = new(); private void WriteMethodPrototype(CodeMethod code, LanguageWriter writer, string returnType, bool isVoid) diff --git a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs index d724c79795..3b0e16617e 100644 --- a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs +++ b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs @@ -132,25 +132,34 @@ public bool IsPrimitiveType(string typeName) } #pragma warning restore CA1822 // Method should be static internal static string RemoveInvalidDescriptionCharacters(string originalDescription) => originalDescription?.Replace("\\", "/", StringComparison.OrdinalIgnoreCase) ?? string.Empty; - public override void WriteShortDescription(string description, LanguageWriter writer) + public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { ArgumentNullException.ThrowIfNull(writer); - if (!string.IsNullOrEmpty(description)) - writer.WriteLine($"{DocCommentStart} {RemoveInvalidDescriptionCharacters(description)}{DocCommentEnd}"); + ArgumentNullException.ThrowIfNull(element); + if (!element.Documentation.DescriptionAvailable) return; + if (element is not CodeElement codeElement) return; + + var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters); + writer.WriteLine($"{DocCommentStart} {description}{DocCommentEnd}"); } + internal const string ReferenceTypePrefix = "{@link "; + internal const string ReferenceTypeSuffix = "}"; public void WriteLongDescription(IDocumentedElement documentedElement, LanguageWriter writer, IEnumerable? additionalRemarks = default) { ArgumentNullException.ThrowIfNull(writer); ArgumentNullException.ThrowIfNull(documentedElement); if (documentedElement.Documentation is null) return; - if (additionalRemarks == default) - additionalRemarks = Enumerable.Empty(); + if (documentedElement is not CodeElement codeElement) return; + additionalRemarks ??= []; var remarks = additionalRemarks.Where(static x => !string.IsNullOrEmpty(x)).ToArray(); if (documentedElement.Documentation.DescriptionAvailable || documentedElement.Documentation.ExternalDocumentationAvailable || remarks.Length != 0) { writer.WriteLine(DocCommentStart); if (documentedElement.Documentation.DescriptionAvailable) - writer.WriteLine($"{DocCommentPrefix}{RemoveInvalidDescriptionCharacters(documentedElement.Documentation.DescriptionTemplate)}"); + { + var description = documentedElement.Documentation.GetDescription(type => GetTypeString(type, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters); + writer.WriteLine($"{DocCommentPrefix}{description}"); + } foreach (var additionalRemark in remarks) writer.WriteLine($"{DocCommentPrefix}{additionalRemark}"); From f3997c2d31ce10c2e8e1c822a41e82bf431997e9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 09:23:42 -0500 Subject: [PATCH 154/394] - fixes regession for position parameter in indexer --- src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs index ae27c1c982..64b3cc92c9 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs @@ -13,7 +13,7 @@ public override void WriteCodeElement(CodeIndexer codeElement, LanguageWriter wr if (codeElement.Parent is not CodeClass parentClass) throw new InvalidOperationException("The parent of a property should be a class"); var returnType = conventions.GetTypeString(codeElement.ReturnType, codeElement); conventions.WriteShortDescription(codeElement, writer); - conventions.WriteShortDescription(codeElement.IndexParameter, writer, $"", ""); + conventions.WriteShortDescription(codeElement.IndexParameter, writer, $"", ""); conventions.WriteDeprecationAttribute(codeElement, writer); writer.StartBlock($"public {returnType} this[{conventions.GetTypeString(codeElement.IndexParameter.Type, codeElement)} position] {{ get {{"); if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProp) From ea41664bf9b0ed79603870a84bfd4150fea256dd Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 10:18:09 -0500 Subject: [PATCH 155/394] - adds thrown exceptions doc comments support for dotnet --- .../Writers/CSharp/CSharpConventionService.cs | 6 ++++++ .../Writers/CSharp/CodeIndexerWriter.cs | 2 +- .../Writers/CSharp/CodeMethodWriter.cs | 14 ++++++++++++++ .../Writers/CSharp/CodeMethodWriterTests.cs | 5 +++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index 7cd4558bed..9a965ca619 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -47,6 +47,12 @@ public override void WriteShortDescription(IDocumentedElement element, LanguageW var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, static x => x.CleanupXMLString()); writer.WriteLine($"{DocCommentPrefix}{prefix}{description}{suffix}"); } + public void WriteAdditionalDescriptionItem(string description, LanguageWriter writer) + { + ArgumentNullException.ThrowIfNull(writer); + ArgumentNullException.ThrowIfNull(description); + writer.WriteLine($"{DocCommentPrefix}{description}"); + } public void WriteLongDescription(IDocumentedElement element, LanguageWriter writer) { ArgumentNullException.ThrowIfNull(writer); diff --git a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs index 64b3cc92c9..7ed4144f71 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs @@ -12,7 +12,7 @@ public override void WriteCodeElement(CodeIndexer codeElement, LanguageWriter wr ArgumentNullException.ThrowIfNull(writer); if (codeElement.Parent is not CodeClass parentClass) throw new InvalidOperationException("The parent of a property should be a class"); var returnType = conventions.GetTypeString(codeElement.ReturnType, codeElement); - conventions.WriteShortDescription(codeElement, writer); + conventions.WriteShortDescription(codeElement, writer);//TODO make the parameter name dynamic in v2 conventions.WriteShortDescription(codeElement.IndexParameter, writer, $"", ""); conventions.WriteDeprecationAttribute(codeElement, writer); writer.StartBlock($"public {returnType} this[{conventions.GetTypeString(codeElement.IndexParameter.Type, codeElement)} position] {{ get {{"); diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index 85b27d1c1b..ea72433b98 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -546,8 +546,22 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer) .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase)) conventions.WriteShortDescription(paramWithDescription, writer, $"", ""); + WriteThrownExceptions(code, writer); conventions.WriteDeprecationAttribute(code, writer); } + private void WriteThrownExceptions(CodeMethod element, LanguageWriter writer) + { + if (element.Kind is not CodeMethodKind.RequestExecutor) return; + foreach (var exception in element.ErrorMappings) + { + var statusCode = exception.Key.ToUpperInvariant() switch + { + "XXX" => "4XX or 5XX", + _ => exception.Key, + }; + conventions.WriteAdditionalDescriptionItem($"When receiving a {statusCode} status code", writer); + } + } private static readonly BaseCodeParameterOrderComparer parameterOrderComparer = new(); private static string GetBaseSuffix(bool isConstructor, bool inherits, CodeClass parentClass, CodeMethod currentMethod) { diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs index bb15cda15e..05d21a87da 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs @@ -470,6 +470,7 @@ public void WritesRequestExecutorBody() var result = tw.ToString(); Assert.Contains("var requestInfo", result); Assert.Contains("var errorMapping = new Dictionary>", result); + Assert.Contains("", result); + Assert.Contains(" Date: Fri, 2 Feb 2024 11:39:12 -0500 Subject: [PATCH 156/394] - adds missing return doc comments for CSharp Signed-off-by: Vincent Biret --- src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs | 1 + src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs | 2 ++ .../Writers/CSharp/CodeIndexerWriterTests.cs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs index 7ed4144f71..cde95bac5b 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs @@ -14,6 +14,7 @@ public override void WriteCodeElement(CodeIndexer codeElement, LanguageWriter wr var returnType = conventions.GetTypeString(codeElement.ReturnType, codeElement); conventions.WriteShortDescription(codeElement, writer);//TODO make the parameter name dynamic in v2 conventions.WriteShortDescription(codeElement.IndexParameter, writer, $"", ""); + conventions.WriteAdditionalDescriptionItem($"A ", writer); conventions.WriteDeprecationAttribute(codeElement, writer); writer.StartBlock($"public {returnType} this[{conventions.GetTypeString(codeElement.IndexParameter.Type, codeElement)} position] {{ get {{"); if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProp) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index ea72433b98..65e75ae003 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -542,6 +542,8 @@ protected string GetSendRequestMethodName(bool isVoid, CodeElement currentElemen private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer) { conventions.WriteLongDescription(code, writer); + if (!"void".Equals(code.ReturnType.Name, StringComparison.OrdinalIgnoreCase) && code.Kind is not CodeMethodKind.ClientConstructor or CodeMethodKind.Constructor) + conventions.WriteAdditionalDescriptionItem($"A ", writer); foreach (var paramWithDescription in code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase)) diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeIndexerWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeIndexerWriterTests.cs index 93bec8f238..a55e1d7e63 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeIndexerWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeIndexerWriterTests.cs @@ -81,6 +81,8 @@ public void WritesIndexer() Assert.Contains("id\", position", result); Assert.Contains("some description", result); Assert.Contains("public SomeRequestBuilder this[string position]", result); + Assert.Contains("return new SomeRequestBuilder(urlTplParams, RequestAdapter);", result); + Assert.Contains("", result); AssertExtensions.CurlyBracesAreClosed(result); } } From 5aab564d86177c5e4dd4dff9f1bf031cc8dc9a22 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 12:56:09 -0500 Subject: [PATCH 157/394] - adds missing return doc comment to java - adds link to types for javadoc Signed-off-by: Vincent Biret --- .../Writers/Java/CodeMethodWriter.cs | 4 ++-- .../Writers/Java/CodePropertyWriter.cs | 6 ++++-- .../Writers/Java/JavaConventionService.cs | 20 ++++++++++++++----- .../Writers/Java/CodeMethodWriterTests.cs | 2 ++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index 639f42f6de..d3e33feaff 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -737,13 +737,13 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, st { var returnVoid = baseReturnType.Equals("void", StringComparison.OrdinalIgnoreCase); // Void returns, this includes constructors, should not have a return statement in the JavaDocs. - var returnRemark = returnVoid ? string.Empty : $"@return a {finalReturnType}"; + var returnRemark = returnVoid ? string.Empty : conventions.GetReturnDocComment(finalReturnType); conventions.WriteLongDescription(code, writer, code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) - .Select(x => $"@param {x.Name} {x.Documentation.GetDescription(y => conventions.GetTypeString(y, code), normalizationFunc: JavaConventionService.RemoveInvalidDescriptionCharacters)}") + .Select(x => $"@param {x.Name} {x.Documentation.GetDescription(y => conventions.GetTypeReferenceForDocComment(y, code), normalizationFunc: JavaConventionService.RemoveInvalidDescriptionCharacters)}") .Union([returnRemark])); if (!returnVoid) //Nullable/Nonnull annotations for returns are a part of Method Documentation writer.WriteLine(code.ReturnType.IsNullable ? "@jakarta.annotation.Nullable" : "@jakarta.annotation.Nonnull"); diff --git a/src/Kiota.Builder/Writers/Java/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Java/CodePropertyWriter.cs index 61dc35b4a1..0f429430f0 100644 --- a/src/Kiota.Builder/Writers/Java/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodePropertyWriter.cs @@ -1,6 +1,5 @@ using System; using Kiota.Builder.CodeDOM; -using Kiota.Builder.Extensions; namespace Kiota.Builder.Writers.Java; public class CodePropertyWriter : BaseElementWriter @@ -13,8 +12,11 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w if (codeElement.ExistsInExternalBaseType) return; if (codeElement.Parent is not CodeClass parentClass) throw new InvalidOperationException("The parent of a property should be a class"); - conventions.WriteLongDescription(codeElement, writer); var returnType = conventions.GetTypeString(codeElement.Type, codeElement); + var returnRemark = codeElement.Kind is CodePropertyKind.RequestBuilder ? + conventions.GetReturnDocComment(returnType) : + string.Empty; + conventions.WriteLongDescription(codeElement, writer, [returnRemark]); var defaultValue = string.Empty; conventions.WriteDeprecatedAnnotation(codeElement, writer); switch (codeElement.Kind) diff --git a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs index 088867a10e..314a0404a5 100644 --- a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs +++ b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs @@ -92,7 +92,11 @@ _ when type.Name.Contains('.', StringComparison.OrdinalIgnoreCase) => type.Name, _ => type.Name is string typeName && !string.IsNullOrEmpty(typeName) ? typeName : "Object", }; } - private const string ReferenceTypePrefix = "{@link #"; + internal string GetReturnDocComment(string returnType) + { + return $"@return a {ReferenceTypePrefix}{returnType}{ReferenceTypeSuffix}"; + } + private const string ReferenceTypePrefix = "{@link "; private const string ReferenceTypeSuffix = "}"; public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") { @@ -101,26 +105,32 @@ public override void WriteShortDescription(IDocumentedElement element, LanguageW if (!element.Documentation.DescriptionAvailable) return; if (element is not CodeElement codeElement) return; - var description = element.Documentation.GetDescription(x => GetTypeString(x, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters); + var description = element.Documentation.GetDescription(x => GetTypeReferenceForDocComment(x, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters); writer.WriteLine($"{DocCommentStart} {description}{DocCommentEnd}"); } + internal string GetTypeReferenceForDocComment(CodeTypeBase code, CodeElement targetElement) + { + if (code is CodeType codeType && codeType.TypeDefinition is CodeMethod method) + return $"{GetTypeString(new CodeType { TypeDefinition = method.Parent, IsExternal = false }, targetElement)}#{GetTypeString(code, targetElement)}"; + return $"{GetTypeString(code, targetElement)}"; + } public void WriteLongDescription(CodeElement element, LanguageWriter writer, IEnumerable? additionalRemarks = default) { ArgumentNullException.ThrowIfNull(writer); if (element is not IDocumentedElement documentedElement || documentedElement.Documentation is not CodeDocumentation documentation) return; if (additionalRemarks == default) additionalRemarks = []; - var remarks = additionalRemarks.ToArray(); + var remarks = additionalRemarks.Where(static x => !string.IsNullOrEmpty(x)).ToArray(); if (documentation.DescriptionAvailable || documentation.ExternalDocumentationAvailable || remarks.Length != 0) { writer.WriteLine(DocCommentStart); if (documentation.DescriptionAvailable) { - var description = documentedElement.Documentation.GetDescription(x => GetTypeString(x, element), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters); + var description = documentedElement.Documentation.GetDescription(x => GetTypeReferenceForDocComment(x, element), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters); writer.WriteLine($"{DocCommentPrefix}{description}"); } - foreach (var additionalRemark in remarks.Where(static x => !string.IsNullOrEmpty(x))) + foreach (var additionalRemark in remarks) writer.WriteLine($"{DocCommentPrefix}{additionalRemark}"); if (element is IDeprecableElement deprecableElement && deprecableElement.Deprecation is not null && deprecableElement.Deprecation.IsDeprecated) foreach (var additionalComment in GetDeprecationInformationForDocumentationComment(deprecableElement)) diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index 635df542a1..1e390cd22f 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -654,6 +654,8 @@ public void WritesRequestExecutorBody() Assert.Contains("put(\"5XX\", Error5XX::createFromDiscriminatorValue);", result); Assert.Contains("put(\"401\", Error401::createFromDiscriminatorValue);", result); Assert.Contains("send", result); + Assert.Contains("@return", result); + Assert.Contains("@link", result); AssertExtensions.CurlyBracesAreClosed(result); } [Fact] From 5b6326190a48c8dd19b6322d3e8f63b7d3295a78 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 13:08:04 -0500 Subject: [PATCH 158/394] - adds support for exception thrown in java doc comments Signed-off-by: Vincent Biret --- .../Writers/Java/CodeMethodWriter.cs | 19 ++++++++++++++++++- .../Writers/Java/CodeMethodWriterTests.cs | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index d3e33feaff..c542d9ca51 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -744,10 +744,27 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, st .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) .Select(x => $"@param {x.Name} {x.Documentation.GetDescription(y => conventions.GetTypeReferenceForDocComment(y, code), normalizationFunc: JavaConventionService.RemoveInvalidDescriptionCharacters)}") - .Union([returnRemark])); + .Union([returnRemark]) + .Union(GetExceptionDocRemarks(code))); if (!returnVoid) //Nullable/Nonnull annotations for returns are a part of Method Documentation writer.WriteLine(code.ReturnType.IsNullable ? "@jakarta.annotation.Nullable" : "@jakarta.annotation.Nonnull"); } + private IEnumerable GetExceptionDocRemarks(CodeMethod code) + { + if (code.Kind is not CodeMethodKind.RequestExecutor) + yield break; + + foreach (var errorMapping in code.ErrorMappings) + { + var statusCode = errorMapping.Key.ToUpperInvariant() switch + { + "XXX" => "4XX or 5XX", + _ => errorMapping.Key, + }; + var errorTypeString = conventions.GetTypeString(errorMapping.Value, code); + yield return $"@throws {errorTypeString} When receiving a {statusCode} status code"; + } + } private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod method) { var isCollection = propType.CollectionKind != CodeTypeBase.CodeTypeCollectionKind.None; diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index 1e390cd22f..fb3bbacc5c 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -656,6 +656,7 @@ public void WritesRequestExecutorBody() Assert.Contains("send", result); Assert.Contains("@return", result); Assert.Contains("@link", result); + Assert.Contains("@throws", result); AssertExtensions.CurlyBracesAreClosed(result); } [Fact] From 33b13f392b3f811ce294f5af8a706ffac4d9ac3b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 13:19:39 -0500 Subject: [PATCH 159/394] - fixes type doc comment syntax in go - does not emit comment if no description is available in go Signed-off-by: Vincent Biret --- src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs | 2 +- src/Kiota.Builder/Writers/Go/GoConventionService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs b/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs index b8e77e213e..6e7c26b7f9 100644 --- a/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeClassDeclarationWriter.cs @@ -15,7 +15,7 @@ protected override void WriteTypeDeclaration(ClassDeclaration codeElement, Langu ArgumentNullException.ThrowIfNull(writer); var className = codeElement.Name.ToFirstCharacterUpperCase(); if (codeElement.Parent is not CodeClass currentClass) throw new InvalidOperationException("The parent of a class declaration should be a class"); - conventions.WriteShortDescription(currentClass, writer, $"A {className}"); + conventions.WriteShortDescription(currentClass, writer, $"{className} "); conventions.WriteDeprecation(currentClass, writer); conventions.WriteLinkDescription(currentClass.Documentation, writer); writer.StartBlock($"type {className} struct {{"); diff --git a/src/Kiota.Builder/Writers/Go/GoConventionService.cs b/src/Kiota.Builder/Writers/Go/GoConventionService.cs index 24f08cbc05..6f45943e74 100644 --- a/src/Kiota.Builder/Writers/Go/GoConventionService.cs +++ b/src/Kiota.Builder/Writers/Go/GoConventionService.cs @@ -173,7 +173,7 @@ public override void WriteShortDescription(IDocumentedElement element, LanguageW if (!element.Documentation.DescriptionAvailable) return; if (element is not CodeElement codeElement) return; - var description = element.Documentation.GetDescription(x => GetTypeString(x, codeElement)); + var description = element.Documentation.GetDescription(x => GetTypeString(x, codeElement, true, false)); if (!string.IsNullOrEmpty(prefix)) { description = description.ToFirstCharacterLowerCase(); From 723d73ff04b2d688f61a6a38403decc3960f44a9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 14:08:55 -0500 Subject: [PATCH 160/394] - adds missing return doc comment in go - adds throws doc comment in go Signed-off-by: Vincent Biret --- .../Writers/Go/CodeMethodWriter.cs | 20 +++++++++++++++++++ .../Writers/Go/GoConventionService.cs | 2 +- .../Writers/Go/CodeMethodWriterTests.cs | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs index ee709bed1c..16b4a4fc44 100644 --- a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs @@ -292,8 +292,28 @@ private void WriteMethodDocumentation(CodeMethod code, string methodName, Langua { conventions.WriteShortDescription(code, writer, $"{methodName.ToFirstCharacterUpperCase()} "); conventions.WriteDeprecation(code, writer); + if (!"void".Equals(code.ReturnType.Name, StringComparison.OrdinalIgnoreCase)) + { + var shortReturnTypeName = conventions.GetTypeString(code.ReturnType, code, true, true, false); + conventions.WriteDescriptionItem($"returns a {shortReturnTypeName} when successful", writer); + } + WriteThrownExceptions(code, writer); conventions.WriteLinkDescription(code.Documentation, writer); } + private void WriteThrownExceptions(CodeMethod code, LanguageWriter writer) + { + if (code.Kind is not CodeMethodKind.RequestExecutor) return; + foreach (var errorMapping in code.ErrorMappings) + { + var statusCode = errorMapping.Key.ToUpperInvariant() switch + { + "XXX" => "4XX or 5XX", + _ => errorMapping.Key, + }; + var errorTypeString = conventions.GetTypeString(errorMapping.Value, code, false, false, false); + conventions.WriteDescriptionItem($"returns a {errorTypeString} error when the service returns a {statusCode} status code", writer); + } + } private const string TempParamsVarName = "urlParams"; private static void WriteRawUrlConstructorBody(CodeClass parentClass, CodeMethod codeElement, LanguageWriter writer) { diff --git a/src/Kiota.Builder/Writers/Go/GoConventionService.cs b/src/Kiota.Builder/Writers/Go/GoConventionService.cs index 6f45943e74..fc4c739d58 100644 --- a/src/Kiota.Builder/Writers/Go/GoConventionService.cs +++ b/src/Kiota.Builder/Writers/Go/GoConventionService.cs @@ -54,7 +54,7 @@ public string GetTypeString(CodeTypeBase code, CodeElement targetElement, bool i throw new InvalidOperationException($"Go does not support union types, the union type {code.Name} should have been filtered out by the refiner"); if (code is CodeType currentType) { - var importSymbol = GetImportSymbol(code, targetElement); + var importSymbol = includeImportSymbol ? GetImportSymbol(code, targetElement) : string.Empty; if (!string.IsNullOrEmpty(importSymbol)) importSymbol += "."; var typeName = TranslateType(currentType, includeImportSymbol); diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs index cda1087fd7..ba7289a149 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs @@ -718,6 +718,7 @@ public void WritesRequestExecutorBody() Assert.Contains("return nil, err", result); Assert.Contains("if res == nil", result); Assert.Contains("return nil, nil", result); + Assert.Contains("returns", result); AssertExtensions.CurlyBracesAreClosed(result); } [Fact] From fe3efe825a28436a6d8029045b15f2fb0e44bc1e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 14:38:28 -0500 Subject: [PATCH 161/394] - adds support for thrown exception doc comments in typescript - fixes jsdoc implementation of return type in typescript Signed-off-by: Vincent Biret --- .../Writers/TypeScript/CodeMethodWriter.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs index 1df04c8940..2e9a99cc3b 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using Kiota.Builder.CodeDOM; using Kiota.Builder.Extensions; @@ -34,8 +35,8 @@ internal static void WriteMethodDocumentationInternal(CodeMethod code, LanguageW var returnRemark = (isVoid, code.IsAsync) switch { (true, _) => string.Empty, - (false, true) => $"@returns a Promise of {code.ReturnType.Name.ToFirstCharacterUpperCase()}", - (false, false) => $"@returns a {code.ReturnType.Name}", + (false, true) => $"@returns {{Promise<{typeScriptConventionService.GetTypeString(code.ReturnType, code)}>}}", + (false, false) => $"@returns {{{typeScriptConventionService.GetTypeString(code.ReturnType, code)}}}", }; typeScriptConventionService.WriteLongDescription(code, writer, @@ -43,7 +44,22 @@ internal static void WriteMethodDocumentationInternal(CodeMethod code, LanguageW .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name) .Select(x => $"@param {x.Name} {x.Documentation.GetDescription(type => typeScriptConventionService.GetTypeString(type, code), TypeScriptConventionService.ReferenceTypePrefix, TypeScriptConventionService.ReferenceTypeSuffix, TypeScriptConventionService.RemoveInvalidDescriptionCharacters)}") - .Union([returnRemark])); + .Union([returnRemark]) + .Union(GetThrownExceptionsRemarks(code, typeScriptConventionService))); + } + private static IEnumerable GetThrownExceptionsRemarks(CodeMethod code, TypeScriptConventionService typeScriptConventionService) + { + if (code.Kind is not CodeMethodKind.RequestExecutor) yield break; + foreach (var errorMapping in code.ErrorMappings) + { + var statusCode = errorMapping.Key.ToUpperInvariant() switch + { + "XXX" => "4XX or 5XX", + _ => errorMapping.Key, + }; + var errorTypeString = typeScriptConventionService.GetTypeString(errorMapping.Value, code, false); + yield return $"@throws {{{errorTypeString}}} error when the service returns a {statusCode} status code"; + } } private static readonly BaseCodeParameterOrderComparer parameterOrderComparer = new(); private void WriteMethodPrototype(CodeMethod code, LanguageWriter writer, string returnType, bool isVoid) From 573ed9a84a811396351d605f99e1c2b0a602f409 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 14:40:22 -0500 Subject: [PATCH 162/394] - adds changelog entries for doc comments improvements --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c98c551eb..e59d56c6f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Keyword in enum names for go should not be escaped. [#2877](https://github.com/microsoft/kiota/issues/2877) - Generator method code reduction in Python. [#3695](https://github.com/microsoft/kiota/issues/3695) +- Fixed return doc comments for Go/Java/CSharp/TypeScript. +- Fixed type names in doc comments and deprecation noticed across languages. +- Added thrown exceptions in doc comments for Go/CSharp/Java/TypeScript. [#3811](https://github.com/microsoft/kiota/issues/3811) + ## [1.11.1] - 2024-02-05 ### Added From 3639f412c87a66f525fe85fa7e71000feeab9cc4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 14:48:11 -0500 Subject: [PATCH 163/394] - fixed formatting --- src/Kiota.Builder/CodeDOM/CodeDocumentation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs index 2d8035fb76..5fd6219455 100644 --- a/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs +++ b/src/Kiota.Builder/CodeDOM/CodeDocumentation.cs @@ -1,6 +1,6 @@ using System; -using System.Collections.Generic; using System.Collections.Concurrent; +using System.Collections.Generic; using System.Linq; namespace Kiota.Builder.CodeDOM; From 641a20a1fb6044c7d12f9d5f6303091b7d01a4a5 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 14:50:43 -0500 Subject: [PATCH 164/394] - fixes failing test --- .../Writers/TypeScript/CodeFunctionWriterTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index a3bbd00f73..cb9856a699 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -851,7 +851,7 @@ public void DoesNotAddUndefinedOnNonNullableReturnType() root.TryAddCodeFile("foo", function); writer.Write(function); var result = tw.ToString(); - Assert.DoesNotContain("| undefined", result.Substring(result.IndexOf("Promise<", StringComparison.OrdinalIgnoreCase))); + Assert.DoesNotContain("| undefined", result[result.IndexOf(": Promise<", StringComparison.OrdinalIgnoreCase)..]); AssertExtensions.CurlyBracesAreClosed(result, 1); } From 252425326f8d2f5fbeeef5e021d10ae35798b529 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 2 Feb 2024 15:01:09 -0500 Subject: [PATCH 165/394] - fixes additional failing unit test Signed-off-by: Vincent Biret --- .../Writers/TypeScript/CodeFunctionWriterTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index cb9856a699..9ffcb50952 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -715,7 +715,7 @@ public void WritesMethodAsyncDescription() Assert.Contains("@param ", result); Assert.Contains(ParamName, result); Assert.Contains(ParamDescription, result); - Assert.Contains("@returns a Promise of", result); + Assert.Contains("@returns {Promise<", result); Assert.Contains("*/", result); AssertExtensions.CurlyBracesAreClosed(result, 1); } @@ -750,7 +750,7 @@ public void WritesMethodSyncDescription() root.TryAddCodeFile("foo", function); writer.Write(function); var result = tw.ToString(); - Assert.DoesNotContain("@returns a Promise of", result); + Assert.DoesNotContain("@returns {Promise<", result); AssertExtensions.CurlyBracesAreClosed(result, 1); } [Fact] From 66eac867e53bcb5d5ae4467038185f464f7da4c4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 11:00:52 -0500 Subject: [PATCH 166/394] - adds support for deduplicating error mappings Signed-off-by: Vincent Biret --- src/Kiota.Builder/CodeDOM/CodeMethod.cs | 17 ++++++- src/Kiota.Builder/KiotaBuilder.cs | 12 ++--- src/Kiota.Builder/Refiners/CSharpRefiner.cs | 1 + .../Refiners/CommonLanguageRefiner.cs | 8 +++ src/Kiota.Builder/Refiners/GoRefiner.cs | 1 + src/Kiota.Builder/Refiners/JavaRefiner.cs | 1 + src/Kiota.Builder/Refiners/PhpRefiner.cs | 1 + src/Kiota.Builder/Refiners/PythonRefiner.cs | 1 + src/Kiota.Builder/Refiners/RubyRefiner.cs | 1 + .../Refiners/TypeScriptRefiner.cs | 1 + .../Writers/TypeScript/CodeConstantWriter.cs | 2 +- .../CodeDOM/CodeMethodTests.cs | 50 +++++++++++++++++++ 12 files changed, 87 insertions(+), 9 deletions(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeMethod.cs b/src/Kiota.Builder/CodeDOM/CodeMethod.cs index a1cc5dc3c5..086a2cad14 100644 --- a/src/Kiota.Builder/CodeDOM/CodeMethod.cs +++ b/src/Kiota.Builder/CodeDOM/CodeMethod.cs @@ -257,8 +257,23 @@ public CodeIndexer? OriginalIndexer /// Avoids regex operations /// public string SimpleName { get; set; } = string.Empty; + /// + /// Deduplicates 4XX and 5XX error mappings into a single XXX mapping if they are the same. + /// + public void DeduplicateErrorMappings() + { + if (!errorMappings.TryGetValue(ErrorMappingClientRange, out var clientError) || !errorMappings.TryGetValue(ErrorMappingServerRange, out var serverError)) return; + if (clientError == serverError && errorMappings.TryAdd(ErrorMappingAllRange, clientError)) + { + errorMappings.TryRemove(ErrorMappingServerRange, out var _); + errorMappings.TryRemove(ErrorMappingClientRange, out var _); + } + } + internal const string ErrorMappingClientRange = "4XX"; + internal const string ErrorMappingServerRange = "5XX"; + internal const string ErrorMappingAllRange = "XXX"; - private ConcurrentDictionary errorMappings = new(); + private ConcurrentDictionary errorMappings = new(StringComparer.OrdinalIgnoreCase); /// /// Mapping of the error code and response types for this method. diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index c381bdd15d..7cf88b6781 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -1279,9 +1279,7 @@ openApiExtension is OpenApiPrimaryErrorMessageExtension primaryErrorMessageExten private const string RequestBodyPlainTextContentType = "text/plain"; private static readonly HashSet noContentStatusCodes = new(StringComparer.OrdinalIgnoreCase) { "201", "202", "204", "205" }; private static readonly HashSet errorStatusCodes = new(Enumerable.Range(400, 599).Select(static x => x.ToString(CultureInfo.InvariantCulture)) - .Concat(new[] { FourXXError, FiveXXError }), StringComparer.OrdinalIgnoreCase); - private const string FourXXError = "4XX"; - private const string FiveXXError = "5XX"; + .Concat([CodeMethod.ErrorMappingClientRange, CodeMethod.ErrorMappingServerRange]), StringComparer.OrdinalIgnoreCase); private void AddErrorMappingsForExecutorMethod(OpenApiUrlTreeNode currentNode, OpenApiOperation operation, CodeMethod executorMethod) { foreach (var response in operation.Responses.Where(x => errorStatusCodes.Contains(x.Key))) @@ -1293,10 +1291,10 @@ private void AddErrorMappingsForExecutorMethod(OpenApiUrlTreeNode currentNode, O } if (operation.Responses.TryGetValue("default", out var defaultResponse) && defaultResponse.GetResponseSchema(config.StructuredMimeTypes) is { } errorSchema) { - if (!executorMethod.HasErrorMappingCode(FourXXError)) - AddErrorMappingToExecutorMethod(currentNode, operation, executorMethod, errorSchema, defaultResponse, FourXXError); - if (!executorMethod.HasErrorMappingCode(FiveXXError)) - AddErrorMappingToExecutorMethod(currentNode, operation, executorMethod, errorSchema, defaultResponse, FiveXXError); + if (!executorMethod.HasErrorMappingCode(CodeMethod.ErrorMappingClientRange)) + AddErrorMappingToExecutorMethod(currentNode, operation, executorMethod, errorSchema, defaultResponse, CodeMethod.ErrorMappingClientRange); + if (!executorMethod.HasErrorMappingCode(CodeMethod.ErrorMappingServerRange)) + AddErrorMappingToExecutorMethod(currentNode, operation, executorMethod, errorSchema, defaultResponse, CodeMethod.ErrorMappingServerRange); } } private void AddErrorMappingToExecutorMethod(OpenApiUrlTreeNode currentNode, OpenApiOperation operation, CodeMethod executorMethod, OpenApiSchema errorSchema, OpenApiResponse response, string errorCode) diff --git a/src/Kiota.Builder/Refiners/CSharpRefiner.cs b/src/Kiota.Builder/Refiners/CSharpRefiner.cs index 3920ad5220..9ca8c9241e 100644 --- a/src/Kiota.Builder/Refiners/CSharpRefiner.cs +++ b/src/Kiota.Builder/Refiners/CSharpRefiner.cs @@ -21,6 +21,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance () => new CodeType { Name = "string", IsNullable = false, IsExternal = true }, true ); + DeduplicateErrorMappings(generatedCode); MoveRequestBuilderPropertiesToBaseType(generatedCode, new CodeUsing { diff --git a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs index 7e142e8c48..30b1b21455 100644 --- a/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs +++ b/src/Kiota.Builder/Refiners/CommonLanguageRefiner.cs @@ -1527,4 +1527,12 @@ internal static void AddPrimaryErrorMessage(CodeElement currentElement, string n } CrawlTree(currentElement, x => AddPrimaryErrorMessage(x, name, type, asProperty)); } + protected static void DeduplicateErrorMappings(CodeElement codeElement) + { + if (codeElement is CodeMethod { Kind: CodeMethodKind.RequestExecutor } requestExecutorMethod) + { + requestExecutorMethod.DeduplicateErrorMappings(); + } + CrawlTree(codeElement, DeduplicateErrorMappings); + } } diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index 0878379326..fcdd9bce1d 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -18,6 +18,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance return Task.Run(() => { cancellationToken.ThrowIfCancellationRequested(); + DeduplicateErrorMappings(generatedCode); MoveRequestBuilderPropertiesToBaseType(generatedCode, new CodeUsing { diff --git a/src/Kiota.Builder/Refiners/JavaRefiner.cs b/src/Kiota.Builder/Refiners/JavaRefiner.cs index c6145fa812..d1237449bf 100644 --- a/src/Kiota.Builder/Refiners/JavaRefiner.cs +++ b/src/Kiota.Builder/Refiners/JavaRefiner.cs @@ -19,6 +19,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance { cancellationToken.ThrowIfCancellationRequested(); CorrectCommonNames(generatedCode); + DeduplicateErrorMappings(generatedCode); AddQueryParameterExtractorMethod(generatedCode); MoveRequestBuilderPropertiesToBaseType(generatedCode, new CodeUsing diff --git a/src/Kiota.Builder/Refiners/PhpRefiner.cs b/src/Kiota.Builder/Refiners/PhpRefiner.cs index f8830ceeb0..e53a544de7 100644 --- a/src/Kiota.Builder/Refiners/PhpRefiner.cs +++ b/src/Kiota.Builder/Refiners/PhpRefiner.cs @@ -20,6 +20,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance return Task.Run(() => { RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor); + DeduplicateErrorMappings(generatedCode); AddInnerClasses(generatedCode, true, string.Empty, diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 2640af6acb..8f1f553f88 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -16,6 +16,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance return Task.Run(() => { cancellationToken.ThrowIfCancellationRequested(); + DeduplicateErrorMappings(generatedCode); ConvertUnionTypesToWrapper(generatedCode, _configuration.UsesBackingStore, static s => s, diff --git a/src/Kiota.Builder/Refiners/RubyRefiner.cs b/src/Kiota.Builder/Refiners/RubyRefiner.cs index 90e5864dd2..0c334b3579 100644 --- a/src/Kiota.Builder/Refiners/RubyRefiner.cs +++ b/src/Kiota.Builder/Refiners/RubyRefiner.cs @@ -19,6 +19,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance { cancellationToken.ThrowIfCancellationRequested(); RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor); + DeduplicateErrorMappings(generatedCode); ReplaceIndexersByMethodsWithParameter(generatedCode, false, static x => $"by_{x.ToSnakeCase()}", diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index 6d921a56f1..11e0358d9b 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -17,6 +17,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance return Task.Run(() => { cancellationToken.ThrowIfCancellationRequested(); + DeduplicateErrorMappings(generatedCode); RemoveMethodByKind(generatedCode, CodeMethodKind.RawUrlConstructor, CodeMethodKind.RawUrlBuilder); ReplaceReservedNames(generatedCode, new TypeScriptReservedNamesProvider(), static x => $"{x}Escaped"); ReplaceReservedExceptionPropertyNames(generatedCode, new TypeScriptExceptionsReservedNamesProvider(), static x => $"{x}Escaped"); diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index 09388ac8ef..325797b642 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -81,7 +81,7 @@ private static void WriteNavigationMetadataEntry(CodeNamespace parentNamespace, writer.WriteLine($"pathParametersMappings: [{string.Join(", ", pathParameters)}],"); } private static string GetErrorMappingKey(string original) => - original.Equals("4XX", StringComparison.OrdinalIgnoreCase) || original.Equals("5XX", StringComparison.OrdinalIgnoreCase) ? + original.Equals(CodeMethod.ErrorMappingClientRange, StringComparison.OrdinalIgnoreCase) || original.Equals(CodeMethod.ErrorMappingServerRange, StringComparison.OrdinalIgnoreCase) ? $"_{original.ToUpperInvariant()}" : // to avoid emitting strings that can't be minified original.ToUpperInvariant(); diff --git a/tests/Kiota.Builder.Tests/CodeDOM/CodeMethodTests.cs b/tests/Kiota.Builder.Tests/CodeDOM/CodeMethodTests.cs index 35069311cb..3340be4eed 100644 --- a/tests/Kiota.Builder.Tests/CodeDOM/CodeMethodTests.cs +++ b/tests/Kiota.Builder.Tests/CodeDOM/CodeMethodTests.cs @@ -114,4 +114,54 @@ public void ParametersExtensionsReturnsValue() Assert.NotNull(method.Parameters.OfKind(CodeParameterKind.Custom)); Assert.Null(method.Parameters.OfKind(CodeParameterKind.RequestBody)); } + [Fact] + public void DeduplicatesErrorMappings() + { + var method = new CodeMethod + { + Name = "method1", + ReturnType = new CodeType + { + Name = "string" + } + }; + var commonType = new CodeType { Name = "string" }; + method.AddErrorMapping("4XX", commonType); + method.AddErrorMapping("5XX", commonType); + method.DeduplicateErrorMappings(); + Assert.Single(method.ErrorMappings); + } + [Fact] + public void DoesNotDeduplicateErrorMappingsOnDifferentTypes() + { + var method = new CodeMethod + { + Name = "method1", + ReturnType = new CodeType + { + Name = "string" + } + }; + method.AddErrorMapping("4XX", new CodeType { Name = "string" }); + method.AddErrorMapping("5XX", new CodeType { Name = "string" }); + method.DeduplicateErrorMappings(); + Assert.Equal(2, method.ErrorMappings.Count()); + } + [Fact] + public void DoesNotDeduplicatesErrorMappingsWithSpecificCodes() + { + var method = new CodeMethod + { + Name = "method1", + ReturnType = new CodeType + { + Name = "string" + } + }; + var commonType = new CodeType { Name = "string" }; + method.AddErrorMapping("404", commonType); + method.AddErrorMapping("5XX", commonType); + method.DeduplicateErrorMappings(); + Assert.Equal(2, method.ErrorMappings.Count()); + } } From 93d6099cf5604b4542eca82595608b0f236a5e71 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 11:01:57 -0500 Subject: [PATCH 167/394] - adds changelog entry for error mapping deduplication Signed-off-by: Vincent Biret --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e59d56c6f2..369c450c35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,13 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed + - Fixed mantis for bitwise enums in Go. [#3936](https://github.com/microsoft/kiota/issues/3936) - Keyword in enum names for go should not be escaped. [#2877](https://github.com/microsoft/kiota/issues/2877) - Generator method code reduction in Python. [#3695](https://github.com/microsoft/kiota/issues/3695) - - Fixed return doc comments for Go/Java/CSharp/TypeScript. - Fixed type names in doc comments and deprecation noticed across languages. - Added thrown exceptions in doc comments for Go/CSharp/Java/TypeScript. [#3811](https://github.com/microsoft/kiota/issues/3811) +- Deduplicates 4XX and 5XX error mappings when they map to the same type to reduce emitted code. [#4025](https://github.com/microsoft/kiota/issues/4025) ## [1.11.1] - 2024-02-05 From b0bdb70aa38816fd30354c829c97137f160113cb Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 14:50:27 -0500 Subject: [PATCH 168/394] - switches Java to stable --- src/kiota/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kiota/appsettings.json b/src/kiota/appsettings.json index f068f41902..4d28d5532d 100644 --- a/src/kiota/appsettings.json +++ b/src/kiota/appsettings.json @@ -57,7 +57,7 @@ "DependencyInstallCommand": "dotnet add package {0} --version {1}" }, "Java": { - "MaturityLevel": "Preview", + "MaturityLevel": "Stable", "Dependencies": [ { "Name": "com.microsoft.kiota:microsoft-kiota-abstractions", From e48385353f51eb51286c30c61f0e7f37775b4a36 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 14:51:55 -0500 Subject: [PATCH 169/394] - adds changelog entry for java becoming stable --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e59d56c6f2..3de19746f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed return doc comments for Go/Java/CSharp/TypeScript. - Fixed type names in doc comments and deprecation noticed across languages. - Added thrown exceptions in doc comments for Go/CSharp/Java/TypeScript. [#3811](https://github.com/microsoft/kiota/issues/3811) +- 📢📢📢 Java generation is now stable! 🚀🚀🚀 special thanks to @andreaTP (Red Hat) for all the help. ## [1.11.1] - 2024-02-05 From ff4a4a04c3b98d2ddcd9aee6284304086cfa1761 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 08:16:41 +0000 Subject: [PATCH 170/394] Bump the kiota-dependencies group in /it/typescript with 7 updates Bumps the kiota-dependencies group in /it/typescript with 7 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/kiota-abstractions](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.40` | `1.0.0-preview.41` | | [@microsoft/kiota-authentication-azure](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.35` | `1.0.0-preview.36` | | [@microsoft/kiota-http-fetchlibrary](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.39` | `1.0.0-preview.40` | | [@microsoft/kiota-serialization-form](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.29` | `1.0.0-preview.30` | | [@microsoft/kiota-serialization-json](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.40` | `1.0.0-preview.41` | | [@microsoft/kiota-serialization-multipart](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.19` | `1.0.0-preview.20` | | [@microsoft/kiota-serialization-text](https://github.com/microsoft-typescript/kiota) | `1.0.0-preview.37` | `1.0.0-preview.38` | Updates `@microsoft/kiota-abstractions` from 1.0.0-preview.40 to 1.0.0-preview.41 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-abstractions@1.0.0-preview.40...@microsoft/kiota-abstractions@1.0.0-preview.41) Updates `@microsoft/kiota-authentication-azure` from 1.0.0-preview.35 to 1.0.0-preview.36 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-authentication-azure@1.0.0-preview.35...@microsoft/kiota-authentication-azure@1.0.0-preview.36) Updates `@microsoft/kiota-http-fetchlibrary` from 1.0.0-preview.39 to 1.0.0-preview.40 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.39...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.40) Updates `@microsoft/kiota-serialization-form` from 1.0.0-preview.29 to 1.0.0-preview.30 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-form@1.0.0-preview.29...@microsoft/kiota-serialization-form@1.0.0-preview.30) Updates `@microsoft/kiota-serialization-json` from 1.0.0-preview.40 to 1.0.0-preview.41 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-json@1.0.0-preview.40...@microsoft/kiota-serialization-json@1.0.0-preview.41) Updates `@microsoft/kiota-serialization-multipart` from 1.0.0-preview.19 to 1.0.0-preview.20 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-multipart@1.0.0-preview.19...@microsoft/kiota-serialization-multipart@1.0.0-preview.20) Updates `@microsoft/kiota-serialization-text` from 1.0.0-preview.37 to 1.0.0-preview.38 - [Commits](https://github.com/microsoft-typescript/kiota/commits) --- updated-dependencies: - dependency-name: "@microsoft/kiota-abstractions" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-authentication-azure" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-http-fetchlibrary" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-json" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-multipart" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-text" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 68 ++++++++++++++++----------------- it/typescript/package.json | 14 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 7e0f05de3d..b09cae4e8f 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.40", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.35", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.39", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.29", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.40", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.19", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.37", + "@microsoft/kiota-abstractions": "^1.0.0-preview.41", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.36", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.40", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.30", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.41", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.20", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.38", "express": "^4.18.2", "node-fetch": "^2.7.0" }, @@ -678,9 +678,9 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.40", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.40.tgz", - "integrity": "sha512-HtRPKA+xw8Gqapu1iDPMrYF1V0oQLGwFBcLjWG5y4L3OOx4llDn+xz2clSdHga2cPKCGWUh2hUwiVYhE7fEXSQ==", + "version": "1.0.0-preview.41", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.41.tgz", + "integrity": "sha512-W//MxpuB9bXlWu/1YEhMY6VOzyqpEZdg1uKEfDZvMIVRl6ylmJLN43eNTQGH7MJA4MtAHp0f0L+dp0DW+tibow==", "dependencies": { "@opentelemetry/api": "^1.7.0", "@std-uritemplate/std-uritemplate": "^0.0.50", @@ -703,22 +703,22 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.35", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.35.tgz", - "integrity": "sha512-WA4jeiJ5wsXlCBelbue+PthF2BPPqQPracrJIH4CctOdDf6zYazGVLiJau+G3PScVRg0eEkq4RxSdg3g/45pNg==", + "version": "1.0.0-preview.36", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.36.tgz", + "integrity": "sha512-MrRTto4P7Ynk7g6Jv7DgKgwhT2XYexQu6MllDOCVmsi3hhWha7wFqvapdsheGqUN4MSDINlg2ayRFdanLWK+8g==", "dependencies": { "@azure/core-auth": "^1.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@microsoft/kiota-abstractions": "^1.0.0-preview.41", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.39", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.39.tgz", - "integrity": "sha512-1QEcXlNYDmt/x/AO8Q9kjiQkIUBy0MsKD1CkihgS66uXZReesT70j+4LM8QjL3opetBQgF6QTXn9tfydv/wuLA==", + "version": "1.0.0-preview.40", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.40.tgz", + "integrity": "sha512-rEZQKy+IfM6ncUwIC2PSi29TYKVmmWxxD1iezBOjXllY7kNVvwYf/Q7cTNhsZ6G6br2eMwftrtMXAtHnwtkI9A==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@microsoft/kiota-abstractions": "^1.0.0-preview.41", "@opentelemetry/api": "^1.7.0", "guid-typescript": "^1.0.9", "node-fetch": "^2.7.0", @@ -726,41 +726,41 @@ } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.29", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.29.tgz", - "integrity": "sha512-hHmeMVLQOpyOHZIu4nOGX9qpowYSE4ZP+BD3SnPh94bUwanMHxgsvK8eisE0b+wO36+282i3LlIn4LyDxspiJA==", + "version": "1.0.0-preview.30", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.30.tgz", + "integrity": "sha512-z1bIz0GLzBakYMFA6M1EUtCP3o1qhOKlckfVIvxAcBf2nj+54+nIzVabHHW5oCd7Vdjp9IBJd7uApzR+aTbR+Q==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@microsoft/kiota-abstractions": "^1.0.0-preview.41", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.40", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.40.tgz", - "integrity": "sha512-3uqCg5itMMkdPyKMIy+QMZp9/6SMSfL91D4f3YgIntv8ud5M+RJEKt+Xd7/3hrSeTZXw8Q2LG5hxlVfCI+9FwA==", + "version": "1.0.0-preview.41", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.41.tgz", + "integrity": "sha512-2Jhelm6ocrL89JtE28r284dymgbcmQ0Tq0IwXhsFiP25qq3bM7zPNvHcMHBFaMowOyPrTM6HSob9G6Ia3Z/Sxg==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@microsoft/kiota-abstractions": "^1.0.0-preview.41", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.19", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.19.tgz", - "integrity": "sha512-0Z2tWLeoTu1jLDKfxxmLdcOEI3YFMlhkk9vPb0XNAUr+NhW+7H4MkU19s/YH6TOjoLC8cLCFqeIVIfhcWS87hQ==", + "version": "1.0.0-preview.20", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.20.tgz", + "integrity": "sha512-4iORvQIcPCz+xlx3EbHeSy2TV3R2WlV2VFu6cxAoWUY+g6l4MWkCaQbJ29bEDfvbUh3yH4vH1ZrgIyFfilBp8Q==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@microsoft/kiota-abstractions": "^1.0.0-preview.41", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.37", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.37.tgz", - "integrity": "sha512-KX7IajZfBd7TfcvqrIDDdyofgm4NY5sqMLWpNXw5LPad0gLioj83mo+r/gehx4eR4Nw7C3vVW8GYq7PA+cjBAw==", + "version": "1.0.0-preview.38", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.38.tgz", + "integrity": "sha512-ZdvChmAH6IzoQgIlD844uxTrBKmcaCuQmG4CA8UcKteG9R5rh9Yq8WFwIVLxZaa3t7wH7utTJH4azI8ywQjCGA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.40", + "@microsoft/kiota-abstractions": "^1.0.0-preview.41", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } diff --git a/it/typescript/package.json b/it/typescript/package.json index 8f592315e1..32a752a4d5 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.40", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.35", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.39", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.29", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.40", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.19", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.37", + "@microsoft/kiota-abstractions": "^1.0.0-preview.41", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.36", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.40", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.30", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.41", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.20", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.38", "express": "^4.18.2", "node-fetch": "^2.7.0" } From 799911de2dc438a17925efeb47b578f5c8891bc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 08:49:25 +0000 Subject: [PATCH 171/394] Bump the kiota-dependencies group in /it/csharp with 3 updates Bumps the kiota-dependencies group in /it/csharp with 3 updates: [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet), [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) and [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet). Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.6 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.6) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.2...v1.1.3) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 624e37dd52..70ae14e00d 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -13,7 +13,7 @@ - + From 57382e503ee45c4363f33f0c59868ed988b45e96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 08:51:45 +0000 Subject: [PATCH 172/394] Bump StreamJsonRpc from 2.17.8 to 2.17.11 Bumps [StreamJsonRpc](https://github.com/microsoft/vs-streamjsonrpc) from 2.17.8 to 2.17.11. - [Release notes](https://github.com/microsoft/vs-streamjsonrpc/releases) - [Commits](https://github.com/microsoft/vs-streamjsonrpc/commits) --- updated-dependencies: - dependency-name: StreamJsonRpc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/kiota/kiota.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index 8efa2e5c7f..9472ce3c50 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -46,7 +46,7 @@ - + From 108a4f84dfb70a42824afaaff327d3432b7750c5 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 14:19:30 -0500 Subject: [PATCH 173/394] - adds the ability to override the url template per operation in CSHarp Signed-off-by: Vincent Biret --- src/Kiota.Builder/CodeDOM/CodeMethod.cs | 8 ++++++++ .../Writers/CSharp/CodeMethodWriter.cs | 3 ++- .../Writers/CSharp/CodeMethodWriterTests.cs | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeMethod.cs b/src/Kiota.Builder/CodeDOM/CodeMethod.cs index 086a2cad14..ce221ca15e 100644 --- a/src/Kiota.Builder/CodeDOM/CodeMethod.cs +++ b/src/Kiota.Builder/CodeDOM/CodeMethod.cs @@ -272,6 +272,13 @@ public void DeduplicateErrorMappings() internal const string ErrorMappingClientRange = "4XX"; internal const string ErrorMappingServerRange = "5XX"; internal const string ErrorMappingAllRange = "XXX"; +#pragma warning disable CA1056 // URI-like properties should not be strings + /// + /// The URL template override for the method when it's different for the operation + /// + public string UrlTemplateOverride { get; set; } = string.Empty; +#pragma warning restore CA1056 // URI-like properties should not be strings + public bool HasUrlTemplateOverride => !string.IsNullOrEmpty(UrlTemplateOverride); private ConcurrentDictionary errorMappings = new(StringComparer.OrdinalIgnoreCase); @@ -328,6 +335,7 @@ public object Clone() PagingInformation = PagingInformation?.Clone() as PagingInformation, Documentation = (CodeDocumentation)Documentation.Clone(), Deprecation = Deprecation, + UrlTemplateOverride = UrlTemplateOverride, }; if (Parameters?.Any() ?? false) method.AddParameter(Parameters.Select(x => (CodeParameter)x.Clone()).ToArray()); diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index 65e75ae003..a856dd6a63 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -411,7 +411,8 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req if (currentClass.GetPropertyOfKind(CodePropertyKind.UrlTemplate) is not CodeProperty urlTemplateProperty) throw new InvalidOperationException("url template property cannot be null"); var operationName = codeElement.HttpMethod.ToString(); - writer.WriteLine($"var {RequestInfoVarName} = new RequestInformation(Method.{operationName?.ToUpperInvariant()}, {GetPropertyCall(urlTemplateProperty, "string.Empty")}, {GetPropertyCall(urlTemplateParamsProperty, "string.Empty")});"); + var urlTemplateValue = codeElement.HasUrlTemplateOverride ? $"\"{codeElement.UrlTemplateOverride}\"" : GetPropertyCall(urlTemplateProperty, "string.Empty"); + writer.WriteLine($"var {RequestInfoVarName} = new RequestInformation(Method.{operationName?.ToUpperInvariant()}, {urlTemplateValue}, {GetPropertyCall(urlTemplateParamsProperty, "string.Empty")});"); if (requestParams.requestConfiguration != null) writer.WriteLine($"{RequestInfoVarName}.Configure({requestParams.requestConfiguration.Name});"); diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs index 05d21a87da..aa2aae7a81 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs @@ -977,6 +977,21 @@ public void WritesRequestGeneratorBodyForParsable() AssertExtensions.CurlyBracesAreClosed(result, 1); } [Fact] + public void WritesRequestGeneratorBodyWhenUrlTemplateIsOverrode() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + AddRequestBodyParameters(true); + method.AcceptedResponseTypes.Add("application/json"); + method.UrlTemplateOverride = "{baseurl+}/foo/bar"; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("var requestInfo = new RequestInformation(Method.GET, \"{baseurl+}/foo/bar\", PathParameters)", result); + AssertExtensions.CurlyBracesAreClosed(result, 1); + } + [Fact] public void WritesRequestGeneratorBodyForScalarCollection() { setup(); From ff0bc508e8ade940ea3ddf6f21a88aaa81af2f61 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 14:32:09 -0500 Subject: [PATCH 174/394] - adds url template override to code methods based on operation and query parameters Signed-off-by: Vincent Biret --- .../OpenApiUrlTreeNodeExtensions.cs | 15 +++--- src/Kiota.Builder/KiotaBuilder.cs | 8 +++- .../OpenApiUrlTreeNodeExtensionsTests.cs | 46 +++++++++++++++++++ 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index 11a4e9d30e..b531c7f77b 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -181,21 +181,24 @@ private static bool IsPathSegmentWithNumberOfParameters(this string currentSegme private static partial Regex stripExtensionForIndexersTestRegex(); // so {param-name}.json is considered as indexer public static bool IsComplexPathMultipleParameters(this OpenApiUrlTreeNode currentNode) => (currentNode?.DeduplicatedSegment()?.IsPathSegmentWithNumberOfParameters(static x => x.Any()) ?? false) && !currentNode.IsPathSegmentWithSingleSimpleParameter(); - public static string GetUrlTemplate(this OpenApiUrlTreeNode currentNode) + public static string GetUrlTemplate(this OpenApiUrlTreeNode currentNode, OperationType? operationType = null) { ArgumentNullException.ThrowIfNull(currentNode); var queryStringParameters = string.Empty; if (currentNode.HasOperations(Constants.DefaultOpenApiLabel)) { var pathItem = currentNode.PathItems[Constants.DefaultOpenApiLabel]; + var operationQueryParameters = (operationType, pathItem.Operations.Any()) switch + { + (OperationType ot, _) when pathItem.Operations.TryGetValue(ot, out var operation) => operation.Parameters, + (null, true) => pathItem.Operations.OrderBy(static x => x.Key).FirstOrDefault().Value.Parameters, + _ => Enumerable.Empty(), + }; var parameters = pathItem.Parameters + .Union(operationQueryParameters) .Where(static x => x.In == ParameterLocation.Query) - .Union( - pathItem.Operations - .SelectMany(static x => x.Value.Parameters) - .Where(static x => x.In == ParameterLocation.Query)) .DistinctBy(static x => x.Name, StringComparer.Ordinal) - .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) + .OrderBy(static x => x.Name, StringComparer.Ordinal) .ToArray(); if (parameters.Length != 0) { diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 7cf88b6781..0351366d1b 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -765,17 +765,17 @@ private void CreateRequestBuilderClass(CodeNamespace currentNamespace, OpenApiUr } } + CreateUrlManagement(codeClass, currentNode, isApiClientClass); // Add methods for Operations if (currentNode.HasOperations(Constants.DefaultOpenApiLabel)) { - if (!isApiClientClass) // do not generate for API client clas with operations as the class won't have the rawUrl constructor. + if (!isApiClientClass) // do not generate for API client class with operations as the class won't have the rawUrl constructor. CreateWithUrlMethod(currentNode, codeClass); foreach (var operation in currentNode .PathItems[Constants.DefaultOpenApiLabel] .Operations) CreateOperationMethods(currentNode, operation.Key, operation.Value, codeClass); } - CreateUrlManagement(codeClass, currentNode, isApiClientClass); if (rootNamespace != null) Parallel.ForEach(currentNode.Children.Values, parallelOptions, childNode => @@ -1481,6 +1481,10 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp Parent = parentClass, Deprecation = deprecationInformation, }; + var operationUrlTemplate = currentNode.GetUrlTemplate(operationType); + if (!operationUrlTemplate.Equals(parentClass.Properties.FirstOrDefault(static x => x.Kind is CodePropertyKind.UrlTemplate)?.DefaultValue?.Trim('"'), StringComparison.Ordinal)) + generatorMethod.UrlTemplateOverride = operationUrlTemplate; + var mediaTypes = schema switch { null => operation.Responses diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs index 2ad8c46606..00b60743ae 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs @@ -188,6 +188,52 @@ public void GetUrlTemplateSelectsDistinctQueryParameters() // the query parameters will be decoded by a middleware at runtime before the request is executed } [Fact] + public void DifferentUrlTemplatesPerOperation() + { + var doc = new OpenApiDocument + { + Paths = [], + }; + doc.Paths.Add("{param-with-dashes}\\existing-segment", new() + { + Parameters = [ + new() { + Name = "param-with-dashes", + In = ParameterLocation.Path, + Required = true, + Schema = new() { + Type = "string" + }, + Style = ParameterStyle.Simple, + }, + ], + Operations = new Dictionary { + { OperationType.Get, new() { + Parameters = [ + + new (){ + Name = "$select", + In = ParameterLocation.Query, + Schema = new () { + Type = "string" + }, + Style = ParameterStyle.Simple, + } + ] + } + }, + { + OperationType.Put, new() {} + } + } + }); + var node = OpenApiUrlTreeNode.Create(doc, Label); + Assert.Equal("{+baseurl}/{param%2Dwith%2Ddashes}/existing-segment{?%24select}", node.Children.First().Value.GetUrlTemplate()); + Assert.Equal("{+baseurl}/{param%2Dwith%2Ddashes}/existing-segment{?%24select}", node.Children.First().Value.GetUrlTemplate(OperationType.Get)); + Assert.Equal("{+baseurl}/{param%2Dwith%2Ddashes}/existing-segment", node.Children.First().Value.GetUrlTemplate(OperationType.Put)); + // the query parameters will be decoded by a middleware at runtime before the request is executed + } + [Fact] public void GeneratesRequiredQueryParametersAndOptionalMixInPathItem() { var doc = new OpenApiDocument From 2734f31dd9825b317becfb317eff562681d73266 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 15:00:39 -0500 Subject: [PATCH 175/394] - java support for override uri template Signed-off-by: Vincent Biret --- .../Writers/Java/CodeMethodWriter.cs | 3 ++- .../Writers/Java/CodeMethodWriterTests.cs | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index c542d9ca51..ab24292b6d 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -575,7 +575,8 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req if (currentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is not CodeProperty urlTemplateParamsProperty) throw new InvalidOperationException("url template params property cannot be null"); if (currentClass.GetPropertyOfKind(CodePropertyKind.UrlTemplate) is not CodeProperty urlTemplateProperty) throw new InvalidOperationException("url template property cannot be null"); - writer.WriteLine($"final RequestInformation {RequestInfoVarName} = new RequestInformation(HttpMethod.{codeElement.HttpMethod.ToString()?.ToUpperInvariant()}, {GetPropertyCall(urlTemplateProperty, "\"\"")}, {GetPropertyCall(urlTemplateParamsProperty, "null")});"); + var urlTemplateValue = codeElement.HasUrlTemplateOverride ? $"\"{codeElement.UrlTemplateOverride}\"" : GetPropertyCall(urlTemplateProperty, "\"\""); + writer.WriteLine($"final RequestInformation {RequestInfoVarName} = new RequestInformation(HttpMethod.{codeElement.HttpMethod.ToString()?.ToUpperInvariant()}, {urlTemplateValue}, {GetPropertyCall(urlTemplateParamsProperty, "null")});"); if (requestParams.requestConfiguration != null) { diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index fb3bbacc5c..b1ccaebbc6 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -1245,6 +1245,21 @@ public void WritesRequestGeneratorBodyForParsable() AssertExtensions.CurlyBracesAreClosed(result); } [Fact] + public void WritesRequestGeneratorBodyWhenUrlTemplateIsOverrode() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + AddRequestBodyParameters(true); + method.AcceptedResponseTypes.Add("application/json"); + method.UrlTemplateOverride = "{baseurl+}/foo/bar"; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("final RequestInformation requestInfo = new RequestInformation(HttpMethod.GET, \"{baseurl+}/foo/bar\", pathParameters)", result); + AssertExtensions.CurlyBracesAreClosed(result); + } + [Fact] public void WritesRequestGeneratorOverloadBody() { setup(); From b67a71e9ce9b71e90b53b1afd1ba65aceb760a2f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 15:05:02 -0500 Subject: [PATCH 176/394] - go uri template override Signed-off-by: Vincent Biret --- .../Writers/Go/CodeMethodWriter.cs | 3 +- .../Writers/Go/CodeMethodWriterTests.cs | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs index 16b4a4fc44..cb7889c03f 100644 --- a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs @@ -873,7 +873,8 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req var requestAdapterPropertyName = BaseRequestBuilderVarName + "." + parentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter)?.Name.ToFirstCharacterUpperCase(); var contextParameterName = codeElement.Parameters.OfKind(CodeParameterKind.Cancellation)?.Name.ToFirstCharacterLowerCase(); - writer.WriteLine($"{RequestInfoVarName} := {conventions.AbstractionsHash}.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters({conventions.AbstractionsHash}.{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}, {GetPropertyCall(urlTemplateProperty, "\"\"")}, {GetPropertyCall(urlTemplateParamsProperty, "\"\"")})"); + var urlTemplateValue = codeElement.HasUrlTemplateOverride ? $"\"{codeElement.UrlTemplateOverride}\"" : GetPropertyCall(urlTemplateProperty, "\"\""); + writer.WriteLine($"{RequestInfoVarName} := {conventions.AbstractionsHash}.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters({conventions.AbstractionsHash}.{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}, {urlTemplateValue}, {GetPropertyCall(urlTemplateParamsProperty, "\"\"")})"); if (ExcludeBackwardCompatible && requestParams.requestConfiguration is not null) writer.WriteLine($"{conventions.AbstractionsHash}.ConfigureRequestInformation({RequestInfoVarName}, {requestParams.requestConfiguration.Name})"); diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs index ba7289a149..bda3bbc109 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs @@ -1245,6 +1245,34 @@ public async Task WritesRequestGeneratorBodyForParsable() AssertExtensions.CurlyBracesAreClosed(result); } [Fact] + public async Task WritesRequestGeneratorBodyWhenUrlTemplateIsOverrode() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + var executor = parentClass.AddMethod(new CodeMethod + { + Name = "executor", + HttpMethod = HttpMethod.Get, + Kind = CodeMethodKind.RequestExecutor, + ReturnType = new CodeType + { + Name = "string", + IsExternal = true, + } + }).First(); + AddRequestBodyParameters(executor, true); + AddRequestBodyParameters(useComplexTypeForBody: true); + AddRequestProperties(); + method.UrlTemplateOverride = "{baseurl+}/foo/bar"; + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Go }, parentClass.Parent as CodeNamespace); + method.AcceptedResponseTypes.Add("application/json"); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains($"requestInfo := {AbstractionsPackageHash}.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters({AbstractionsPackageHash}.GET, \"{{baseurl+}}/foo/bar\", m.pathParameters)", result); + AssertExtensions.CurlyBracesAreClosed(result); + } + [Fact] public async Task WritesRequestGeneratorBodyForParsableCollection() { setup(); From 16f950fc65f05a6e9e0b7bb14dca4599383ee028 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 15:21:50 -0500 Subject: [PATCH 177/394] - php support for url template override --- .../Writers/Php/CodeMethodWriter.cs | 5 ++++- .../Writers/Php/CodeMethodWriterTests.cs | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index fd7151dde8..3fc6397717 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -557,8 +557,11 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req writer.WriteLine($"{RequestInfoVarName} = new {requestInformationClass}();"); if (currentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProperty && currentClass.GetPropertyOfKind(CodePropertyKind.UrlTemplate) is CodeProperty urlTemplateProperty) - writer.WriteLines($"{RequestInfoVarName}->urlTemplate = {GetPropertyCall(urlTemplateProperty, "''")};", + { + var urlTemplateValue = codeElement.HasUrlTemplateOverride ? $"'{codeElement.UrlTemplateOverride}'" : GetPropertyCall(urlTemplateProperty, "''"); + writer.WriteLines($"{RequestInfoVarName}->urlTemplate = {urlTemplateValue};", $"{RequestInfoVarName}->pathParameters = {GetPropertyCall(pathParametersProperty, "''")};"); + } writer.WriteLine($"{RequestInfoVarName}->httpMethod = HttpMethod::{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()};"); WriteRequestConfiguration(requestParams, writer); WriteAcceptHeaderDef(codeElement, writer); diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs index f9fa005b23..d7fecc9ab7 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs @@ -605,6 +605,7 @@ public void WriteRequestGeneratorForParsable() Assert.Contains( "public function createPostRequestInformation(Message $body, ?RequestConfig $requestConfiguration = null): RequestInformation", result); + Assert.Contains("$requestInfo->urlTemplate = $this->urlTemplate;", result); Assert.Contains("if ($requestConfiguration !== null", result); Assert.Contains("$requestInfo->addHeaders($requestConfiguration->h);", result); Assert.Contains("$requestInfo->setQueryParameters($requestConfiguration->q);", result); @@ -612,6 +613,26 @@ public void WriteRequestGeneratorForParsable() Assert.Contains("$requestInfo->setContentFromParsable($this->requestAdapter, \"\", $body);", result); Assert.Contains("return $requestInfo;", result); } + [Fact] + public void WritesRequestGeneratorBodyWhenUrlTemplateIsOverrode() + { + setup(); + parentClass.Kind = CodeClassKind.RequestBuilder; + method.Name = "createPostRequestInformation"; + method.Kind = CodeMethodKind.RequestGenerator; + method.ReturnType = new CodeType() + { + Name = "RequestInformation", + IsNullable = false + }; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.UrlTemplateOverride = "{baseurl+}/foo/bar"; + _codeMethodWriter.WriteCodeElement(method, languageWriter); + var result = stringWriter.ToString(); + Assert.Contains("$requestInfo->urlTemplate = '{baseurl+}/foo/bar';", result); + } [Fact] public void WritesRequestGeneratorBodyForParsableCollection() From ca80966931f268437adf4a6c6854af55019d2481 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 15:25:18 -0500 Subject: [PATCH 178/394] - python support for url template override Signed-off-by: Vincent Biret --- .../Writers/Python/CodeMethodWriter.cs | 3 ++- .../Writers/Python/CodeMethodWriterTests.cs | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index 1c4f8c5814..42a222e36b 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -614,7 +614,8 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req if (currentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is not CodeProperty urlTemplateParamsProperty) throw new InvalidOperationException("path parameters cannot be null"); if (currentClass.GetPropertyOfKind(CodePropertyKind.UrlTemplate) is not CodeProperty urlTemplateProperty) throw new InvalidOperationException("url template cannot be null"); - writer.WriteLine($"{RequestInfoVarName} = RequestInformation(Method.{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}, {GetPropertyCall(urlTemplateProperty, "''")}, {GetPropertyCall(urlTemplateParamsProperty, "''")})"); + var urlTemplateValue = codeElement.HasUrlTemplateOverride ? $"'{codeElement.UrlTemplateOverride}'" : GetPropertyCall(urlTemplateProperty, "''"); + writer.WriteLine($"{RequestInfoVarName} = RequestInformation(Method.{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}, {urlTemplateValue}, {GetPropertyCall(urlTemplateParamsProperty, "''")})"); if (requestParams.requestConfiguration != null) writer.WriteLine($"{RequestInfoVarName}.configure({requestParams.requestConfiguration.Name})"); if (codeElement.ShouldAddAcceptHeader) diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index 70210d6f6e..5e7f62bf0f 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -694,6 +694,21 @@ public void WritesRequestGeneratorBodyForParsable() Assert.Contains("return request_info", result); } [Fact] + public void WritesRequestGeneratorBodyWhenUrlTemplateIsOverrode() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + AddRequestBodyParameters(true); + method.AcceptedResponseTypes.Add("application/json"); + method.AcceptedResponseTypes.Add("text/plain"); + method.UrlTemplateOverride = "{baseurl+}/foo/bar"; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("request_info = RequestInformation(Method.GET, '{baseurl+}/foo/bar', self.path_parameters", result); + } + [Fact] public void WritesRequestGeneratorBodyKnownRequestBodyType() { setup(); From 415827f813ed8b71073d995fa1617bbd233b72d7 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 7 Feb 2024 16:49:47 -0500 Subject: [PATCH 179/394] - fixes formatting --- .../Extensions/OpenApiUrlTreeNodeExtensionsTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs index 00b60743ae..c97dd49ea1 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs @@ -197,11 +197,13 @@ public void DifferentUrlTemplatesPerOperation() doc.Paths.Add("{param-with-dashes}\\existing-segment", new() { Parameters = [ - new() { + new() + { Name = "param-with-dashes", In = ParameterLocation.Path, Required = true, - Schema = new() { + Schema = new() + { Type = "string" }, Style = ParameterStyle.Simple, From be073ba8e406092a44e6777beaf9e6ee9f6d1e28 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 8 Feb 2024 14:21:03 -0500 Subject: [PATCH 180/394] - adds url template override support for ruby Signed-off-by: Vincent Biret --- src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs | 7 +++++-- .../Writers/Ruby/CodeMethodWriterTests.cs | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs index 6ff28fe805..a20eeb3823 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs @@ -314,8 +314,11 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty urlTemplateParamsProperty && parentClass.GetPropertyOfKind(CodePropertyKind.UrlTemplate) is CodeProperty urlTemplateProperty) - writer.WriteLines($"request_info.url_template = {GetPropertyCall(urlTemplateProperty, "''")}", - $"request_info.path_parameters = {GetPropertyCall(urlTemplateParamsProperty, "''")}"); + { + var urlTemplateValue = codeElement.HasUrlTemplateOverride ? $"'{codeElement.UrlTemplateOverride}'" : GetPropertyCall(urlTemplateProperty, "''"); + writer.WriteLines($"request_info.url_template = {urlTemplateValue}", + $"request_info.path_parameters = {GetPropertyCall(urlTemplateParamsProperty, "''")}"); + } writer.WriteLine($"request_info.http_method = :{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}"); if (codeElement.ShouldAddAcceptHeader) writer.WriteLine($"request_info.headers.try_add('Accept', '{codeElement.AcceptHeaderValue}')"); diff --git a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs index abd965b639..44cb9bdd9c 100644 --- a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs @@ -525,6 +525,20 @@ public void WritesRequestGeneratorBody() Assert.Contains("return request_info", result); } [Fact] + public void WritesRequestGeneratorBodyWhenUrlTemplateIsOverrode() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + method.AcceptedResponseTypes.Add("application/json"); + AddRequestProperties(); + AddRequestBodyParameters(); + method.UrlTemplateOverride = "{baseurl+}/foo/bar"; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("request_info.url_template = '{baseurl+}/foo/bar'", result); + } + [Fact] public void WritesRequestGeneratorBodyKnownRequestBodyType() { setup(); From 7de7158404b5880c12d58a6757cb141991244421 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 8 Feb 2024 15:27:54 -0500 Subject: [PATCH 181/394] - fixes an issue with error mapping deduplication --- src/Kiota.Builder/CodeDOM/CodeMethod.cs | 3 ++- .../CodeDOM/CodeMethodTests.cs | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/CodeDOM/CodeMethod.cs b/src/Kiota.Builder/CodeDOM/CodeMethod.cs index ce221ca15e..006960ec8c 100644 --- a/src/Kiota.Builder/CodeDOM/CodeMethod.cs +++ b/src/Kiota.Builder/CodeDOM/CodeMethod.cs @@ -263,7 +263,8 @@ public CodeIndexer? OriginalIndexer public void DeduplicateErrorMappings() { if (!errorMappings.TryGetValue(ErrorMappingClientRange, out var clientError) || !errorMappings.TryGetValue(ErrorMappingServerRange, out var serverError)) return; - if (clientError == serverError && errorMappings.TryAdd(ErrorMappingAllRange, clientError)) + if ((clientError == serverError || clientError is CodeType clientErrorType && serverError is CodeType serverErrorType && clientErrorType.TypeDefinition == serverErrorType.TypeDefinition && clientErrorType.TypeDefinition is not null) && + errorMappings.TryAdd(ErrorMappingAllRange, clientError)) { errorMappings.TryRemove(ErrorMappingServerRange, out var _); errorMappings.TryRemove(ErrorMappingClientRange, out var _); diff --git a/tests/Kiota.Builder.Tests/CodeDOM/CodeMethodTests.cs b/tests/Kiota.Builder.Tests/CodeDOM/CodeMethodTests.cs index 3340be4eed..d2ef6e4172 100644 --- a/tests/Kiota.Builder.Tests/CodeDOM/CodeMethodTests.cs +++ b/tests/Kiota.Builder.Tests/CodeDOM/CodeMethodTests.cs @@ -132,6 +132,28 @@ public void DeduplicatesErrorMappings() Assert.Single(method.ErrorMappings); } [Fact] + public void DeduplicatesErrorMappingsCommonDefinition() + { + var method = new CodeMethod + { + Name = "method1", + ReturnType = new CodeType + { + Name = "string" + } + }; + var codeClass = new CodeClass + { + Name = "class1" + }; + var commonType = new CodeType { TypeDefinition = codeClass }; + var commonType2 = new CodeType { TypeDefinition = codeClass }; + method.AddErrorMapping("4XX", commonType); + method.AddErrorMapping("5XX", commonType2); + method.DeduplicateErrorMappings(); + Assert.Single(method.ErrorMappings); + } + [Fact] public void DoesNotDeduplicateErrorMappingsOnDifferentTypes() { var method = new CodeMethod From 895cd2f9651e2b567c82384502c19953a8000e76 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 8 Feb 2024 15:28:13 -0500 Subject: [PATCH 182/394] - typescript: adds support for uri template override --- .../CodeElementOrderComparer.cs | 14 +++- .../Refiners/TypeScriptRefiner.cs | 2 +- .../Writers/TypeScript/CodeConstantWriter.cs | 6 +- .../Writers/TypeScript/CodeFunctionWriter.cs | 3 +- .../CodeElementComparerPythonTests.cs | 8 +-- .../CodeElementComparerTests.cs | 16 ++--- .../TypeScript/CodeConstantWriterTests.cs | 66 ++++++++++++++++--- .../TypeScript/CodeFunctionWriterTests.cs | 1 - 8 files changed, 88 insertions(+), 28 deletions(-) diff --git a/src/Kiota.Builder/OrderComparers/CodeElementOrderComparer.cs b/src/Kiota.Builder/OrderComparers/CodeElementOrderComparer.cs index 31ad890d75..da8a8cec87 100644 --- a/src/Kiota.Builder/OrderComparers/CodeElementOrderComparer.cs +++ b/src/Kiota.Builder/OrderComparers/CodeElementOrderComparer.cs @@ -13,6 +13,7 @@ public override int Compare(CodeElement? x, CodeElement? y) (null, _) => -1, (_, null) => 1, _ => GetTypeFactor(x).CompareTo(GetTypeFactor(y)) * TypeWeight + + GetConstantKindFactor(x).CompareTo(GetConstantKindFactor(y)) * constantKindWeight + #pragma warning disable CA1062 CompareStrings(x.Name, y.Name, StringComparer.InvariantCultureIgnoreCase) * NameWeight + #pragma warning restore CA1062 @@ -21,7 +22,7 @@ public override int Compare(CodeElement? x, CodeElement? y) }; } private const int NameWeight = 100; - private const int TypeWeight = 1000; + private const int TypeWeight = 10000; protected virtual int GetTypeFactor(CodeElement element) { return element switch @@ -53,6 +54,17 @@ protected virtual int GetMethodKindFactor(CodeElement element) }; return 0; } + protected virtual int constantKindWeight { get; } = 1000; + protected virtual int GetConstantKindFactor(CodeElement element) + { + if (element is CodeConstant constant) + return constant.Kind switch + { + CodeConstantKind.UriTemplate => 1, // in typescript uri templates need to go first before the request metadata constants + _ => 2, + }; + return 0; + } private const int ParametersWeight = 1; private static int GetParametersFactor(CodeElement element) { diff --git a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs index 11e0358d9b..65a217ec15 100644 --- a/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs +++ b/src/Kiota.Builder/Refiners/TypeScriptRefiner.cs @@ -234,7 +234,7 @@ codeFile.Parent is CodeNamespace parentNamespace && parentNamespace.Parent is CodeNamespace parentLevelNamespace && parentLevelNamespace.Files.SelectMany(static x => x.Interfaces).FirstOrDefault(static x => x.Kind is CodeInterfaceKind.RequestBuilder) is CodeInterface parentLevelInterface && codeFile.Constants - .Where(static x => x.Kind is CodeConstantKind.NavigationMetadata or CodeConstantKind.UriTemplate or CodeConstantKind.RequestsMetadata) + .Where(static x => x.Kind is CodeConstantKind.NavigationMetadata or CodeConstantKind.RequestsMetadata) .Select(static x => new CodeUsing { Name = x.Name, diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index 325797b642..c1d37e9233 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -71,8 +71,6 @@ private void WriteNavigationMetadataConstant(CodeConstant codeElement, LanguageW private static void WriteNavigationMetadataEntry(CodeNamespace parentNamespace, LanguageWriter writer, string requestBuilderName, string[]? pathParameters = null) { - if (parentNamespace.FindChildByName($"{requestBuilderName}{CodeConstant.UriTemplateSuffix}", 3) is CodeConstant uriTemplateConstant && uriTemplateConstant.Kind is CodeConstantKind.UriTemplate) - writer.WriteLine($"uriTemplate: {uriTemplateConstant.Name.ToFirstCharacterUpperCase()},"); if (parentNamespace.FindChildByName($"{requestBuilderName}{CodeConstant.RequestsMetadataSuffix}", 3) is CodeConstant requestsMetadataConstant && requestsMetadataConstant.Kind is CodeConstantKind.RequestsMetadata) writer.WriteLine($"requestsMetadata: {requestsMetadataConstant.Name.ToFirstCharacterUpperCase()},"); if (parentNamespace.FindChildByName($"{requestBuilderName}{CodeConstant.NavigationMetadataSuffix}", 3) is CodeConstant navigationMetadataConstant && navigationMetadataConstant.Kind is CodeConstantKind.NavigationMetadata) @@ -93,6 +91,8 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase) .ToArray() is not { Length: > 0 } executorMethods) return; + var uriTemplateConstant = codeElement.Parent is CodeFile parentFile && parentFile.Constants.FirstOrDefault(static x => x.Kind is CodeConstantKind.UriTemplate) is CodeConstant tplct ? + tplct : throw new InvalidOperationException("Couldn't find the associated uri template constant for the requests metadata constant"); writer.StartBlock($"export const {codeElement.Name.ToFirstCharacterUpperCase()}: RequestsMetadata = {{"); foreach (var executorMethod in executorMethods) { @@ -101,6 +101,8 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri var isStream = conventions.StreamTypeName.Equals(returnType, StringComparison.OrdinalIgnoreCase); var returnTypeWithoutCollectionSymbol = GetReturnTypeWithoutCollectionSymbol(executorMethod, returnType); writer.StartBlock($"{executorMethod.Name.ToFirstCharacterLowerCase()}: {{"); + var urlTemplateValue = executorMethod.HasUrlTemplateOverride ? $"\"{executorMethod.UrlTemplateOverride}\"" : uriTemplateConstant.Name.ToFirstCharacterUpperCase(); + writer.WriteLine($"uriTemplate: {urlTemplateValue},"); if (codeClass.Methods.FirstOrDefault(x => x.Kind is CodeMethodKind.RequestGenerator && x.HttpMethod == executorMethod.HttpMethod) is { } generatorMethod && generatorMethod.AcceptHeaderValue is string acceptHeader && !string.IsNullOrEmpty(acceptHeader)) writer.WriteLine($"responseBodyContentType: \"{acceptHeader}\","); diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs index 6f302d522c..1fb6d24e66 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs @@ -71,10 +71,9 @@ private static void WriteApiConstructorBody(CodeFile parentFile, CodeMethod meth writer.WriteLine($"{requestAdapterArgumentName}.enableBackingStore({backingStoreParameterName.ToFirstCharacterLowerCase()});"); if (parentFile.Interfaces.FirstOrDefault(static x => x.Kind is CodeInterfaceKind.RequestBuilder) is CodeInterface codeInterface) { - var uriTemplateConstantName = $"{codeInterface.Name.ToFirstCharacterUpperCase()}{CodeConstant.UriTemplateSuffix}"; var navigationMetadataConstantName = parentFile.FindChildByName($"{codeInterface.Name.ToFirstCharacterUpperCase()}{CodeConstant.NavigationMetadataSuffix}", false) is { } navConstant ? navConstant.Name.ToFirstCharacterUpperCase() : "undefined"; var requestsMetadataConstantName = parentFile.FindChildByName($"{codeInterface.Name.ToFirstCharacterUpperCase()}{CodeConstant.RequestsMetadataSuffix}", false) is { } reqConstant ? reqConstant.Name.ToFirstCharacterUpperCase() : "undefined"; - writer.WriteLine($"return apiClientProxifier<{codeInterface.Name.ToFirstCharacterUpperCase()}>({requestAdapterArgumentName}, pathParameters, {uriTemplateConstantName}, {navigationMetadataConstantName}, {requestsMetadataConstantName});"); + writer.WriteLine($"return apiClientProxifier<{codeInterface.Name.ToFirstCharacterUpperCase()}>({requestAdapterArgumentName}, pathParameters, {navigationMetadataConstantName}, {requestsMetadataConstantName});"); } } private static void WriteSerializationRegistration(HashSet serializationModules, LanguageWriter writer, string methodName) diff --git a/tests/Kiota.Builder.Tests/OrderComparers/CodeElementComparerPythonTests.cs b/tests/Kiota.Builder.Tests/OrderComparers/CodeElementComparerPythonTests.cs index 4c457e7448..1cae7659f3 100644 --- a/tests/Kiota.Builder.Tests/OrderComparers/CodeElementComparerPythonTests.cs +++ b/tests/Kiota.Builder.Tests/OrderComparers/CodeElementComparerPythonTests.cs @@ -44,7 +44,7 @@ public void OrdersWithMethodWithinClass() Type = new CodeType { Name = "string" } - }, -1100), + }, -10100), new(new CodeIndexer() { ReturnType = new CodeType { Name = "string" @@ -60,14 +60,14 @@ public void OrdersWithMethodWithinClass() Type = new CodeType { Name = "string" } - }, -1100), + }, -10100), new(method, new CodeProperty() { Name = "prop", Type = new CodeType { Name = "string" } - }, -899), - new(method, codeClass, -699), + }, -9899), + new(method, codeClass, -9699), new(new CodeMethod() { Kind = CodeMethodKind.Constructor, ReturnType = new CodeType diff --git a/tests/Kiota.Builder.Tests/OrderComparers/CodeElementComparerTests.cs b/tests/Kiota.Builder.Tests/OrderComparers/CodeElementComparerTests.cs index 8f1e2a0570..8248a93c62 100644 --- a/tests/Kiota.Builder.Tests/OrderComparers/CodeElementComparerTests.cs +++ b/tests/Kiota.Builder.Tests/OrderComparers/CodeElementComparerTests.cs @@ -44,7 +44,7 @@ public void OrdersWithMethodWithinClass() Type = new CodeType { Name = "string" } - }, -1100), + }, -10100), new(new CodeIndexer() { ReturnType = new CodeType { Name = "string" @@ -60,14 +60,14 @@ public void OrdersWithMethodWithinClass() Type = new CodeType { Name = "string" } - }, 900), + }, 9900), new(method, new CodeProperty() { Name = "prop", Type = new CodeType { Name = "string" } - }, 901), - new(method, codeClass, -899) + }, 9901), + new(method, codeClass, -9899) }; foreach (var dataEntry in dataSet) @@ -111,7 +111,7 @@ public void OrdersWithMethodsOutsideOfClass() Type = new CodeType { Name = "string" } - }, -1100), + }, -10100), new(new CodeIndexer() { ReturnType = new CodeType { Name = "string" @@ -127,14 +127,14 @@ public void OrdersWithMethodsOutsideOfClass() Type = new CodeType { Name = "string" } - }, 900), + }, 9900), new(method, new CodeProperty() { Name = "prop", Type = new CodeType { Name = "string" } - }, 901), - new(method, codeClass, 1101) + }, 9901), + new(method, codeClass, 10101) }; foreach (var dataEntry in dataSet) diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs index fec43b8a97..f894b68970 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs @@ -130,7 +130,13 @@ public void DoesNotCreateDictionaryOnEmptyErrorMapping() AddRequestBodyParameters(); var constant = CodeConstant.FromRequestBuilderToRequestsMetadata(parentClass); - parentClass.GetImmediateParentOfType().AddConstant(constant); + var codeFile = parentClass.GetImmediateParentOfType().TryAddCodeFile("foo", constant); + codeFile.AddElements(new CodeConstant + { + Name = "UriTemplate", + Kind = CodeConstantKind.UriTemplate, + UriTemplate = "{baseurl+}/foo/bar" + }); writer.Write(constant); var result = tw.ToString(); Assert.DoesNotContain("errorMappings", result); @@ -146,9 +152,16 @@ public void WritesRequestGeneratorBodyForMultipart() AddRequestBodyParameters(); method.Parameters.First(static x => x.IsOfKind(CodeParameterKind.RequestBody)).Type = new CodeType { Name = "MultipartBody", IsExternal = true }; var constant = CodeConstant.FromRequestBuilderToRequestsMetadata(parentClass); - root.TryAddCodeFile("foo", constant); + var codeFile = root.TryAddCodeFile("foo", constant); + codeFile.AddElements(new CodeConstant + { + Name = "UriTemplate", + Kind = CodeConstantKind.UriTemplate, + UriTemplate = "{baseurl+}/foo/bar" + }); writer.Write(constant); var result = tw.ToString(); + Assert.Contains("uriTemplate:", result); Assert.Contains("setContentFromParsable", result); Assert.Contains("serializeMultipartBody", result); AssertExtensions.CurlyBracesAreClosed(result); @@ -161,7 +174,13 @@ public void WritesRequestExecutorBodyForCollections() method.ReturnType.CollectionKind = CodeTypeBase.CodeTypeCollectionKind.Array; AddRequestBodyParameters(); var constant = CodeConstant.FromRequestBuilderToRequestsMetadata(parentClass); - parentClass.GetImmediateParentOfType().AddConstant(constant); + var codeFile = parentClass.GetImmediateParentOfType().TryAddCodeFile("foo", constant); + codeFile.AddElements(new CodeConstant + { + Name = "UriTemplate", + Kind = CodeConstantKind.UriTemplate, + UriTemplate = "{baseurl+}/foo/bar" + }); writer.Write(constant); var result = tw.ToString(); Assert.Contains("sendCollectionAsync", result); @@ -188,7 +207,13 @@ public void WritesRequestGeneratorBodyForScalar() }).First(); generatorMethod.AcceptedResponseTypes.Add("application/json"); var constant = CodeConstant.FromRequestBuilderToRequestsMetadata(parentClass); - root.TryAddCodeFile("foo", constant); + var codeFile = root.TryAddCodeFile("foo", constant); + codeFile.AddElements(new CodeConstant + { + Name = "UriTemplate", + Kind = CodeConstantKind.UriTemplate, + UriTemplate = "{baseurl+}/foo/bar" + }); writer.Write(constant); var result = tw.ToString(); Assert.Contains("export const", result); @@ -228,7 +253,13 @@ public void WritesRequestGeneratorBodyForParsable() }; generatorMethod.AcceptedResponseTypes.Add("application/json"); var constant = CodeConstant.FromRequestBuilderToRequestsMetadata(parentClass); - root.TryAddCodeFile("foo", constant); + var codeFile = root.TryAddCodeFile("foo", constant); + codeFile.AddElements(new CodeConstant + { + Name = "UriTemplate", + Kind = CodeConstantKind.UriTemplate, + UriTemplate = "{baseurl+}/foo/bar" + }); writer.Write(constant); var result = tw.ToString(); Assert.Contains("export const", result); @@ -252,7 +283,13 @@ public void WritesRequestGeneratorBodyKnownRequestBodyType() }; method.RequestBodyContentType = "application/json"; var constant = CodeConstant.FromRequestBuilderToRequestsMetadata(parentClass); - root.TryAddCodeFile("foo", constant); + var codeFile = root.TryAddCodeFile("foo", constant); + codeFile.AddElements(new CodeConstant + { + Name = "UriTemplate", + Kind = CodeConstantKind.UriTemplate, + UriTemplate = "{baseurl+}/foo/bar" + }); writer.Write(constant); var result = tw.ToString(); Assert.Contains("export const", result); @@ -285,7 +322,13 @@ public void WritesRequestGeneratorBodyUnknownRequestBodyType() Kind = CodeParameterKind.RequestBodyContentType, }); var constant = CodeConstant.FromRequestBuilderToRequestsMetadata(parentClass); - root.TryAddCodeFile("foo", constant); + var codeFile = root.TryAddCodeFile("foo", constant); + codeFile.AddElements(new CodeConstant + { + Name = "UriTemplate", + Kind = CodeConstantKind.UriTemplate, + UriTemplate = "{baseurl+}/foo/bar" + }); writer.Write(constant); var result = tw.ToString(); Assert.Contains("export const", result); @@ -318,7 +361,13 @@ public void WritesRequestExecutorBody() method.AddErrorMapping("403", new CodeType { Name = "Error403", TypeDefinition = error403 }); AddRequestBodyParameters(); var constant = CodeConstant.FromRequestBuilderToRequestsMetadata(parentClass); - root.TryAddCodeFile("foo", constant); + var codeFile = root.TryAddCodeFile("foo", constant); + codeFile.AddElements(new CodeConstant + { + Name = "UriTemplate", + Kind = CodeConstantKind.UriTemplate, + UriTemplate = "{baseurl+}/foo/bar" + }); writer.Write(constant); var result = tw.ToString(); Assert.Contains("errorMappings: {", result); @@ -393,7 +442,6 @@ public void WritesIndexer() var result = tw.ToString(); Assert.Contains("export const ParentClassNavigationMetadata: Record, NavigationMetadata> = {", result); Assert.Contains("methodName", result); - Assert.Contains("uriTemplate: SomecustomtypeUriTemplate", result); Assert.Contains("requestsMetadata: SomecustomtypeRequestsMetadata", result); Assert.Contains("navigationMetadata: SomecustomtypeNavigationMetadata", result); Assert.Contains("pathParametersMappings: [\"foo-id\"]", result); diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index 9ffcb50952..456da14378 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -596,7 +596,6 @@ public void WritesApiConstructor() Assert.Contains($"\"baseurl\": requestAdapter.baseUrl", result); Assert.Contains($"apiClientProxifier<", result); Assert.Contains($"pathParameters", result); - Assert.Contains($"UriTemplate", result); } [Fact] public void WritesApiConstructorWithBackingStore() From 44c07dc6ba1229dd2d0337fafce78bf5500c6aa8 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 8 Feb 2024 15:29:49 -0500 Subject: [PATCH 183/394] - adds changelog entry for uri template override --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64a19db0e4..1f71399c9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed mantis for bitwise enums in Go. [#3936](https://github.com/microsoft/kiota/issues/3936) - Keyword in enum names for go should not be escaped. [#2877](https://github.com/microsoft/kiota/issues/2877) - Generator method code reduction in Python. [#3695](https://github.com/microsoft/kiota/issues/3695) +- Fixed a bug with URI template generation for required parameters when they differ between operations. [#4148](https://github.com/microsoft/kiota/issues/4148) - Fixed return doc comments for Go/Java/CSharp/TypeScript. - Fixed type names in doc comments and deprecation noticed across languages. - Added thrown exceptions in doc comments for Go/CSharp/Java/TypeScript. [#3811](https://github.com/microsoft/kiota/issues/3811) From 668ec8bcc6b12d8d7daa2a63d1ebe96f01932c87 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 08:12:01 +0000 Subject: [PATCH 184/394] Bump the kiota-dependencies group in /it/csharp with 2 updates Bumps the kiota-dependencies group in /it/csharp with 2 updates: [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet) and [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet). Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.6 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.6) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 70ae14e00d..2e906dd5aa 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -12,7 +12,7 @@ - + From d2fd1c41bfc7581e81c33d51a781a49d2ceceedc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 08:22:17 +0000 Subject: [PATCH 185/394] Bump the kiota-dependencies group in /it/python with 2 updates Bumps the kiota-dependencies group in /it/python with 2 updates: [microsoft-kiota-abstractions](https://github.com/microsoft/kiota) and [microsoft-kiota-http](https://github.com/microsoft/kiota). Updates `microsoft-kiota-abstractions` from 1.1.0 to 1.2.0 - [Release notes](https://github.com/microsoft/kiota/releases) - [Changelog](https://github.com/microsoft/kiota/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota/compare/v1.1.0...v1.2.0) Updates `microsoft-kiota-http` from 1.2.1 to 1.3.0 - [Release notes](https://github.com/microsoft/kiota/releases) - [Changelog](https://github.com/microsoft/kiota/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota/compare/v1.2.1...v1.3.0) --- updated-dependencies: - dependency-name: microsoft-kiota-abstractions dependency-type: direct:development update-type: version-update:semver-minor dependency-group: kiota-dependencies - dependency-name: microsoft-kiota-http dependency-type: direct:development update-type: version-update:semver-minor dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 09acdd3927..5833521d30 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -98,11 +98,11 @@ httpx[http2]==0.26.0 hyperframe==6.0.1 ; python_full_version >= '3.6.1' -microsoft-kiota-abstractions==1.1.0 +microsoft-kiota-abstractions==1.2.0 microsoft-kiota-authentication-azure==1.0.0 -microsoft-kiota-http==1.2.1 +microsoft-kiota-http==1.3.0 microsoft-kiota-serialization-json==1.0.1 From 43ee08bff3feeb9cd387dcbac2be810367f9d25a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 08:36:33 +0000 Subject: [PATCH 186/394] Bump mocha from 10.2.0 to 10.3.0 in /vscode/microsoft-kiota Bumps [mocha](https://github.com/mochajs/mocha) from 10.2.0 to 10.3.0. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v10.2.0...v10.3.0) --- updated-dependencies: - dependency-name: mocha dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 52 +++++------------------- vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 12 insertions(+), 42 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 9f10454099..f7faf99682 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -25,7 +25,7 @@ "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", - "mocha": "^10.1.0", + "mocha": "^10.3.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.1", @@ -2847,9 +2847,9 @@ } }, "node_modules/mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.3.0.tgz", + "integrity": "sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg==", "dev": true, "dependencies": { "ansi-colors": "4.1.1", @@ -2859,13 +2859,12 @@ "diff": "5.0.0", "escape-string-regexp": "4.0.0", "find-up": "5.0.0", - "glob": "7.2.0", + "glob": "8.1.0", "he": "1.2.0", "js-yaml": "4.1.0", "log-symbols": "4.1.0", "minimatch": "5.0.1", "ms": "2.1.3", - "nanoid": "3.3.3", "serialize-javascript": "6.0.0", "strip-json-comments": "3.1.1", "supports-color": "8.1.1", @@ -2880,44 +2879,27 @@ }, "engines": { "node": ">= 14.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" } }, "node_modules/mocha/node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "minimatch": "^5.0.1", + "once": "^1.3.0" }, "engines": { - "node": "*" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/mocha/node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/mocha/node_modules/minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", @@ -2966,18 +2948,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index baeb0ee83c..cd29b1ed03 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -432,7 +432,7 @@ "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", - "mocha": "^10.1.0", + "mocha": "^10.3.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.1", From b5d2467ab9cc525d443f44a7c8c699e4bdb06c71 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 08:36:40 +0000 Subject: [PATCH 187/394] Bump @types/node from 20.11.16 to 20.11.17 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.16 to 20.11.17. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 9f10454099..370084c898 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", - "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", + "version": "20.11.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz", + "integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From c497f8d29d855a45452dff1b149f29b59acafcce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 08:46:11 +0000 Subject: [PATCH 188/394] Bump @types/node from 20.11.16 to 20.11.17 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.16 to 20.11.17. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index b09cae4e8f..f698699e4a 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.16", + "@types/node": "^20.11.17", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", "esbuild": "^0.20.0", @@ -828,9 +828,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz", - "integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==", + "version": "20.11.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz", + "integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 32a752a4d5..702d1e25d1 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.16", + "@types/node": "^20.11.17", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", "esbuild": "^0.20.0", From 169b54c6ace8d2db296ed30924e7b6e8489f968e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 14:07:59 -0500 Subject: [PATCH 189/394] - adds config command structure --- src/kiota/KiotaConfigCommands.cs | 26 ++++++++++++++++++++++++++ src/kiota/KiotaHost.cs | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 src/kiota/KiotaConfigCommands.cs diff --git a/src/kiota/KiotaConfigCommands.cs b/src/kiota/KiotaConfigCommands.cs new file mode 100644 index 0000000000..4c9ca7fe66 --- /dev/null +++ b/src/kiota/KiotaConfigCommands.cs @@ -0,0 +1,26 @@ +using System.CommandLine; + +namespace kiota; + +public static class KiotaConfigCommands +{ + public static Command GetConfigNodeCommand() + { + var command = new Command("config", "Manages the Kiota configuration"); + command.AddCommand(GetInitCommand()); + command.AddCommand(GetMigrateCommand()); + return command; + } + private static Command GetInitCommand() + { + var command = new Command("init", "Initializes the Kiota configuration"); + //TODO map the handler + return command; + } + private static Command GetMigrateCommand() + { + var command = new Command("migrate", "Migrates a kiota lock file to a Kiota configuration"); + //TODO map the handler + return command; + } +} diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index 473a563fde..a7210d8bf7 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -14,6 +14,7 @@ namespace kiota; public static partial class KiotaHost { + private static readonly Lazy IsConfigPreviewEnabled = new(() => bool.TryParse(Environment.GetEnvironmentVariable("KIOTA_CONFIG_PREVIEW"), out var isPreviewEnabled) && isPreviewEnabled); public static RootCommand GetRootCommand() { var rootCommand = new RootCommand(); @@ -26,6 +27,8 @@ public static RootCommand GetRootCommand() rootCommand.AddCommand(GetLoginCommand()); rootCommand.AddCommand(GetLogoutCommand()); rootCommand.AddCommand(GetRpcCommand()); + if (IsConfigPreviewEnabled.Value) + rootCommand.AddCommand(KiotaConfigCommands.GetConfigNodeCommand()); return rootCommand; } private static Command GetGitHubLoginCommand() From a48086383d6bfca28b515ad80cf99efdafd09181 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 14:17:41 -0500 Subject: [PATCH 190/394] - renames handler to align with others Signed-off-by: Vincent Biret --- ...nerationCommandHandler.cs => KiotaGenerateCommandHandler.cs} | 2 +- src/kiota/KiotaHost.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/kiota/Handlers/{KiotaGenerationCommandHandler.cs => KiotaGenerateCommandHandler.cs} (99%) diff --git a/src/kiota/Handlers/KiotaGenerationCommandHandler.cs b/src/kiota/Handlers/KiotaGenerateCommandHandler.cs similarity index 99% rename from src/kiota/Handlers/KiotaGenerationCommandHandler.cs rename to src/kiota/Handlers/KiotaGenerateCommandHandler.cs index f4df49016e..8c9e9d3c08 100644 --- a/src/kiota/Handlers/KiotaGenerationCommandHandler.cs +++ b/src/kiota/Handlers/KiotaGenerateCommandHandler.cs @@ -14,7 +14,7 @@ namespace kiota.Handlers; -internal class KiotaGenerationCommandHandler : BaseKiotaCommandHandler +internal class KiotaGenerateCommandHandler : BaseKiotaCommandHandler { public required Option DescriptionOption { diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index a7210d8bf7..27f2f4e514 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -404,7 +404,7 @@ private static Command GetGenerateCommand() dvrOption, clearCacheOption, }; - command.Handler = new KiotaGenerationCommandHandler + command.Handler = new KiotaGenerateCommandHandler { DescriptionOption = descriptionOption, ManifestOption = manifestOption, From 298941d1c998d0fa7b077c65ef7dd0821c326888 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 14:21:35 -0500 Subject: [PATCH 191/394] - adds a warning when using generate and update commands with config --- src/kiota/Handlers/BaseKiotaCommandHandler.cs | 5 +++++ src/kiota/Handlers/KiotaGenerateCommandHandler.cs | 1 + src/kiota/Handlers/KiotaUpdateCommandHandler.cs | 1 + src/kiota/KiotaHost.cs | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/kiota/Handlers/BaseKiotaCommandHandler.cs b/src/kiota/Handlers/BaseKiotaCommandHandler.cs index eea451df67..a34c4a8d4d 100644 --- a/src/kiota/Handlers/BaseKiotaCommandHandler.cs +++ b/src/kiota/Handlers/BaseKiotaCommandHandler.cs @@ -328,6 +328,11 @@ protected async Task DisplayLoginHintAsync(ILogger logger, CancellationToken tok "Example: kiota login github"); } } + protected void WarnShouldUseKiotaConfigClientsCommands() + { + if (KiotaHost.IsConfigPreviewEnabled.Value) + DisplayWarning("Warning: the kiota generate and update commands are deprecated, use kiota client commands instead."); + } protected void DisplayGitHubDeviceCodeLoginMessage(Uri uri, string code) { DisplayInfo($"Please go to {uri} and enter the code {code} to authenticate."); diff --git a/src/kiota/Handlers/KiotaGenerateCommandHandler.cs b/src/kiota/Handlers/KiotaGenerateCommandHandler.cs index 8c9e9d3c08..1a9f39c1d4 100644 --- a/src/kiota/Handlers/KiotaGenerateCommandHandler.cs +++ b/src/kiota/Handlers/KiotaGenerateCommandHandler.cs @@ -66,6 +66,7 @@ public required Option> StructuredMimeTypesOption } public override async Task InvokeAsync(InvocationContext context) { + WarnShouldUseKiotaConfigClientsCommands(); string output = context.ParseResult.GetValueForOption(OutputOption) ?? string.Empty; GenerationLanguage language = context.ParseResult.GetValueForOption(LanguageOption); string openapi = context.ParseResult.GetValueForOption(DescriptionOption) ?? string.Empty; diff --git a/src/kiota/Handlers/KiotaUpdateCommandHandler.cs b/src/kiota/Handlers/KiotaUpdateCommandHandler.cs index d73241f661..f0a8186c6f 100644 --- a/src/kiota/Handlers/KiotaUpdateCommandHandler.cs +++ b/src/kiota/Handlers/KiotaUpdateCommandHandler.cs @@ -27,6 +27,7 @@ public required Option ClearCacheOption } public override async Task InvokeAsync(InvocationContext context) { + WarnShouldUseKiotaConfigClientsCommands(); string output = context.ParseResult.GetValueForOption(OutputOption) ?? string.Empty; bool clearCache = context.ParseResult.GetValueForOption(ClearCacheOption); bool cleanOutput = context.ParseResult.GetValueForOption(CleanOutputOption); diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index 27f2f4e514..c13f48bb54 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -14,7 +14,7 @@ namespace kiota; public static partial class KiotaHost { - private static readonly Lazy IsConfigPreviewEnabled = new(() => bool.TryParse(Environment.GetEnvironmentVariable("KIOTA_CONFIG_PREVIEW"), out var isPreviewEnabled) && isPreviewEnabled); + internal static readonly Lazy IsConfigPreviewEnabled = new(() => bool.TryParse(Environment.GetEnvironmentVariable("KIOTA_CONFIG_PREVIEW"), out var isPreviewEnabled) && isPreviewEnabled); public static RootCommand GetRootCommand() { var rootCommand = new RootCommand(); From 359e38ac20e753d4d6b716394ff9c6eeb4e03939 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 15:08:52 -0500 Subject: [PATCH 192/394] - adds workspace configuration storage service --- .../WorkspaceConfiguration.cs | 6 ++ ...WorkspaceConfigurationGenerationContext.cs | 9 +++ .../WorkspaceConfigurationStorageService.cs | 58 +++++++++++++++++++ src/kiota/Handlers/Config/InitHandler.cs | 15 +++++ 4 files changed, 88 insertions(+) create mode 100644 src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs create mode 100644 src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs create mode 100644 src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs create mode 100644 src/kiota/Handlers/Config/InitHandler.cs diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs new file mode 100644 index 0000000000..f4286afd1d --- /dev/null +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs @@ -0,0 +1,6 @@ +namespace Kiota.Builder.WorkspaceManagement; + +public class WorkspaceConfiguration +{ + public string Version { get; set; } = "1.0.0"; +} diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs new file mode 100644 index 0000000000..aa8ebaa6b8 --- /dev/null +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs @@ -0,0 +1,9 @@ + +using System.Text.Json.Serialization; + +namespace Kiota.Builder.WorkspaceManagement; + +[JsonSerializable(typeof(WorkspaceConfiguration))] +internal partial class WorkspaceConfigurationGenerationContext : JsonSerializerContext +{ +} diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs new file mode 100644 index 0000000000..6e7936ca32 --- /dev/null +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -0,0 +1,58 @@ +using System; +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; + +namespace Kiota.Builder.WorkspaceManagement; + +public class WorkspaceConfigurationStorageService +{ + private const string ConfigurationFileName = "kiota-config.json"; + public string TargetDirectory + { + get; private set; + } + private readonly string targetConfigurationFilePath; + public WorkspaceConfigurationStorageService(string targetDirectory) + { + ArgumentException.ThrowIfNullOrEmpty(targetDirectory); + TargetDirectory = targetDirectory; + targetConfigurationFilePath = Path.Combine(TargetDirectory, ConfigurationFileName); + } + public Task InitializeAsync(CancellationToken cancellationToken = default) + { + return UpdateWorkspaceConfigurationAsync(new WorkspaceConfiguration(), cancellationToken); + } + public async Task UpdateWorkspaceConfigurationAsync(WorkspaceConfiguration configuration, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(configuration); + if (!Directory.Exists(TargetDirectory)) + Directory.CreateDirectory(TargetDirectory); +#pragma warning disable CA2007 + await using var fileStream = File.Open(targetConfigurationFilePath, FileMode.Create); +#pragma warning restore CA2007 + await JsonSerializer.SerializeAsync(fileStream, configuration, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); + } + public Task IsInitializedAsync(CancellationToken cancellationToken = default) + {// keeping this as a task in case we want to do more complex validation in the future + return Task.FromResult(File.Exists(targetConfigurationFilePath)); + } + private static readonly JsonSerializerOptions options = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + WriteIndented = true, + }; + private static readonly WorkspaceConfigurationGenerationContext context = new(options); + public async Task GetWorkspaceConfigurationAsync(CancellationToken cancellationToken = default) + { + if (File.Exists(targetConfigurationFilePath)) + { +#pragma warning disable CA2007 + await using var fileStream = File.OpenRead(targetConfigurationFilePath); +#pragma warning restore CA2007 + return await JsonSerializer.DeserializeAsync(fileStream, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); + } + return null; + } +} diff --git a/src/kiota/Handlers/Config/InitHandler.cs b/src/kiota/Handlers/Config/InitHandler.cs new file mode 100644 index 0000000000..21fa9c2487 --- /dev/null +++ b/src/kiota/Handlers/Config/InitHandler.cs @@ -0,0 +1,15 @@ +using System.CommandLine.Invocation; +using System.Threading; +using System.Threading.Tasks; + +namespace kiota.Handlers.Config; + +internal class InitHandler : BaseKiotaCommandHandler +{ + public override Task InvokeAsync(InvocationContext context) + { + CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; + + throw new System.NotImplementedException(); + } +} From 6c37d68e849ff235177934d1abee8793a0eaabba Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Feb 2024 10:22:33 -0500 Subject: [PATCH 193/394] - implements init command --- .../WorkspaceConfigurationStorageService.cs | 6 +++++ src/kiota/Handlers/Config/InitHandler.cs | 22 ++++++++++++++++--- src/kiota/KiotaConfigCommands.cs | 7 +++++- src/kiota/KiotaHost.cs | 2 +- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 6e7936ca32..2a2e70b04a 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -14,6 +14,10 @@ public string TargetDirectory get; private set; } private readonly string targetConfigurationFilePath; + public WorkspaceConfigurationStorageService() : this(Directory.GetCurrentDirectory()) + { + + } public WorkspaceConfigurationStorageService(string targetDirectory) { ArgumentException.ThrowIfNullOrEmpty(targetDirectory); @@ -22,6 +26,8 @@ public WorkspaceConfigurationStorageService(string targetDirectory) } public Task InitializeAsync(CancellationToken cancellationToken = default) { + if (File.Exists(targetConfigurationFilePath)) + return Task.FromException(new InvalidOperationException("The workspace configuration already exists")); return UpdateWorkspaceConfigurationAsync(new WorkspaceConfiguration(), cancellationToken); } public async Task UpdateWorkspaceConfigurationAsync(WorkspaceConfiguration configuration, CancellationToken cancellationToken = default) diff --git a/src/kiota/Handlers/Config/InitHandler.cs b/src/kiota/Handlers/Config/InitHandler.cs index 21fa9c2487..c87f10ce26 100644 --- a/src/kiota/Handlers/Config/InitHandler.cs +++ b/src/kiota/Handlers/Config/InitHandler.cs @@ -1,15 +1,31 @@ +using System; using System.CommandLine.Invocation; using System.Threading; using System.Threading.Tasks; +using Kiota.Builder.WorkspaceManagement; +using Microsoft.Extensions.Logging; namespace kiota.Handlers.Config; internal class InitHandler : BaseKiotaCommandHandler { - public override Task InvokeAsync(InvocationContext context) + public async override Task InvokeAsync(InvocationContext context) { CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; - - throw new System.NotImplementedException(); + var workspaceStorageService = new WorkspaceConfigurationStorageService(); + var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); + using (loggerFactory) + { + try + { + await workspaceStorageService.InitializeAsync(cancellationToken).ConfigureAwait(false); + return 0; + } + catch (Exception ex) + { + logger.LogCritical(ex, "error initializing the workspace configuration"); + return 1; + } + } } } diff --git a/src/kiota/KiotaConfigCommands.cs b/src/kiota/KiotaConfigCommands.cs index 4c9ca7fe66..acffd974b7 100644 --- a/src/kiota/KiotaConfigCommands.cs +++ b/src/kiota/KiotaConfigCommands.cs @@ -1,4 +1,5 @@ using System.CommandLine; +using kiota.Handlers.Config; namespace kiota; @@ -14,7 +15,11 @@ public static Command GetConfigNodeCommand() private static Command GetInitCommand() { var command = new Command("init", "Initializes the Kiota configuration"); - //TODO map the handler + var logLevelOption = KiotaHost.GetLogLevelOption(); + command.Handler = new InitHandler + { + LogLevelOption = logLevelOption, + }; return command; } private static Command GetMigrateCommand() diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index c13f48bb54..2da259af21 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -468,7 +468,7 @@ private static (Option>, Option>) GetIncludeAndExclude excludePatterns.AddAlias("-e"); return (includePatterns, excludePatterns); } - private static Option GetLogLevelOption() + internal static Option GetLogLevelOption() { var logLevelOption = new Option("--log-level", () => LogLevel.Warning, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("--ll"); From 5ca222d2d7f0f6b056024044cbbaf1d0da6f34ea Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Feb 2024 10:47:18 -0500 Subject: [PATCH 194/394] - adds unit tests for worskpace management service Signed-off-by: Vincent Biret --- ...rkspaceConfigurationStorageServiceTests.cs | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs new file mode 100644 index 0000000000..5413a120df --- /dev/null +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using Kiota.Builder.WorkspaceManagement; +using Xunit; + +namespace Kiota.Builder.Tests.WorkspaceManagement; +public sealed class WorkspaceConfigurationStorageServiceTests : IDisposable +{ + [Fact] + public async Task DefensiveProgramming() + { + Assert.Throws(() => new WorkspaceConfigurationStorageService(string.Empty)); + var service = new WorkspaceConfigurationStorageService(); + await Assert.ThrowsAsync(() => service.UpdateWorkspaceConfigurationAsync(null)); + } + private readonly string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + [Fact] + public async Task InitializesAsync() + { + var service = new WorkspaceConfigurationStorageService(tempPath); + await service.InitializeAsync(); + Assert.True(File.Exists(Path.Combine(tempPath, "kiota-config.json"))); + } + [Fact] + public async Task FailsOnDoubleInit() + { + var service = new WorkspaceConfigurationStorageService(tempPath); + await service.InitializeAsync(); + await Assert.ThrowsAsync(() => service.InitializeAsync()); + } + [Fact] + public async Task ReturnsNullOnNonInitialized() + { + var service = new WorkspaceConfigurationStorageService(tempPath); + var result = await service.GetWorkspaceConfigurationAsync(); + Assert.Null(result); + } + [Fact] + public async Task ReturnsConfigurationWhenInitialized() + { + var service = new WorkspaceConfigurationStorageService(tempPath); + await service.InitializeAsync(); + var result = await service.GetWorkspaceConfigurationAsync(); + Assert.NotNull(result); + } + public void Dispose() + { + if (Directory.Exists(tempPath)) + Directory.Delete(tempPath, true); + GC.SuppressFinalize(this); + } +} From c7fe02ca1a6dc472396accdfa09ff3601be9a476 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Feb 2024 10:48:10 -0500 Subject: [PATCH 195/394] - adds changelog entry for init command Signed-off-by: Vincent Biret --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f71399c9d..db2097415b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added the init command as part of the experience revamp of [#3356](https://github.com/microsoft/kiota/issues/3356) + ### Changed - Fixed mantis for bitwise enums in Go. [#3936](https://github.com/microsoft/kiota/issues/3936) From 1929f3af5baac5ddfbd5c231939ae3f9d073169f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Feb 2024 10:51:00 -0500 Subject: [PATCH 196/394] - reduces code duplication Signed-off-by: Vincent Biret --- .../WorkspaceConfigurationStorageService.cs | 8 ++++---- .../WorkspaceConfigurationStorageServiceTests.cs | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 2a2e70b04a..719638ee9c 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -24,11 +24,11 @@ public WorkspaceConfigurationStorageService(string targetDirectory) TargetDirectory = targetDirectory; targetConfigurationFilePath = Path.Combine(TargetDirectory, ConfigurationFileName); } - public Task InitializeAsync(CancellationToken cancellationToken = default) + public async Task InitializeAsync(CancellationToken cancellationToken = default) { - if (File.Exists(targetConfigurationFilePath)) - return Task.FromException(new InvalidOperationException("The workspace configuration already exists")); - return UpdateWorkspaceConfigurationAsync(new WorkspaceConfiguration(), cancellationToken); + if (await IsInitializedAsync(cancellationToken).ConfigureAwait(false)) + throw new InvalidOperationException("The workspace configuration already exists"); + await UpdateWorkspaceConfigurationAsync(new WorkspaceConfiguration(), cancellationToken).ConfigureAwait(false); } public async Task UpdateWorkspaceConfigurationAsync(WorkspaceConfiguration configuration, CancellationToken cancellationToken = default) { diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs index 5413a120df..dca5462c15 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs @@ -44,6 +44,21 @@ public async Task ReturnsConfigurationWhenInitialized() var result = await service.GetWorkspaceConfigurationAsync(); Assert.NotNull(result); } + [Fact] + public async Task ReturnsIsInitialized() + { + var service = new WorkspaceConfigurationStorageService(tempPath); + await service.InitializeAsync(); + var result = await service.IsInitializedAsync(); + Assert.True(result); + } + [Fact] + public async Task DoesNotReturnIsInitialized() + { + var service = new WorkspaceConfigurationStorageService(tempPath); + var result = await service.IsInitializedAsync(); + Assert.False(result); + } public void Dispose() { if (Directory.Exists(tempPath)) From 8b227f20dc0daa47ea96c283a6d5dc88b9b5fe9c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Feb 2024 10:55:17 -0500 Subject: [PATCH 197/394] - fixes formatting --- src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs | 2 +- .../WorkspaceConfigurationGenerationContext.cs | 2 +- .../WorkspaceManagement/WorkspaceConfigurationStorageService.cs | 2 +- src/kiota/Handlers/Config/InitHandler.cs | 2 +- src/kiota/KiotaConfigCommands.cs | 2 +- .../WorkspaceConfigurationStorageServiceTests.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs index f4286afd1d..0b47ec370d 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs @@ -1,4 +1,4 @@ -namespace Kiota.Builder.WorkspaceManagement; +namespace Kiota.Builder.WorkspaceManagement; public class WorkspaceConfiguration { diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs index aa8ebaa6b8..cafe2d7573 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs @@ -1,4 +1,4 @@ - + using System.Text.Json.Serialization; namespace Kiota.Builder.WorkspaceManagement; diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 719638ee9c..c49aa71f0f 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Text.Json; using System.Threading; diff --git a/src/kiota/Handlers/Config/InitHandler.cs b/src/kiota/Handlers/Config/InitHandler.cs index c87f10ce26..3c3fd3804e 100644 --- a/src/kiota/Handlers/Config/InitHandler.cs +++ b/src/kiota/Handlers/Config/InitHandler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.CommandLine.Invocation; using System.Threading; using System.Threading.Tasks; diff --git a/src/kiota/KiotaConfigCommands.cs b/src/kiota/KiotaConfigCommands.cs index acffd974b7..24db579a55 100644 --- a/src/kiota/KiotaConfigCommands.cs +++ b/src/kiota/KiotaConfigCommands.cs @@ -1,4 +1,4 @@ -using System.CommandLine; +using System.CommandLine; using kiota.Handlers.Config; namespace kiota; diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs index dca5462c15..446bf39673 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; using Kiota.Builder.WorkspaceManagement; From bee45e8d40e2e08fffd60d92d2daf50249b4f8bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 08:28:41 +0000 Subject: [PATCH 198/394] Bump the kiota-dependencies group in /it/csharp with 1 update Bumps the kiota-dependencies group in /it/csharp with 1 update: [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet). Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.2...v1.1.3) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 2e906dd5aa..d514deda3e 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -11,7 +11,7 @@ - + From dfb90551f9e3631f6e0770e9121a8ad066cf0906 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 08:31:39 +0000 Subject: [PATCH 199/394] Bump the kiota-dependencies group in /it/typescript with 7 updates Bumps the kiota-dependencies group in /it/typescript with 7 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/kiota-abstractions](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.41` | `1.0.0-preview.42` | | [@microsoft/kiota-authentication-azure](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.36` | `1.0.0-preview.37` | | [@microsoft/kiota-http-fetchlibrary](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.40` | `1.0.0-preview.41` | | [@microsoft/kiota-serialization-form](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.30` | `1.0.0-preview.31` | | [@microsoft/kiota-serialization-json](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.41` | `1.0.0-preview.42` | | [@microsoft/kiota-serialization-multipart](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.20` | `1.0.0-preview.21` | | [@microsoft/kiota-serialization-text](https://github.com/microsoft-typescript/kiota) | `1.0.0-preview.38` | `1.0.0-preview.39` | Updates `@microsoft/kiota-abstractions` from 1.0.0-preview.41 to 1.0.0-preview.42 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-abstractions@1.0.0-preview.41...@microsoft/kiota-abstractions@1.0.0-preview.42) Updates `@microsoft/kiota-authentication-azure` from 1.0.0-preview.36 to 1.0.0-preview.37 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-authentication-azure@1.0.0-preview.36...@microsoft/kiota-authentication-azure@1.0.0-preview.37) Updates `@microsoft/kiota-http-fetchlibrary` from 1.0.0-preview.40 to 1.0.0-preview.41 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.40...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.41) Updates `@microsoft/kiota-serialization-form` from 1.0.0-preview.30 to 1.0.0-preview.31 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-form@1.0.0-preview.30...@microsoft/kiota-serialization-form@1.0.0-preview.31) Updates `@microsoft/kiota-serialization-json` from 1.0.0-preview.41 to 1.0.0-preview.42 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-json@1.0.0-preview.41...@microsoft/kiota-serialization-json@1.0.0-preview.42) Updates `@microsoft/kiota-serialization-multipart` from 1.0.0-preview.20 to 1.0.0-preview.21 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-multipart@1.0.0-preview.20...@microsoft/kiota-serialization-multipart@1.0.0-preview.21) Updates `@microsoft/kiota-serialization-text` from 1.0.0-preview.38 to 1.0.0-preview.39 - [Commits](https://github.com/microsoft-typescript/kiota/commits) --- updated-dependencies: - dependency-name: "@microsoft/kiota-abstractions" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-authentication-azure" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-http-fetchlibrary" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-json" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-multipart" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-text" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 68 ++++++++++++++++----------------- it/typescript/package.json | 14 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index f698699e4a..6d950396ec 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.41", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.36", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.40", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.30", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.41", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.20", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.38", + "@microsoft/kiota-abstractions": "^1.0.0-preview.42", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.37", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.41", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.31", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.42", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.21", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.39", "express": "^4.18.2", "node-fetch": "^2.7.0" }, @@ -678,9 +678,9 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.41", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.41.tgz", - "integrity": "sha512-W//MxpuB9bXlWu/1YEhMY6VOzyqpEZdg1uKEfDZvMIVRl6ylmJLN43eNTQGH7MJA4MtAHp0f0L+dp0DW+tibow==", + "version": "1.0.0-preview.42", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.42.tgz", + "integrity": "sha512-LU1BxErkQsLrk49EvzNbh09uYZw/liSE/vVeOA+U7PIWXOwmYdNFurOZJWlGoLeBosAGbrJlR5BqsVGHJBnnVA==", "dependencies": { "@opentelemetry/api": "^1.7.0", "@std-uritemplate/std-uritemplate": "^0.0.50", @@ -703,22 +703,22 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.36", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.36.tgz", - "integrity": "sha512-MrRTto4P7Ynk7g6Jv7DgKgwhT2XYexQu6MllDOCVmsi3hhWha7wFqvapdsheGqUN4MSDINlg2ayRFdanLWK+8g==", + "version": "1.0.0-preview.37", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.37.tgz", + "integrity": "sha512-P1Kt5yERdNOot3OMJ3MAINfBK1ueI+PeUYnC+ud44KW6xrkr5UtGCipLmePyHKTs+D22OlRuyvc/pft9O8IEMg==", "dependencies": { "@azure/core-auth": "^1.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.41", + "@microsoft/kiota-abstractions": "^1.0.0-preview.42", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.40", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.40.tgz", - "integrity": "sha512-rEZQKy+IfM6ncUwIC2PSi29TYKVmmWxxD1iezBOjXllY7kNVvwYf/Q7cTNhsZ6G6br2eMwftrtMXAtHnwtkI9A==", + "version": "1.0.0-preview.41", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.41.tgz", + "integrity": "sha512-Z81mve+Wpk3ZH2iplW7zdoi+84obTJj9Y6eGwhUvkKE06T0fnpmQGIQC8NHBMkRH3E8BZCpeUDXvZ+fI5+sPNA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.41", + "@microsoft/kiota-abstractions": "^1.0.0-preview.42", "@opentelemetry/api": "^1.7.0", "guid-typescript": "^1.0.9", "node-fetch": "^2.7.0", @@ -726,41 +726,41 @@ } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.30", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.30.tgz", - "integrity": "sha512-z1bIz0GLzBakYMFA6M1EUtCP3o1qhOKlckfVIvxAcBf2nj+54+nIzVabHHW5oCd7Vdjp9IBJd7uApzR+aTbR+Q==", + "version": "1.0.0-preview.31", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.31.tgz", + "integrity": "sha512-h/raZO/AhOxuqvBf2ju0GgKTouu6G5d5JMi7zWJrCG8jO6g/7shJqIwrzZdP2uO9lkBCnjZk9OV5/3D1HvCE0g==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.41", + "@microsoft/kiota-abstractions": "^1.0.0-preview.42", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.41", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.41.tgz", - "integrity": "sha512-2Jhelm6ocrL89JtE28r284dymgbcmQ0Tq0IwXhsFiP25qq3bM7zPNvHcMHBFaMowOyPrTM6HSob9G6Ia3Z/Sxg==", + "version": "1.0.0-preview.42", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.42.tgz", + "integrity": "sha512-Yt+4ItvQiUtwY2q352XhtaIUwTNE765BVg084Hg/Ej8MYb1CR4Q7FW66nBWs4zI5+4V0BOpFzzkuBzqHIoN86g==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.41", + "@microsoft/kiota-abstractions": "^1.0.0-preview.42", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.20", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.20.tgz", - "integrity": "sha512-4iORvQIcPCz+xlx3EbHeSy2TV3R2WlV2VFu6cxAoWUY+g6l4MWkCaQbJ29bEDfvbUh3yH4vH1ZrgIyFfilBp8Q==", + "version": "1.0.0-preview.21", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.21.tgz", + "integrity": "sha512-CSzIg03Bkq24RDpM2jMERDYm371t1t+7DbWHvGgiDbARNHnMV9nwEH6wFwUGGKixNOFTssjbGqW5MdXxFvMVrw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.41", + "@microsoft/kiota-abstractions": "^1.0.0-preview.42", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.38", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.38.tgz", - "integrity": "sha512-ZdvChmAH6IzoQgIlD844uxTrBKmcaCuQmG4CA8UcKteG9R5rh9Yq8WFwIVLxZaa3t7wH7utTJH4azI8ywQjCGA==", + "version": "1.0.0-preview.39", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.39.tgz", + "integrity": "sha512-PHcpKGeaaheAi1RnxdJASvG/tZStf6fr4dNSYr/1Q5D01R5U6X54hBCtf1GjI6wDR8K4X/GFo+eoi2HOXTUv2Q==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.41", + "@microsoft/kiota-abstractions": "^1.0.0-preview.42", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } diff --git a/it/typescript/package.json b/it/typescript/package.json index 702d1e25d1..30f4de708d 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.41", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.36", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.40", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.30", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.41", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.20", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.38", + "@microsoft/kiota-abstractions": "^1.0.0-preview.42", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.37", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.41", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.31", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.42", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.21", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.39", "express": "^4.18.2", "node-fetch": "^2.7.0" } From d56edb4d23f17ade6a9b8d2fe0fee5a56c0af290 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 08:34:26 +0000 Subject: [PATCH 200/394] Bump pytest-asyncio from 0.23.4 to 0.23.5 in /it/python Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.4 to 0.23.5. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.4...v0.23.5) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 5833521d30..fe98a67978 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -44,7 +44,7 @@ pylint==3.0.3 pytest==7.4.4 -pytest-asyncio==0.23.4 +pytest-asyncio==0.23.5 requests==2.31.0 ; python_version >= '3.7' From 9bbcc96dd7ece25bf39740819711d0b7451c2d6f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:16:23 +0000 Subject: [PATCH 201/394] Bump pytest from 7.4.4 to 8.0.0 in /it/python Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.4 to 8.0.0. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.4.4...8.0.0) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index fe98a67978..1f79436aee 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -42,7 +42,7 @@ pluggy==1.4.0 ; python_version >= '3.7' pylint==3.0.3 -pytest==7.4.4 +pytest==8.0.0 pytest-asyncio==0.23.5 From dab9ea9eaeb776fbfb5fac7a905b7784d73f6394 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:25:44 +0000 Subject: [PATCH 202/394] Bump @typescript-eslint/parser from 6.21.0 to 7.0.1 in /it/typescript Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.21.0 to 7.0.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 117 +++++++++++++++++++++++++++++--- it/typescript/package.json | 2 +- 2 files changed, 109 insertions(+), 10 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 6d950396ec..4b06e83d06 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -24,7 +24,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.17", "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.21.0", + "@typescript-eslint/parser": "^7.0.1", "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", @@ -878,15 +878,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", - "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.1.tgz", + "integrity": "sha512-8GcRRZNzaHxKzBPU3tKtFNing571/GwPBeCvmAUw0yBtfE2XVd0zFKJIMSWkHJcPQi0ekxjIts6L/rrZq5cxGQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/typescript-estree": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", "debug": "^4.3.4" }, "engines": { @@ -897,7 +897,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -905,6 +905,105 @@ } } }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", + "integrity": "sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", + "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", + "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", + "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index 30f4de708d..9afa4121f4 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -21,7 +21,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.17", "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.21.0", + "@typescript-eslint/parser": "^7.0.1", "esbuild": "^0.20.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", From 963b9e5bb4af8d904dd1f22f62b4a32c3be947af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:29:19 +0000 Subject: [PATCH 203/394] Bump the eslint group in /vscode/microsoft-kiota with 2 updates Bumps the eslint group in /vscode/microsoft-kiota with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser). Updates `@typescript-eslint/eslint-plugin` from 6.21.0 to 7.0.1 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.1/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 6.21.0 to 7.0.1 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-major dependency-group: eslint - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-major dependency-group: eslint ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 104 +++++++++++------------ vscode/microsoft-kiota/package.json | 4 +- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 78d3483954..38428b036e 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -20,8 +20,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.86.0", - "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.21.0", + "@typescript-eslint/eslint-plugin": "^7.0.1", + "@typescript-eslint/parser": "^7.0.1", "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", @@ -543,9 +543,9 @@ } }, "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", + "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", "dev": true }, "node_modules/@types/vscode": { @@ -555,16 +555,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", - "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.1.tgz", + "integrity": "sha512-OLvgeBv3vXlnnJGIAgCLYKjgMEU+wBGj07MQ/nxAaON+3mLzX7mJbhRYrVGiVvFiXtwFlkcBa/TtmglHy0UbzQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/type-utils": "6.21.0", - "@typescript-eslint/utils": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/type-utils": "7.0.1", + "@typescript-eslint/utils": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -580,8 +580,8 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", - "eslint": "^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -590,15 +590,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", - "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.1.tgz", + "integrity": "sha512-8GcRRZNzaHxKzBPU3tKtFNing571/GwPBeCvmAUw0yBtfE2XVd0zFKJIMSWkHJcPQi0ekxjIts6L/rrZq5cxGQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/typescript-estree": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", "debug": "^4.3.4" }, "engines": { @@ -609,7 +609,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -618,13 +618,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", + "integrity": "sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -635,13 +635,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", - "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.1.tgz", + "integrity": "sha512-YtT9UcstTG5Yqy4xtLiClm1ZpM/pWVGFnkAa90UfdkkZsR1eP2mR/1jbHeYp8Ay1l1JHPyGvoUYR6o3On5Nhmw==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/typescript-estree": "7.0.1", + "@typescript-eslint/utils": "7.0.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -653,7 +653,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -662,9 +662,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", + "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -675,13 +675,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", - "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", + "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -727,17 +727,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", - "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.1.tgz", + "integrity": "sha512-oe4his30JgPbnv+9Vef1h48jm0S6ft4mNwi9wj7bX10joGn07QRfqIqFHoMiajrtoU88cIhXf8ahwgrcbNLgPA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/typescript-estree": "7.0.1", "semver": "^7.5.4" }, "engines": { @@ -748,16 +748,16 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", + "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/types": "7.0.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index cd29b1ed03..673bd38428 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -427,8 +427,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.86.0", - "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.21.0", + "@typescript-eslint/eslint-plugin": "^7.0.1", + "@typescript-eslint/parser": "^7.0.1", "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", From 80b9061d65ff85dd2980826e68c04719459a1708 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:31:02 +0000 Subject: [PATCH 204/394] Bump @typescript-eslint/eslint-plugin in /it/typescript Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.21.0 to 7.0.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 177 +++++++------------------------- it/typescript/package.json | 2 +- 2 files changed, 40 insertions(+), 139 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 4b06e83d06..22b863aec6 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -23,7 +23,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.17", - "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/eslint-plugin": "^7.0.1", "@typescript-eslint/parser": "^7.0.1", "esbuild": "^0.20.0", "eslint": "^8.56.0", @@ -837,22 +837,22 @@ } }, "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", + "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", - "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.1.tgz", + "integrity": "sha512-OLvgeBv3vXlnnJGIAgCLYKjgMEU+wBGj07MQ/nxAaON+3mLzX7mJbhRYrVGiVvFiXtwFlkcBa/TtmglHy0UbzQ==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/type-utils": "6.21.0", - "@typescript-eslint/utils": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/type-utils": "7.0.1", + "@typescript-eslint/utils": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -868,8 +868,8 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", - "eslint": "^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -905,7 +905,7 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "node_modules/@typescript-eslint/scope-manager": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", "integrity": "sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==", @@ -922,113 +922,14 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", - "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", - "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", - "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.1", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", - "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.1.tgz", + "integrity": "sha512-YtT9UcstTG5Yqy4xtLiClm1ZpM/pWVGFnkAa90UfdkkZsR1eP2mR/1jbHeYp8Ay1l1JHPyGvoUYR6o3On5Nhmw==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/typescript-estree": "7.0.1", + "@typescript-eslint/utils": "7.0.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1040,7 +941,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1049,9 +950,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", + "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1062,13 +963,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", - "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", + "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/visitor-keys": "7.0.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1114,17 +1015,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", - "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.1.tgz", + "integrity": "sha512-oe4his30JgPbnv+9Vef1h48jm0S6ft4mNwi9wj7bX10joGn07QRfqIqFHoMiajrtoU88cIhXf8ahwgrcbNLgPA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/scope-manager": "7.0.1", + "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/typescript-estree": "7.0.1", "semver": "^7.5.4" }, "engines": { @@ -1135,16 +1036,16 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", + "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/types": "7.0.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/it/typescript/package.json b/it/typescript/package.json index 9afa4121f4..89228746fa 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.17", - "@typescript-eslint/eslint-plugin": "^6.21.0", + "@typescript-eslint/eslint-plugin": "^7.0.1", "@typescript-eslint/parser": "^7.0.1", "esbuild": "^0.20.0", "eslint": "^8.56.0", From df7fdd984f26bb6c219ee1309e90b6b65c8265f0 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 13 Feb 2024 15:30:47 +0300 Subject: [PATCH 205/394] Fixing cref tags --- CHANGELOG.md | 1 + src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs | 2 +- src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db2097415b..40f04bb798 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed return doc comments for Go/Java/CSharp/TypeScript. - Fixed type names in doc comments and deprecation noticed across languages. - Added thrown exceptions in doc comments for Go/CSharp/Java/TypeScript. [#3811](https://github.com/microsoft/kiota/issues/3811) +- Fixed `cref` tags not closed in doc comments in CSharp generation. - Deduplicates 4XX and 5XX error mappings when they map to the same type to reduce emitted code. [#4025](https://github.com/microsoft/kiota/issues/4025) - 📢📢📢 Java generation is now stable! 🚀🚀🚀 special thanks to @andreaTP (Red Hat) for all the help. diff --git a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs index cde95bac5b..a218bfdd09 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs @@ -14,7 +14,7 @@ public override void WriteCodeElement(CodeIndexer codeElement, LanguageWriter wr var returnType = conventions.GetTypeString(codeElement.ReturnType, codeElement); conventions.WriteShortDescription(codeElement, writer);//TODO make the parameter name dynamic in v2 conventions.WriteShortDescription(codeElement.IndexParameter, writer, $"", ""); - conventions.WriteAdditionalDescriptionItem($"A ", writer); + conventions.WriteAdditionalDescriptionItem($"A ", writer); conventions.WriteDeprecationAttribute(codeElement, writer); writer.StartBlock($"public {returnType} this[{conventions.GetTypeString(codeElement.IndexParameter.Type, codeElement)} position] {{ get {{"); if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProp) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index a856dd6a63..289aca65d5 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -544,7 +544,7 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer) { conventions.WriteLongDescription(code, writer); if (!"void".Equals(code.ReturnType.Name, StringComparison.OrdinalIgnoreCase) && code.Kind is not CodeMethodKind.ClientConstructor or CodeMethodKind.Constructor) - conventions.WriteAdditionalDescriptionItem($"A ", writer); + conventions.WriteAdditionalDescriptionItem($"A ", writer); foreach (var paramWithDescription in code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase)) From 124a375673424757d86d03619f099778be0c6334 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 13 Feb 2024 17:38:00 +0300 Subject: [PATCH 206/394] Cleanup --- .../Writers/CSharp/CSharpConventionService.cs | 12 ++++++++++-- .../Writers/CSharp/CodeIndexerWriter.cs | 2 +- src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index 9a965ca619..dbbb3bdff5 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -44,7 +44,7 @@ public override void WriteShortDescription(IDocumentedElement element, LanguageW ArgumentNullException.ThrowIfNull(element); if (element is not CodeElement codeElement) return; if (!element.Documentation.DescriptionAvailable) return; - var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, static x => x.CleanupXMLString()); + var description = element.Documentation.GetDescription(type => GetTypeStringForDocumentation(type, codeElement), normalizationFunc: static x => x.CleanupXMLString()); writer.WriteLine($"{DocCommentPrefix}{prefix}{description}{suffix}"); } public void WriteAdditionalDescriptionItem(string description, LanguageWriter writer) @@ -64,7 +64,7 @@ public void WriteLongDescription(IDocumentedElement element, LanguageWriter writ writer.WriteLine($"{DocCommentPrefix}"); if (documentation.DescriptionAvailable) { - var description = element.Documentation.GetDescription(type => GetTypeString(type, codeElement), ReferenceTypePrefix, ReferenceTypeSuffix, static x => x.CleanupXMLString()); + var description = element.Documentation.GetDescription(type => GetTypeStringForDocumentation(type, codeElement), normalizationFunc: static x => x.CleanupXMLString()); writer.WriteLine($"{DocCommentPrefix}{description}"); } if (documentation.ExternalDocumentationAvailable) @@ -151,6 +151,14 @@ private static IEnumerable GetAllNamespaces(CodeNamespace ns) yield return childNsSegment; } } + public string GetTypeStringForDocumentation(CodeTypeBase code, CodeElement targetElement) + { + var typeString = GetTypeString(code, targetElement, true, false);// dont include nullable markers + if (typeString.EndsWith('>')) + return typeString.CleanupXMLString(); // don't generate cref links for generic types as concrete types generate invalid links + + return $"{ReferenceTypePrefix}{typeString.CleanupXMLString()}{ReferenceTypeSuffix}"; + } public override string GetTypeString(CodeTypeBase code, CodeElement targetElement, bool includeCollectionInformation = true, LanguageWriter? writer = null) { return GetTypeString(code, targetElement, includeCollectionInformation, true); diff --git a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs index a218bfdd09..89b3b292d6 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeIndexerWriter.cs @@ -14,7 +14,7 @@ public override void WriteCodeElement(CodeIndexer codeElement, LanguageWriter wr var returnType = conventions.GetTypeString(codeElement.ReturnType, codeElement); conventions.WriteShortDescription(codeElement, writer);//TODO make the parameter name dynamic in v2 conventions.WriteShortDescription(codeElement.IndexParameter, writer, $"", ""); - conventions.WriteAdditionalDescriptionItem($"A ", writer); + conventions.WriteAdditionalDescriptionItem($"A {conventions.GetTypeStringForDocumentation(codeElement.ReturnType, codeElement)}", writer); conventions.WriteDeprecationAttribute(codeElement, writer); writer.StartBlock($"public {returnType} this[{conventions.GetTypeString(codeElement.IndexParameter.Type, codeElement)} position] {{ get {{"); if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProp) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index 289aca65d5..bdab613416 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -544,7 +544,7 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer) { conventions.WriteLongDescription(code, writer); if (!"void".Equals(code.ReturnType.Name, StringComparison.OrdinalIgnoreCase) && code.Kind is not CodeMethodKind.ClientConstructor or CodeMethodKind.Constructor) - conventions.WriteAdditionalDescriptionItem($"A ", writer); + conventions.WriteAdditionalDescriptionItem($"A {conventions.GetTypeStringForDocumentation(code.ReturnType, code)}", writer); foreach (var paramWithDescription in code.Parameters .Where(static x => x.Documentation.DescriptionAvailable) .OrderBy(static x => x.Name, StringComparer.OrdinalIgnoreCase)) From dcd9088e796e7ace98936877c2cf269019a2f3e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Feb 2024 08:44:37 +0000 Subject: [PATCH 207/394] Bump httpcore from 1.0.2 to 1.0.3 in /it/python Bumps [httpcore](https://github.com/encode/httpcore) from 1.0.2 to 1.0.3. - [Release notes](https://github.com/encode/httpcore/releases) - [Changelog](https://github.com/encode/httpcore/blob/master/CHANGELOG.md) - [Commits](https://github.com/encode/httpcore/compare/1.0.2...1.0.3) --- updated-dependencies: - dependency-name: httpcore dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 1f79436aee..e40b52d44d 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -92,7 +92,7 @@ h2==4.1.0 hpack==4.0.0 ; python_full_version >= '3.6.1' -httpcore==1.0.2 ; python_version >= '3.7' +httpcore==1.0.3 ; python_version >= '3.7' httpx[http2]==0.26.0 From 1d499836fe8ec24b48e149077678018acc3d3604 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:09:38 +0000 Subject: [PATCH 208/394] Bump @types/node from 20.11.17 to 20.11.19 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.17 to 20.11.19. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 22b863aec6..ab23877578 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.17", + "@types/node": "^20.11.19", "@typescript-eslint/eslint-plugin": "^7.0.1", "@typescript-eslint/parser": "^7.0.1", "esbuild": "^0.20.0", @@ -828,9 +828,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz", - "integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==", + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 89228746fa..5ae8cdc422 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.17", + "@types/node": "^20.11.19", "@typescript-eslint/eslint-plugin": "^7.0.1", "@typescript-eslint/parser": "^7.0.1", "esbuild": "^0.20.0", From f807ed9f2ca85455b5ee861dd7533fa6629bfe41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:11:55 +0000 Subject: [PATCH 209/394] Bump @types/node from 20.11.17 to 20.11.19 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.17 to 20.11.19. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 38428b036e..faeb06d1a1 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz", - "integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==", + "version": "20.11.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", + "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From d1236dbead919abe53ff424eb38d3adae4851fb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:12:08 +0000 Subject: [PATCH 210/394] Bump webpack from 5.90.1 to 5.90.2 in /vscode/microsoft-kiota Bumps [webpack](https://github.com/webpack/webpack) from 5.90.1 to 5.90.2. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.90.1...v5.90.2) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 8 ++++---- vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 38428b036e..d484a0c62b 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -28,7 +28,7 @@ "mocha": "^10.3.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", - "webpack": "^5.90.1", + "webpack": "^5.90.2", "webpack-cli": "^5.1.4" }, "engines": { @@ -4044,9 +4044,9 @@ } }, "node_modules/webpack": { - "version": "5.90.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.1.tgz", - "integrity": "sha512-SstPdlAC5IvgFnhiRok8hqJo/+ArAbNv7rhU4fnWGHNVfN59HSQFaxZDSAL3IFG2YmqxuRs+IU33milSxbPlog==", + "version": "5.90.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.2.tgz", + "integrity": "sha512-ziXu8ABGr0InCMEYFnHrYweinHK2PWrMqnwdHk2oK3rRhv/1B+2FnfwYv5oD+RrknK/Pp/Hmyvu+eAsaMYhzCw==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 673bd38428..94f7c63b71 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -435,7 +435,7 @@ "mocha": "^10.3.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", - "webpack": "^5.90.1", + "webpack": "^5.90.2", "webpack-cli": "^5.1.4" }, "dependencies": { From 779ead99c99537b6a86c8179a675e57e0e8d1748 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:41:29 +0000 Subject: [PATCH 211/394] Bump xunit from 2.6.6 to 2.7.0 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.6 to 2.7.0. - [Commits](https://github.com/xunit/xunit/compare/2.6.6...2.7.0) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Kiota.Builder.IntegrationTests.csproj | 2 +- tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj | 2 +- tests/Kiota.Tests/Kiota.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index 1fd27b3f25..f7ce9089fb 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -16,7 +16,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj index abf92474f7..0295505625 100644 --- a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj +++ b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj @@ -19,7 +19,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Kiota.Tests/Kiota.Tests.csproj b/tests/Kiota.Tests/Kiota.Tests.csproj index e14cadca38..bb6a6f549b 100644 --- a/tests/Kiota.Tests/Kiota.Tests.csproj +++ b/tests/Kiota.Tests/Kiota.Tests.csproj @@ -12,7 +12,7 @@ all - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 0206f1b96d304c7d8438456f410ed576f0536650 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 16 Feb 2024 11:44:50 +0300 Subject: [PATCH 212/394] Fix missing doc comments. --- CHANGELOG.md | 1 + .../Writers/CSharp/CSharpConventionService.cs | 6 ++++-- .../Writers/Go/GoConventionService.cs | 2 +- .../Writers/Java/JavaConventionService.cs | 2 +- .../Writers/Python/PythonConventionService.cs | 4 ++-- .../TypeScript/TypeScriptConventionService.cs | 2 +- .../Writers/CSharp/CodeMethodWriterTests.cs | 12 ++++++++++++ .../Writers/Go/CodeMethodWriterTests.cs | 11 +++++++++++ .../Writers/Java/CodeMethodWriterTests.cs | 11 +++++++++++ .../Writers/Python/CodeMethodWriterTests.cs | 11 +++++++++++ .../TypeScript/CodeFunctionWriterTests.cs | 19 +++++++++++++++++++ 11 files changed, 74 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40f04bb798..3b434be70c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed return doc comments for Go/Java/CSharp/TypeScript. - Fixed type names in doc comments and deprecation noticed across languages. - Added thrown exceptions in doc comments for Go/CSharp/Java/TypeScript. [#3811](https://github.com/microsoft/kiota/issues/3811) +- Fixed missing type/method names in deprecation comments.[#4186](https://github.com/microsoft/kiota/issues/4186) - Fixed `cref` tags not closed in doc comments in CSharp generation. - Deduplicates 4XX and 5XX error mappings when they map to the same type to reduce emitted code. [#4025](https://github.com/microsoft/kiota/issues/4025) - 📢📢📢 Java generation is now stable! 🚀🚀🚀 special thanks to @andreaTP (Red Hat) for all the help. diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index dbbb3bdff5..92ebd23ca0 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -38,7 +38,9 @@ public static void WriteNullableClosing(LanguageWriter writer) } private const string ReferenceTypePrefix = ""; +#pragma warning disable S1006 // Method overrides should not change parameter defaults public override void WriteShortDescription(IDocumentedElement element, LanguageWriter writer, string prefix = "", string suffix = "") +#pragma warning restore S1006 // Method overrides should not change parameter defaults { ArgumentNullException.ThrowIfNull(writer); ArgumentNullException.ThrowIfNull(element); @@ -293,14 +295,14 @@ _ when nameof(String).Equals(parameterType, StringComparison.OrdinalIgnoreCase) }; return $"{GetDeprecationInformation(parameter)}{parameterType} {parameter.Name.ToFirstCharacterLowerCase()}{defaultValue}"; } - private static string GetDeprecationInformation(IDeprecableElement element) + private string GetDeprecationInformation(IDeprecableElement element) { if (element.Deprecation is null || !element.Deprecation.IsDeprecated) return string.Empty; var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return $"[Obsolete(\"{element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}\")]"; + return $"[Obsolete(\"{element.Deprecation.GetDescription(type => GetTypeStringForDocumentation(type, (element as CodeElement)!))}{versionComment}{dateComment}{removalComment}\")]"; } internal void WriteDeprecationAttribute(IDeprecableElement element, LanguageWriter writer) { diff --git a/src/Kiota.Builder/Writers/Go/GoConventionService.cs b/src/Kiota.Builder/Writers/Go/GoConventionService.cs index fc4c739d58..df513ad5be 100644 --- a/src/Kiota.Builder/Writers/Go/GoConventionService.cs +++ b/src/Kiota.Builder/Writers/Go/GoConventionService.cs @@ -266,6 +266,6 @@ internal void WriteDeprecation(IDeprecableElement element, LanguageWriter writer var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - WriteDescriptionItem($"Deprecated: {element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}", writer); + WriteDescriptionItem($"Deprecated: {element.Deprecation.GetDescription(type => GetTypeString(type, (element as CodeElement)!).TrimStart('*'))}{versionComment}{dateComment}{removalComment}", writer); } } diff --git a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs index 314a0404a5..33d6b49fa4 100644 --- a/src/Kiota.Builder/Writers/Java/JavaConventionService.cs +++ b/src/Kiota.Builder/Writers/Java/JavaConventionService.cs @@ -181,7 +181,7 @@ private string[] GetDeprecationInformationForDocumentationComment(IDeprecableEle var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; return [ $"@deprecated", - $"{element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}" + $"{element.Deprecation.GetDescription(type => GetTypeString(type, (element as CodeElement)!))}{versionComment}{dateComment}{removalComment}" ]; } internal void WriteDeprecatedAnnotation(CodeElement element, LanguageWriter writer) diff --git a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs index 4f1a146415..b4b58b8ad3 100644 --- a/src/Kiota.Builder/Writers/Python/PythonConventionService.cs +++ b/src/Kiota.Builder/Writers/Python/PythonConventionService.cs @@ -202,14 +202,14 @@ public void WriteInLineDescription(IDocumentedElement element, LanguageWriter wr writer.WriteLine($"{InLineCommentPrefix}{description}"); } - private static string GetDeprecationInformation(IDeprecableElement element) + private string GetDeprecationInformation(IDeprecableElement element) { if (element.Deprecation is null || !element.Deprecation.IsDeprecated) return string.Empty; var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return $"{element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}"; + return $"{element.Deprecation.GetDescription(type => GetTypeString(type, (element as CodeElement)!))}{versionComment}{dateComment}{removalComment}"; } internal void WriteDeprecationWarning(IDeprecableElement element, LanguageWriter writer) { diff --git a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs index 3b0e16617e..7d7bd6a39b 100644 --- a/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs +++ b/src/Kiota.Builder/Writers/TypeScript/TypeScriptConventionService.cs @@ -178,6 +178,6 @@ private string GetDeprecationComment(IDeprecableElement element) var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return $"@deprecated {element.Deprecation.DescriptionTemplate}{versionComment}{dateComment}{removalComment}"; + return $"@deprecated {element.Deprecation.GetDescription(type => GetTypeString(type, (element as CodeElement)!))}{versionComment}{dateComment}{removalComment}"; } } diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs index aa2aae7a81..2103f4f62f 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs @@ -1838,4 +1838,16 @@ public void WritesDeprecationInformation() Assert.Contains("v2.0", result); Assert.Contains("[Obsolete", result); } + + [Fact] + public void WritesDeprecationInformationFromBuilder() + { + setup(); + var newMethod = method.Clone() as CodeMethod; + newMethod.Name = "NewAwesomeMethod";// new method replacement + method.Deprecation = new("This method is obsolete. Use {TypeName} instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", new CodeType { TypeDefinition = newMethod, IsExternal = false } } }); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("This method is obsolete. Use instead.", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs index bda3bbc109..da4ee17d6b 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs @@ -2177,6 +2177,17 @@ public void WritesDeprecationInformation() Assert.Contains("// Deprecated:", result); } [Fact] + public void WritesDeprecationInformationFromBuilder() + { + setup(); + var newMethod = method.Clone() as CodeMethod; + newMethod.Name = "NewAwesomeMethod";// new method replacement + method.Deprecation = new("This method is obsolete. Use {TypeName} instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", new CodeType { TypeDefinition = newMethod, IsExternal = false } } }); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); + } + [Fact] public void WritesComposedMarker() { setup(); diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index b1ccaebbc6..1fa32f6de4 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -2070,6 +2070,17 @@ public void WritesDeprecationInformation() Assert.Contains("@Deprecated", result); } [Fact] + public void WritesDeprecationInformationFromBuilder() + { + setup(); + var newMethod = method.Clone() as CodeMethod; + newMethod.Name = "NewAwesomeMethod";// new method replacement + method.Deprecation = new("This method is obsolete. Use NewAwesomeMethod instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", new CodeType { TypeDefinition = newMethod, IsExternal = false } } }); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); + } + [Fact] public void WritesMessageOverrideOnPrimary() { // Given diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index 5e7f62bf0f..6693c4ba59 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -2191,4 +2191,15 @@ public void WritesDeprecationInformation() Assert.Contains("v2.0", result); Assert.Contains("warn(", result); } + [Fact] + public void WritesDeprecationInformationFromBuilder() + { + setup(); + var newMethod = method.Clone() as CodeMethod; + newMethod.Name = "NewAwesomeMethod";// new method replacement + method.Deprecation = new("This method is obsolete. Use NewAwesomeMethod instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", new CodeType { TypeDefinition = newMethod, IsExternal = false } } }); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index 456da14378..18358913bb 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -677,6 +677,25 @@ public void WritesDeprecationInformation() Assert.Contains("v2.0", result); Assert.Contains("@deprecated", result); } + [Fact] + public void WritesDeprecationInformationFromBuilder() + { + var parentClass = root.AddClass(new CodeClass + { + Name = "ODataError", + Kind = CodeClassKind.Model, + }).First(); + var method = TestHelper.CreateMethod(parentClass, MethodName, ReturnTypeName); + method.Kind = CodeMethodKind.Factory; + method.IsStatic = true; + method.Name = "NewAwesomeMethod";// new method replacement + method.Deprecation = new("This method is obsolete. Use {TypeName} instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", new CodeType { TypeDefinition = method, IsExternal = false } } }); + var function = new CodeFunction(method); + root.TryAddCodeFile("foo", function); + writer.Write(function); + var result = tw.ToString(); + Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); + } private const string MethodDescription = "some description"; private const string ParamDescription = "some parameter description"; private const string ParamName = "paramName"; From bd34075e3b69b0601d69ccea3d0d103cf7779f2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:47:39 +0000 Subject: [PATCH 213/394] Bump the kiota-dependencies group in /it/ruby with 1 update Updates the requirements on [microsoft_kiota_faraday](https://github.com/microsoft/kiota-http-ruby) to permit the latest version. Updates `microsoft_kiota_faraday` to 0.14.0 - [Release notes](https://github.com/microsoft/kiota-http-ruby/releases) - [Changelog](https://github.com/microsoft/kiota-http-ruby/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-ruby/compare/v0.13.0...v0.14.0) --- updated-dependencies: - dependency-name: microsoft_kiota_faraday dependency-type: direct:production dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/ruby/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/ruby/Gemfile b/it/ruby/Gemfile index c7ca931ed4..e07838eec3 100644 --- a/it/ruby/Gemfile +++ b/it/ruby/Gemfile @@ -13,7 +13,7 @@ gem "rubocop", "~> 1.21" gem "microsoft_kiota_abstractions", "~> 0.14.3" -gem "microsoft_kiota_faraday", "~> 0.13.0" +gem "microsoft_kiota_faraday", "~> 0.14.0" gem "microsoft_kiota_serialization_json", "~> 0.9.1" From 435f3217f75c835634f973a15074de3afd9066d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:49:20 +0000 Subject: [PATCH 214/394] Bump cryptography from 42.0.2 to 42.0.3 in /it/python Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.2 to 42.0.3. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/42.0.2...42.0.3) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index e40b52d44d..8ea7d4f127 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -82,7 +82,7 @@ azure-identity==1.15.0 cffi==1.16.0 -cryptography==42.0.2 ; python_version >= '3.7' +cryptography==42.0.3 ; python_version >= '3.7' frozenlist==1.4.1 ; python_version >= '3.7' From a757f1e611ee98bb7d3efaea19492207d3a1fe11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:54:27 +0000 Subject: [PATCH 215/394] Bump the kiota-dependencies group in /it/typescript with 7 updates Bumps the kiota-dependencies group in /it/typescript with 7 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/kiota-abstractions](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.42` | `1.0.0-preview.43` | | [@microsoft/kiota-authentication-azure](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.37` | `1.0.0-preview.38` | | [@microsoft/kiota-http-fetchlibrary](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.41` | `1.0.0-preview.42` | | [@microsoft/kiota-serialization-form](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.31` | `1.0.0-preview.32` | | [@microsoft/kiota-serialization-json](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.42` | `1.0.0-preview.43` | | [@microsoft/kiota-serialization-multipart](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.21` | `1.0.0-preview.22` | | [@microsoft/kiota-serialization-text](https://github.com/microsoft-typescript/kiota) | `1.0.0-preview.39` | `1.0.0-preview.40` | Updates `@microsoft/kiota-abstractions` from 1.0.0-preview.42 to 1.0.0-preview.43 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-abstractions@1.0.0-preview.42...@microsoft/kiota-abstractions@1.0.0-preview.43) Updates `@microsoft/kiota-authentication-azure` from 1.0.0-preview.37 to 1.0.0-preview.38 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-authentication-azure@1.0.0-preview.37...@microsoft/kiota-authentication-azure@1.0.0-preview.38) Updates `@microsoft/kiota-http-fetchlibrary` from 1.0.0-preview.41 to 1.0.0-preview.42 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.41...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.42) Updates `@microsoft/kiota-serialization-form` from 1.0.0-preview.31 to 1.0.0-preview.32 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-form@1.0.0-preview.31...@microsoft/kiota-serialization-form@1.0.0-preview.32) Updates `@microsoft/kiota-serialization-json` from 1.0.0-preview.42 to 1.0.0-preview.43 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-json@1.0.0-preview.42...@microsoft/kiota-serialization-json@1.0.0-preview.43) Updates `@microsoft/kiota-serialization-multipart` from 1.0.0-preview.21 to 1.0.0-preview.22 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-multipart@1.0.0-preview.21...@microsoft/kiota-serialization-multipart@1.0.0-preview.22) Updates `@microsoft/kiota-serialization-text` from 1.0.0-preview.39 to 1.0.0-preview.40 - [Commits](https://github.com/microsoft-typescript/kiota/commits) --- updated-dependencies: - dependency-name: "@microsoft/kiota-abstractions" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-authentication-azure" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-http-fetchlibrary" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-json" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-multipart" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-text" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 76 ++++++++++++++++----------------- it/typescript/package.json | 14 +++--- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index ab23877578..dc4bf7b64e 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.42", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.37", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.41", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.31", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.42", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.21", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.39", + "@microsoft/kiota-abstractions": "^1.0.0-preview.43", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.38", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.42", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.32", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.43", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.22", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.40", "express": "^4.18.2", "node-fetch": "^2.7.0" }, @@ -678,12 +678,12 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.42", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.42.tgz", - "integrity": "sha512-LU1BxErkQsLrk49EvzNbh09uYZw/liSE/vVeOA+U7PIWXOwmYdNFurOZJWlGoLeBosAGbrJlR5BqsVGHJBnnVA==", + "version": "1.0.0-preview.43", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.43.tgz", + "integrity": "sha512-IFMuom+MIry2BnoJ58T5TLmkX2P/KO54/KX8Gu09X8cfW8YUhEF11LB9E/YXabSh4hHfVPb+dc4JF/sR0iPRAw==", "dependencies": { "@opentelemetry/api": "^1.7.0", - "@std-uritemplate/std-uritemplate": "^0.0.50", + "@std-uritemplate/std-uritemplate": "^0.0.53", "guid-typescript": "^1.0.9", "tinyduration": "^3.3.0", "tslib": "^2.6.2", @@ -703,22 +703,22 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.37", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.37.tgz", - "integrity": "sha512-P1Kt5yERdNOot3OMJ3MAINfBK1ueI+PeUYnC+ud44KW6xrkr5UtGCipLmePyHKTs+D22OlRuyvc/pft9O8IEMg==", + "version": "1.0.0-preview.38", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.38.tgz", + "integrity": "sha512-EbEtBO3VXN4Zzu/dzDxmfbccom4JOl41ADXbjZb5f5jZIY+YtHi4adz2UHTKsJ6OytUJAQT3LfyvJT+/hoUfPw==", "dependencies": { "@azure/core-auth": "^1.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.42", + "@microsoft/kiota-abstractions": "^1.0.0-preview.43", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.41", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.41.tgz", - "integrity": "sha512-Z81mve+Wpk3ZH2iplW7zdoi+84obTJj9Y6eGwhUvkKE06T0fnpmQGIQC8NHBMkRH3E8BZCpeUDXvZ+fI5+sPNA==", + "version": "1.0.0-preview.42", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.42.tgz", + "integrity": "sha512-JuA+C0ucsXe3t75cfYErv6+WgCI8ABysqLEDXzbVqZiR0YxTmzZFjlx88w0MaFDj3VEA8mRaBBBdgU1aS/bTlw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.42", + "@microsoft/kiota-abstractions": "^1.0.0-preview.43", "@opentelemetry/api": "^1.7.0", "guid-typescript": "^1.0.9", "node-fetch": "^2.7.0", @@ -726,41 +726,41 @@ } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.31", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.31.tgz", - "integrity": "sha512-h/raZO/AhOxuqvBf2ju0GgKTouu6G5d5JMi7zWJrCG8jO6g/7shJqIwrzZdP2uO9lkBCnjZk9OV5/3D1HvCE0g==", + "version": "1.0.0-preview.32", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.32.tgz", + "integrity": "sha512-uPv4lTgRnZZjkn8cQBcSXoFti0sv3dxET4RLHhYJaadOGvO97fse7wv99KQX+PixsTIPG0LfFJb6qw5IN0eMdg==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.42", + "@microsoft/kiota-abstractions": "^1.0.0-preview.43", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.42", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.42.tgz", - "integrity": "sha512-Yt+4ItvQiUtwY2q352XhtaIUwTNE765BVg084Hg/Ej8MYb1CR4Q7FW66nBWs4zI5+4V0BOpFzzkuBzqHIoN86g==", + "version": "1.0.0-preview.43", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.43.tgz", + "integrity": "sha512-xTtdA+tT8AH0i2AH/owUFlIgVICB9W3uZZvK1j1Fon9Wjg4Kz8Bja8f27RoJoi6q4A0lqobisZkisP6/PLlhBQ==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.42", + "@microsoft/kiota-abstractions": "^1.0.0-preview.43", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.21", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.21.tgz", - "integrity": "sha512-CSzIg03Bkq24RDpM2jMERDYm371t1t+7DbWHvGgiDbARNHnMV9nwEH6wFwUGGKixNOFTssjbGqW5MdXxFvMVrw==", + "version": "1.0.0-preview.22", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.22.tgz", + "integrity": "sha512-2u0wPMB4qiup2cCWoJSoe/vIItD92CV6yDd022WV9eV5zgbfEzEXUe9jCGu2zGFJ9KRCC1Ko+YxUR6kGArsNYg==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.42", + "@microsoft/kiota-abstractions": "^1.0.0-preview.43", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.39", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.39.tgz", - "integrity": "sha512-PHcpKGeaaheAi1RnxdJASvG/tZStf6fr4dNSYr/1Q5D01R5U6X54hBCtf1GjI6wDR8K4X/GFo+eoi2HOXTUv2Q==", + "version": "1.0.0-preview.40", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.40.tgz", + "integrity": "sha512-Aa15B155/OzVoyudtzoYlJnTZeYdgrD2GyCpju9KE28YL+Qtz7iRyxZcxR/yQzdYUhV9S27kYBetSzVncfPGlw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.42", + "@microsoft/kiota-abstractions": "^1.0.0-preview.43", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } @@ -809,9 +809,9 @@ } }, "node_modules/@std-uritemplate/std-uritemplate": { - "version": "0.0.50", - "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-0.0.50.tgz", - "integrity": "sha512-R0sJ3C8LnIvo0xFG9Sf1BBJn66LHeZcE36utpEwGknM7ehUaU1iEEjH1bJIjzI738bq3nf2GNpOGVE/lQ4DeJA==" + "version": "0.0.53", + "resolved": "https://registry.npmjs.org/@std-uritemplate/std-uritemplate/-/std-uritemplate-0.0.53.tgz", + "integrity": "sha512-x+mzWGdjae6jrNQaLOsAWvZ1BT15++BVVBTi9NYYF09BdpbsdkUmB+DmmTXiwQcXGwol96E/u7X99HixG9LY+A==" }, "node_modules/@tootallnate/once": { "version": "2.0.0", diff --git a/it/typescript/package.json b/it/typescript/package.json index 5ae8cdc422..1a27e2cbef 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.42", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.37", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.41", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.31", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.42", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.21", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.39", + "@microsoft/kiota-abstractions": "^1.0.0-preview.43", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.38", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.42", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.32", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.43", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.22", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.40", "express": "^4.18.2", "node-fetch": "^2.7.0" } From 9d66b8686b9218407e2ba8c227cb22a2029b2f05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:55:56 +0000 Subject: [PATCH 216/394] Bump xunit.runner.visualstudio from 2.5.6 to 2.5.7 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.6 to 2.5.7. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.6...2.5.7) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Kiota.Builder.IntegrationTests.csproj | 2 +- tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj | 2 +- tests/Kiota.Tests/Kiota.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index f7ce9089fb..21ec7e142d 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -17,7 +17,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj index 0295505625..a64bdf734f 100644 --- a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj +++ b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj @@ -20,7 +20,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Kiota.Tests/Kiota.Tests.csproj b/tests/Kiota.Tests/Kiota.Tests.csproj index bb6a6f549b..3d0f2ab341 100644 --- a/tests/Kiota.Tests/Kiota.Tests.csproj +++ b/tests/Kiota.Tests/Kiota.Tests.csproj @@ -13,7 +13,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 0253c7e57c216992611f33eb5477344f53256801 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 16 Feb 2024 12:08:29 +0300 Subject: [PATCH 217/394] Fix error --- src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs | 2 +- .../Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index 92ebd23ca0..a2f39b64a7 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -302,7 +302,7 @@ private string GetDeprecationInformation(IDeprecableElement element) var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return $"[Obsolete(\"{element.Deprecation.GetDescription(type => GetTypeStringForDocumentation(type, (element as CodeElement)!))}{versionComment}{dateComment}{removalComment}\")]"; + return $"[Obsolete(\"{element.Deprecation.GetDescription(type => GetTypeString(type, (element as CodeElement)!))}{versionComment}{dateComment}{removalComment}\")]"; } internal void WriteDeprecationAttribute(IDeprecableElement element, LanguageWriter writer) { diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs index 2103f4f62f..2dc8a949f3 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs @@ -1848,6 +1848,6 @@ public void WritesDeprecationInformationFromBuilder() method.Deprecation = new("This method is obsolete. Use {TypeName} instead.", IsDeprecated: true, TypeReferences: new() { { "TypeName", new CodeType { TypeDefinition = newMethod, IsExternal = false } } }); writer.Write(method); var result = tw.ToString(); - Assert.Contains("This method is obsolete. Use instead.", result); + Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); } } From 5c46b79d8f0c7dd0fdbb45859520a620a8a72237 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 16 Feb 2024 12:30:53 +0300 Subject: [PATCH 218/394] Only include the type name --- src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs index a2f39b64a7..6c71029cf6 100644 --- a/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs +++ b/src/Kiota.Builder/Writers/CSharp/CSharpConventionService.cs @@ -302,7 +302,7 @@ private string GetDeprecationInformation(IDeprecableElement element) var versionComment = string.IsNullOrEmpty(element.Deprecation.Version) ? string.Empty : $" as of {element.Deprecation.Version}"; var dateComment = element.Deprecation.Date is null ? string.Empty : $" on {element.Deprecation.Date.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; var removalComment = element.Deprecation.RemovalDate is null ? string.Empty : $" and will be removed {element.Deprecation.RemovalDate.Value.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; - return $"[Obsolete(\"{element.Deprecation.GetDescription(type => GetTypeString(type, (element as CodeElement)!))}{versionComment}{dateComment}{removalComment}\")]"; + return $"[Obsolete(\"{element.Deprecation.GetDescription(type => GetTypeString(type, (element as CodeElement)!).Split('.', StringSplitOptions.TrimEntries)[^1])}{versionComment}{dateComment}{removalComment}\")]"; } internal void WriteDeprecationAttribute(IDeprecableElement element, LanguageWriter writer) { From a503eb70dc691450d4ed1ac30d26a8de4a3146c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 08:10:20 +0000 Subject: [PATCH 219/394] Bump esbuild from 0.20.0 to 0.20.1 in /it/typescript Bumps [esbuild](https://github.com/evanw/esbuild) from 0.20.0 to 0.20.1. - [Release notes](https://github.com/evanw/esbuild/releases) - [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md) - [Commits](https://github.com/evanw/esbuild/compare/v0.20.0...v0.20.1) --- updated-dependencies: - dependency-name: esbuild dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 192 ++++++++++++++++---------------- it/typescript/package.json | 2 +- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index dc4bf7b64e..f4ab1c4341 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -25,7 +25,7 @@ "@types/node": "^20.11.19", "@typescript-eslint/eslint-plugin": "^7.0.1", "@typescript-eslint/parser": "^7.0.1", - "esbuild": "^0.20.0", + "esbuild": "^0.20.1", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", @@ -221,9 +221,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.0.tgz", - "integrity": "sha512-fGFDEctNh0CcSwsiRPxiaqX0P5rq+AqE0SRhYGZ4PX46Lg1FNR6oCxJghf8YgY0WQEgQuh3lErUFE4KxLeRmmw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.1.tgz", + "integrity": "sha512-m55cpeupQ2DbuRGQMMZDzbv9J9PgVelPjlcmM5kxHnrBdBx6REaEd7LamYV7Dm8N7rCyR/XwU6rVP8ploKtIkA==", "cpu": [ "ppc64" ], @@ -237,9 +237,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.0.tgz", - "integrity": "sha512-3bMAfInvByLHfJwYPJRlpTeaQA75n8C/QKpEaiS4HrFWFiJlNI0vzq/zCjBrhAYcPyVPG7Eo9dMrcQXuqmNk5g==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.1.tgz", + "integrity": "sha512-4j0+G27/2ZXGWR5okcJi7pQYhmkVgb4D7UKwxcqrjhvp5TKWx3cUjgB1CGj1mfdmJBQ9VnUGgUhign+FPF2Zgw==", "cpu": [ "arm" ], @@ -253,9 +253,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.0.tgz", - "integrity": "sha512-aVpnM4lURNkp0D3qPoAzSG92VXStYmoVPOgXveAUoQBWRSuQzt51yvSju29J6AHPmwY1BjH49uR29oyfH1ra8Q==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.1.tgz", + "integrity": "sha512-hCnXNF0HM6AjowP+Zou0ZJMWWa1VkD77BXe959zERgGJBBxB+sV+J9f/rcjeg2c5bsukD/n17RKWXGFCO5dD5A==", "cpu": [ "arm64" ], @@ -269,9 +269,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.0.tgz", - "integrity": "sha512-uK7wAnlRvjkCPzh8jJ+QejFyrP8ObKuR5cBIsQZ+qbMunwR8sbd8krmMbxTLSrDhiPZaJYKQAU5Y3iMDcZPhyQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.1.tgz", + "integrity": "sha512-MSfZMBoAsnhpS+2yMFYIQUPs8Z19ajwfuaSZx+tSl09xrHZCjbeXXMsUF/0oq7ojxYEpsSo4c0SfjxOYXRbpaA==", "cpu": [ "x64" ], @@ -285,9 +285,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.0.tgz", - "integrity": "sha512-AjEcivGAlPs3UAcJedMa9qYg9eSfU6FnGHJjT8s346HSKkrcWlYezGE8VaO2xKfvvlZkgAhyvl06OJOxiMgOYQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.1.tgz", + "integrity": "sha512-Ylk6rzgMD8klUklGPzS414UQLa5NPXZD5tf8JmQU8GQrj6BrFA/Ic9tb2zRe1kOZyCbGl+e8VMbDRazCEBqPvA==", "cpu": [ "arm64" ], @@ -301,9 +301,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.0.tgz", - "integrity": "sha512-bsgTPoyYDnPv8ER0HqnJggXK6RyFy4PH4rtsId0V7Efa90u2+EifxytE9pZnsDgExgkARy24WUQGv9irVbTvIw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.1.tgz", + "integrity": "sha512-pFIfj7U2w5sMp52wTY1XVOdoxw+GDwy9FsK3OFz4BpMAjvZVs0dT1VXs8aQm22nhwoIWUmIRaE+4xow8xfIDZA==", "cpu": [ "x64" ], @@ -317,9 +317,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.0.tgz", - "integrity": "sha512-kQ7jYdlKS335mpGbMW5tEe3IrQFIok9r84EM3PXB8qBFJPSc6dpWfrtsC/y1pyrz82xfUIn5ZrnSHQQsd6jebQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.1.tgz", + "integrity": "sha512-UyW1WZvHDuM4xDz0jWun4qtQFauNdXjXOtIy7SYdf7pbxSWWVlqhnR/T2TpX6LX5NI62spt0a3ldIIEkPM6RHw==", "cpu": [ "arm64" ], @@ -333,9 +333,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.0.tgz", - "integrity": "sha512-uG8B0WSepMRsBNVXAQcHf9+Ko/Tr+XqmK7Ptel9HVmnykupXdS4J7ovSQUIi0tQGIndhbqWLaIL/qO/cWhXKyQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.1.tgz", + "integrity": "sha512-itPwCw5C+Jh/c624vcDd9kRCCZVpzpQn8dtwoYIt2TJF3S9xJLiRohnnNrKwREvcZYx0n8sCSbvGH349XkcQeg==", "cpu": [ "x64" ], @@ -349,9 +349,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.0.tgz", - "integrity": "sha512-2ezuhdiZw8vuHf1HKSf4TIk80naTbP9At7sOqZmdVwvvMyuoDiZB49YZKLsLOfKIr77+I40dWpHVeY5JHpIEIg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.1.tgz", + "integrity": "sha512-LojC28v3+IhIbfQ+Vu4Ut5n3wKcgTu6POKIHN9Wpt0HnfgUGlBuyDDQR4jWZUZFyYLiz4RBBBmfU6sNfn6RhLw==", "cpu": [ "arm" ], @@ -365,9 +365,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.0.tgz", - "integrity": "sha512-uTtyYAP5veqi2z9b6Gr0NUoNv9F/rOzI8tOD5jKcCvRUn7T60Bb+42NDBCWNhMjkQzI0qqwXkQGo1SY41G52nw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.1.tgz", + "integrity": "sha512-cX8WdlF6Cnvw/DO9/X7XLH2J6CkBnz7Twjpk56cshk9sjYVcuh4sXQBy5bmTwzBjNVZze2yaV1vtcJS04LbN8w==", "cpu": [ "arm64" ], @@ -381,9 +381,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.0.tgz", - "integrity": "sha512-c88wwtfs8tTffPaoJ+SQn3y+lKtgTzyjkD8NgsyCtCmtoIC8RDL7PrJU05an/e9VuAke6eJqGkoMhJK1RY6z4w==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.1.tgz", + "integrity": "sha512-4H/sQCy1mnnGkUt/xszaLlYJVTz3W9ep52xEefGtd6yXDQbz/5fZE5dFLUgsPdbUOQANcVUa5iO6g3nyy5BJiw==", "cpu": [ "ia32" ], @@ -397,9 +397,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.0.tgz", - "integrity": "sha512-lR2rr/128/6svngnVta6JN4gxSXle/yZEZL3o4XZ6esOqhyR4wsKyfu6qXAL04S4S5CgGfG+GYZnjFd4YiG3Aw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.1.tgz", + "integrity": "sha512-c0jgtB+sRHCciVXlyjDcWb2FUuzlGVRwGXgI+3WqKOIuoo8AmZAddzeOHeYLtD+dmtHw3B4Xo9wAUdjlfW5yYA==", "cpu": [ "loong64" ], @@ -413,9 +413,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.0.tgz", - "integrity": "sha512-9Sycc+1uUsDnJCelDf6ZNqgZQoK1mJvFtqf2MUz4ujTxGhvCWw+4chYfDLPepMEvVL9PDwn6HrXad5yOrNzIsQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.1.tgz", + "integrity": "sha512-TgFyCfIxSujyuqdZKDZ3yTwWiGv+KnlOeXXitCQ+trDODJ+ZtGOzLkSWngynP0HZnTsDyBbPy7GWVXWaEl6lhA==", "cpu": [ "mips64el" ], @@ -429,9 +429,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.0.tgz", - "integrity": "sha512-CoWSaaAXOZd+CjbUTdXIJE/t7Oz+4g90A3VBCHLbfuc5yUQU/nFDLOzQsN0cdxgXd97lYW/psIIBdjzQIwTBGw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.1.tgz", + "integrity": "sha512-b+yuD1IUeL+Y93PmFZDZFIElwbmFfIKLKlYI8M6tRyzE6u7oEP7onGk0vZRh8wfVGC2dZoy0EqX1V8qok4qHaw==", "cpu": [ "ppc64" ], @@ -445,9 +445,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.0.tgz", - "integrity": "sha512-mlb1hg/eYRJUpv8h/x+4ShgoNLL8wgZ64SUr26KwglTYnwAWjkhR2GpoKftDbPOCnodA9t4Y/b68H4J9XmmPzA==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.1.tgz", + "integrity": "sha512-wpDlpE0oRKZwX+GfomcALcouqjjV8MIX8DyTrxfyCfXxoKQSDm45CZr9fanJ4F6ckD4yDEPT98SrjvLwIqUCgg==", "cpu": [ "riscv64" ], @@ -461,9 +461,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.0.tgz", - "integrity": "sha512-fgf9ubb53xSnOBqyvWEY6ukBNRl1mVX1srPNu06B6mNsNK20JfH6xV6jECzrQ69/VMiTLvHMicQR/PgTOgqJUQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.1.tgz", + "integrity": "sha512-5BepC2Au80EohQ2dBpyTquqGCES7++p7G+7lXe1bAIvMdXm4YYcEfZtQrP4gaoZ96Wv1Ute61CEHFU7h4FMueQ==", "cpu": [ "s390x" ], @@ -477,9 +477,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.0.tgz", - "integrity": "sha512-H9Eu6MGse++204XZcYsse1yFHmRXEWgadk2N58O/xd50P9EvFMLJTQLg+lB4E1cF2xhLZU5luSWtGTb0l9UeSg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.1.tgz", + "integrity": "sha512-5gRPk7pKuaIB+tmH+yKd2aQTRpqlf1E4f/mC+tawIm/CGJemZcHZpp2ic8oD83nKgUPMEd0fNanrnFljiruuyA==", "cpu": [ "x64" ], @@ -493,9 +493,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.0.tgz", - "integrity": "sha512-lCT675rTN1v8Fo+RGrE5KjSnfY0x9Og4RN7t7lVrN3vMSjy34/+3na0q7RIfWDAj0e0rCh0OL+P88lu3Rt21MQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.1.tgz", + "integrity": "sha512-4fL68JdrLV2nVW2AaWZBv3XEm3Ae3NZn/7qy2KGAt3dexAgSVT+Hc97JKSZnqezgMlv9x6KV0ZkZY7UO5cNLCg==", "cpu": [ "x64" ], @@ -509,9 +509,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.0.tgz", - "integrity": "sha512-HKoUGXz/TOVXKQ+67NhxyHv+aDSZf44QpWLa3I1lLvAwGq8x1k0T+e2HHSRvxWhfJrFxaaqre1+YyzQ99KixoA==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.1.tgz", + "integrity": "sha512-GhRuXlvRE+twf2ES+8REbeCb/zeikNqwD3+6S5y5/x+DYbAQUNl0HNBs4RQJqrechS4v4MruEr8ZtAin/hK5iw==", "cpu": [ "x64" ], @@ -525,9 +525,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.0.tgz", - "integrity": "sha512-GDwAqgHQm1mVoPppGsoq4WJwT3vhnz/2N62CzhvApFD1eJyTroob30FPpOZabN+FgCjhG+AgcZyOPIkR8dfD7g==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.1.tgz", + "integrity": "sha512-ZnWEyCM0G1Ex6JtsygvC3KUUrlDXqOihw8RicRuQAzw+c4f1D66YlPNNV3rkjVW90zXVsHwZYWbJh3v+oQFM9Q==", "cpu": [ "x64" ], @@ -541,9 +541,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.0.tgz", - "integrity": "sha512-0vYsP8aC4TvMlOQYozoksiaxjlvUcQrac+muDqj1Fxy6jh9l9CZJzj7zmh8JGfiV49cYLTorFLxg7593pGldwQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.1.tgz", + "integrity": "sha512-QZ6gXue0vVQY2Oon9WyLFCdSuYbXSoxaZrPuJ4c20j6ICedfsDilNPYfHLlMH7vGfU5DQR0czHLmJvH4Nzis/A==", "cpu": [ "arm64" ], @@ -557,9 +557,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.0.tgz", - "integrity": "sha512-p98u4rIgfh4gdpV00IqknBD5pC84LCub+4a3MO+zjqvU5MVXOc3hqR2UgT2jI2nh3h8s9EQxmOsVI3tyzv1iFg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.1.tgz", + "integrity": "sha512-HzcJa1NcSWTAU0MJIxOho8JftNp9YALui3o+Ny7hCh0v5f90nprly1U3Sj1Ldj/CvKKdvvFsCRvDkpsEMp4DNw==", "cpu": [ "ia32" ], @@ -573,9 +573,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.0.tgz", - "integrity": "sha512-NgJnesu1RtWihtTtXGFMU5YSE6JyyHPMxCwBZK7a6/8d31GuSo9l0Ss7w1Jw5QnKUawG6UEehs883kcXf5fYwg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.1.tgz", + "integrity": "sha512-0MBh53o6XtI6ctDnRMeQ+xoCN8kD2qI1rY1KgF/xdWQwoFeKou7puvDfV8/Wv4Ctx2rRpET/gGdz3YlNtNACSA==", "cpu": [ "x64" ], @@ -1467,9 +1467,9 @@ } }, "node_modules/esbuild": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.0.tgz", - "integrity": "sha512-6iwE3Y2RVYCME1jLpBqq7LQWK3MW6vjV2bZy6gt/WrqkY+WE74Spyc0ThAOYpMtITvnjX09CrC6ym7A/m9mebA==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.1.tgz", + "integrity": "sha512-OJwEgrpWm/PCMsLVWXKqvcjme3bHNpOgN7Tb6cQnR5n0TPbQx1/Xrn7rqM+wn17bYeT6MGB5sn1Bh5YiGi70nA==", "dev": true, "hasInstallScript": true, "bin": { @@ -1479,29 +1479,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.20.0", - "@esbuild/android-arm": "0.20.0", - "@esbuild/android-arm64": "0.20.0", - "@esbuild/android-x64": "0.20.0", - "@esbuild/darwin-arm64": "0.20.0", - "@esbuild/darwin-x64": "0.20.0", - "@esbuild/freebsd-arm64": "0.20.0", - "@esbuild/freebsd-x64": "0.20.0", - "@esbuild/linux-arm": "0.20.0", - "@esbuild/linux-arm64": "0.20.0", - "@esbuild/linux-ia32": "0.20.0", - "@esbuild/linux-loong64": "0.20.0", - "@esbuild/linux-mips64el": "0.20.0", - "@esbuild/linux-ppc64": "0.20.0", - "@esbuild/linux-riscv64": "0.20.0", - "@esbuild/linux-s390x": "0.20.0", - "@esbuild/linux-x64": "0.20.0", - "@esbuild/netbsd-x64": "0.20.0", - "@esbuild/openbsd-x64": "0.20.0", - "@esbuild/sunos-x64": "0.20.0", - "@esbuild/win32-arm64": "0.20.0", - "@esbuild/win32-ia32": "0.20.0", - "@esbuild/win32-x64": "0.20.0" + "@esbuild/aix-ppc64": "0.20.1", + "@esbuild/android-arm": "0.20.1", + "@esbuild/android-arm64": "0.20.1", + "@esbuild/android-x64": "0.20.1", + "@esbuild/darwin-arm64": "0.20.1", + "@esbuild/darwin-x64": "0.20.1", + "@esbuild/freebsd-arm64": "0.20.1", + "@esbuild/freebsd-x64": "0.20.1", + "@esbuild/linux-arm": "0.20.1", + "@esbuild/linux-arm64": "0.20.1", + "@esbuild/linux-ia32": "0.20.1", + "@esbuild/linux-loong64": "0.20.1", + "@esbuild/linux-mips64el": "0.20.1", + "@esbuild/linux-ppc64": "0.20.1", + "@esbuild/linux-riscv64": "0.20.1", + "@esbuild/linux-s390x": "0.20.1", + "@esbuild/linux-x64": "0.20.1", + "@esbuild/netbsd-x64": "0.20.1", + "@esbuild/openbsd-x64": "0.20.1", + "@esbuild/sunos-x64": "0.20.1", + "@esbuild/win32-arm64": "0.20.1", + "@esbuild/win32-ia32": "0.20.1", + "@esbuild/win32-x64": "0.20.1" } }, "node_modules/escape-html": { diff --git a/it/typescript/package.json b/it/typescript/package.json index 1a27e2cbef..34bcc01c08 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -22,7 +22,7 @@ "@types/node": "^20.11.19", "@typescript-eslint/eslint-plugin": "^7.0.1", "@typescript-eslint/parser": "^7.0.1", - "esbuild": "^0.20.0", + "esbuild": "^0.20.1", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", From be9a4b2c07cab9b4e0bb6606a4e17c97d0d4faa1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 08:26:56 +0000 Subject: [PATCH 220/394] Bump the kiota-dependencies group in /it/ruby with 1 update Updates the requirements on [microsoft_kiota_faraday](https://github.com/microsoft/kiota-http-ruby) to permit the latest version. Updates `microsoft_kiota_faraday` to 0.15.0 - [Release notes](https://github.com/microsoft/kiota-http-ruby/releases) - [Changelog](https://github.com/microsoft/kiota-http-ruby/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-ruby/compare/v0.14.0...v0.15.0) --- updated-dependencies: - dependency-name: microsoft_kiota_faraday dependency-type: direct:production dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/ruby/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/ruby/Gemfile b/it/ruby/Gemfile index e07838eec3..6cb4bd089a 100644 --- a/it/ruby/Gemfile +++ b/it/ruby/Gemfile @@ -13,7 +13,7 @@ gem "rubocop", "~> 1.21" gem "microsoft_kiota_abstractions", "~> 0.14.3" -gem "microsoft_kiota_faraday", "~> 0.14.0" +gem "microsoft_kiota_faraday", "~> 0.15.0" gem "microsoft_kiota_serialization_json", "~> 0.9.1" From b650e61779ad3da0ce312207bd3ddf422b9bd3cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 08:57:45 +0000 Subject: [PATCH 221/394] Bump anyio from 4.2.0 to 4.3.0 in /it/python Bumps [anyio](https://github.com/agronholm/anyio) from 4.2.0 to 4.3.0. - [Release notes](https://github.com/agronholm/anyio/releases) - [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst) - [Commits](https://github.com/agronholm/anyio/compare/4.2.0...4.3.0) --- updated-dependencies: - dependency-name: anyio dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 8ea7d4f127..a5ab0cd81e 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -70,7 +70,7 @@ aiohttp==3.9.3 ; python_version >= '3.6' aiosignal==1.3.1 ; python_version >= '3.7' -anyio==4.2.0 ; python_version >= '3.7' +anyio==4.3.0 ; python_version >= '3.7' async-timeout==4.0.3 ; python_version >= '3.6' From 0a9b76501db91440708ad155d6610a874a00c390 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 08:57:49 +0000 Subject: [PATCH 222/394] Bump urllib3 from 2.2.0 to 2.2.1 in /it/python Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.0 to 2.2.1. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.2.0...2.2.1) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 8ea7d4f127..d1d6f26725 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -58,7 +58,7 @@ tomlkit==0.12.3 ; python_version >= '3.7' typing-extensions==4.9.0 ; python_version >= '3.7' -urllib3==2.2.0 ; python_version >= '3.7' +urllib3==2.2.1 ; python_version >= '3.7' wrapt==1.15.0 ; python_version < '3.11' From fcbededa21121db1f6c308254f2e7b85666a5496 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 08:57:58 +0000 Subject: [PATCH 223/394] Bump pytest from 8.0.0 to 8.0.1 in /it/python Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.0.0...8.0.1) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 8ea7d4f127..0e55f53f13 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -42,7 +42,7 @@ pluggy==1.4.0 ; python_version >= '3.7' pylint==3.0.3 -pytest==8.0.0 +pytest==8.0.1 pytest-asyncio==0.23.5 From 419d9bab67b01d98437e735c16f893f7e876ef27 Mon Sep 17 00:00:00 2001 From: Andrea Peruffo Date: Mon, 19 Feb 2024 12:15:55 +0000 Subject: [PATCH 224/394] Fix the Mock Server Integration Tests execution --- it/exec-cmd.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/it/exec-cmd.ps1 b/it/exec-cmd.ps1 index bae550fac2..af5993caa3 100755 --- a/it/exec-cmd.ps1 +++ b/it/exec-cmd.ps1 @@ -53,7 +53,7 @@ function Kill-MockServer { Pop-Location } -$mockSeverITFolder = $null +$mockSeverITFolder = "inexistent-it-folder" $configPath = Join-Path -Path $PSScriptRoot -ChildPath "config.json" $jsonValue = Get-Content -Path $configPath -Raw | ConvertFrom-Json $descriptionValue = $jsonValue.psobject.properties.Where({ $_.name -eq $descriptionUrl }).value @@ -63,10 +63,10 @@ if ($null -ne $descriptionValue) { } } -$mockServerTest = false +$mockServerTest = $false $itTestPath = Join-Path -Path $testPath -ChildPath $mockSeverITFolder if (Test-Path -Path $itTestPath) { - $mockServerTest = true + $mockServerTest = $true } # Start MockServer if needed From db58ae022a4964444afe718d56355eb2a266c721 Mon Sep 17 00:00:00 2001 From: Andrea Peruffo Date: Mon, 19 Feb 2024 13:17:55 +0000 Subject: [PATCH 225/394] Fix a Java Mock Server test result --- it/java/query-params/src/test/java/BasicAPITest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/java/query-params/src/test/java/BasicAPITest.java b/it/java/query-params/src/test/java/BasicAPITest.java index 5eafb1d43a..dae42cc2cc 100644 --- a/it/java/query-params/src/test/java/BasicAPITest.java +++ b/it/java/query-params/src/test/java/BasicAPITest.java @@ -46,7 +46,7 @@ void includesAllTheQueryParameters() throws Exception { }); reqInf.pathParameters.put("baseurl", "http://test"); - assertEquals("http://test/api/something/v1?startDateTime=START&EndDateTime=END", reqInf.getUri().toString()); + assertEquals("http://test/api/something/v1?EndDateTime=END&startDateTime=START", reqInf.getUri().toString()); } } From 98000a4e4a160271416a143c79695236c92b30b3 Mon Sep 17 00:00:00 2001 From: Andrea Peruffo Date: Thu, 8 Feb 2024 10:54:45 +0000 Subject: [PATCH 226/394] Repro for 4151 --- .../Kiota.Builder.Tests/KiotaBuilderTests.cs | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index cc0f7850af..a14f358faa 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -6592,6 +6592,113 @@ public void SinglePathParametersAreDeduplicated() Assert.Equal("{+baseurl}/users/{users%2Did}/careerAdvisor/{id}", careerAdvisorItemUrlTemplate.DefaultValue.Trim('"')); } [Fact] + public void SinglePathParametersAreDeduplicatedAndOrderIsRespected() + { + var ownerSchema = new OpenApiSchema + { + Type = "object", + Properties = new Dictionary { + { + "id", new OpenApiSchema { + Type = "string" + } + } + }, + Reference = new OpenApiReference + { + Id = "#/components/schemas/owner" + }, + UnresolvedReference = false + }; + var repoSchema = new OpenApiSchema + { + Type = "object", + Properties = new Dictionary { + { + "id", new OpenApiSchema { + Type = "string" + } + } + }, + Reference = new OpenApiReference + { + Id = "#/components/schemas/repo" + }, + UnresolvedReference = false + }; + var document = new OpenApiDocument + { + Paths = new OpenApiPaths + { + ["/repos/{owner}/{repo}"] = new OpenApiPathItem + { + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = repoSchema + } + } + } + } + } + } + }, + ["/repos/{template_owner}/{template_repo}/generate"] = new OpenApiPathItem + { + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = repoSchema + } + } + } + } + } + } + } + }, + Components = new OpenApiComponents + { + Schemas = new Dictionary { + {"owner", ownerSchema}, + {"repo", repoSchema} + } + } + }; + var mockLogger = new CountLogger(); + var builder = new KiotaBuilder(mockLogger, new GenerationConfiguration { ClientClassName = "GitHub", ApiRootUrl = "https://localhost" }, _httpClient); + var node = builder.CreateUriSpace(document); + var codeModel = builder.CreateSourceModel(node); + + // Expected + var reposRB = codeModel.FindNamespaceByName("ApiSdk.repos.item.item").FindChildByName("ReposItemRequestBuilder", false); + Assert.NotNull(reposRB); + var repoUrlTemplate = reposRB.FindChildByName("UrlTemplate", false); + Assert.NotNull(repoUrlTemplate); + Assert.Equal("{+baseurl}/repos/{owner}/{repos%2Did}", repoUrlTemplate.DefaultValue.Trim('"')); + Console.WriteLine(repoUrlTemplate.DefaultValue.Trim('"')); + + // Current behavior + // var reposRB = codeModel.FindNamespaceByName("ApiSdk.repos.item.item").FindChildByName("OwnerItemRequestBuilder", false); + // Assert.NotNull(reposRB); + // var repoUrlTemplate = reposRB.FindChildByName("UrlTemplate", false); + // Assert.NotNull(repoUrlTemplate); + // Assert.Equal("{+baseurl}/repos/{repos%2Did}/{Owner%2Did}", repoUrlTemplate.DefaultValue.Trim('"')); + // Console.WriteLine(repoUrlTemplate.DefaultValue.Trim('"')); + } + [Fact] public void AddReservedPathParameterSymbol() { var userSchema = new OpenApiSchema From 1d920e5c8104a45413169cd2d74430d00ec5914d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 15 Feb 2024 13:35:26 -0500 Subject: [PATCH 227/394] - moves node deduplication to extension methods --- .../OpenApiUrlTreeNodeExtensions.cs | 70 ++++++++++++++++++ src/Kiota.Builder/KiotaBuilder.cs | 71 +------------------ 2 files changed, 71 insertions(+), 70 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index b531c7f77b..8910eab4c2 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text.RegularExpressions; using Kiota.Builder.Configuration; +using Microsoft.Extensions.Logging; using Microsoft.OpenApi.MicrosoftExtensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; @@ -268,4 +269,73 @@ public static void AddDeduplicatedSegment(this OpenApiUrlTreeNode openApiUrlTree ArgumentException.ThrowIfNullOrEmpty(newName); openApiUrlTreeNode.AdditionalData.Add(DeduplicatedSegmentKey, [newName]); } + internal static void MergeIndexNodesAtSameLevel(this OpenApiUrlTreeNode node, ILogger logger) + { + var indexNodes = node.Children + .Where(static x => x.Value.IsPathSegmentWithSingleSimpleParameter()) + .OrderBy(static x => x.Key, StringComparer.OrdinalIgnoreCase) + .ToArray(); + if (indexNodes.Length > 1) + { + var indexNode = indexNodes[0]; + node.Children.Remove(indexNode.Key); + var newSegmentParameterName = $"{{{node.Segment.CleanupSymbolName()}-id}}"; + indexNode.Value.Path = indexNode.Value.Path.Replace(indexNode.Key, newSegmentParameterName, StringComparison.OrdinalIgnoreCase); + indexNode.Value.AddDeduplicatedSegment(newSegmentParameterName); + node.Children.Add(newSegmentParameterName, indexNode.Value); + CopyNodeIntoOtherNode(indexNode.Value, indexNode.Value, indexNode.Key, newSegmentParameterName, logger); + foreach (var child in indexNodes.Except([indexNode])) + { + node.Children.Remove(child.Key); + CopyNodeIntoOtherNode(child.Value, indexNode.Value, child.Key, newSegmentParameterName, logger); + } + } + + foreach (var child in node.Children.Values) + MergeIndexNodesAtSameLevel(child, logger); + } + private static void CopyNodeIntoOtherNode(OpenApiUrlTreeNode source, OpenApiUrlTreeNode destination, string pathParameterNameToReplace, string pathParameterNameReplacement, ILogger logger) + { + foreach (var child in source.Children) + { + child.Value.Path = child.Value.Path.Replace(pathParameterNameToReplace, pathParameterNameReplacement, StringComparison.OrdinalIgnoreCase); + if (!destination.Children.TryAdd(child.Key, child.Value)) + CopyNodeIntoOtherNode(child.Value, destination.Children[child.Key], pathParameterNameToReplace, pathParameterNameReplacement, logger); + } + pathParameterNameToReplace = pathParameterNameToReplace.Trim('{', '}'); + pathParameterNameReplacement = pathParameterNameReplacement.Trim('{', '}'); + foreach (var pathItem in source.PathItems) + { + foreach (var pathParameter in pathItem + .Value + .Parameters + .Where(x => x.In == ParameterLocation.Path && pathParameterNameToReplace.Equals(x.Name, StringComparison.Ordinal)) + .Union( + pathItem + .Value + .Operations + .SelectMany(static x => x.Value.Parameters) + .Where(x => x.In == ParameterLocation.Path && pathParameterNameToReplace.Equals(x.Name, StringComparison.Ordinal)) + )) + { + pathParameter.Name = pathParameterNameReplacement; + } + if (source != destination && !destination.PathItems.TryAdd(pathItem.Key, pathItem.Value)) + { + var destinationPathItem = destination.PathItems[pathItem.Key]; + foreach (var operation in pathItem.Value.Operations) + if (!destinationPathItem.Operations.TryAdd(operation.Key, operation.Value)) + { + logger.LogWarning("Duplicate operation {Operation} in path {Path}", operation.Key, pathItem.Key); + } + foreach (var pathParameter in pathItem.Value.Parameters) + destinationPathItem.Parameters.Add(pathParameter); + foreach (var extension in pathItem.Value.Extensions) + if (!destinationPathItem.Extensions.TryAdd(extension.Key, extension.Value)) + { + logger.LogWarning("Duplicate extension {Extension} in path {Path}", extension.Key, pathItem.Key); + } + } + } + } } diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 0351366d1b..756afb3228 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -549,80 +549,11 @@ public OpenApiUrlTreeNode CreateUriSpace(OpenApiDocument doc) var stopwatch = new Stopwatch(); stopwatch.Start(); var node = OpenApiUrlTreeNode.Create(doc, Constants.DefaultOpenApiLabel); - MergeIndexNodesAtSameLevel(node); + node.MergeIndexNodesAtSameLevel(logger); stopwatch.Stop(); logger.LogTrace("{Timestamp}ms: Created UriSpace tree", stopwatch.ElapsedMilliseconds); return node; } - private void MergeIndexNodesAtSameLevel(OpenApiUrlTreeNode node) - { - var indexNodes = node.Children - .Where(static x => x.Value.IsPathSegmentWithSingleSimpleParameter()) - .OrderBy(static x => x.Key, StringComparer.OrdinalIgnoreCase) - .ToArray(); - if (indexNodes.Length > 1) - { - var indexNode = indexNodes[0]; - node.Children.Remove(indexNode.Key); - var newSegmentParameterName = $"{{{node.Segment.CleanupSymbolName()}-id}}"; - indexNode.Value.Path = indexNode.Value.Path.Replace(indexNode.Key, newSegmentParameterName, StringComparison.OrdinalIgnoreCase); - indexNode.Value.AddDeduplicatedSegment(newSegmentParameterName); - node.Children.Add(newSegmentParameterName, indexNode.Value); - CopyNodeIntoOtherNode(indexNode.Value, indexNode.Value, indexNode.Key, newSegmentParameterName); - foreach (var child in indexNodes.Except(new[] { indexNode })) - { - node.Children.Remove(child.Key); - CopyNodeIntoOtherNode(child.Value, indexNode.Value, child.Key, newSegmentParameterName); - } - } - - foreach (var child in node.Children.Values) - MergeIndexNodesAtSameLevel(child); - } - private void CopyNodeIntoOtherNode(OpenApiUrlTreeNode source, OpenApiUrlTreeNode destination, string pathParameterNameToReplace, string pathParameterNameReplacement) - { - foreach (var child in source.Children) - { - child.Value.Path = child.Value.Path.Replace(pathParameterNameToReplace, pathParameterNameReplacement, StringComparison.OrdinalIgnoreCase); - if (!destination.Children.TryAdd(child.Key, child.Value)) - CopyNodeIntoOtherNode(child.Value, destination.Children[child.Key], pathParameterNameToReplace, pathParameterNameReplacement); - } - pathParameterNameToReplace = pathParameterNameToReplace.Trim('{', '}'); - pathParameterNameReplacement = pathParameterNameReplacement.Trim('{', '}'); - foreach (var pathItem in source.PathItems) - { - foreach (var pathParameter in pathItem - .Value - .Parameters - .Where(x => x.In == ParameterLocation.Path && pathParameterNameToReplace.Equals(x.Name, StringComparison.Ordinal)) - .Union( - pathItem - .Value - .Operations - .SelectMany(static x => x.Value.Parameters) - .Where(x => x.In == ParameterLocation.Path && pathParameterNameToReplace.Equals(x.Name, StringComparison.Ordinal)) - )) - { - pathParameter.Name = pathParameterNameReplacement; - } - if (source != destination && !destination.PathItems.TryAdd(pathItem.Key, pathItem.Value)) - { - var destinationPathItem = destination.PathItems[pathItem.Key]; - foreach (var operation in pathItem.Value.Operations) - if (!destinationPathItem.Operations.TryAdd(operation.Key, operation.Value)) - { - logger.LogWarning("Duplicate operation {Operation} in path {Path}", operation.Key, pathItem.Key); - } - foreach (var pathParameter in pathItem.Value.Parameters) - destinationPathItem.Parameters.Add(pathParameter); - foreach (var extension in pathItem.Value.Extensions) - if (!destinationPathItem.Extensions.TryAdd(extension.Key, extension.Value)) - { - logger.LogWarning("Duplicate extension {Extension} in path {Path}", extension.Key, pathItem.Key); - } - } - } - } private CodeNamespace? rootNamespace; private CodeNamespace? modelsNamespace; private string? modelNamespacePrefixToTrim; From dc91c810b4f3ddc43ed031f4ddc7894e2b63fcd4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 15 Feb 2024 14:25:06 -0500 Subject: [PATCH 228/394] - moves unit tests for path merge to url tree node extensions --- .../OpenApiUrlTreeNodeExtensions.cs | 2 +- .../OpenApiUrlTreeNodeExtensionsTests.cs | 270 +++++++++++++++++- .../Kiota.Builder.Tests/KiotaBuilderTests.cs | 227 --------------- 3 files changed, 268 insertions(+), 231 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index 8910eab4c2..280d8a2c69 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -80,7 +80,7 @@ public static IEnumerable GetPathParametersForCurrentSegment(t .Where(static x => x.Value.PathItems.ContainsKey(Constants.DefaultOpenApiLabel)) .SelectMany(x => GetParametersForPathItem(x.Value.PathItems[Constants.DefaultOpenApiLabel], node.DeduplicatedSegment())) .Distinct(); - return Enumerable.Empty(); + return []; } private const char PathNameSeparator = '\\'; [GeneratedRegex(@"-?id\d?}?$", RegexOptions.Singleline | RegexOptions.IgnoreCase, 500)] diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs index c97dd49ea1..53b9e3bd78 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs @@ -1,6 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; - +using System.Net.Http; +using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; using Microsoft.OpenApi.Models; @@ -9,7 +11,7 @@ using Xunit; namespace Kiota.Builder.Tests.Extensions; -public class OpenApiUrlTreeNodeExtensionsTests +public sealed class OpenApiUrlTreeNodeExtensionsTests : IDisposable { [Fact] public void Defensive() @@ -673,4 +675,266 @@ public void GetsClassNameWithSegmentsToSkipForClassNames() // validate that we get a valid class name Assert.Equal("json", responseClassName); } + [Fact] + public void SinglePathParametersAreDeduplicated() + { + var userSchema = new OpenApiSchema + { + Type = "object", + Properties = new Dictionary { + { + "id", new OpenApiSchema { + Type = "string" + } + }, + { + "displayName", new OpenApiSchema { + Type = "string" + } + } + }, + Reference = new OpenApiReference + { + Id = "#/components/schemas/microsoft.graph.user" + }, + UnresolvedReference = false + }; + var document = new OpenApiDocument + { + Paths = new OpenApiPaths + { + ["users/{foo}/careerAdvisor/{id}"] = new OpenApiPathItem + { + Parameters = { + new OpenApiParameter { + Name = "foo", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + }, + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = userSchema + } + } + } + } + } + } + }, + ["users/{id}/careerAdvisor"] = new OpenApiPathItem + { + Parameters = { + new OpenApiParameter { + Name = "id", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + }, + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = userSchema + } + } + } + } + } + } + }, + ["users/{user-id}/manager"] = new OpenApiPathItem + { + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Parameters = { + new OpenApiParameter { + Name = "user-id", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema { + Type = "string" + } + }, + }, + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = userSchema + } + } + } + } + } + } + }, + }, + Components = new OpenApiComponents + { + Schemas = new Dictionary { + { + "microsoft.graph.user", userSchema + } + } + } + }; + var mockLogger = new CountLogger(); + var builder = new KiotaBuilder(mockLogger, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost" }, _httpClient); + var node = builder.CreateUriSpace(document); + node.MergeIndexNodesAtSameLevel(mockLogger); + var usersCollectionIndexNode = GetChildNodeByPath(node, "users/{users-id}"); + Assert.NotNull(usersCollectionIndexNode); + Assert.Equal("{+baseurl}/users/{users%2Did}", usersCollectionIndexNode.GetUrlTemplate()); + + var managerNode = GetChildNodeByPath(node, "users/{users-id}/manager"); + Assert.NotNull(managerNode); + Assert.Equal("{+baseurl}/users/{users%2Did}/manager", managerNode.GetUrlTemplate()); + + var careerAdvisorNode = GetChildNodeByPath(node, "users/{users-id}/careerAdvisor"); + Assert.NotNull(careerAdvisorNode); + Assert.Equal("{+baseurl}/users/{users%2Did}/careerAdvisor", careerAdvisorNode.GetUrlTemplate()); + + var careerAdvisorIndexNode = GetChildNodeByPath(node, "users/{users-id}/careerAdvisor/{id}"); + Assert.NotNull(careerAdvisorIndexNode); + Assert.Equal("{+baseurl}/users/{users%2Did}/careerAdvisor/{id}", careerAdvisorIndexNode.GetUrlTemplate()); + var pathItem = careerAdvisorIndexNode.PathItems[Constants.DefaultOpenApiLabel]; + Assert.NotNull(pathItem); + var parameter = pathItem.Parameters.FirstOrDefault(static p => p.Name == "users-id"); + Assert.NotNull(parameter); + } + [Fact] + public void SinglePathParametersAreDeduplicatedAndOrderIsRespected() + { + var ownerSchema = new OpenApiSchema + { + Type = "object", + Properties = new Dictionary { + { + "id", new OpenApiSchema { + Type = "string" + } + } + }, + Reference = new OpenApiReference + { + Id = "#/components/schemas/owner" + }, + UnresolvedReference = false + }; + var repoSchema = new OpenApiSchema + { + Type = "object", + Properties = new Dictionary { + { + "id", new OpenApiSchema { + Type = "string" + } + } + }, + Reference = new OpenApiReference + { + Id = "#/components/schemas/repo" + }, + UnresolvedReference = false + }; + var document = new OpenApiDocument + { + Paths = new OpenApiPaths + { + ["/repos/{owner}/{repo}"] = new OpenApiPathItem + { + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = repoSchema + } + } + } + } + } + } + }, + ["/repos/{template_owner}/{template_repo}/generate"] = new OpenApiPathItem + { + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = repoSchema + } + } + } + } + } + } + } + }, + Components = new OpenApiComponents + { + Schemas = new Dictionary { + {"owner", ownerSchema}, + {"repo", repoSchema} + } + } + }; + var mockLogger = new CountLogger(); + var builder = new KiotaBuilder(mockLogger, new GenerationConfiguration { ClientClassName = "GitHub", ApiRootUrl = "https://localhost" }, _httpClient); + var node = builder.CreateUriSpace(document); + node.MergeIndexNodesAtSameLevel(mockLogger); + + // Expected + var resultNode = GetChildNodeByPath(node, "repos/{owner}/{repos%2Did}/generate"); + Assert.NotNull(resultNode); + Assert.Equal("{+baseurl}/repos/{owner}/{repos%2Did}/generate", resultNode.GetUrlTemplate()); + } + private static OpenApiUrlTreeNode GetChildNodeByPath(OpenApiUrlTreeNode node, string path) + { + var pathSegments = path.Split('/'); + if (pathSegments.Length == 0) + return null; + if (pathSegments.Length == 1 && node.Children.TryGetValue(pathSegments[0], out var result)) + return result; + if (node.Children.TryGetValue(pathSegments[0], out var currentNode)) + return GetChildNodeByPath(currentNode, string.Join('/', pathSegments.Skip(1))); + return null; + } + public void Dispose() + { + _httpClient.Dispose(); + GC.SuppressFinalize(this); + } + private static readonly HttpClient _httpClient = new(); } diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index a14f358faa..473b2775b4 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -6472,233 +6472,6 @@ await File.WriteAllTextAsync(tempFilePath, @$"openapi: 3.0.1 Assert.NotNull(inlineType); } [Fact] - public void SinglePathParametersAreDeduplicated() - { - var userSchema = new OpenApiSchema - { - Type = "object", - Properties = new Dictionary { - { - "id", new OpenApiSchema { - Type = "string" - } - }, - { - "displayName", new OpenApiSchema { - Type = "string" - } - } - }, - Reference = new OpenApiReference - { - Id = "#/components/schemas/microsoft.graph.user" - }, - UnresolvedReference = false - }; - var document = new OpenApiDocument - { - Paths = new OpenApiPaths - { - ["users/{foo}/careerAdvisor/{id}"] = new OpenApiPathItem - { - Operations = { - [OperationType.Get] = new OpenApiOperation - { - Responses = new OpenApiResponses { - ["200"] = new OpenApiResponse - { - Content = { - ["application/json"] = new OpenApiMediaType - { - Schema = userSchema - } - } - } - } - } - } - }, - ["users/{id}/careerAdvisor"] = new OpenApiPathItem - { - Operations = { - [OperationType.Get] = new OpenApiOperation - { - Responses = new OpenApiResponses { - ["200"] = new OpenApiResponse - { - Content = { - ["application/json"] = new OpenApiMediaType - { - Schema = userSchema - } - } - } - } - } - } - }, - ["users/{user-id}/manager"] = new OpenApiPathItem - { - Operations = { - [OperationType.Get] = new OpenApiOperation - { - Responses = new OpenApiResponses { - ["200"] = new OpenApiResponse - { - Content = { - ["application/json"] = new OpenApiMediaType - { - Schema = userSchema - } - } - } - } - } - } - }, - }, - Components = new OpenApiComponents - { - Schemas = new Dictionary { - { - "microsoft.graph.user", userSchema - } - } - } - }; - var mockLogger = new CountLogger(); - var builder = new KiotaBuilder(mockLogger, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost" }, _httpClient); - var node = builder.CreateUriSpace(document); - var codeModel = builder.CreateSourceModel(node); - var usersRB = codeModel.FindNamespaceByName("ApiSdk.users").FindChildByName("UsersRequestBuilder", false); - Assert.NotNull(usersRB); - var usersIndexer = usersRB.Indexer; - Assert.NotNull(usersIndexer); - Assert.Equal("users%2Did", usersIndexer.IndexParameter.SerializationName); - var managerRB = codeModel.FindNamespaceByName("ApiSdk.users.item.manager").FindChildByName("ManagerRequestBuilder", false); - Assert.NotNull(managerRB); - var managerUrlTemplate = managerRB.FindChildByName("UrlTemplate", false); - Assert.NotNull(managerUrlTemplate); - Assert.Equal("{+baseurl}/users/{users%2Did}/manager", managerUrlTemplate.DefaultValue.Trim('"')); - var careerAdvisorRB = codeModel.FindNamespaceByName("ApiSdk.users.item.careerAdvisor").FindChildByName("CareerAdvisorRequestBuilder", false); - Assert.NotNull(careerAdvisorRB); - var careerAdvisorUrlTemplate = careerAdvisorRB.FindChildByName("UrlTemplate", false); - Assert.NotNull(careerAdvisorUrlTemplate); - Assert.Equal("{+baseurl}/users/{users%2Did}/careerAdvisor", careerAdvisorUrlTemplate.DefaultValue.Trim('"')); - var careerAdvisorItemRB = codeModel.FindNamespaceByName("ApiSdk.users.item.careerAdvisor.item").FindChildByName("CareerAdvisorItemRequestBuilder", false); - Assert.NotNull(careerAdvisorItemRB); - var careerAdvisorItemUrlTemplate = careerAdvisorItemRB.FindChildByName("UrlTemplate", false); - Assert.NotNull(careerAdvisorItemUrlTemplate); - Assert.Equal("{+baseurl}/users/{users%2Did}/careerAdvisor/{id}", careerAdvisorItemUrlTemplate.DefaultValue.Trim('"')); - } - [Fact] - public void SinglePathParametersAreDeduplicatedAndOrderIsRespected() - { - var ownerSchema = new OpenApiSchema - { - Type = "object", - Properties = new Dictionary { - { - "id", new OpenApiSchema { - Type = "string" - } - } - }, - Reference = new OpenApiReference - { - Id = "#/components/schemas/owner" - }, - UnresolvedReference = false - }; - var repoSchema = new OpenApiSchema - { - Type = "object", - Properties = new Dictionary { - { - "id", new OpenApiSchema { - Type = "string" - } - } - }, - Reference = new OpenApiReference - { - Id = "#/components/schemas/repo" - }, - UnresolvedReference = false - }; - var document = new OpenApiDocument - { - Paths = new OpenApiPaths - { - ["/repos/{owner}/{repo}"] = new OpenApiPathItem - { - Operations = { - [OperationType.Get] = new OpenApiOperation - { - Responses = new OpenApiResponses { - ["200"] = new OpenApiResponse - { - Content = { - ["application/json"] = new OpenApiMediaType - { - Schema = repoSchema - } - } - } - } - } - } - }, - ["/repos/{template_owner}/{template_repo}/generate"] = new OpenApiPathItem - { - Operations = { - [OperationType.Get] = new OpenApiOperation - { - Responses = new OpenApiResponses { - ["200"] = new OpenApiResponse - { - Content = { - ["application/json"] = new OpenApiMediaType - { - Schema = repoSchema - } - } - } - } - } - } - } - }, - Components = new OpenApiComponents - { - Schemas = new Dictionary { - {"owner", ownerSchema}, - {"repo", repoSchema} - } - } - }; - var mockLogger = new CountLogger(); - var builder = new KiotaBuilder(mockLogger, new GenerationConfiguration { ClientClassName = "GitHub", ApiRootUrl = "https://localhost" }, _httpClient); - var node = builder.CreateUriSpace(document); - var codeModel = builder.CreateSourceModel(node); - - // Expected - var reposRB = codeModel.FindNamespaceByName("ApiSdk.repos.item.item").FindChildByName("ReposItemRequestBuilder", false); - Assert.NotNull(reposRB); - var repoUrlTemplate = reposRB.FindChildByName("UrlTemplate", false); - Assert.NotNull(repoUrlTemplate); - Assert.Equal("{+baseurl}/repos/{owner}/{repos%2Did}", repoUrlTemplate.DefaultValue.Trim('"')); - Console.WriteLine(repoUrlTemplate.DefaultValue.Trim('"')); - - // Current behavior - // var reposRB = codeModel.FindNamespaceByName("ApiSdk.repos.item.item").FindChildByName("OwnerItemRequestBuilder", false); - // Assert.NotNull(reposRB); - // var repoUrlTemplate = reposRB.FindChildByName("UrlTemplate", false); - // Assert.NotNull(repoUrlTemplate); - // Assert.Equal("{+baseurl}/repos/{repos%2Did}/{Owner%2Did}", repoUrlTemplate.DefaultValue.Trim('"')); - // Console.WriteLine(repoUrlTemplate.DefaultValue.Trim('"')); - } - [Fact] public void AddReservedPathParameterSymbol() { var userSchema = new OpenApiSchema From 1e39f50cc22760f13474456a0068fbc80909488d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 15 Feb 2024 15:07:00 -0500 Subject: [PATCH 229/394] - fixes deduplication algorythm taking parent segment name - fixes deduplication algo not renaming child paths and parameter names --- .../OpenApiUrlTreeNodeExtensions.cs | 30 ++++++++++++++++++- .../OpenApiUrlTreeNodeExtensionsTests.cs | 23 +++++++------- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index 280d8a2c69..c88bce001d 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -279,7 +279,9 @@ internal static void MergeIndexNodesAtSameLevel(this OpenApiUrlTreeNode node, IL { var indexNode = indexNodes[0]; node.Children.Remove(indexNode.Key); - var newSegmentParameterName = $"{{{node.Segment.CleanupSymbolName()}-id}}"; + var oldSegmentName = indexNode.Value.Segment.Trim('{', '}').CleanupSymbolName(); + var segmentIndex = indexNode.Value.Path.Split('\\', StringSplitOptions.RemoveEmptyEntries).ToList().IndexOf(indexNode.Value.Segment); + var newSegmentParameterName = oldSegmentName.EndsWith("-id", StringComparison.OrdinalIgnoreCase) ? oldSegmentName : $"{{{oldSegmentName}-id}}"; indexNode.Value.Path = indexNode.Value.Path.Replace(indexNode.Key, newSegmentParameterName, StringComparison.OrdinalIgnoreCase); indexNode.Value.AddDeduplicatedSegment(newSegmentParameterName); node.Children.Add(newSegmentParameterName, indexNode.Value); @@ -289,11 +291,37 @@ internal static void MergeIndexNodesAtSameLevel(this OpenApiUrlTreeNode node, IL node.Children.Remove(child.Key); CopyNodeIntoOtherNode(child.Value, indexNode.Value, child.Key, newSegmentParameterName, logger); } + ReplaceParameterInPathForAllChildNodes(indexNode.Value, segmentIndex, newSegmentParameterName); } foreach (var child in node.Children.Values) MergeIndexNodesAtSameLevel(child, logger); } + private static void ReplaceParameterInPathForAllChildNodes(OpenApiUrlTreeNode node, int parameterIndex, string newParameterName) + { + if (parameterIndex < 0) + return; + foreach (var child in node.Children.Values) + { + var splatPath = child.Path.Split('\\', StringSplitOptions.RemoveEmptyEntries); + if (splatPath.Length > parameterIndex) + { + var oldName = splatPath[parameterIndex]; + splatPath[parameterIndex] = newParameterName; + child.Path = "\\" + string.Join('\\', splatPath); + if (node.PathItems.TryGetValue(Constants.DefaultOpenApiLabel, out var pathItem)) + { + foreach (var pathParameter in pathItem.Parameters + .Union(pathItem.Operations.SelectMany(static x => x.Value.Parameters)) + .Where(x => x.In == ParameterLocation.Path && oldName.Equals(x.Name, StringComparison.Ordinal))) + { + pathParameter.Name = newParameterName; + } + } + } + ReplaceParameterInPathForAllChildNodes(child, parameterIndex, newParameterName); + } + } private static void CopyNodeIntoOtherNode(OpenApiUrlTreeNode source, OpenApiUrlTreeNode destination, string pathParameterNameToReplace, string pathParameterNameReplacement, ILogger logger) { foreach (var child in source.Children) diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs index 53b9e3bd78..396eb1fdf5 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs @@ -804,24 +804,24 @@ public void SinglePathParametersAreDeduplicated() var builder = new KiotaBuilder(mockLogger, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost" }, _httpClient); var node = builder.CreateUriSpace(document); node.MergeIndexNodesAtSameLevel(mockLogger); - var usersCollectionIndexNode = GetChildNodeByPath(node, "users/{users-id}"); + var usersCollectionIndexNode = GetChildNodeByPath(node, "users/{foo-id}"); Assert.NotNull(usersCollectionIndexNode); - Assert.Equal("{+baseurl}/users/{users%2Did}", usersCollectionIndexNode.GetUrlTemplate()); + Assert.Equal("{+baseurl}/users/{foo%2Did}", usersCollectionIndexNode.GetUrlTemplate()); - var managerNode = GetChildNodeByPath(node, "users/{users-id}/manager"); + var managerNode = GetChildNodeByPath(node, "users/{foo-id}/manager"); Assert.NotNull(managerNode); - Assert.Equal("{+baseurl}/users/{users%2Did}/manager", managerNode.GetUrlTemplate()); + Assert.Equal("{+baseurl}/users/{foo%2Did}/manager", managerNode.GetUrlTemplate()); - var careerAdvisorNode = GetChildNodeByPath(node, "users/{users-id}/careerAdvisor"); + var careerAdvisorNode = GetChildNodeByPath(node, "users/{foo-id}/careerAdvisor"); Assert.NotNull(careerAdvisorNode); - Assert.Equal("{+baseurl}/users/{users%2Did}/careerAdvisor", careerAdvisorNode.GetUrlTemplate()); + Assert.Equal("{+baseurl}/users/{foo%2Did}/careerAdvisor", careerAdvisorNode.GetUrlTemplate()); - var careerAdvisorIndexNode = GetChildNodeByPath(node, "users/{users-id}/careerAdvisor/{id}"); + var careerAdvisorIndexNode = GetChildNodeByPath(node, "users/{foo-id}/careerAdvisor/{id}"); Assert.NotNull(careerAdvisorIndexNode); - Assert.Equal("{+baseurl}/users/{users%2Did}/careerAdvisor/{id}", careerAdvisorIndexNode.GetUrlTemplate()); + Assert.Equal("{+baseurl}/users/{foo%2Did}/careerAdvisor/{id}", careerAdvisorIndexNode.GetUrlTemplate()); var pathItem = careerAdvisorIndexNode.PathItems[Constants.DefaultOpenApiLabel]; Assert.NotNull(pathItem); - var parameter = pathItem.Parameters.FirstOrDefault(static p => p.Name == "users-id"); + var parameter = pathItem.Parameters.FirstOrDefault(static p => p.Name == "foo-id"); Assert.NotNull(parameter); } [Fact] @@ -916,9 +916,10 @@ public void SinglePathParametersAreDeduplicatedAndOrderIsRespected() node.MergeIndexNodesAtSameLevel(mockLogger); // Expected - var resultNode = GetChildNodeByPath(node, "repos/{owner}/{repos%2Did}/generate"); + var resultNode = GetChildNodeByPath(node, "repos/{owner-id}/{repo-id}/generate"); Assert.NotNull(resultNode); - Assert.Equal("{+baseurl}/repos/{owner}/{repos%2Did}/generate", resultNode.GetUrlTemplate()); + Assert.Equal("\\repos\\{owner-id}\\{repo-id}\\generate", resultNode.Path); + Assert.Equal("{+baseurl}/repos/{owner%2Did}/{repo%2Did}/generate", resultNode.GetUrlTemplate()); } private static OpenApiUrlTreeNode GetChildNodeByPath(OpenApiUrlTreeNode node, string path) { From 8759fb17ed46b6d44fd16dadb975fd4056b4db29 Mon Sep 17 00:00:00 2001 From: Andrea Peruffo Date: Mon, 19 Feb 2024 11:50:35 +0000 Subject: [PATCH 230/394] tests --- .github/workflows/integration-tests.yml | 1 + it/config.json | 5 +- it/java/gh/pom.xml | 74 +++++++++++++++++++ it/java/gh/src/test/java/GHAPITest.java | 23 ++++++ .../OpenApiUrlTreeNodeExtensionsTests.cs | 69 +++++++++++++++++ 5 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 it/java/gh/pom.xml create mode 100644 it/java/gh/src/test/java/GHAPITest.java diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 53739c92f5..0d367a37e3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -57,6 +57,7 @@ jobs: - "https://developers.pipedrive.com/docs/api/v1/openapi.yaml" - "apisguru::twilio.com:api" - "apisguru::docusign.net" + - "apisguru::github.com:api.github.com" steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 diff --git a/it/config.json b/it/config.json index 39ef0c14d5..e153f64c5a 100644 --- a/it/config.json +++ b/it/config.json @@ -73,6 +73,9 @@ "./tests/Kiota.Builder.IntegrationTests/GeneratesUritemplateHints.yaml": { "MockServerITFolder": "query-params" }, + "apisguru::github.com:api.github.com": { + "MockServerITFolder": "gh" + }, "apisguru::notion.com": { "ExcludePatterns": [ { @@ -325,4 +328,4 @@ } ] } -} +} \ No newline at end of file diff --git a/it/java/gh/pom.xml b/it/java/gh/pom.xml new file mode 100644 index 0000000000..641d5bdc48 --- /dev/null +++ b/it/java/gh/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + io.kiota + kiota-gh-api + 0.1.0-SNAPSHOT + + + 11 + 11 + 11 + UTF-8 + UTF-8 + + 0.12.1 + + + + + com.microsoft.kiota + microsoft-kiota-abstractions + ${kiota-java.version} + + + com.microsoft.kiota + microsoft-kiota-serialization-json + ${kiota-java.version} + + + com.microsoft.kiota + microsoft-kiota-serialization-text + ${kiota-java.version} + + + com.microsoft.kiota + microsoft-kiota-serialization-form + ${kiota-java.version} + + + com.microsoft.kiota + microsoft-kiota-serialization-multipart + ${kiota-java.version} + + + com.microsoft.kiota + microsoft-kiota-http-okHttp + ${kiota-java.version} + + + jakarta.annotation + jakarta.annotation-api + 2.1.1 + + + org.junit.jupiter + junit-jupiter-engine + 5.9.2 + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M9 + + + + \ No newline at end of file diff --git a/it/java/gh/src/test/java/GHAPITest.java b/it/java/gh/src/test/java/GHAPITest.java new file mode 100644 index 0000000000..12135b3dd8 --- /dev/null +++ b/it/java/gh/src/test/java/GHAPITest.java @@ -0,0 +1,23 @@ +import apisdk.ApiClient; +import com.microsoft.kiota.ApiException; +import com.microsoft.kiota.authentication.AnonymousAuthenticationProvider; +import com.microsoft.kiota.http.OkHttpRequestAdapter; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.concurrent.TimeUnit; + +public class BasicAPITest { + + @Test + void basicTest() throws Exception { + var adapter = new OkHttpRequestAdapter(new AnonymousAuthenticationProvider()); + adapter.setBaseUrl("http://127.0.0.1:1080"); + var client = new ApiClient(adapter); + + client.repos().byOwnerId("my-owner").byReposId("my-repo").get(); + client.repos().byTemplateOwner("my-template-owner").byTemplateRepo("my-repo").post(null); + } + +} diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs index 396eb1fdf5..e0a96d9ff4 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs @@ -921,6 +921,75 @@ public void SinglePathParametersAreDeduplicatedAndOrderIsRespected() Assert.Equal("\\repos\\{owner-id}\\{repo-id}\\generate", resultNode.Path); Assert.Equal("{+baseurl}/repos/{owner%2Did}/{repo%2Did}/generate", resultNode.GetUrlTemplate()); } + [Fact] + public void repro4085() + { + var document = new OpenApiDocument + { + Paths = new OpenApiPaths + { + ["/path/{thingId}/abc/{second}"] = new OpenApiPathItem + { + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = new OpenApiSchema { + Type = "string" + } + } + } + } + } + } + } + }, + ["/path/{differentThingId}/def/{second}"] = new OpenApiPathItem + { + Operations = { + [OperationType.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses { + ["200"] = new OpenApiResponse + { + Content = { + ["application/json"] = new OpenApiMediaType + { + Schema = new OpenApiSchema { + Type = "string" + } + } + } + } + } + } + } + } + } + }; + var mockLogger = new CountLogger(); + var builder = new KiotaBuilder(mockLogger, new GenerationConfiguration { ClientClassName = "GitHub", ApiRootUrl = "https://localhost" }, _httpClient); + var node = builder.CreateUriSpace(document); + node.MergeIndexNodesAtSameLevel(mockLogger); + + // Expected + var resultNode = GetChildNodeByPath(node, "path"); + Assert.NotNull(resultNode); + Assert.Equal("\\path", resultNode.Path); + + var thingId = GetChildNodeByPath(resultNode, "{thingId}"); + Assert.Equal("\\path\\{thingId}", thingId.Path); + Assert.Equal("{+baseurl}/path/{thingId}", thingId.GetUrlTemplate()); + + var differentThingId = GetChildNodeByPath(resultNode, "{differentThingId}"); + Assert.Equal("\\path\\{differentThingId}", differentThingId.Path); + Assert.Equal("{+baseurl}/path/{differentThingId}", differentThingId.GetUrlTemplate()); + } private static OpenApiUrlTreeNode GetChildNodeByPath(OpenApiUrlTreeNode node, string path) { var pathSegments = path.Split('/'); From 41d85ab760b0caaa68f8bfd66a8a4354b558ed54 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 08:20:53 +0000 Subject: [PATCH 231/394] Bump @typescript-eslint/parser from 7.0.1 to 7.0.2 in /it/typescript Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.0.1 to 7.0.2. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.2/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 115 +++++++++++++++++++++++++++++--- it/typescript/package.json | 2 +- 2 files changed, 108 insertions(+), 9 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index f4ab1c4341..12a6512258 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -24,7 +24,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.19", "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.1", + "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", @@ -878,15 +878,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.1.tgz", - "integrity": "sha512-8GcRRZNzaHxKzBPU3tKtFNing571/GwPBeCvmAUw0yBtfE2XVd0zFKJIMSWkHJcPQi0ekxjIts6L/rrZq5cxGQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.2.tgz", + "integrity": "sha512-GdwfDglCxSmU+QTS9vhz2Sop46ebNCXpPPvsByK7hu0rFGRHL+AusKQJ7SoN+LbLh6APFpQwHKmDSwN35Z700Q==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/typescript-estree": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", + "@typescript-eslint/scope-manager": "7.0.2", + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/typescript-estree": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2", "debug": "^4.3.4" }, "engines": { @@ -905,6 +905,105 @@ } } }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.2.tgz", + "integrity": "sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.2.tgz", + "integrity": "sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz", + "integrity": "sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz", + "integrity": "sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.0.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index 34bcc01c08..bd17bac140 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -21,7 +21,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.19", "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.1", + "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", From b78d8fcbbc0efc6bbd7b4cff9f0856bd9db73469 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 08:26:18 +0000 Subject: [PATCH 232/394] Bump @typescript-eslint/eslint-plugin in /it/typescript Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 7.0.1 to 7.0.2. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.2/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 163 +++++++------------------------- it/typescript/package.json | 2 +- 2 files changed, 33 insertions(+), 132 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 12a6512258..c6ce40ac0f 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -23,7 +23,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.19", - "@typescript-eslint/eslint-plugin": "^7.0.1", + "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", "eslint": "^8.56.0", @@ -843,16 +843,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.1.tgz", - "integrity": "sha512-OLvgeBv3vXlnnJGIAgCLYKjgMEU+wBGj07MQ/nxAaON+3mLzX7mJbhRYrVGiVvFiXtwFlkcBa/TtmglHy0UbzQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.2.tgz", + "integrity": "sha512-/XtVZJtbaphtdrWjr+CJclaCVGPtOdBpFEnvtNf/jRV0IiEemRrL0qABex/nEt8isYcnFacm3nPHYQwL+Wb7qg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/type-utils": "7.0.1", - "@typescript-eslint/utils": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", + "@typescript-eslint/scope-manager": "7.0.2", + "@typescript-eslint/type-utils": "7.0.2", + "@typescript-eslint/utils": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -905,7 +905,7 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "node_modules/@typescript-eslint/scope-manager": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.2.tgz", "integrity": "sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g==", @@ -922,113 +922,14 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.2.tgz", - "integrity": "sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz", - "integrity": "sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz", - "integrity": "sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", - "integrity": "sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.1.tgz", - "integrity": "sha512-YtT9UcstTG5Yqy4xtLiClm1ZpM/pWVGFnkAa90UfdkkZsR1eP2mR/1jbHeYp8Ay1l1JHPyGvoUYR6o3On5Nhmw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.2.tgz", + "integrity": "sha512-IKKDcFsKAYlk8Rs4wiFfEwJTQlHcdn8CLwLaxwd6zb8HNiMcQIFX9sWax2k4Cjj7l7mGS5N1zl7RCHOVwHq2VQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.0.1", - "@typescript-eslint/utils": "7.0.1", + "@typescript-eslint/typescript-estree": "7.0.2", + "@typescript-eslint/utils": "7.0.2", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1049,9 +950,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", - "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.2.tgz", + "integrity": "sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1062,13 +963,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", - "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz", + "integrity": "sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1114,17 +1015,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.1.tgz", - "integrity": "sha512-oe4his30JgPbnv+9Vef1h48jm0S6ft4mNwi9wj7bX10joGn07QRfqIqFHoMiajrtoU88cIhXf8ahwgrcbNLgPA==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.2.tgz", + "integrity": "sha512-PZPIONBIB/X684bhT1XlrkjNZJIEevwkKDsdwfiu1WeqBxYEEdIgVDgm8/bbKHVu+6YOpeRqcfImTdImx/4Bsw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/typescript-estree": "7.0.1", + "@typescript-eslint/scope-manager": "7.0.2", + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/typescript-estree": "7.0.2", "semver": "^7.5.4" }, "engines": { @@ -1139,12 +1040,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", - "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz", + "integrity": "sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/types": "7.0.2", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/it/typescript/package.json b/it/typescript/package.json index bd17bac140..2d0465b373 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.19", - "@typescript-eslint/eslint-plugin": "^7.0.1", + "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", "eslint": "^8.56.0", From a04523ee720253f915415b7c3d3981a0142e4580 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 08:58:45 +0000 Subject: [PATCH 233/394] Bump the eslint group in /vscode/microsoft-kiota with 2 updates Bumps the eslint group in /vscode/microsoft-kiota with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser). Updates `@typescript-eslint/eslint-plugin` from 7.0.1 to 7.0.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.2/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 7.0.1 to 7.0.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.0.2/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: eslint - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: eslint ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 88 ++++++++++++------------ vscode/microsoft-kiota/package.json | 4 +- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index d4670217ff..3328dd7d10 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -20,8 +20,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.86.0", - "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.1", + "@typescript-eslint/eslint-plugin": "^7.0.2", + "@typescript-eslint/parser": "^7.0.2", "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", @@ -555,16 +555,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.1.tgz", - "integrity": "sha512-OLvgeBv3vXlnnJGIAgCLYKjgMEU+wBGj07MQ/nxAaON+3mLzX7mJbhRYrVGiVvFiXtwFlkcBa/TtmglHy0UbzQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.2.tgz", + "integrity": "sha512-/XtVZJtbaphtdrWjr+CJclaCVGPtOdBpFEnvtNf/jRV0IiEemRrL0qABex/nEt8isYcnFacm3nPHYQwL+Wb7qg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/type-utils": "7.0.1", - "@typescript-eslint/utils": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", + "@typescript-eslint/scope-manager": "7.0.2", + "@typescript-eslint/type-utils": "7.0.2", + "@typescript-eslint/utils": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -590,15 +590,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.1.tgz", - "integrity": "sha512-8GcRRZNzaHxKzBPU3tKtFNing571/GwPBeCvmAUw0yBtfE2XVd0zFKJIMSWkHJcPQi0ekxjIts6L/rrZq5cxGQ==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.2.tgz", + "integrity": "sha512-GdwfDglCxSmU+QTS9vhz2Sop46ebNCXpPPvsByK7hu0rFGRHL+AusKQJ7SoN+LbLh6APFpQwHKmDSwN35Z700Q==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/typescript-estree": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", + "@typescript-eslint/scope-manager": "7.0.2", + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/typescript-estree": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2", "debug": "^4.3.4" }, "engines": { @@ -618,13 +618,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.1.tgz", - "integrity": "sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.2.tgz", + "integrity": "sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1" + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -635,13 +635,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.1.tgz", - "integrity": "sha512-YtT9UcstTG5Yqy4xtLiClm1ZpM/pWVGFnkAa90UfdkkZsR1eP2mR/1jbHeYp8Ay1l1JHPyGvoUYR6o3On5Nhmw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.2.tgz", + "integrity": "sha512-IKKDcFsKAYlk8Rs4wiFfEwJTQlHcdn8CLwLaxwd6zb8HNiMcQIFX9sWax2k4Cjj7l7mGS5N1zl7RCHOVwHq2VQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.0.1", - "@typescript-eslint/utils": "7.0.1", + "@typescript-eslint/typescript-estree": "7.0.2", + "@typescript-eslint/utils": "7.0.2", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -662,9 +662,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.1.tgz", - "integrity": "sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.2.tgz", + "integrity": "sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -675,13 +675,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.1.tgz", - "integrity": "sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz", + "integrity": "sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/visitor-keys": "7.0.1", + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/visitor-keys": "7.0.2", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -727,17 +727,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.1.tgz", - "integrity": "sha512-oe4his30JgPbnv+9Vef1h48jm0S6ft4mNwi9wj7bX10joGn07QRfqIqFHoMiajrtoU88cIhXf8ahwgrcbNLgPA==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.2.tgz", + "integrity": "sha512-PZPIONBIB/X684bhT1XlrkjNZJIEevwkKDsdwfiu1WeqBxYEEdIgVDgm8/bbKHVu+6YOpeRqcfImTdImx/4Bsw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.0.1", - "@typescript-eslint/types": "7.0.1", - "@typescript-eslint/typescript-estree": "7.0.1", + "@typescript-eslint/scope-manager": "7.0.2", + "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/typescript-estree": "7.0.2", "semver": "^7.5.4" }, "engines": { @@ -752,12 +752,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.1.tgz", - "integrity": "sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz", + "integrity": "sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.1", + "@typescript-eslint/types": "7.0.2", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 94f7c63b71..8f6070baa4 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -427,8 +427,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.86.0", - "@typescript-eslint/eslint-plugin": "^7.0.1", - "@typescript-eslint/parser": "^7.0.1", + "@typescript-eslint/eslint-plugin": "^7.0.2", + "@typescript-eslint/parser": "^7.0.2", "@vscode/test-electron": "^2.3.9", "eslint": "^8.56.0", "glob": "^10.3.10", From 1b5ec66d470625e1374a61882063d9ee26f5f9a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 08:58:58 +0000 Subject: [PATCH 234/394] Bump webpack from 5.90.2 to 5.90.3 in /vscode/microsoft-kiota Bumps [webpack](https://github.com/webpack/webpack) from 5.90.2 to 5.90.3. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.90.2...v5.90.3) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 8 ++++---- vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index d4670217ff..e239fad719 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -28,7 +28,7 @@ "mocha": "^10.3.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", - "webpack": "^5.90.2", + "webpack": "^5.90.3", "webpack-cli": "^5.1.4" }, "engines": { @@ -4044,9 +4044,9 @@ } }, "node_modules/webpack": { - "version": "5.90.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.2.tgz", - "integrity": "sha512-ziXu8ABGr0InCMEYFnHrYweinHK2PWrMqnwdHk2oK3rRhv/1B+2FnfwYv5oD+RrknK/Pp/Hmyvu+eAsaMYhzCw==", + "version": "5.90.3", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.3.tgz", + "integrity": "sha512-h6uDYlWCctQRuXBs1oYpVe6sFcWedl0dpcVaTf/YF67J9bKvwJajFulMVSYKHrksMB3I/pIagRzDxwxkebuzKA==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 94f7c63b71..bca11c5560 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -435,7 +435,7 @@ "mocha": "^10.3.0", "ts-loader": "^9.5.1", "typescript": "^5.3.3", - "webpack": "^5.90.2", + "webpack": "^5.90.3", "webpack-cli": "^5.1.4" }, "dependencies": { From 9a121472aaf0ff33b1016924fb8472536975b288 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 08:13:07 +0000 Subject: [PATCH 235/394] Bump cryptography from 42.0.3 to 42.0.4 in /it/python Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.3 to 42.0.4. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/42.0.3...42.0.4) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index c47490ca8b..5d3614e338 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -82,7 +82,7 @@ azure-identity==1.15.0 cffi==1.16.0 -cryptography==42.0.3 ; python_version >= '3.7' +cryptography==42.0.4 ; python_version >= '3.7' frozenlist==1.4.1 ; python_version >= '3.7' From 4bee7e1234c551e0948c93ba84e1c2ee54f743d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 08:48:57 +0000 Subject: [PATCH 236/394] Bump coverlet.msbuild from 6.0.0 to 6.0.1 Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 6.0.0 to 6.0.1. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.0...v6.0.1) --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Kiota.Builder.IntegrationTests.csproj | 2 +- tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj | 2 +- tests/Kiota.Tests/Kiota.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index 21ec7e142d..b1b8853791 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -10,7 +10,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj index a64bdf734f..a689d65034 100644 --- a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj +++ b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj @@ -12,7 +12,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Kiota.Tests/Kiota.Tests.csproj b/tests/Kiota.Tests/Kiota.Tests.csproj index 3d0f2ab341..ec6c240911 100644 --- a/tests/Kiota.Tests/Kiota.Tests.csproj +++ b/tests/Kiota.Tests/Kiota.Tests.csproj @@ -7,7 +7,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From ef92fad6fffdab843ddf8b47b9bf82f8f2724cc9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 08:49:32 +0000 Subject: [PATCH 237/394] Bump coverlet.collector from 6.0.0 to 6.0.1 Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.0 to 6.0.1. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.0...v6.0.1) --- updated-dependencies: - dependency-name: coverlet.collector dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Kiota.Builder.IntegrationTests.csproj | 2 +- tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj | 2 +- tests/Kiota.Tests/Kiota.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj index 21ec7e142d..f3da02b073 100644 --- a/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj +++ b/tests/Kiota.Builder.IntegrationTests/Kiota.Builder.IntegrationTests.csproj @@ -6,7 +6,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj index a64bdf734f..05ce41344c 100644 --- a/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj +++ b/tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj @@ -24,7 +24,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Kiota.Tests/Kiota.Tests.csproj b/tests/Kiota.Tests/Kiota.Tests.csproj index 3d0f2ab341..6e41c86705 100644 --- a/tests/Kiota.Tests/Kiota.Tests.csproj +++ b/tests/Kiota.Tests/Kiota.Tests.csproj @@ -17,7 +17,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all From e0e9ab561944063cb0c0438d3fdaad38ad2d37cd Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 21:32:45 +0300 Subject: [PATCH 238/394] Add form serialization library to default --- .vscode/launch.json | 64 ++++++++++++++++----- src/Kiota.Builder/Refiners/PythonRefiner.cs | 6 +- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 36465ec859..fbfb8e14e9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,12 +30,15 @@ "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", "args": [ "generate", + "--backing-store", "--openapi", - "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", + // "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", + "${workspaceFolder}/samples/descs/openapi.yaml", "--language", "java", "-o", - "${workspaceFolder}/samples/msgraph-mail/java/utilities/src/main/java/graphjavav4/utilities", + // "${workspaceFolder}/samples/msgraph-mail/java/utilities/src/main/java/graphjavav4/utilities", + "${workspaceFolder}/samples/twitter/java", "-n", "graphjavav4.utilities" ], @@ -51,12 +54,17 @@ "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", "args": [ "generate", + "--backing-store", "--openapi", - "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", + // "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", + // "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + // "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/beta/openapi.yaml", + "${workspaceFolder}/samples/descs/openapi.yaml", "--language", "csharp", "-o", - "${workspaceFolder}/samples/msgraph-mail/dotnet", + // "${workspaceFolder}/samples/msgraph-mail/dotnet", + "${workspaceFolder}/samples/twitter/dotnet", "-n", "Graphdotnetv4" ], @@ -93,14 +101,16 @@ "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", "args": [ "generate", + "--backing-store", "--openapi", - "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", + // "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", + "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", "--language", "php", "-o", "${workspaceFolder}/samples/msgraph-mail/php/src/", "-n", - "Microsoft\\Graph" + "Microsoft\\Graph", ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", @@ -157,14 +167,24 @@ "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", "args": [ "generate", + "--clean-output", + "--backing-store", "--openapi", "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", + // "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + // "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/beta/openapi.yaml", + // "${workspaceFolder}/samples/descs/openapi.yaml", "--language", "python", "-o", + // "${workspaceFolder}/samples/msgraph/python", + // "${workspaceFolder}/samples/msgraph/python/beta", "${workspaceFolder}/samples/msgraph-mail/python", + // "${workspaceFolder}/samples/twitter", + // "${userHome}/projects/ms/kiota-samples/msgraph-mail/python", "-n", - "GraphPythonv1" + "GraphPythonv1", + // "GraphPythonBeta", ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", @@ -196,7 +216,10 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": ["search", "microsoft"], + "args": [ + "search", + "microsoft" + ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -207,7 +230,10 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": ["search", "test"], + "args": [ + "search", + "test" + ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -249,7 +275,11 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": ["info", "-l", "CSharp"], + "args": [ + "info", + "-l", + "CSharp" + ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -260,7 +290,11 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": ["update", "-o", "${workspaceFolder}/samples"], + "args": [ + "update", + "-o", + "${workspaceFolder}/samples" + ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -271,7 +305,11 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": ["login", "github", "device"], + "args": [ + "login", + "github", + "device" + ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -283,4 +321,4 @@ "processId": "${command:pickProcess}" } ] -} +} \ No newline at end of file diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 8f1f553f88..83b0533c0b 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -111,7 +111,8 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance defaultConfiguration.Serializers, new(StringComparer.OrdinalIgnoreCase) { "kiota_serialization_json.json_serialization_writer_factory.JsonSerializationWriterFactory", - "kiota_serialization_text.text_serialization_writer_factory.TextSerializationWriterFactory" + "kiota_serialization_text.text_serialization_writer_factory.TextSerializationWriterFactory", + "kiota_serialization_form.form_serialization_writer_factory.FormSerializationWriterFactory", } ); ReplaceDefaultDeserializationModules( @@ -119,7 +120,8 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance defaultConfiguration.Deserializers, new(StringComparer.OrdinalIgnoreCase) { "kiota_serialization_json.json_parse_node_factory.JsonParseNodeFactory", - "kiota_serialization_text.text_parse_node_factory.TextParseNodeFactory" + "kiota_serialization_text.text_parse_node_factory.TextParseNodeFactory", + "kiota_serialization_form.form_parse_node_factory.FormParseNodeFactory", } ); AddSerializationModulesImport(generatedCode, From ffa6ab5a247b1175ade0080fc8cd35272a28e67b Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 21:45:17 +0300 Subject: [PATCH 239/394] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b434be70c..c71c207b8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added the init command as part of the experience revamp of [#3356](https://github.com/microsoft/kiota/issues/3356) +- Added uri-form encoded serialization for Python. [#2075](https://github.com/microsoft/kiota/issues/2075) ### Changed From 3e0faadb564f8269060018fcf4b52accbd67ded5 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 21:45:46 +0300 Subject: [PATCH 240/394] Update README and appsettings --- README.md | 2 +- src/kiota/appsettings.json | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 856830281e..c288ce7b63 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The following table provides an overview of the languages supported by Kiota and | Go | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-go) | [FORM](https://github.com/microsoft/kiota-serialization-form-go), [JSON](https://github.com/microsoft/kiota-serialization-json-go), [MULTIPART](https://github.com/microsoft/kiota-serialization-multipart-go), [TEXT](https://github.com/microsoft/kiota-serialization-text-go) | [Anonymous](https://github.com/microsoft/kiota-abstractions-go/blob/main/authentication/anonymous_authentication_provider.go), [API Key](https://github.com/microsoft/kiota-abstractions-go/blob/main/authentication/api_key_authentication_provider.go), [Azure](https://github.com/microsoft/kiota-authentication-azure-go/) | [✔](https://github.com/microsoft/kiota-http-go/) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/go) | | Java | ✔ | [✔](https://github.com/microsoft/kiota-java/tree/main/components/abstractions) | [FORM](https://github.com/microsoft/kiota-java/tree/main/components/serialization/form), [JSON](https://github.com/microsoft/kiota-java/tree/main/components/serialization/json), [MULTIPART](https://github.com/microsoft/kiota-java/tree/main/components/serialization/multipart), [TEXT](https://github.com/microsoft/kiota-java/tree/main/components/serialization/text) | [Anonymous](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/authentication/AnonymousAuthenticationProvider.java), [API Key](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/authentication/ApiKeyAuthenticationProvider.java), [Azure](https://github.com/microsoft/kiota-java/tree/main/components/authentication/azure) | [✔](https://github.com/microsoft/kiota-java/tree/main/components/http/okHttp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/java) | | PHP | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-php) | [JSON](https://github.com/microsoft/kiota-serialization-json-php), [❌ FORM](https://github.com/microsoft/kiota/issues/2074), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3029), [TEXT](https://github.com/microsoft/kiota-serialization-text-php) | [Anonymous](https://github.com/microsoft/kiota-abstractions-php/blob/main/src/Authentication/AnonymousAuthenticationProvider.php), [✔️ PHP League](https://github.com/microsoft/kiota-authentication-phpleague-php) | [✔](https://github.com/microsoft/kiota-http-guzzle-php) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/php) | -| Python | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-python) | [❌ FORM](https://github.com/microsoft/kiota/issues/2075), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3030), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [✔](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) | +| Python | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-python) | [FORM]((https://github.com/microsoft/kiota-serialization-form-python), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3030), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [✔](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) | | Ruby | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-ruby) | [❌ FORM](https://github.com/microsoft/kiota/issues/2077), [JSON](https://github.com/microsoft/kiota-serialization-json-ruby), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3032), [❌ TEXT](https://github.com/microsoft/kiota/issues/1049) | [Anonymous](https://github.com/microsoft/kiota-abstractions-ruby/blob/main/lib/microsoft_kiota_abstractions/authentication/anonymous_authentication_provider.rb), [✔️ OAuth2](https://github.com/microsoft/kiota-authentication-oauth-ruby) | [✔](https://github.com/microsoft/kiota-http-ruby)| | | CLI | ✔ | (see CSharp) + [✔](https://github.com/microsoft/kiota-cli-commons) | (see CSharp) | (see CSharp) | (see CSharp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/cli) | | Swift | [▶](https://github.com/microsoft/kiota/issues/1449) | [✔](./abstractions/swift) | [❌ FORM](https://github.com/microsoft/kiota/issues/2076), [❌ JSON](https://github.com/microsoft/kiota/issues/1451), [❌ FORM](https://github.com/microsoft/kiota/issues/3033), [❌ TEXT](https://github.com/microsoft/kiota/issues/1452) | [Anonymous](./abstractions/swift/Source/MicrosoftKiotaAbstractions/Authentication/AnonymousAuthenticationProvider.swift), [❌ Azure](https://github.com/microsoft/kiota/issues/1453) | [❌](https://github.com/microsoft/kiota/issues/1454)| | diff --git a/src/kiota/appsettings.json b/src/kiota/appsettings.json index 4d28d5532d..667857da05 100644 --- a/src/kiota/appsettings.json +++ b/src/kiota/appsettings.json @@ -210,6 +210,10 @@ { "Name": "microsoft-kiota-serialization-text", "Version": "1.0.0" + }, + { + "Name": "microsoft-kiota-serialization-form", + "Version": "0.1.0" } ], "DependencyInstallCommand": "pip install {0}=={1}" @@ -276,4 +280,4 @@ "DependencyInstallCommand": "dotnet add package {0} --version {1}" } } -} +} \ No newline at end of file From d6bba174a52594a9a362ec31055aa91d38fd6e55 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 21:46:21 +0300 Subject: [PATCH 241/394] Update integration test dependency versions --- it/python/pyproject.toml | 11 ++++++----- it/python/requirements-dev.txt | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/it/python/pyproject.toml b/it/python/pyproject.toml index dbc6bcf7e5..ac6eec4e36 100644 --- a/it/python/pyproject.toml +++ b/it/python/pyproject.toml @@ -7,11 +7,12 @@ name = "integration-test" authors = [{name = "Microsoft", email = "graphtooling+python@microsoft.com"}] dependencies = [ "uritemplate >=4.1.1", - "microsoft-kiota-abstractions >= 0.6.0", - "microsoft-kiota-http >= 0.4.4", - "microsoft-kiota-authentication-azure >= 0.2.0", - "microsoft-kiota-serialization-json >= 0.3.7", - "microsoft-kiota-serialization-text >= 0.2.1" + "microsoft-kiota-abstractions >= 1.0.0", + "microsoft-kiota-http >= 1.0.0", + "microsoft-kiota-authentication-azure >= 1.0.0", + "microsoft-kiota-serialization-json >= 1.0.0", + "microsoft-kiota-serialization-text >= 1.0.0", + "microsoft-kiota-serialization-form >= 0.1.0", ] license = {file = "LICENSE"} readme = "README.md" diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 5d3614e338..61c41f9b0c 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -108,6 +108,8 @@ microsoft-kiota-serialization-json==1.0.1 microsoft-kiota-serialization-text==1.0.0 +microsoft-kiota-serializaion_form==0.1.0 + msal==1.26.0 msal-extensions==1.1.0 From 2ed619e677f80ce8504b262b1968d4fe5d2d0dc5 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 21:49:47 +0300 Subject: [PATCH 242/394] Revert launch file --- .vscode/launch.json | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index fbfb8e14e9..1b05649371 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,15 +30,12 @@ "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", "args": [ "generate", - "--backing-store", "--openapi", - // "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", - "${workspaceFolder}/samples/descs/openapi.yaml", + "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", "--language", "java", "-o", - // "${workspaceFolder}/samples/msgraph-mail/java/utilities/src/main/java/graphjavav4/utilities", - "${workspaceFolder}/samples/twitter/java", + "${workspaceFolder}/samples/msgraph-mail/java/utilities/src/main/java/graphjavav4/utilities", "-n", "graphjavav4.utilities" ], @@ -54,17 +51,12 @@ "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", "args": [ "generate", - "--backing-store", "--openapi", - // "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", - // "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", - // "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/beta/openapi.yaml", - "${workspaceFolder}/samples/descs/openapi.yaml", + "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", "--language", "csharp", "-o", - // "${workspaceFolder}/samples/msgraph-mail/dotnet", - "${workspaceFolder}/samples/twitter/dotnet", + "${workspaceFolder}/samples/msgraph-mail/dotnet", "-n", "Graphdotnetv4" ], @@ -101,16 +93,14 @@ "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", "args": [ "generate", - "--backing-store", "--openapi", - // "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", - "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", + "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", "--language", "php", "-o", "${workspaceFolder}/samples/msgraph-mail/php/src/", "-n", - "Microsoft\\Graph", + "Microsoft\\Graph" ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", @@ -167,24 +157,14 @@ "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", "args": [ "generate", - "--clean-output", - "--backing-store", "--openapi", "https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml", - // "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml", - // "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/beta/openapi.yaml", - // "${workspaceFolder}/samples/descs/openapi.yaml", "--language", "python", "-o", - // "${workspaceFolder}/samples/msgraph/python", - // "${workspaceFolder}/samples/msgraph/python/beta", "${workspaceFolder}/samples/msgraph-mail/python", - // "${workspaceFolder}/samples/twitter", - // "${userHome}/projects/ms/kiota-samples/msgraph-mail/python", "-n", - "GraphPythonv1", - // "GraphPythonBeta", + "GraphPythonv1" ], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", From b4c8821ccffbaf8f90a234d8211a2f79f31fe981 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 21:55:07 +0300 Subject: [PATCH 243/394] Update launch file --- .vscode/launch.json | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1b05649371..242d8b55d7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -196,10 +196,7 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": [ - "search", - "microsoft" - ], + "args": ["search", "microsoft"], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -210,10 +207,7 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": [ - "search", - "test" - ], + "args": ["search", "test"], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -255,11 +249,7 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": [ - "info", - "-l", - "CSharp" - ], + "args": ["info", "-l", "CSharp"], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -270,11 +260,7 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": [ - "update", - "-o", - "${workspaceFolder}/samples" - ], + "args": ["update", "-o", "${workspaceFolder}/samples"], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false @@ -285,11 +271,7 @@ "request": "launch", "preLaunchTask": "build", "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", - "args": [ - "login", - "github", - "device" - ], + "args": ["login", "github", "device"], "cwd": "${workspaceFolder}/src/kiota", "console": "internalConsole", "stopAtEntry": false From 369649a75fe31da16716d24858fd4a4ccbdf2ca1 Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 21:56:30 +0300 Subject: [PATCH 244/394] Fix launch file --- .vscode/launch.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 242d8b55d7..36465ec859 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -283,4 +283,4 @@ "processId": "${command:pickProcess}" } ] -} \ No newline at end of file +} From fb9c58bdf91a4f1fe43ab9a9f977c0191622c71a Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 21:59:19 +0300 Subject: [PATCH 245/394] Fix dependency name in integration tests --- it/python/requirements-dev.txt | 2 +- src/kiota/appsettings.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 61c41f9b0c..4ee23a2f02 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -108,7 +108,7 @@ microsoft-kiota-serialization-json==1.0.1 microsoft-kiota-serialization-text==1.0.0 -microsoft-kiota-serializaion_form==0.1.0 +microsoft-kiota-serializaion-form==0.1.0 msal==1.26.0 diff --git a/src/kiota/appsettings.json b/src/kiota/appsettings.json index 667857da05..71ac42668a 100644 --- a/src/kiota/appsettings.json +++ b/src/kiota/appsettings.json @@ -280,4 +280,4 @@ "DependencyInstallCommand": "dotnet add package {0} --version {1}" } } -} \ No newline at end of file +} From f403662b5af98be799bb7c951a8a58287ebacf4e Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 22:02:09 +0300 Subject: [PATCH 246/394] Fix typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c288ce7b63..1c7927b704 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The following table provides an overview of the languages supported by Kiota and | Go | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-go) | [FORM](https://github.com/microsoft/kiota-serialization-form-go), [JSON](https://github.com/microsoft/kiota-serialization-json-go), [MULTIPART](https://github.com/microsoft/kiota-serialization-multipart-go), [TEXT](https://github.com/microsoft/kiota-serialization-text-go) | [Anonymous](https://github.com/microsoft/kiota-abstractions-go/blob/main/authentication/anonymous_authentication_provider.go), [API Key](https://github.com/microsoft/kiota-abstractions-go/blob/main/authentication/api_key_authentication_provider.go), [Azure](https://github.com/microsoft/kiota-authentication-azure-go/) | [✔](https://github.com/microsoft/kiota-http-go/) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/go) | | Java | ✔ | [✔](https://github.com/microsoft/kiota-java/tree/main/components/abstractions) | [FORM](https://github.com/microsoft/kiota-java/tree/main/components/serialization/form), [JSON](https://github.com/microsoft/kiota-java/tree/main/components/serialization/json), [MULTIPART](https://github.com/microsoft/kiota-java/tree/main/components/serialization/multipart), [TEXT](https://github.com/microsoft/kiota-java/tree/main/components/serialization/text) | [Anonymous](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/authentication/AnonymousAuthenticationProvider.java), [API Key](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/authentication/ApiKeyAuthenticationProvider.java), [Azure](https://github.com/microsoft/kiota-java/tree/main/components/authentication/azure) | [✔](https://github.com/microsoft/kiota-java/tree/main/components/http/okHttp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/java) | | PHP | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-php) | [JSON](https://github.com/microsoft/kiota-serialization-json-php), [❌ FORM](https://github.com/microsoft/kiota/issues/2074), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3029), [TEXT](https://github.com/microsoft/kiota-serialization-text-php) | [Anonymous](https://github.com/microsoft/kiota-abstractions-php/blob/main/src/Authentication/AnonymousAuthenticationProvider.php), [✔️ PHP League](https://github.com/microsoft/kiota-authentication-phpleague-php) | [✔](https://github.com/microsoft/kiota-http-guzzle-php) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/php) | -| Python | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-python) | [FORM]((https://github.com/microsoft/kiota-serialization-form-python), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3030), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [✔](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) | +| Python | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-python) | [FORM](https://github.com/microsoft/kiota-serialization-form-python), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3030), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [✔](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) | | Ruby | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-ruby) | [❌ FORM](https://github.com/microsoft/kiota/issues/2077), [JSON](https://github.com/microsoft/kiota-serialization-json-ruby), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3032), [❌ TEXT](https://github.com/microsoft/kiota/issues/1049) | [Anonymous](https://github.com/microsoft/kiota-abstractions-ruby/blob/main/lib/microsoft_kiota_abstractions/authentication/anonymous_authentication_provider.rb), [✔️ OAuth2](https://github.com/microsoft/kiota-authentication-oauth-ruby) | [✔](https://github.com/microsoft/kiota-http-ruby)| | | CLI | ✔ | (see CSharp) + [✔](https://github.com/microsoft/kiota-cli-commons) | (see CSharp) | (see CSharp) | (see CSharp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/cli) | | Swift | [▶](https://github.com/microsoft/kiota/issues/1449) | [✔](./abstractions/swift) | [❌ FORM](https://github.com/microsoft/kiota/issues/2076), [❌ JSON](https://github.com/microsoft/kiota/issues/1451), [❌ FORM](https://github.com/microsoft/kiota/issues/3033), [❌ TEXT](https://github.com/microsoft/kiota/issues/1452) | [Anonymous](./abstractions/swift/Source/MicrosoftKiotaAbstractions/Authentication/AnonymousAuthenticationProvider.swift), [❌ Azure](https://github.com/microsoft/kiota/issues/1453) | [❌](https://github.com/microsoft/kiota/issues/1454)| | From f14b85eee6ca0dd317aa4a83aa5f08a702fb3d4d Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Wed, 21 Feb 2024 22:11:46 +0300 Subject: [PATCH 247/394] Fix form serialization dependency name --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 4ee23a2f02..317506ca99 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -108,7 +108,7 @@ microsoft-kiota-serialization-json==1.0.1 microsoft-kiota-serialization-text==1.0.0 -microsoft-kiota-serializaion-form==0.1.0 +microsoft-kiota-serialization-form==0.1.0 msal==1.26.0 From d027b51f5357703011157657b0b7fa02c0d70d8e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 21 Feb 2024 14:15:59 -0500 Subject: [PATCH 248/394] - updates unit test to match implementation Signed-off-by: Vincent Biret --- .../Extensions/OpenApiUrlTreeNodeExtensionsTests.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs index e0a96d9ff4..0a7030661a 100644 --- a/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs +++ b/tests/Kiota.Builder.Tests/Extensions/OpenApiUrlTreeNodeExtensionsTests.cs @@ -982,13 +982,12 @@ public void repro4085() Assert.NotNull(resultNode); Assert.Equal("\\path", resultNode.Path); - var thingId = GetChildNodeByPath(resultNode, "{thingId}"); - Assert.Equal("\\path\\{thingId}", thingId.Path); - Assert.Equal("{+baseurl}/path/{thingId}", thingId.GetUrlTemplate()); + Assert.Null(GetChildNodeByPath(resultNode, "{thingId}")); + Assert.Null(GetChildNodeByPath(resultNode, "{differentThingId}")); - var differentThingId = GetChildNodeByPath(resultNode, "{differentThingId}"); - Assert.Equal("\\path\\{differentThingId}", differentThingId.Path); - Assert.Equal("{+baseurl}/path/{differentThingId}", differentThingId.GetUrlTemplate()); + var differentThingId = GetChildNodeByPath(resultNode, "{differentThingId-id}"); + Assert.Equal("\\path\\{differentThingId-id}", differentThingId.Path); + Assert.Equal("{+baseurl}/path/{differentThingId%2Did}", differentThingId.GetUrlTemplate()); } private static OpenApiUrlTreeNode GetChildNodeByPath(OpenApiUrlTreeNode node, string path) { From 34a698db67242646d9685057fcc0b08d98d17f98 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 21 Feb 2024 14:44:23 -0500 Subject: [PATCH 249/394] - fixes fluent API test for GH --- it/java/gh/src/test/java/GHAPITest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it/java/gh/src/test/java/GHAPITest.java b/it/java/gh/src/test/java/GHAPITest.java index 12135b3dd8..cc9f50ec48 100644 --- a/it/java/gh/src/test/java/GHAPITest.java +++ b/it/java/gh/src/test/java/GHAPITest.java @@ -16,8 +16,8 @@ void basicTest() throws Exception { adapter.setBaseUrl("http://127.0.0.1:1080"); var client = new ApiClient(adapter); - client.repos().byOwnerId("my-owner").byReposId("my-repo").get(); - client.repos().byTemplateOwner("my-template-owner").byTemplateRepo("my-repo").post(null); + client.repos().byOrgId("my-owner").byRepoId("my-repo").get(); + client.repos().byOrgId("my-owner").byRepoId("my-repo").generate().post(null); } } From 2937cd05b207a38229fe5ecb63c88f4fc60bec55 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 08:58:58 +0000 Subject: [PATCH 250/394] Bump httpcore from 1.0.3 to 1.0.4 in /it/python Bumps [httpcore](https://github.com/encode/httpcore) from 1.0.3 to 1.0.4. - [Release notes](https://github.com/encode/httpcore/releases) - [Changelog](https://github.com/encode/httpcore/blob/master/CHANGELOG.md) - [Commits](https://github.com/encode/httpcore/compare/1.0.3...1.0.4) --- updated-dependencies: - dependency-name: httpcore dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 5d3614e338..70d51e0a3e 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -92,7 +92,7 @@ h2==4.1.0 hpack==4.0.0 ; python_full_version >= '3.6.1' -httpcore==1.0.3 ; python_version >= '3.7' +httpcore==1.0.4 ; python_version >= '3.7' httpx[http2]==0.26.0 From 238a0ec605ac272e9dd7b0184b1159c3eefe107f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 08:59:06 +0000 Subject: [PATCH 251/394] Bump httpx[http2] from 0.26.0 to 0.27.0 in /it/python Bumps [httpx[http2]](https://github.com/encode/httpx) from 0.26.0 to 0.27.0. - [Release notes](https://github.com/encode/httpx/releases) - [Changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md) - [Commits](https://github.com/encode/httpx/compare/0.26.0...0.27.0) --- updated-dependencies: - dependency-name: httpx[http2] dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 5d3614e338..51a5997eba 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -94,7 +94,7 @@ hpack==4.0.0 ; python_full_version >= '3.6.1' httpcore==1.0.3 ; python_version >= '3.7' -httpx[http2]==0.26.0 +httpx[http2]==0.27.0 hyperframe==6.0.1 ; python_full_version >= '3.6.1' From fd1a06fc134049d294be0d7f2408c8ae2b6609e0 Mon Sep 17 00:00:00 2001 From: Andrea Peruffo Date: Thu, 22 Feb 2024 12:02:31 +0000 Subject: [PATCH 252/394] [Java] add remaining Object methods to the reserved list --- src/Kiota.Builder/Refiners/JavaReservedNamesProvider.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Kiota.Builder/Refiners/JavaReservedNamesProvider.cs b/src/Kiota.Builder/Refiners/JavaReservedNamesProvider.cs index 9b80829986..b6f6204eaa 100644 --- a/src/Kiota.Builder/Refiners/JavaReservedNamesProvider.cs +++ b/src/Kiota.Builder/Refiners/JavaReservedNamesProvider.cs @@ -21,9 +21,11 @@ public class JavaReservedNamesProvider : IReservedNamesProvider "double", "else", "enum", + "equals", "extends", "false", "final", + "finalize", "finally", "float", "for", @@ -55,6 +57,7 @@ public class JavaReservedNamesProvider : IReservedNamesProvider "this", "throw", "throws", + "tostring", "transient", "true", "try", From 9e5b62cc1f82c1cc8dbd5183219fb6d91a30d1d9 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 22 Feb 2024 15:26:30 +0300 Subject: [PATCH 253/394] Check that stream responses don't generate paging code (#4210) * Check that stream responses don't generate paging code * Update changelog --- CHANGELOG.md | 1 + .../Writers/CLI/CliCodeMethodWriter.cs | 30 +++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b434be70c..be77daa67d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed `cref` tags not closed in doc comments in CSharp generation. - Deduplicates 4XX and 5XX error mappings when they map to the same type to reduce emitted code. [#4025](https://github.com/microsoft/kiota/issues/4025) - 📢📢📢 Java generation is now stable! 🚀🚀🚀 special thanks to @andreaTP (Red Hat) for all the help. +- Fixed bug where stream responses would generate incorrect partial paging code. [#4207](https://github.com/microsoft/kiota/issues/4207) ## [1.11.1] - 2024-02-05 diff --git a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs index eac0cb25b8..9d7c94edca 100644 --- a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs @@ -317,7 +317,7 @@ private void AddCustomCommandOptions(LanguageWriter writer, ref List ava parameters.Add((OutputFilterQueryParamType, OutputFilterQueryParamName, null)); availableOptions.Add($"{InvocationContextParamName}.ParseResult.GetValueForOption({outputFilterQueryOptionName})"); - // Add --all option + // Add --all option for pageable data if (isPageable) { var allOptionName = $"{AllParamName}Option"; @@ -632,7 +632,7 @@ protected virtual void WriteCommandHandlerBody(CodeMethod codeElement, CodeClass if (parentClass .UnorderedMethods .FirstOrDefault(x => x.IsOfKind(CodeMethodKind.RequestGenerator) && x.HttpMethod == codeElement.HttpMethod) is not CodeMethod generatorMethod) return; - bool isStream = false; + bool isStreamReq = false; if (requestParams.requestBody is CodeParameter requestBodyParam) { var requestBodyParamType = requestBodyParam.Type as CodeType; @@ -663,7 +663,7 @@ protected virtual void WriteCommandHandlerBody(CodeMethod codeElement, CodeClass } else if (conventions.StreamTypeName.Equals(requestBodyParamType?.Name, StringComparison.OrdinalIgnoreCase)) { - isStream = true; + isStreamReq = true; var pName = requestBodyParam.Name; requestBodyParam.Name = "stream"; // Check for file existence @@ -680,7 +680,7 @@ protected virtual void WriteCommandHandlerBody(CodeMethod codeElement, CodeClass .Select(static x => x?.Name).Where(static x => x != null)); var separator = string.IsNullOrWhiteSpace(parametersList) ? "" : ", "; - WriteRequestInformation(writer, generatorMethod, parametersList, separator, isStream); + WriteRequestInformation(writer, generatorMethod, parametersList, separator, isStreamReq); var errorMappingVarName = "default"; if (codeElement.ErrorMappings.Any()) @@ -695,24 +695,24 @@ protected virtual void WriteCommandHandlerBody(CodeMethod codeElement, CodeClass writer.CloseBlock("};"); } - var requestMethod = "SendPrimitiveAsync"; - var pageInfo = codeElement?.PagingInformation; - if (isVoid || pageInfo != null) + var isStreamResp = conventions.StreamTypeName.Equals(returnType, StringComparison.OrdinalIgnoreCase); + const string SendNoContent = "SendNoContentAsync"; + const string SendStream = "SendPrimitiveAsync"; + if (isVoid) { - requestMethod = "SendNoContentAsync"; + writer.WriteLine($"await {RequestAdapterParamName}.{SendNoContent}(requestInfo, errorMapping: {errorMappingVarName}, cancellationToken: {CancellationTokenParamName});"); } - - if (pageInfo != null) + else if (!isStreamResp && !conventions.IsPrimitiveType(returnType) && codeElement.PagingInformation is { } pi) { - writer.WriteLine($"var pagingData = new PageLinkData(requestInfo, null, itemName: \"{pageInfo.ItemName}\", nextLinkName: \"{pageInfo.NextLinkName}\");"); - writer.WriteLine($"{(isVoid ? string.Empty : "var pageResponse = ")}await {PagingServiceParamName}.GetPagedDataAsync((info, token) => {RequestAdapterParamName}.{requestMethod}(info, cancellationToken: token), pagingData, {AllParamName}, {CancellationTokenParamName});"); + writer.WriteLine($"var pagingData = new PageLinkData(requestInfo, null, itemName: \"{pi.ItemName}\", nextLinkName: \"{pi.NextLinkName}\");"); + writer.WriteLine($"var pageResponse = await {PagingServiceParamName}.GetPagedDataAsync((info, token) => {RequestAdapterParamName}.{SendNoContent}(info, cancellationToken: token), pagingData, {AllParamName}, {CancellationTokenParamName});"); writer.WriteLine("var response = pageResponse?.Response;"); } else { - string suffix = string.Empty; - if (!isVoid) suffix = " ?? Stream.Null"; - writer.WriteLine($"{(isVoid ? string.Empty : "var response = ")}await {RequestAdapterParamName}.{requestMethod}(requestInfo, errorMapping: {errorMappingVarName}, cancellationToken: {CancellationTokenParamName}){suffix};"); + // TODO: Warn when paging information is available on a stream response + // https://github.com/microsoft/kiota/issues/4208 + writer.WriteLine($"var response = await {RequestAdapterParamName}.{SendStream}(requestInfo, errorMapping: {errorMappingVarName}, cancellationToken: {CancellationTokenParamName}) ?? Stream.Null;"); } } From b73493d533b100963aa2fe13d7552ab94fc15aa7 Mon Sep 17 00:00:00 2001 From: Llewellyn Roos Date: Thu, 22 Feb 2024 15:00:14 +0200 Subject: [PATCH 254/394] fix enum default value literal #4216 --- src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs index 1fb6d24e66..c5b809c950 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs @@ -255,8 +255,8 @@ private void WriteDeserializerFunction(CodeFunction codeFunction, LanguageWriter private static string GetDefaultValueLiteralForProperty(CodeProperty codeProperty) { if (string.IsNullOrEmpty(codeProperty.DefaultValue)) return string.Empty; - if (codeProperty.Type is CodeType propertyType && propertyType.TypeDefinition is CodeEnum enumDefinition) - return $"{enumDefinition.Name.ToFirstCharacterUpperCase()}.{codeProperty.DefaultValue.Trim('"').CleanupSymbolName().ToFirstCharacterUpperCase()}"; + if (codeProperty.Type is CodeType propertyType && propertyType.TypeDefinition is CodeEnum enumDefinition && enumDefinition.CodeEnumObject is not null) + return $"{enumDefinition.CodeEnumObject.Name.ToFirstCharacterUpperCase()}.{codeProperty.DefaultValue.Trim('"').CleanupSymbolName().ToFirstCharacterUpperCase()}"; return codeProperty.DefaultValue; } private static void WriteDefensiveStatements(CodeMethod codeElement, LanguageWriter writer) From d9717b1448d244681191c9b82b5fb69c344a00af Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Thu, 22 Feb 2024 08:15:15 -0700 Subject: [PATCH 255/394] sanitize string headers when writing request generator --- .../Writers/CSharp/CodeMethodWriter.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index bdab613416..f33ed1341c 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -418,22 +418,23 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req writer.WriteLine($"{RequestInfoVarName}.Configure({requestParams.requestConfiguration.Name});"); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue}\");"); + writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{SanitizeString(codeElement.AcceptHeaderValue)}\");"); if (requestParams.requestBody != null) { var suffix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; + var sanitizedRequestBodyContentType = SanitizeString(codeElement.RequestBodyContentType); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}.SetStreamContent({requestParams.requestBody.Name}, {requestParams.requestContentType.Name});"); - else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}.SetStreamContent({requestParams.requestBody.Name}, \"{codeElement.RequestBodyContentType}\");"); + else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"{RequestInfoVarName}.SetStreamContent({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\");"); } else if (currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) if (requestParams.requestBody.Type is CodeType bodyType && (bodyType.TypeDefinition is CodeClass || bodyType.Name.Equals("MultipartBody", StringComparison.OrdinalIgnoreCase))) - writer.WriteLine($"{RequestInfoVarName}.SetContentFromParsable({requestAdapterProperty.Name.ToFirstCharacterUpperCase()}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name});"); + writer.WriteLine($"{RequestInfoVarName}.SetContentFromParsable({requestAdapterProperty.Name.ToFirstCharacterUpperCase()}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name});"); else - writer.WriteLine($"{RequestInfoVarName}.SetContentFromScalar{suffix}({requestAdapterProperty.Name.ToFirstCharacterUpperCase()}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name});"); + writer.WriteLine($"{RequestInfoVarName}.SetContentFromScalar{suffix}({requestAdapterProperty.Name.ToFirstCharacterUpperCase()}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name});"); } writer.WriteLine($"return {RequestInfoVarName};"); @@ -669,4 +670,12 @@ _ when conventions.IsPrimitiveType(propertyType) => $"Write{propertyType.TrimEnd _ => $"WriteObjectValue<{propertyType.ToFirstCharacterUpperCase()}{(includeNullableRef ? "?" : string.Empty)}>", }; } + + /// + /// Sanitize a string for direct writing. + /// + /// The string to sanitize. + /// The sanitized string. + private static string SanitizeString(string input) + => input.Replace("\"", "\\\"", StringComparison.Ordinal); } From cff4cef89946f4eac8cd00e6c31d8477ff3fc7cc Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Thu, 22 Feb 2024 09:15:31 -0700 Subject: [PATCH 256/394] update other generators --- .../Writers/CLI/CliCodeMethodWriter.cs | 7 +++-- .../Writers/CSharp/CodeMethodWriter.cs | 12 ++------ .../Writers/Go/CodeMethodWriter.cs | 11 ++++---- .../Writers/Java/CodeMethodWriter.cs | 9 +++--- .../Writers/Php/CodeMethodWriter.cs | 9 +++--- .../Writers/Python/CodeMethodWriter.cs | 9 +++--- .../Writers/Ruby/CodeMethodWriter.cs | 9 +++--- src/Kiota.Builder/Writers/StringExtensions.cs | 28 +++++++++++++++++-- .../Writers/TypeScript/CodeConstantWriter.cs | 7 +++-- 9 files changed, 62 insertions(+), 39 deletions(-) diff --git a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs index 9d7c94edca..b651471c26 100644 --- a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs @@ -639,7 +639,7 @@ protected virtual void WriteCommandHandlerBody(CodeMethod codeElement, CodeClass if (requestBodyParamType?.TypeDefinition is CodeClass) { writer.WriteLine($"using var stream = new MemoryStream(Encoding.UTF8.GetBytes({requestBodyParam.Name}));"); - writer.WriteLine($"var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode(\"{generatorMethod.RequestBodyContentType}\", stream);"); + writer.WriteLine($"var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode(\"{generatorMethod.RequestBodyContentType.SanitizeDoubleQuote()}\", stream);"); var typeString = conventions.GetTypeString(requestBodyParamType, requestBodyParam, false); @@ -757,9 +757,10 @@ private static void WriteRequestInformation(LanguageWriter writer, CodeMethod ge // Set the content type header. Will not add the code if the method is a stream, has no RequestBodyContentType or if there's no body parameter. if (!isStream && generatorMethod.Parameters.Any(p => p.IsOfKind(CodeParameterKind.RequestBody))) { - if (!string.IsNullOrWhiteSpace(generatorMethod.RequestBodyContentType)) + var sanitizedRequestBodyContentType = generatorMethod.RequestBodyContentType.SanitizeDoubleQuote(); + if (!string.IsNullOrWhiteSpace(sanitizedRequestBodyContentType)) { - writer.WriteLine($"requestInfo.SetContentFromParsable({RequestAdapterParamName}, \"{generatorMethod.RequestBodyContentType}\", model);"); + writer.WriteLine($"requestInfo.SetContentFromParsable({RequestAdapterParamName}, \"{sanitizedRequestBodyContentType}\", model);"); } else { diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index f33ed1341c..08a2e53183 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -418,11 +418,11 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req writer.WriteLine($"{RequestInfoVarName}.Configure({requestParams.requestConfiguration.Name});"); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{SanitizeString(codeElement.AcceptHeaderValue)}\");"); + writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue.SanitizeDoubleQuote()}\");"); if (requestParams.requestBody != null) { var suffix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; - var sanitizedRequestBodyContentType = SanitizeString(codeElement.RequestBodyContentType); + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) @@ -670,12 +670,4 @@ _ when conventions.IsPrimitiveType(propertyType) => $"Write{propertyType.TrimEnd _ => $"WriteObjectValue<{propertyType.ToFirstCharacterUpperCase()}{(includeNullableRef ? "?" : string.Empty)}>", }; } - - /// - /// Sanitize a string for direct writing. - /// - /// The string to sanitize. - /// The sanitized string. - private static string SanitizeString(string input) - => input.Replace("\"", "\\\"", StringComparison.Ordinal); } diff --git a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs index cb7889c03f..41b1456864 100644 --- a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs @@ -882,17 +882,18 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req WriteLegacyRequestConfiguration(requestParams, writer); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue}\")"); + writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue.SanitizeDoubleQuote()}\")"); if (requestParams.requestBody != null) { var bodyParamReference = $"{requestParams.requestBody.Name.ToFirstCharacterLowerCase()}"; var collectionSuffix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals("binary", StringComparison.OrdinalIgnoreCase) || requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, *{requestParams.requestContentType.Name.ToFirstCharacterLowerCase()})"); - else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, \"{codeElement.RequestBodyContentType}\")"); + else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, \"{sanitizedRequestBodyContentType}\")"); } else if (requestParams.requestBody.Type is CodeType bodyType && (bodyType.TypeDefinition is CodeClass || bodyType.TypeDefinition is CodeInterface || bodyType.Name.Equals("MultipartBody", StringComparison.OrdinalIgnoreCase))) { @@ -902,11 +903,11 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req WriteCollectionCast(parsableSymbol, bodyParamReference, "cast", writer, string.Empty, false); bodyParamReference = "cast"; } - writer.WriteLine($"err := {RequestInfoVarName}.SetContentFromParsable{collectionSuffix}({contextParameterName}, m.{requestAdapterPropertyName}, \"{codeElement.RequestBodyContentType}\", {bodyParamReference})"); + writer.WriteLine($"err := {RequestInfoVarName}.SetContentFromParsable{collectionSuffix}({contextParameterName}, m.{requestAdapterPropertyName}, \"{sanitizedRequestBodyContentType}\", {bodyParamReference})"); writer.WriteBlock("if err != nil {", "}", "return nil, err"); } else - writer.WriteLine($"{RequestInfoVarName}.SetContentFromScalar{collectionSuffix}({contextParameterName}, m.{requestAdapterPropertyName}, \"{codeElement.RequestBodyContentType}\", {bodyParamReference})"); + writer.WriteLine($"{RequestInfoVarName}.SetContentFromScalar{collectionSuffix}({contextParameterName}, m.{requestAdapterPropertyName}, \"{sanitizedRequestBodyContentType}\", {bodyParamReference})"); } writer.WriteLine($"return {RequestInfoVarName}, nil"); diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index ab24292b6d..8bf41ca027 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -585,24 +585,25 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.headers.tryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue}\");"); + writer.WriteLine($"{RequestInfoVarName}.headers.tryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue.SanitizeDoubleQuote()}\");"); if (requestParams.requestBody != null && currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) { var toArrayPostfix = requestParams.requestBody.Type.IsCollection ? $".toArray(new {requestParams.requestBody.Type.Name}[0])" : string.Empty; var collectionPostfix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}.setStreamContent({requestParams.requestBody.Name}, {requestParams.requestContentType.Name});"); else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}.setStreamContent({requestParams.requestBody.Name}, \"{codeElement.RequestBodyContentType}\");"); + writer.WriteLine($"{RequestInfoVarName}.setStreamContent({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\");"); } else if (requestParams.requestBody.Type is CodeType bodyType && (bodyType.TypeDefinition is CodeClass || bodyType.Name.Equals("MultipartBody", StringComparison.OrdinalIgnoreCase))) - writer.WriteLine($"{RequestInfoVarName}.setContentFromParsable({requestAdapterProperty.Name}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name}{toArrayPostfix});"); + writer.WriteLine($"{RequestInfoVarName}.setContentFromParsable({requestAdapterProperty.Name}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name}{toArrayPostfix});"); else - writer.WriteLine($"{RequestInfoVarName}.setContentFromScalar{collectionPostfix}({requestAdapterProperty.Name}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name}{toArrayPostfix});"); + writer.WriteLine($"{RequestInfoVarName}.setContentFromScalar{collectionPostfix}({requestAdapterProperty.Name}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name}{toArrayPostfix});"); } writer.WriteLine($"return {RequestInfoVarName};"); diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 3fc6397717..375f986024 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -568,18 +568,19 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req if (requestParams.requestBody != null) { var suffix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}->setStreamContent({conventions.GetParameterName(requestParams.requestBody)}, {conventions.GetParameterName(requestParams.requestContentType)});"); else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}->setStreamContent({conventions.GetParameterName(requestParams.requestBody)}, \"{codeElement.RequestBodyContentType}\");"); + writer.WriteLine($"{RequestInfoVarName}->setStreamContent({conventions.GetParameterName(requestParams.requestBody)}, \"{sanitizedRequestBodyContentType}\");"); } else if (currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) if (requestParams.requestBody.Type is CodeType bodyType && bodyType.TypeDefinition is CodeClass) - writer.WriteLine($"{RequestInfoVarName}->setContentFromParsable{suffix}($this->{requestAdapterProperty.Name.ToFirstCharacterLowerCase()}, \"{codeElement.RequestBodyContentType}\", {conventions.GetParameterName(requestParams.requestBody)});"); + writer.WriteLine($"{RequestInfoVarName}->setContentFromParsable{suffix}($this->{requestAdapterProperty.Name.ToFirstCharacterLowerCase()}, \"{sanitizedRequestBodyContentType}\", {conventions.GetParameterName(requestParams.requestBody)});"); else - writer.WriteLine($"{RequestInfoVarName}->setContentFromScalar{suffix}($this->{requestAdapterProperty.Name.ToFirstCharacterLowerCase()}, \"{codeElement.RequestBodyContentType}\", {conventions.GetParameterName(requestParams.requestBody)});"); + writer.WriteLine($"{RequestInfoVarName}->setContentFromScalar{suffix}($this->{requestAdapterProperty.Name.ToFirstCharacterLowerCase()}, \"{sanitizedRequestBodyContentType}\", {conventions.GetParameterName(requestParams.requestBody)});"); } writer.WriteLine($"return {RequestInfoVarName};"); @@ -612,7 +613,7 @@ private void WriteRequestConfiguration(RequestParams requestParams, LanguageWrit private void WriteAcceptHeaderDef(CodeMethod codeMethod, LanguageWriter writer) { if (codeMethod.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}->tryAddHeader('Accept', \"{codeMethod.AcceptHeaderValue}\");"); + writer.WriteLine($"{RequestInfoVarName}->tryAddHeader('Accept', \"{codeMethod.AcceptHeaderValue.SanitizeDoubleQuote()}\");"); } private void WriteDeserializerBody(CodeClass parentClass, LanguageWriter writer, CodeMethod method, bool extendsModelClass = false) { diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index 42a222e36b..f156bf9262 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -619,7 +619,7 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req if (requestParams.requestConfiguration != null) writer.WriteLine($"{RequestInfoVarName}.configure({requestParams.requestConfiguration.Name})"); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.headers.try_add(\"Accept\", \"{codeElement.AcceptHeaderValue}\")"); + writer.WriteLine($"{RequestInfoVarName}.headers.try_add(\"Accept\", \"{codeElement.AcceptHeaderValue.SanitizeDoubleQuote()}\")"); if (currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) UpdateRequestInformationFromRequestBody(codeElement, requestParams, requestAdapterProperty, writer); writer.WriteLine($"return {RequestInfoVarName}"); @@ -823,17 +823,18 @@ private void UpdateRequestInformationFromRequestBody(CodeMethod codeElement, Req { if (requestParams.requestBody != null) { + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}.set_stream_content({requestParams.requestBody.Name}, {requestParams.requestContentType.Name})"); - else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}.set_stream_content({requestParams.requestBody.Name}, \"{codeElement.RequestBodyContentType}\")"); + else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"{RequestInfoVarName}.set_stream_content({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\")"); } else { var setMethodName = requestParams.requestBody.Type is CodeType bodyType && bodyType.TypeDefinition is CodeClass ? "set_content_from_parsable" : "set_content_from_scalar"; - writer.WriteLine($"{RequestInfoVarName}.{setMethodName}(self.{requestAdapterProperty.Name}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name})"); + writer.WriteLine($"{RequestInfoVarName}.{setMethodName}(self.{requestAdapterProperty.Name}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name})"); } } } diff --git a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs index a20eeb3823..0bad38caf3 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs @@ -301,15 +301,16 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } if (requestParams.requestBody != null) { + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, {requestParams.requestContentType.Name})"); - else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, \"{codeElement.RequestBodyContentType}\")"); + else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\")"); } else if (parentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) - writer.WriteLine($"request_info.set_content_from_parsable(@{requestAdapterProperty.Name.ToSnakeCase()}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name})"); + writer.WriteLine($"request_info.set_content_from_parsable(@{requestAdapterProperty.Name.ToSnakeCase()}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name})"); } } if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty urlTemplateParamsProperty && @@ -321,7 +322,7 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } writer.WriteLine($"request_info.http_method = :{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}"); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"request_info.headers.try_add('Accept', '{codeElement.AcceptHeaderValue}')"); + writer.WriteLine($"request_info.headers.try_add('Accept', '{codeElement.AcceptHeaderValue.SanitizeSingleQuote()}')"); writer.WriteLine("return request_info"); } private static string GetPropertyCall(CodeProperty property, string defaultValue) => property == null ? defaultValue : $"@{property.NamePrefix}{property.Name.ToSnakeCase()}"; diff --git a/src/Kiota.Builder/Writers/StringExtensions.cs b/src/Kiota.Builder/Writers/StringExtensions.cs index c3e9c21043..ace7e7a465 100644 --- a/src/Kiota.Builder/Writers/StringExtensions.cs +++ b/src/Kiota.Builder/Writers/StringExtensions.cs @@ -1,5 +1,29 @@ -namespace Kiota.Builder.Writers; +using System; + +namespace Kiota.Builder.Writers; + public static class StringExtensions { - public static string StripArraySuffix(this string original) => string.IsNullOrEmpty(original) ? original : original.TrimEnd(']').TrimEnd('['); + public static string StripArraySuffix(this string original) => + string.IsNullOrEmpty(original) ? original : original.TrimEnd(']').TrimEnd('['); + + /// + /// Sanitize a string for direct writing. + /// + /// The string to sanitize. + /// The sanitized string. + public static string SanitizeDoubleQuote(this string original) + => string.IsNullOrEmpty(original) + ? original + : original.Replace("\"", "\\\"", StringComparison.Ordinal); + + /// + /// Sanitize a string for direct writing. + /// + /// The string to sanitize. + /// The sanitized string. + public static string SanitizeSingleQuote(this string original) + => string.IsNullOrEmpty(original) + ? original + : original.Replace("'", "\\'", StringComparison.Ordinal); } diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index c1d37e9233..a3e0f9401b 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -105,7 +105,7 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri writer.WriteLine($"uriTemplate: {urlTemplateValue},"); if (codeClass.Methods.FirstOrDefault(x => x.Kind is CodeMethodKind.RequestGenerator && x.HttpMethod == executorMethod.HttpMethod) is { } generatorMethod && generatorMethod.AcceptHeaderValue is string acceptHeader && !string.IsNullOrEmpty(acceptHeader)) - writer.WriteLine($"responseBodyContentType: \"{acceptHeader}\","); + writer.WriteLine($"responseBodyContentType: \"{acceptHeader.SanitizeDoubleQuote()}\","); if (executorMethod.ErrorMappings.Any()) { writer.StartBlock("errorMappings: {"); @@ -118,8 +118,9 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri writer.WriteLine($"adapterMethodName: \"{GetSendRequestMethodName(isVoid, isStream, executorMethod.ReturnType.IsCollection, returnTypeWithoutCollectionSymbol)}\","); if (!isVoid) writer.WriteLine($"responseBodyFactory: {GetTypeFactory(isVoid, isStream, executorMethod, writer)},"); - if (!string.IsNullOrEmpty(executorMethod.RequestBodyContentType)) - writer.WriteLine($"requestBodyContentType: \"{executorMethod.RequestBodyContentType}\","); + var sanitizedRequestBodyContentType = executorMethod.RequestBodyContentType.SanitizeDoubleQuote(); + if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"requestBodyContentType: \"{sanitizedRequestBodyContentType}\","); if (executorMethod.Parameters.FirstOrDefault(static x => x.Kind is CodeParameterKind.RequestBody) is CodeParameter requestBody) { if (GetBodySerializer(requestBody) is string bodySerializer) From f5905a47b9cc6a47b2248e6dd803fd59496afd81 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Thu, 22 Feb 2024 09:15:39 -0700 Subject: [PATCH 257/394] add tests --- .../Writers/CSharp/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ .../Writers/Go/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ .../Writers/Java/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ .../Writers/Php/CodeMethodWriterTests.cs | 28 ++++++++++++++++++- .../Writers/Python/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ .../Writers/Ruby/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ 6 files changed, 162 insertions(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs index 2dc8a949f3..23a5f940c3 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs @@ -1850,4 +1850,31 @@ public void WritesDeprecationInformationFromBuilder() var result = tw.ToString(); Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("requestInfo.Headers.TryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs index da4ee17d6b..9b099d21f0 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs @@ -2266,4 +2266,31 @@ public void WritesMessageOverrideOnPrimary() Assert.Contains("Error()(string) {", result); Assert.Contains("return *(m.GetProp1()", result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("requestInfo.Headers.TryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index 1fa32f6de4..b472fa3aa6 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -2132,4 +2132,31 @@ public void WritesMessageOverrideOnPrimary() Assert.Contains("String getErrorMessage() ", result); Assert.Contains("return this.getProp1()", result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("requestInfo.headers.tryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\");", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs index d7fecc9ab7..2682b6a9e6 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs @@ -2481,5 +2481,31 @@ public async Task WritesFullyQualifiedNameWhenSimilarTypeAlreadyExists() Assert.Contains("return $this->requestAdapter->sendAsync($requestInfo, [\\Microsoft\\Graph\\Models\\Security\\ModelA::class, 'createFromDiscriminatorValue'], null);", result); Assert.Contains("return $this->requestAdapter->sendCollectionAsync($requestInfo, [Component::class, 'createFromDiscriminatorValue'], null);", result); } - + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + languageWriter.Write(method); + var result = stringWriter.ToString(); + Assert.Contains("$requestInfo->tryAddHeader('Accept', \"application/json; profile=\\\"CamelCase\\\"\");", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + languageWriter.Write(method); + var result = stringWriter.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index 6693c4ba59..6f93b7124b 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -2202,4 +2202,31 @@ public void WritesDeprecationInformationFromBuilder() var result = tw.ToString(); Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("request_info.headers.try_add(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs index 44cb9bdd9c..5d24252c52 100644 --- a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs @@ -1074,4 +1074,31 @@ public void DoesntWriteReadOnlyPropertiesInSerializerBody() Assert.DoesNotContain("ReadOnlyProperty", result); AssertExtensions.CurlyBracesAreClosed(result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile='CamelCase'"); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("request_info.headers.try_add('Accept', 'application/json; profile=\\'CamelCase\\'')", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } From ac13233e6f0564043fc5ea035facea44c8782624 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Thu, 22 Feb 2024 08:15:15 -0700 Subject: [PATCH 258/394] sanitize string headers when writing request generator --- .../Writers/CSharp/CodeMethodWriter.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index bdab613416..f33ed1341c 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -418,22 +418,23 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req writer.WriteLine($"{RequestInfoVarName}.Configure({requestParams.requestConfiguration.Name});"); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue}\");"); + writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{SanitizeString(codeElement.AcceptHeaderValue)}\");"); if (requestParams.requestBody != null) { var suffix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; + var sanitizedRequestBodyContentType = SanitizeString(codeElement.RequestBodyContentType); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}.SetStreamContent({requestParams.requestBody.Name}, {requestParams.requestContentType.Name});"); - else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}.SetStreamContent({requestParams.requestBody.Name}, \"{codeElement.RequestBodyContentType}\");"); + else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"{RequestInfoVarName}.SetStreamContent({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\");"); } else if (currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) if (requestParams.requestBody.Type is CodeType bodyType && (bodyType.TypeDefinition is CodeClass || bodyType.Name.Equals("MultipartBody", StringComparison.OrdinalIgnoreCase))) - writer.WriteLine($"{RequestInfoVarName}.SetContentFromParsable({requestAdapterProperty.Name.ToFirstCharacterUpperCase()}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name});"); + writer.WriteLine($"{RequestInfoVarName}.SetContentFromParsable({requestAdapterProperty.Name.ToFirstCharacterUpperCase()}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name});"); else - writer.WriteLine($"{RequestInfoVarName}.SetContentFromScalar{suffix}({requestAdapterProperty.Name.ToFirstCharacterUpperCase()}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name});"); + writer.WriteLine($"{RequestInfoVarName}.SetContentFromScalar{suffix}({requestAdapterProperty.Name.ToFirstCharacterUpperCase()}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name});"); } writer.WriteLine($"return {RequestInfoVarName};"); @@ -669,4 +670,12 @@ _ when conventions.IsPrimitiveType(propertyType) => $"Write{propertyType.TrimEnd _ => $"WriteObjectValue<{propertyType.ToFirstCharacterUpperCase()}{(includeNullableRef ? "?" : string.Empty)}>", }; } + + /// + /// Sanitize a string for direct writing. + /// + /// The string to sanitize. + /// The sanitized string. + private static string SanitizeString(string input) + => input.Replace("\"", "\\\"", StringComparison.Ordinal); } From d9bb58bea1f8108483cac7830aee134fbed37d5c Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Thu, 22 Feb 2024 09:15:31 -0700 Subject: [PATCH 259/394] update other generators --- .../Writers/CLI/CliCodeMethodWriter.cs | 7 +++-- .../Writers/CSharp/CodeMethodWriter.cs | 12 ++------ .../Writers/Go/CodeMethodWriter.cs | 11 ++++---- .../Writers/Java/CodeMethodWriter.cs | 9 +++--- .../Writers/Php/CodeMethodWriter.cs | 9 +++--- .../Writers/Python/CodeMethodWriter.cs | 9 +++--- .../Writers/Ruby/CodeMethodWriter.cs | 9 +++--- src/Kiota.Builder/Writers/StringExtensions.cs | 28 +++++++++++++++++-- .../Writers/TypeScript/CodeConstantWriter.cs | 7 +++-- 9 files changed, 62 insertions(+), 39 deletions(-) diff --git a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs index 9d7c94edca..b651471c26 100644 --- a/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CLI/CliCodeMethodWriter.cs @@ -639,7 +639,7 @@ protected virtual void WriteCommandHandlerBody(CodeMethod codeElement, CodeClass if (requestBodyParamType?.TypeDefinition is CodeClass) { writer.WriteLine($"using var stream = new MemoryStream(Encoding.UTF8.GetBytes({requestBodyParam.Name}));"); - writer.WriteLine($"var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode(\"{generatorMethod.RequestBodyContentType}\", stream);"); + writer.WriteLine($"var parseNode = ParseNodeFactoryRegistry.DefaultInstance.GetRootParseNode(\"{generatorMethod.RequestBodyContentType.SanitizeDoubleQuote()}\", stream);"); var typeString = conventions.GetTypeString(requestBodyParamType, requestBodyParam, false); @@ -757,9 +757,10 @@ private static void WriteRequestInformation(LanguageWriter writer, CodeMethod ge // Set the content type header. Will not add the code if the method is a stream, has no RequestBodyContentType or if there's no body parameter. if (!isStream && generatorMethod.Parameters.Any(p => p.IsOfKind(CodeParameterKind.RequestBody))) { - if (!string.IsNullOrWhiteSpace(generatorMethod.RequestBodyContentType)) + var sanitizedRequestBodyContentType = generatorMethod.RequestBodyContentType.SanitizeDoubleQuote(); + if (!string.IsNullOrWhiteSpace(sanitizedRequestBodyContentType)) { - writer.WriteLine($"requestInfo.SetContentFromParsable({RequestAdapterParamName}, \"{generatorMethod.RequestBodyContentType}\", model);"); + writer.WriteLine($"requestInfo.SetContentFromParsable({RequestAdapterParamName}, \"{sanitizedRequestBodyContentType}\", model);"); } else { diff --git a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs index f33ed1341c..08a2e53183 100644 --- a/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs @@ -418,11 +418,11 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req writer.WriteLine($"{RequestInfoVarName}.Configure({requestParams.requestConfiguration.Name});"); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{SanitizeString(codeElement.AcceptHeaderValue)}\");"); + writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue.SanitizeDoubleQuote()}\");"); if (requestParams.requestBody != null) { var suffix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; - var sanitizedRequestBodyContentType = SanitizeString(codeElement.RequestBodyContentType); + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) @@ -670,12 +670,4 @@ _ when conventions.IsPrimitiveType(propertyType) => $"Write{propertyType.TrimEnd _ => $"WriteObjectValue<{propertyType.ToFirstCharacterUpperCase()}{(includeNullableRef ? "?" : string.Empty)}>", }; } - - /// - /// Sanitize a string for direct writing. - /// - /// The string to sanitize. - /// The sanitized string. - private static string SanitizeString(string input) - => input.Replace("\"", "\\\"", StringComparison.Ordinal); } diff --git a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs index cb7889c03f..41b1456864 100644 --- a/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Go/CodeMethodWriter.cs @@ -882,17 +882,18 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req WriteLegacyRequestConfiguration(requestParams, writer); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue}\")"); + writer.WriteLine($"{RequestInfoVarName}.Headers.TryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue.SanitizeDoubleQuote()}\")"); if (requestParams.requestBody != null) { var bodyParamReference = $"{requestParams.requestBody.Name.ToFirstCharacterLowerCase()}"; var collectionSuffix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals("binary", StringComparison.OrdinalIgnoreCase) || requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, *{requestParams.requestContentType.Name.ToFirstCharacterLowerCase()})"); - else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, \"{codeElement.RequestBodyContentType}\")"); + else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"{RequestInfoVarName}.SetStreamContentAndContentType({bodyParamReference}, \"{sanitizedRequestBodyContentType}\")"); } else if (requestParams.requestBody.Type is CodeType bodyType && (bodyType.TypeDefinition is CodeClass || bodyType.TypeDefinition is CodeInterface || bodyType.Name.Equals("MultipartBody", StringComparison.OrdinalIgnoreCase))) { @@ -902,11 +903,11 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req WriteCollectionCast(parsableSymbol, bodyParamReference, "cast", writer, string.Empty, false); bodyParamReference = "cast"; } - writer.WriteLine($"err := {RequestInfoVarName}.SetContentFromParsable{collectionSuffix}({contextParameterName}, m.{requestAdapterPropertyName}, \"{codeElement.RequestBodyContentType}\", {bodyParamReference})"); + writer.WriteLine($"err := {RequestInfoVarName}.SetContentFromParsable{collectionSuffix}({contextParameterName}, m.{requestAdapterPropertyName}, \"{sanitizedRequestBodyContentType}\", {bodyParamReference})"); writer.WriteBlock("if err != nil {", "}", "return nil, err"); } else - writer.WriteLine($"{RequestInfoVarName}.SetContentFromScalar{collectionSuffix}({contextParameterName}, m.{requestAdapterPropertyName}, \"{codeElement.RequestBodyContentType}\", {bodyParamReference})"); + writer.WriteLine($"{RequestInfoVarName}.SetContentFromScalar{collectionSuffix}({contextParameterName}, m.{requestAdapterPropertyName}, \"{sanitizedRequestBodyContentType}\", {bodyParamReference})"); } writer.WriteLine($"return {RequestInfoVarName}, nil"); diff --git a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs index ab24292b6d..8bf41ca027 100644 --- a/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Java/CodeMethodWriter.cs @@ -585,24 +585,25 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.headers.tryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue}\");"); + writer.WriteLine($"{RequestInfoVarName}.headers.tryAdd(\"Accept\", \"{codeElement.AcceptHeaderValue.SanitizeDoubleQuote()}\");"); if (requestParams.requestBody != null && currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) { var toArrayPostfix = requestParams.requestBody.Type.IsCollection ? $".toArray(new {requestParams.requestBody.Type.Name}[0])" : string.Empty; var collectionPostfix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}.setStreamContent({requestParams.requestBody.Name}, {requestParams.requestContentType.Name});"); else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}.setStreamContent({requestParams.requestBody.Name}, \"{codeElement.RequestBodyContentType}\");"); + writer.WriteLine($"{RequestInfoVarName}.setStreamContent({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\");"); } else if (requestParams.requestBody.Type is CodeType bodyType && (bodyType.TypeDefinition is CodeClass || bodyType.Name.Equals("MultipartBody", StringComparison.OrdinalIgnoreCase))) - writer.WriteLine($"{RequestInfoVarName}.setContentFromParsable({requestAdapterProperty.Name}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name}{toArrayPostfix});"); + writer.WriteLine($"{RequestInfoVarName}.setContentFromParsable({requestAdapterProperty.Name}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name}{toArrayPostfix});"); else - writer.WriteLine($"{RequestInfoVarName}.setContentFromScalar{collectionPostfix}({requestAdapterProperty.Name}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name}{toArrayPostfix});"); + writer.WriteLine($"{RequestInfoVarName}.setContentFromScalar{collectionPostfix}({requestAdapterProperty.Name}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name}{toArrayPostfix});"); } writer.WriteLine($"return {RequestInfoVarName};"); diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 3fc6397717..375f986024 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -568,18 +568,19 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req if (requestParams.requestBody != null) { var suffix = requestParams.requestBody.Type.IsCollection ? "Collection" : string.Empty; + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}->setStreamContent({conventions.GetParameterName(requestParams.requestBody)}, {conventions.GetParameterName(requestParams.requestContentType)});"); else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}->setStreamContent({conventions.GetParameterName(requestParams.requestBody)}, \"{codeElement.RequestBodyContentType}\");"); + writer.WriteLine($"{RequestInfoVarName}->setStreamContent({conventions.GetParameterName(requestParams.requestBody)}, \"{sanitizedRequestBodyContentType}\");"); } else if (currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) if (requestParams.requestBody.Type is CodeType bodyType && bodyType.TypeDefinition is CodeClass) - writer.WriteLine($"{RequestInfoVarName}->setContentFromParsable{suffix}($this->{requestAdapterProperty.Name.ToFirstCharacterLowerCase()}, \"{codeElement.RequestBodyContentType}\", {conventions.GetParameterName(requestParams.requestBody)});"); + writer.WriteLine($"{RequestInfoVarName}->setContentFromParsable{suffix}($this->{requestAdapterProperty.Name.ToFirstCharacterLowerCase()}, \"{sanitizedRequestBodyContentType}\", {conventions.GetParameterName(requestParams.requestBody)});"); else - writer.WriteLine($"{RequestInfoVarName}->setContentFromScalar{suffix}($this->{requestAdapterProperty.Name.ToFirstCharacterLowerCase()}, \"{codeElement.RequestBodyContentType}\", {conventions.GetParameterName(requestParams.requestBody)});"); + writer.WriteLine($"{RequestInfoVarName}->setContentFromScalar{suffix}($this->{requestAdapterProperty.Name.ToFirstCharacterLowerCase()}, \"{sanitizedRequestBodyContentType}\", {conventions.GetParameterName(requestParams.requestBody)});"); } writer.WriteLine($"return {RequestInfoVarName};"); @@ -612,7 +613,7 @@ private void WriteRequestConfiguration(RequestParams requestParams, LanguageWrit private void WriteAcceptHeaderDef(CodeMethod codeMethod, LanguageWriter writer) { if (codeMethod.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}->tryAddHeader('Accept', \"{codeMethod.AcceptHeaderValue}\");"); + writer.WriteLine($"{RequestInfoVarName}->tryAddHeader('Accept', \"{codeMethod.AcceptHeaderValue.SanitizeDoubleQuote()}\");"); } private void WriteDeserializerBody(CodeClass parentClass, LanguageWriter writer, CodeMethod method, bool extendsModelClass = false) { diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index 42a222e36b..f156bf9262 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -619,7 +619,7 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req if (requestParams.requestConfiguration != null) writer.WriteLine($"{RequestInfoVarName}.configure({requestParams.requestConfiguration.Name})"); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"{RequestInfoVarName}.headers.try_add(\"Accept\", \"{codeElement.AcceptHeaderValue}\")"); + writer.WriteLine($"{RequestInfoVarName}.headers.try_add(\"Accept\", \"{codeElement.AcceptHeaderValue.SanitizeDoubleQuote()}\")"); if (currentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) UpdateRequestInformationFromRequestBody(codeElement, requestParams, requestAdapterProperty, writer); writer.WriteLine($"return {RequestInfoVarName}"); @@ -823,17 +823,18 @@ private void UpdateRequestInformationFromRequestBody(CodeMethod codeElement, Req { if (requestParams.requestBody != null) { + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"{RequestInfoVarName}.set_stream_content({requestParams.requestBody.Name}, {requestParams.requestContentType.Name})"); - else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"{RequestInfoVarName}.set_stream_content({requestParams.requestBody.Name}, \"{codeElement.RequestBodyContentType}\")"); + else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"{RequestInfoVarName}.set_stream_content({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\")"); } else { var setMethodName = requestParams.requestBody.Type is CodeType bodyType && bodyType.TypeDefinition is CodeClass ? "set_content_from_parsable" : "set_content_from_scalar"; - writer.WriteLine($"{RequestInfoVarName}.{setMethodName}(self.{requestAdapterProperty.Name}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name})"); + writer.WriteLine($"{RequestInfoVarName}.{setMethodName}(self.{requestAdapterProperty.Name}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name})"); } } } diff --git a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs index a20eeb3823..0bad38caf3 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs @@ -301,15 +301,16 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } if (requestParams.requestBody != null) { + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, {requestParams.requestContentType.Name})"); - else if (!string.IsNullOrEmpty(codeElement.RequestBodyContentType)) - writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, \"{codeElement.RequestBodyContentType}\")"); + else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\")"); } else if (parentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) - writer.WriteLine($"request_info.set_content_from_parsable(@{requestAdapterProperty.Name.ToSnakeCase()}, \"{codeElement.RequestBodyContentType}\", {requestParams.requestBody.Name})"); + writer.WriteLine($"request_info.set_content_from_parsable(@{requestAdapterProperty.Name.ToSnakeCase()}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name})"); } } if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty urlTemplateParamsProperty && @@ -321,7 +322,7 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } writer.WriteLine($"request_info.http_method = :{codeElement.HttpMethod.Value.ToString().ToUpperInvariant()}"); if (codeElement.ShouldAddAcceptHeader) - writer.WriteLine($"request_info.headers.try_add('Accept', '{codeElement.AcceptHeaderValue}')"); + writer.WriteLine($"request_info.headers.try_add('Accept', '{codeElement.AcceptHeaderValue.SanitizeSingleQuote()}')"); writer.WriteLine("return request_info"); } private static string GetPropertyCall(CodeProperty property, string defaultValue) => property == null ? defaultValue : $"@{property.NamePrefix}{property.Name.ToSnakeCase()}"; diff --git a/src/Kiota.Builder/Writers/StringExtensions.cs b/src/Kiota.Builder/Writers/StringExtensions.cs index c3e9c21043..ace7e7a465 100644 --- a/src/Kiota.Builder/Writers/StringExtensions.cs +++ b/src/Kiota.Builder/Writers/StringExtensions.cs @@ -1,5 +1,29 @@ -namespace Kiota.Builder.Writers; +using System; + +namespace Kiota.Builder.Writers; + public static class StringExtensions { - public static string StripArraySuffix(this string original) => string.IsNullOrEmpty(original) ? original : original.TrimEnd(']').TrimEnd('['); + public static string StripArraySuffix(this string original) => + string.IsNullOrEmpty(original) ? original : original.TrimEnd(']').TrimEnd('['); + + /// + /// Sanitize a string for direct writing. + /// + /// The string to sanitize. + /// The sanitized string. + public static string SanitizeDoubleQuote(this string original) + => string.IsNullOrEmpty(original) + ? original + : original.Replace("\"", "\\\"", StringComparison.Ordinal); + + /// + /// Sanitize a string for direct writing. + /// + /// The string to sanitize. + /// The sanitized string. + public static string SanitizeSingleQuote(this string original) + => string.IsNullOrEmpty(original) + ? original + : original.Replace("'", "\\'", StringComparison.Ordinal); } diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index c1d37e9233..a3e0f9401b 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -105,7 +105,7 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri writer.WriteLine($"uriTemplate: {urlTemplateValue},"); if (codeClass.Methods.FirstOrDefault(x => x.Kind is CodeMethodKind.RequestGenerator && x.HttpMethod == executorMethod.HttpMethod) is { } generatorMethod && generatorMethod.AcceptHeaderValue is string acceptHeader && !string.IsNullOrEmpty(acceptHeader)) - writer.WriteLine($"responseBodyContentType: \"{acceptHeader}\","); + writer.WriteLine($"responseBodyContentType: \"{acceptHeader.SanitizeDoubleQuote()}\","); if (executorMethod.ErrorMappings.Any()) { writer.StartBlock("errorMappings: {"); @@ -118,8 +118,9 @@ private void WriteRequestsMetadataConstant(CodeConstant codeElement, LanguageWri writer.WriteLine($"adapterMethodName: \"{GetSendRequestMethodName(isVoid, isStream, executorMethod.ReturnType.IsCollection, returnTypeWithoutCollectionSymbol)}\","); if (!isVoid) writer.WriteLine($"responseBodyFactory: {GetTypeFactory(isVoid, isStream, executorMethod, writer)},"); - if (!string.IsNullOrEmpty(executorMethod.RequestBodyContentType)) - writer.WriteLine($"requestBodyContentType: \"{executorMethod.RequestBodyContentType}\","); + var sanitizedRequestBodyContentType = executorMethod.RequestBodyContentType.SanitizeDoubleQuote(); + if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) + writer.WriteLine($"requestBodyContentType: \"{sanitizedRequestBodyContentType}\","); if (executorMethod.Parameters.FirstOrDefault(static x => x.Kind is CodeParameterKind.RequestBody) is CodeParameter requestBody) { if (GetBodySerializer(requestBody) is string bodySerializer) From 5710263c6ba7bc20cccf7227c7b862a55563747f Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Thu, 22 Feb 2024 09:15:39 -0700 Subject: [PATCH 260/394] add tests --- .../Writers/CSharp/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ .../Writers/Go/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ .../Writers/Java/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ .../Writers/Php/CodeMethodWriterTests.cs | 28 ++++++++++++++++++- .../Writers/Python/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ .../Writers/Ruby/CodeMethodWriterTests.cs | 27 ++++++++++++++++++ 6 files changed, 162 insertions(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs index 2dc8a949f3..23a5f940c3 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs @@ -1850,4 +1850,31 @@ public void WritesDeprecationInformationFromBuilder() var result = tw.ToString(); Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("requestInfo.Headers.TryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs index da4ee17d6b..9b099d21f0 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs @@ -2266,4 +2266,31 @@ public void WritesMessageOverrideOnPrimary() Assert.Contains("Error()(string) {", result); Assert.Contains("return *(m.GetProp1()", result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("requestInfo.Headers.TryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index 1fa32f6de4..b472fa3aa6 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -2132,4 +2132,31 @@ public void WritesMessageOverrideOnPrimary() Assert.Contains("String getErrorMessage() ", result); Assert.Contains("return this.getProp1()", result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("requestInfo.headers.tryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\");", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs index d7fecc9ab7..2682b6a9e6 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs @@ -2481,5 +2481,31 @@ public async Task WritesFullyQualifiedNameWhenSimilarTypeAlreadyExists() Assert.Contains("return $this->requestAdapter->sendAsync($requestInfo, [\\Microsoft\\Graph\\Models\\Security\\ModelA::class, 'createFromDiscriminatorValue'], null);", result); Assert.Contains("return $this->requestAdapter->sendCollectionAsync($requestInfo, [Component::class, 'createFromDiscriminatorValue'], null);", result); } - + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + languageWriter.Write(method); + var result = stringWriter.ToString(); + Assert.Contains("$requestInfo->tryAddHeader('Accept', \"application/json; profile=\\\"CamelCase\\\"\");", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + languageWriter.Write(method); + var result = stringWriter.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index 6693c4ba59..6f93b7124b 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -2202,4 +2202,31 @@ public void WritesDeprecationInformationFromBuilder() var result = tw.ToString(); Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile=\"CamelCase\""); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("request_info.headers.try_add(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } diff --git a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs index 44cb9bdd9c..5d24252c52 100644 --- a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs @@ -1074,4 +1074,31 @@ public void DoesntWriteReadOnlyPropertiesInSerializerBody() Assert.DoesNotContain("ReadOnlyProperty", result); AssertExtensions.CurlyBracesAreClosed(result); } + + [Fact] + public void WritesRequestGeneratorAcceptHeaderQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Get; + AddRequestProperties(); + method.AcceptedResponseTypes.Add("application/json; profile='CamelCase'"); + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("request_info.headers.try_add('Accept', 'application/json; profile=\\'CamelCase\\'')", result); + } + + [Fact] + public void WritesRequestGeneratorContentTypeQuotes() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(); + method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + } } From 2bb8492823aa2dec6d131b213ed574b075cb5cff Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Thu, 22 Feb 2024 09:19:19 -0700 Subject: [PATCH 261/394] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82f797bd6f..5b6ee54c0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Deduplicates 4XX and 5XX error mappings when they map to the same type to reduce emitted code. [#4025](https://github.com/microsoft/kiota/issues/4025) - 📢📢📢 Java generation is now stable! 🚀🚀🚀 special thanks to @andreaTP (Red Hat) for all the help. - Fixed bug where stream responses would generate incorrect partial paging code. [#4207](https://github.com/microsoft/kiota/issues/4207) +- Sanitize Accept and Content-Type headers during generation. [#4211](https://github.com/microsoft/kiota/issues/4211) ## [1.11.1] - 2024-02-05 From dc3c44363ea8713638ea0b9f64a5d9859a8caaaf Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 22 Feb 2024 14:14:24 -0500 Subject: [PATCH 262/394] Apply suggestions from code review --- src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs | 6 +++--- .../Writers/Ruby/CodeMethodWriterTests.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs index 0bad38caf3..8b51bc0e29 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs @@ -301,16 +301,16 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } if (requestParams.requestBody != null) { - var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeSingleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, {requestParams.requestContentType.Name})"); else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) - writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\")"); + writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, '{sanitizedRequestBodyContentType}')"); } else if (parentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) - writer.WriteLine($"request_info.set_content_from_parsable(@{requestAdapterProperty.Name.ToSnakeCase()}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name})"); + writer.WriteLine($"request_info.set_content_from_parsable(@{requestAdapterProperty.Name.ToSnakeCase()}, '{sanitizedRequestBodyContentType}', {requestParams.requestBody.Name})"); } } if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty urlTemplateParamsProperty && diff --git a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs index 5d24252c52..42801436e5 100644 --- a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs @@ -1099,6 +1099,6 @@ public void WritesRequestGeneratorContentTypeQuotes() method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; writer.Write(method); var result = tw.ToString(); - Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + Assert.Contains("'application/json; profile=\\'CamelCase\\''", result); } } From 6e6735056d2e568635767fa36ab8287533c8253f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 22 Feb 2024 14:56:59 -0500 Subject: [PATCH 263/394] - fixes formatting --- src/Kiota.Builder/Writers/StringExtensions.cs | 2 +- .../Writers/CSharp/CodeMethodWriterTests.cs | 4 ++-- tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs | 4 ++-- .../Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs | 4 ++-- .../Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs | 4 ++-- .../Writers/Python/CodeMethodWriterTests.cs | 4 ++-- .../Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Kiota.Builder/Writers/StringExtensions.cs b/src/Kiota.Builder/Writers/StringExtensions.cs index ace7e7a465..46f9461283 100644 --- a/src/Kiota.Builder/Writers/StringExtensions.cs +++ b/src/Kiota.Builder/Writers/StringExtensions.cs @@ -16,7 +16,7 @@ public static string SanitizeDoubleQuote(this string original) => string.IsNullOrEmpty(original) ? original : original.Replace("\"", "\\\"", StringComparison.Ordinal); - + /// /// Sanitize a string for direct writing. /// diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs index 23a5f940c3..820e7d2a5d 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs @@ -1850,7 +1850,7 @@ public void WritesDeprecationInformationFromBuilder() var result = tw.ToString(); Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); } - + [Fact] public void WritesRequestGeneratorAcceptHeaderQuotes() { @@ -1863,7 +1863,7 @@ public void WritesRequestGeneratorAcceptHeaderQuotes() var result = tw.ToString(); Assert.Contains("requestInfo.Headers.TryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); } - + [Fact] public void WritesRequestGeneratorContentTypeQuotes() { diff --git a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs index 9b099d21f0..54ded91a6e 100644 --- a/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Go/CodeMethodWriterTests.cs @@ -2266,7 +2266,7 @@ public void WritesMessageOverrideOnPrimary() Assert.Contains("Error()(string) {", result); Assert.Contains("return *(m.GetProp1()", result); } - + [Fact] public void WritesRequestGeneratorAcceptHeaderQuotes() { @@ -2279,7 +2279,7 @@ public void WritesRequestGeneratorAcceptHeaderQuotes() var result = tw.ToString(); Assert.Contains("requestInfo.Headers.TryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); } - + [Fact] public void WritesRequestGeneratorContentTypeQuotes() { diff --git a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs index b472fa3aa6..dca1b6850f 100644 --- a/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Java/CodeMethodWriterTests.cs @@ -2132,7 +2132,7 @@ public void WritesMessageOverrideOnPrimary() Assert.Contains("String getErrorMessage() ", result); Assert.Contains("return this.getProp1()", result); } - + [Fact] public void WritesRequestGeneratorAcceptHeaderQuotes() { @@ -2145,7 +2145,7 @@ public void WritesRequestGeneratorAcceptHeaderQuotes() var result = tw.ToString(); Assert.Contains("requestInfo.headers.tryAdd(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\");", result); } - + [Fact] public void WritesRequestGeneratorContentTypeQuotes() { diff --git a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs index 2682b6a9e6..f5dd725799 100644 --- a/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Php/CodeMethodWriterTests.cs @@ -2481,7 +2481,7 @@ public async Task WritesFullyQualifiedNameWhenSimilarTypeAlreadyExists() Assert.Contains("return $this->requestAdapter->sendAsync($requestInfo, [\\Microsoft\\Graph\\Models\\Security\\ModelA::class, 'createFromDiscriminatorValue'], null);", result); Assert.Contains("return $this->requestAdapter->sendCollectionAsync($requestInfo, [Component::class, 'createFromDiscriminatorValue'], null);", result); } - + [Fact] public void WritesRequestGeneratorAcceptHeaderQuotes() { @@ -2494,7 +2494,7 @@ public void WritesRequestGeneratorAcceptHeaderQuotes() var result = stringWriter.ToString(); Assert.Contains("$requestInfo->tryAddHeader('Accept', \"application/json; profile=\\\"CamelCase\\\"\");", result); } - + [Fact] public void WritesRequestGeneratorContentTypeQuotes() { diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index 6f93b7124b..b4d73a1481 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -2202,7 +2202,7 @@ public void WritesDeprecationInformationFromBuilder() var result = tw.ToString(); Assert.Contains("This method is obsolete. Use NewAwesomeMethod instead.", result); } - + [Fact] public void WritesRequestGeneratorAcceptHeaderQuotes() { @@ -2215,7 +2215,7 @@ public void WritesRequestGeneratorAcceptHeaderQuotes() var result = tw.ToString(); Assert.Contains("request_info.headers.try_add(\"Accept\", \"application/json; profile=\\\"CamelCase\\\"\")", result); } - + [Fact] public void WritesRequestGeneratorContentTypeQuotes() { diff --git a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs index 42801436e5..2933fa05fe 100644 --- a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs @@ -1074,7 +1074,7 @@ public void DoesntWriteReadOnlyPropertiesInSerializerBody() Assert.DoesNotContain("ReadOnlyProperty", result); AssertExtensions.CurlyBracesAreClosed(result); } - + [Fact] public void WritesRequestGeneratorAcceptHeaderQuotes() { @@ -1087,7 +1087,7 @@ public void WritesRequestGeneratorAcceptHeaderQuotes() var result = tw.ToString(); Assert.Contains("request_info.headers.try_add('Accept', 'application/json; profile=\\'CamelCase\\'')", result); } - + [Fact] public void WritesRequestGeneratorContentTypeQuotes() { From a0e3d6c041cce71bfbae2c03b58dfca72baba552 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 22 Feb 2024 15:12:17 -0500 Subject: [PATCH 264/394] - fixes failing unit test after quotes normalziation Signed-off-by: Vincent Biret --- tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs index 2933fa05fe..1f2a128c5c 100644 --- a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs @@ -1096,7 +1096,7 @@ public void WritesRequestGeneratorContentTypeQuotes() method.HttpMethod = HttpMethod.Post; AddRequestProperties(); AddRequestBodyParameters(); - method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; + method.RequestBodyContentType = "application/json; profile='CamelCase'"; writer.Write(method); var result = tw.ToString(); Assert.Contains("'application/json; profile=\\'CamelCase\\''", result); From 7ffd6abe44761eb8bc480e5470e6f78d79a57ca3 Mon Sep 17 00:00:00 2001 From: Llewellyn Roos Date: Thu, 22 Feb 2024 22:30:07 +0200 Subject: [PATCH 265/394] Add test for TypeScript enum object reference --- tests/Kiota.Builder.Tests/TestHelper.cs | 2 ++ .../TypeScript/CodeFunctionWriterTests.cs | 23 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/TestHelper.cs b/tests/Kiota.Builder.Tests/TestHelper.cs index bd9725336f..aa81170632 100644 --- a/tests/Kiota.Builder.Tests/TestHelper.cs +++ b/tests/Kiota.Builder.Tests/TestHelper.cs @@ -115,6 +115,8 @@ public static void AddSerializationPropertiesToModelClass(CodeClass modelClass) { Name = "EnumType" }; + var enumOption = new CodeEnumOption() { Name = "SomeOption" }; + propertyEnum.AddOption(enumOption); parentNamespace.AddEnum(propertyEnum); modelClass.AddProperty(new CodeProperty { diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index 18358913bb..059e5a1c2a 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -333,6 +333,26 @@ public async Task WritesDeSerializerBodyWithDefaultValue() Name = "string", }, }); + var propertyEnum = new CodeEnum + { + Name = "EnumTypeWithOption", + Parent = parentClass, + }; + var enumOption = new CodeEnumOption() { Name = "SomeOption" }; + propertyEnum.AddOption(enumOption); + var codeNamespace = parentClass.Parent as CodeNamespace; + codeNamespace.AddEnum(propertyEnum); + parentClass.AddProperty(new CodeProperty + { + Name = "propWithDefaultEnum", + DefaultValue = enumOption.Name, + Type = new CodeType + { + Name = "EnumTypeWithOption", + TypeDefinition = propertyEnum, + } + }); + await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.TypeScript }, root); var deserializerFunction = root.FindChildByName($"deserializeInto{parentClass.Name.ToFirstCharacterUpperCase()}"); Assert.NotNull(deserializerFunction); @@ -342,6 +362,7 @@ public async Task WritesDeSerializerBodyWithDefaultValue() writer.Write(deserializerFunction); var result = tw.ToString(); Assert.Contains("?? \"Test Value\"", result); + Assert.Contains("?? EnumTypeWithOptionObject.SomeOption", result); } [Fact] public async Task WritesInheritedSerializerBody() @@ -1032,6 +1053,6 @@ public async Task WritesConstructorWithEnumValue() var serializeFunction = root.FindChildByName($"Serialize{parentClass.Name.ToFirstCharacterUpperCase()}"); writer.Write(serializeFunction); var result = tw.ToString(); - Assert.Contains($" ?? {codeEnum.Name.ToFirstCharacterUpperCase()}.{defaultValue.CleanupSymbolName()}", result);//ensure symbol is cleaned up + Assert.Contains($" ?? {codeEnum.CodeEnumObject.Name.ToFirstCharacterUpperCase()}.{defaultValue.CleanupSymbolName()}", result);//ensure symbol is cleaned up } } From 09d031096d3b225c441cd8cdcb1f038d1bea3b91 Mon Sep 17 00:00:00 2001 From: Llewellyn Roos Date: Fri, 23 Feb 2024 08:36:43 +0200 Subject: [PATCH 266/394] Update change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index be77daa67d..cdc291662b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Deduplicates 4XX and 5XX error mappings when they map to the same type to reduce emitted code. [#4025](https://github.com/microsoft/kiota/issues/4025) - 📢📢📢 Java generation is now stable! 🚀🚀🚀 special thanks to @andreaTP (Red Hat) for all the help. - Fixed bug where stream responses would generate incorrect partial paging code. [#4207](https://github.com/microsoft/kiota/issues/4207) +- Fixed a bug in enum default value generator for TypeScript. [#4216](https://github.com/microsoft/kiota/issues/4216) ## [1.11.1] - 2024-02-05 From ebddda5861200ad075ee0532279009f115fcf137 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:08:16 +0000 Subject: [PATCH 267/394] Bump the kiota-dependencies group in /it/csharp with 7 updates Bumps the kiota-dependencies group in /it/csharp with 7 updates: | Package | From | To | | --- | --- | --- | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.9` | `1.7.10` | | [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet) | `1.1.3` | `1.1.4` | | [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) | `1.3.6` | `1.3.7` | | [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) | `1.1.3` | `1.1.4` | | [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet) | `1.1.5` | `1.1.6` | | [Microsoft.kiota.Serialization.Multipart](https://github.com/microsoft/kiota-serialization-multipart-dotnet) | `1.1.2` | `1.1.3` | | [Microsoft.Kiota.Serialization.Text](https://github.com/microsoft/kiota-serialization-text-dotnet) | `1.1.2` | `1.1.3` | Updates `Microsoft.Kiota.Abstractions` from 1.7.9 to 1.7.10 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.9...v1.7.10) Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.6 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.6...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.5 to 1.1.6 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.5...v1.1.6) Updates `Microsoft.kiota.Serialization.Multipart` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-multipart-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-multipart-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-multipart-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.Kiota.Serialization.Text` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-text-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-text-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-text-dotnet/compare/v1.1.2...v1.1.3) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.kiota.Serialization.Multipart dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Text dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index d514deda3e..f3243a7531 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -10,13 +10,13 @@ - + - + From 37cf45247d8ad2a2a28ae8637cc77596a56834ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:14:34 +0000 Subject: [PATCH 268/394] Bump @types/node from 20.11.19 to 20.11.20 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.19 to 20.11.20. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 44a446cf61..27a2ba8e08 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", + "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From 6411c3c9e568500ebca8fe71d3ca8893d5de27c0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:30:33 +0000 Subject: [PATCH 269/394] Bump msal from 1.26.0 to 1.27.0 in /it/python Bumps [msal](https://github.com/AzureAD/microsoft-authentication-library-for-python) from 1.26.0 to 1.27.0. - [Release notes](https://github.com/AzureAD/microsoft-authentication-library-for-python/releases) - [Commits](https://github.com/AzureAD/microsoft-authentication-library-for-python/compare/1.26.0...1.27.0) --- updated-dependencies: - dependency-name: msal dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index d0c5ef29c7..63beae9b7c 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -110,7 +110,7 @@ microsoft-kiota-serialization-text==1.0.0 microsoft-kiota-serialization-form==0.1.0 -msal==1.26.0 +msal==1.27.0 msal-extensions==1.1.0 From 2cd42db3891cd419c2c57fb523803e27ea2b307f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:57:37 +0000 Subject: [PATCH 270/394] Bump @types/node from 20.11.19 to 20.11.20 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.19 to 20.11.20. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index c6ce40ac0f..a449dde866 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.19", + "@types/node": "^20.11.20", "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", @@ -828,9 +828,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", + "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 2d0465b373..0d7df652a0 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.19", + "@types/node": "^20.11.20", "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", From 02c17d2eb8efb3800100668e05c5be9abae82268 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 23 Feb 2024 07:41:59 -0500 Subject: [PATCH 271/394] - fixes formatting --- .../Writers/TypeScript/CodeFunctionWriterTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs index 059e5a1c2a..8855644e50 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs @@ -339,17 +339,17 @@ public async Task WritesDeSerializerBodyWithDefaultValue() Parent = parentClass, }; var enumOption = new CodeEnumOption() { Name = "SomeOption" }; - propertyEnum.AddOption(enumOption); + propertyEnum.AddOption(enumOption); var codeNamespace = parentClass.Parent as CodeNamespace; codeNamespace.AddEnum(propertyEnum); parentClass.AddProperty(new CodeProperty { - Name = "propWithDefaultEnum", + Name = "propWithDefaultEnum", DefaultValue = enumOption.Name, Type = new CodeType { Name = "EnumTypeWithOption", - TypeDefinition = propertyEnum, + TypeDefinition = propertyEnum, } }); From 813463264ddc74a355e94113bb066b70bf663216 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 23 Feb 2024 08:18:09 -0500 Subject: [PATCH 272/394] - adds token to step to avoid throttling --- .github/workflows/build-vscode-extension.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-vscode-extension.yml b/.github/workflows/build-vscode-extension.yml index 44ad4eb9c3..561362855d 100644 --- a/.github/workflows/build-vscode-extension.yml +++ b/.github/workflows/build-vscode-extension.yml @@ -6,6 +6,9 @@ on: branches: [main] pull_request: +permissions: + contents: read + jobs: build_extension: runs-on: ubuntu-latest @@ -20,6 +23,7 @@ jobs: owner: microsoft repo: kiota excludes: prerelease, draft + token: ${{ secrets.GITHUB_TOKEN }} - run: scripts/update-vscode-releases.ps1 -version "${{ steps.last_release.outputs.release }}" -filePath "./vscode/microsoft-kiota/package.json" -online shell: pwsh - name: Install dependencies From f1982dbb518d1bd45d5378376e7e17d7eb8d0ade Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Sat, 24 Feb 2024 13:01:53 -0700 Subject: [PATCH 273/394] Add generation of enum array in query --- CHANGELOG.md | 1 + .../Extensions/OpenApiSchemaExtensions.cs | 13 ++- src/Kiota.Builder/KiotaBuilder.cs | 9 ++- .../Kiota.Builder.Tests/KiotaBuilderTests.cs | 80 +++++++++++++++++++ 4 files changed, 97 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57601a4e2c..621e36c610 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed bug where stream responses would generate incorrect partial paging code. [#4207](https://github.com/microsoft/kiota/issues/4207) - Sanitize Accept and Content-Type headers during generation. [#4211](https://github.com/microsoft/kiota/issues/4211) - Fixed a bug in enum default value generator for TypeScript. [#4216](https://github.com/microsoft/kiota/issues/4216) +- Generate enum array for query parameters. [#4225](https://github.com/microsoft/kiota/issues/4225) ## [1.11.1] - 2024-02-05 diff --git a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs index 4c705bdeeb..5ce2c5df44 100644 --- a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs @@ -47,10 +47,19 @@ public static string GetSchemaName(this OpenApiSchema schema) return schema.GetSchemaNames().LastOrDefault()?.TrimStart('$') ?? string.Empty;// OData $ref } + public static OpenApiSchema? GetSchema(this OpenApiSchema schema) + { + if (schema is null) + return null; + + return schema.IsArray() ? schema.Items : schema; + } + public static bool IsReferencedSchema(this OpenApiSchema schema) { - var isReference = schema?.Reference != null; - if (isReference && schema!.Reference.IsExternal) + var currentSchema = schema.GetSchema(); + var isReference = currentSchema?.Reference != null; + if (isReference && currentSchema!.Reference.IsExternal) throw new NotSupportedException("External references are not supported in this version of Kiota. While Kiota awaits on OpenAPI.Net to support inlining external references, you can use https://www.nuget.org/packages/Microsoft.OpenApi.Hidi to generate an OpenAPI description with inlined external references and then use this new reference with Kiota."); return isReference; } diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 0351366d1b..128874b921 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -1905,7 +1905,7 @@ private CodeElement AddModelDeclarationIfDoesntExist(OpenApiUrlTreeNode currentN { if (GetExistingDeclaration(currentNamespace, currentNode, declarationName) is not CodeEnum existingDeclaration) // we can find it in the components { - return AddEnumDeclaration(currentNode, schema, declarationName, currentNamespace); + return AddEnumDeclaration(currentNode, schema.GetSchema() ?? schema, declarationName, currentNamespace); } return existingDeclaration; } @@ -2412,9 +2412,9 @@ private void AddPropertyForQueryParameter(OpenApiUrlTreeNode node, OperationType { CodeType? resultType = default; var addBackwardCompatibleParameter = false; - if (parameter.Schema.IsEnum()) + var schema = parameter.Schema.GetSchema() ?? parameter.Schema; + if (schema.IsEnum()) { - var schema = parameter.Schema; var codeNamespace = schema.IsReferencedSchema() switch { true => GetShortestNamespace(parameterClass.GetImmediateParentOfType(), schema), // referenced schema @@ -2429,11 +2429,12 @@ private void AddPropertyForQueryParameter(OpenApiUrlTreeNode node, OperationType resultType = new CodeType { TypeDefinition = enumDeclaration, + IsNullable = !parameter.Schema.IsArray() }; addBackwardCompatibleParameter = true; } } - resultType ??= GetPrimitiveType(parameter.Schema) ?? new CodeType() + resultType ??= GetPrimitiveType(schema) ?? new CodeType() { // since its a query parameter default to string if there is no schema // it also be an object type, but we'd need to create the model in that case and there's no standard on how to serialize those as query parameters diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs index cc0f7850af..9bdd20ae8e 100644 --- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs +++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs @@ -12,6 +12,7 @@ using Kiota.Builder.Extensions; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.MicrosoftExtensions; @@ -7613,4 +7614,83 @@ The comment text in [Atlassian Document var linkIssueRequestJsonBeanClass = codeModel.FindChildByName("LinkIssueRequestJsonBean"); Assert.NotNull(linkIssueRequestJsonBeanClass); } + + [Fact] + public async Task EnumArrayQueryParameter() + { + const string schemaDocument = """ + openapi: 3.0.2 + info: + title: Enum + version: 1.0.0 + paths: + /EnumQuery: + get: + parameters: + - name: enumValues + in: query + schema: + type: array + items: + $ref: '#/components/schemas/EnumValue' + - name: enumValues2 + in: query + schema: + $ref: '#/components/schemas/EnumValue' + responses: + '200': + description: response + content: + application/json: + schema: + $ref: '#/components/schemas/EnumObject' + components: + schemas: + EnumValue: + type: string + enum: + - Value1 + - Value2 + - Value3 + EnumObject: + type: object + properties: + enumArray: + type: array + items: + $ref: '#/components/schemas/EnumValue' + """; + + var tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()); + await using var fs = await GetDocumentStream(schemaDocument); + + var builder = new KiotaBuilder( + NullLogger.Instance, + new GenerationConfiguration + { + ClientClassName = "EnumTest", + OpenAPIFilePath = tempFilePath, + IncludeAdditionalData = false + }, + _httpClient); + + var document = await builder.CreateOpenApiDocumentAsync(fs); + Assert.NotNull(document); + var node = builder.CreateUriSpace(document); + var codeModel = builder.CreateSourceModel(node); + Assert.NotNull(codeModel); + var enumRequestBuilder = codeModel.FindChildByName("EnumQueryRequestBuilder"); + Assert.NotNull(enumRequestBuilder); + var queryParameters = enumRequestBuilder.FindChildByName("EnumQueryRequestBuilderGetQueryParameters"); + Assert.NotNull(queryParameters); + + Assert.Contains(queryParameters.Properties, p => + p.Type is + { + IsCollection: true, + IsArray: true, + CollectionKind: CodeTypeBase.CodeTypeCollectionKind.Array, + Name: "EnumValue" + }); + } } From b94da66fb4f1419f02b83b8cadbe14adaf67dcb1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:22:22 +0000 Subject: [PATCH 274/394] Bump the eslint group in /vscode/microsoft-kiota with 1 update Bumps the eslint group in /vscode/microsoft-kiota with 1 update: [eslint](https://github.com/eslint/eslint). Updates `eslint` from 8.56.0 to 8.57.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.56.0...v8.57.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: eslint ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 34 ++++++++++++------------ vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 27a2ba8e08..f4c0da826d 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -23,7 +23,7 @@ "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "@vscode/test-electron": "^2.3.9", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "glob": "^10.3.10", "mocha": "^10.3.0", "ts-loader": "^9.5.1", @@ -101,22 +101,22 @@ } }, "node_modules/@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -137,9 +137,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", "dev": true }, "node_modules/@isaacs/cliui": { @@ -1708,16 +1708,16 @@ } }, "node_modules/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index d44ff9d4b7..13207057ae 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -430,7 +430,7 @@ "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "@vscode/test-electron": "^2.3.9", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "glob": "^10.3.10", "mocha": "^10.3.0", "ts-loader": "^9.5.1", From eda2b1d60992407174fbc2f5a6f5e2efe73e1fe0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:28:06 +0000 Subject: [PATCH 275/394] Bump the kiota-dependencies group with 6 updates Bumps the kiota-dependencies group with 6 updates: | Package | From | To | | --- | --- | --- | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.6` | `1.7.10` | | [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) | `1.3.4` | `1.3.7` | | [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) | `1.1.1` | `1.1.4` | | [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet) | `1.1.4` | `1.1.6` | | [Microsoft.Kiota.Serialization.Text](https://github.com/microsoft/kiota-serialization-text-dotnet) | `1.1.2` | `1.1.3` | | [Microsoft.kiota.Serialization.Multipart](https://github.com/microsoft/kiota-serialization-multipart-dotnet) | `1.1.1` | `1.1.3` | Updates `Microsoft.Kiota.Abstractions` from 1.7.6 to 1.7.10 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.6...v1.7.10) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.4) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.4 to 1.1.6 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.4...v1.1.6) Updates `Microsoft.Kiota.Serialization.Text` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-text-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-text-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-text-dotnet/compare/v1.1.2...v1.1.3) Updates `Microsoft.kiota.Serialization.Multipart` from 1.1.1 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-multipart-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-multipart-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-multipart-dotnet/compare/v1.1.1...v1.1.3) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Text dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.kiota.Serialization.Multipart dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 450c1881e3..3897acbcaa 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -38,12 +38,12 @@ - + - + From 3d694ea32e1c862f38106654bfc63839e00f3dd0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:29:50 +0000 Subject: [PATCH 276/394] Bump YamlDotNet from 15.1.0 to 15.1.1 Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 15.1.0 to 15.1.1. - [Release notes](https://github.com/aaubry/YamlDotNet/releases) - [Commits](https://github.com/aaubry/YamlDotNet/compare/v15.1.0...v15.1.1) --- updated-dependencies: - dependency-name: YamlDotNet dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 450c1881e3..9477bfa510 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -48,7 +48,7 @@ - + From 7a8a146212469f82cadaa7d23a47c272320e8698 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:40:52 +0000 Subject: [PATCH 277/394] Bump eslint from 8.56.0 to 8.57.0 in /it/typescript Bumps [eslint](https://github.com/eslint/eslint) from 8.56.0 to 8.57.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.56.0...v8.57.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 34 ++++++++++++++++----------------- it/typescript/package.json | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index a449dde866..ed9ffaf107 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -26,7 +26,7 @@ "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", "prettier": "^3.2.5", @@ -636,22 +636,22 @@ } }, "node_modules/@eslint/js": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", - "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -672,9 +672,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", "dev": true }, "node_modules/@microsoft/kiota-abstractions": { @@ -1522,16 +1522,16 @@ } }, "node_modules/eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", - "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.56.0", - "@humanwhocodes/config-array": "^0.11.13", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", "@ungap/structured-clone": "^1.2.0", diff --git a/it/typescript/package.json b/it/typescript/package.json index 0d7df652a0..0f9d6e4f27 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -23,7 +23,7 @@ "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "minimist": "^1.2.8", "prettier": "^3.2.5", From db372829c1e7ca2e4fd2ce2eaad1f98f42b471e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:54:11 +0000 Subject: [PATCH 278/394] Bump the kiota-dependencies group in /it/csharp with 5 updates Bumps the kiota-dependencies group in /it/csharp with 5 updates: | Package | From | To | | --- | --- | --- | | [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet) | `1.1.3` | `1.1.4` | | [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) | `1.3.6` | `1.3.7` | | [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) | `1.1.3` | `1.1.4` | | [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet) | `1.1.5` | `1.1.7` | | [Microsoft.kiota.Serialization.Multipart](https://github.com/microsoft/kiota-serialization-multipart-dotnet) | `1.1.2` | `1.1.3` | Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.6 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.6...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.5 to 1.1.7 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.5...v1.1.7) Updates `Microsoft.kiota.Serialization.Multipart` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/microsoft/kiota-serialization-multipart-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-multipart-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-multipart-dotnet/compare/v1.1.2...v1.1.3) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.kiota.Serialization.Multipart dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index f3243a7531..be973318d8 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -15,7 +15,7 @@ - + From 3df35412ad73d8fc9a5eb0a6cc64564d64f8bb7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:54:55 +0000 Subject: [PATCH 279/394] Bump typing-extensions from 4.9.0 to 4.10.0 in /it/python Bumps [typing-extensions](https://github.com/python/typing_extensions) from 4.9.0 to 4.10.0. - [Release notes](https://github.com/python/typing_extensions/releases) - [Changelog](https://github.com/python/typing_extensions/blob/main/CHANGELOG.md) - [Commits](https://github.com/python/typing_extensions/commits) --- updated-dependencies: - dependency-name: typing-extensions dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 63beae9b7c..ca96157d3f 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -56,7 +56,7 @@ tomli-w==1.0.0 ; python_version >= '3.7' tomlkit==0.12.3 ; python_version >= '3.7' -typing-extensions==4.9.0 ; python_version >= '3.7' +typing-extensions==4.10.0 ; python_version >= '3.7' urllib3==2.2.1 ; python_version >= '3.7' From 25fc65b752d91147428d58bb0e3a920d85e6553e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:55:00 +0000 Subject: [PATCH 280/394] Bump cryptography from 42.0.4 to 42.0.5 in /it/python Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.4 to 42.0.5. - [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pyca/cryptography/compare/42.0.4...42.0.5) --- updated-dependencies: - dependency-name: cryptography dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 63beae9b7c..8423a6d068 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -82,7 +82,7 @@ azure-identity==1.15.0 cffi==1.16.0 -cryptography==42.0.4 ; python_version >= '3.7' +cryptography==42.0.5 ; python_version >= '3.7' frozenlist==1.4.1 ; python_version >= '3.7' From c32854063e0291479008d678a715f7d9f8af5b4f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:55:04 +0000 Subject: [PATCH 281/394] Bump pytest from 8.0.1 to 8.0.2 in /it/python Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.0.1 to 8.0.2. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.0.1...8.0.2) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 63beae9b7c..3a50be3651 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -42,7 +42,7 @@ pluggy==1.4.0 ; python_version >= '3.7' pylint==3.0.3 -pytest==8.0.1 +pytest==8.0.2 pytest-asyncio==0.23.5 From f3fe25ab8ada3718635c1aa2951ae7217b527a4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 10:15:27 +0000 Subject: [PATCH 282/394] Bump sniffio from 1.3.0 to 1.3.1 in /it/python Bumps [sniffio](https://github.com/python-trio/sniffio) from 1.3.0 to 1.3.1. - [Commits](https://github.com/python-trio/sniffio/compare/v1.3.0...v1.3.1) --- updated-dependencies: - dependency-name: sniffio dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 2e60309ae4..5d43d96fe7 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -130,7 +130,7 @@ rfc3986[idna2008]==2.0.0 six==1.16.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2' -sniffio==1.3.0 ; python_version >= '3.7' +sniffio==1.3.1 ; python_version >= '3.7' uritemplate==4.1.1 ; python_version >= '3.6' From bd5fbb18f9416726b2ff11450968bfe790310d4d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 10:15:30 +0000 Subject: [PATCH 283/394] Bump pylint from 3.0.3 to 3.1.0 in /it/python Bumps [pylint](https://github.com/pylint-dev/pylint) from 3.0.3 to 3.1.0. - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/v3.0.3...v3.1.0) --- updated-dependencies: - dependency-name: pylint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 6bc23502ad..f06ed55aca 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -40,7 +40,7 @@ platformdirs==4.2.0 ; python_version >= '3.7' pluggy==1.4.0 ; python_version >= '3.7' -pylint==3.0.3 +pylint==3.1.0 pytest==8.0.2 From 4992a5cb46d09d29d34ba00f1eaebf9688fff6c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 10:15:57 +0000 Subject: [PATCH 284/394] Bump astroid from 3.0.3 to 3.1.0 in /it/python Bumps [astroid](https://github.com/pylint-dev/astroid) from 3.0.3 to 3.1.0. - [Release notes](https://github.com/pylint-dev/astroid/releases) - [Changelog](https://github.com/pylint-dev/astroid/blob/main/ChangeLog) - [Commits](https://github.com/pylint-dev/astroid/compare/v3.0.3...v3.1.0) --- updated-dependencies: - dependency-name: astroid dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 6bc23502ad..26abf6e5e3 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -1,6 +1,6 @@ -i https://pypi.org/simple -astroid==3.0.3 ; python_full_version >= '3.7.2' +astroid==3.1.0 ; python_full_version >= '3.7.2' certifi==2024.2.2 ; python_version >= '3.6' From 16c96561045465438ab396435524e8d9829d516c Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Mon, 26 Feb 2024 06:25:13 -0700 Subject: [PATCH 285/394] format --- src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs index 5ce2c5df44..2b785fc035 100644 --- a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs @@ -54,7 +54,7 @@ public static string GetSchemaName(this OpenApiSchema schema) return schema.IsArray() ? schema.Items : schema; } - + public static bool IsReferencedSchema(this OpenApiSchema schema) { var currentSchema = schema.GetSchema(); From fc343df15917055685d07c1160cdadefc54978ef Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Mon, 26 Feb 2024 11:54:02 -0700 Subject: [PATCH 286/394] Revert unnecessary changes --- .../Extensions/OpenApiSchemaExtensions.cs | 5 ++--- src/Kiota.Builder/KiotaBuilder.cs | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs index 2b785fc035..f618145f8b 100644 --- a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs @@ -57,9 +57,8 @@ public static string GetSchemaName(this OpenApiSchema schema) public static bool IsReferencedSchema(this OpenApiSchema schema) { - var currentSchema = schema.GetSchema(); - var isReference = currentSchema?.Reference != null; - if (isReference && currentSchema!.Reference.IsExternal) + var isReference = schema?.Reference != null; + if (isReference && schema!.Reference.IsExternal) throw new NotSupportedException("External references are not supported in this version of Kiota. While Kiota awaits on OpenAPI.Net to support inlining external references, you can use https://www.nuget.org/packages/Microsoft.OpenApi.Hidi to generate an OpenAPI description with inlined external references and then use this new reference with Kiota."); return isReference; } diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 128874b921..8fb8f5bb98 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -1905,7 +1905,7 @@ private CodeElement AddModelDeclarationIfDoesntExist(OpenApiUrlTreeNode currentN { if (GetExistingDeclaration(currentNamespace, currentNode, declarationName) is not CodeEnum existingDeclaration) // we can find it in the components { - return AddEnumDeclaration(currentNode, schema.GetSchema() ?? schema, declarationName, currentNamespace); + return AddEnumDeclaration(currentNode, schema, declarationName, currentNamespace); } return existingDeclaration; } @@ -2412,19 +2412,20 @@ private void AddPropertyForQueryParameter(OpenApiUrlTreeNode node, OperationType { CodeType? resultType = default; var addBackwardCompatibleParameter = false; - var schema = parameter.Schema.GetSchema() ?? parameter.Schema; - if (schema.IsEnum()) + + if (parameter.Schema.IsEnum() || (parameter.Schema.IsArray() && parameter.Schema.Items.IsEnum())) { - var codeNamespace = schema.IsReferencedSchema() switch + var enumSchema = parameter.Schema.IsArray() ? parameter.Schema.Items : parameter.Schema; + var codeNamespace = enumSchema.IsReferencedSchema() switch { - true => GetShortestNamespace(parameterClass.GetImmediateParentOfType(), schema), // referenced schema + true => GetShortestNamespace(parameterClass.GetImmediateParentOfType(), enumSchema), // referenced schema false => parameterClass.GetImmediateParentOfType(), // Inline schema, i.e. specific to the Operation }; - var shortestNamespace = GetShortestNamespace(codeNamespace, schema); - var enumName = schema.GetSchemaName().CleanupSymbolName(); + var shortestNamespace = GetShortestNamespace(codeNamespace, enumSchema); + var enumName = enumSchema.GetSchemaName().CleanupSymbolName(); if (string.IsNullOrEmpty(enumName)) enumName = $"{operationType.ToString().ToFirstCharacterUpperCase()}{parameter.Name.CleanupSymbolName().ToFirstCharacterUpperCase()}QueryParameterType"; - if (AddEnumDeclarationIfDoesntExist(node, schema, enumName, shortestNamespace) is { } enumDeclaration) + if (AddEnumDeclarationIfDoesntExist(node, enumSchema, enumName, shortestNamespace) is { } enumDeclaration) { resultType = new CodeType { @@ -2434,7 +2435,7 @@ private void AddPropertyForQueryParameter(OpenApiUrlTreeNode node, OperationType addBackwardCompatibleParameter = true; } } - resultType ??= GetPrimitiveType(schema) ?? new CodeType() + resultType ??= GetPrimitiveType(parameter.Schema) ?? new CodeType() { // since its a query parameter default to string if there is no schema // it also be an object type, but we'd need to create the model in that case and there's no standard on how to serialize those as query parameters From b347f7aad41ca0e7c80fd48485f6a0d2f4be2b70 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Mon, 26 Feb 2024 11:55:42 -0700 Subject: [PATCH 287/394] Remove unused function --- src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs index f618145f8b..4c705bdeeb 100644 --- a/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiSchemaExtensions.cs @@ -47,14 +47,6 @@ public static string GetSchemaName(this OpenApiSchema schema) return schema.GetSchemaNames().LastOrDefault()?.TrimStart('$') ?? string.Empty;// OData $ref } - public static OpenApiSchema? GetSchema(this OpenApiSchema schema) - { - if (schema is null) - return null; - - return schema.IsArray() ? schema.Items : schema; - } - public static bool IsReferencedSchema(this OpenApiSchema schema) { var isReference = schema?.Reference != null; From 4393061e8e8fc7fdb716fa70aec3637aad67c014 Mon Sep 17 00:00:00 2001 From: silaskenneth Date: Mon, 26 Feb 2024 23:31:55 +0300 Subject: [PATCH 288/394] Fix escaping quotes. --- src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 375f986024..c54b09d3be 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -558,7 +558,7 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req if (currentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty pathParametersProperty && currentClass.GetPropertyOfKind(CodePropertyKind.UrlTemplate) is CodeProperty urlTemplateProperty) { - var urlTemplateValue = codeElement.HasUrlTemplateOverride ? $"'{codeElement.UrlTemplateOverride}'" : GetPropertyCall(urlTemplateProperty, "''"); + var urlTemplateValue = codeElement.HasUrlTemplateOverride ? $"'{codeElement.UrlTemplateOverride.SanitizeSingleQuote()}'" : GetPropertyCall(urlTemplateProperty, "''"); writer.WriteLines($"{RequestInfoVarName}->urlTemplate = {urlTemplateValue};", $"{RequestInfoVarName}->pathParameters = {GetPropertyCall(pathParametersProperty, "''")};"); } From 805a41fbcf4f939c24863d7fe0520236aa882ef8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 08:25:05 +0000 Subject: [PATCH 289/394] Bump the kiota-dependencies group in /it/csharp with 6 updates Bumps the kiota-dependencies group in /it/csharp with 6 updates: | Package | From | To | | --- | --- | --- | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.10` | `1.7.11` | | [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet) | `1.1.3` | `1.1.4` | | [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) | `1.3.6` | `1.3.7` | | [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) | `1.1.3` | `1.1.4` | | [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet) | `1.1.5` | `1.1.8` | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.10` | `1.7.11` | | [Microsoft.Kiota.Serialization.Text](https://github.com/microsoft/kiota-serialization-text-dotnet) | `1.1.3` | `1.1.4` | Updates `Microsoft.Kiota.Abstractions` from 1.7.10 to 1.7.11 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.10...v1.7.11) Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.6 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.6...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.5 to 1.1.8 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.5...v1.1.8) Updates `Microsoft.Kiota.Abstractions` from 1.7.10 to 1.7.11 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.10...v1.7.11) Updates `Microsoft.Kiota.Serialization.Text` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-text-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-text-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-text-dotnet/compare/v1.1.3...v1.1.4) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Text dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index be973318d8..2e3df05894 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -10,13 +10,13 @@ - + - + From 42c93befcb01b6fa983193d659a59205f1a2e5a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 08:25:26 +0000 Subject: [PATCH 290/394] Bump the kiota-dependencies group with 5 updates Bumps the kiota-dependencies group with 5 updates: | Package | From | To | | --- | --- | --- | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.10` | `1.7.11` | | [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) | `1.3.4` | `1.3.7` | | [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) | `1.1.1` | `1.1.4` | | [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet) | `1.1.4` | `1.1.8` | | [Microsoft.Kiota.Abstractions](https://github.com/microsoft/kiota-abstractions-dotnet) | `1.7.10` | `1.7.11` | | [Microsoft.Kiota.Serialization.Text](https://github.com/microsoft/kiota-serialization-text-dotnet) | `1.1.2` | `1.1.4` | Updates `Microsoft.Kiota.Abstractions` from 1.7.10 to 1.7.11 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.10...v1.7.11) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.4) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.4 to 1.1.8 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.4...v1.1.8) Updates `Microsoft.Kiota.Abstractions` from 1.7.10 to 1.7.11 - [Release notes](https://github.com/microsoft/kiota-abstractions-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-abstractions-dotnet/compare/v1.7.10...v1.7.11) Updates `Microsoft.Kiota.Serialization.Text` from 1.1.2 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-serialization-text-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-text-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-text-dotnet/compare/v1.1.2...v1.1.4) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Abstractions dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Text dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index c84b390896..0eb129fb55 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -38,11 +38,11 @@ - + - + From afee2bae2f360bf7de0a410cbfbb09abffb6bd11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 08:28:27 +0000 Subject: [PATCH 291/394] Bump YamlDotNet from 15.1.1 to 15.1.2 Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 15.1.1 to 15.1.2. - [Release notes](https://github.com/aaubry/YamlDotNet/releases) - [Commits](https://github.com/aaubry/YamlDotNet/compare/v15.1.1...v15.1.2) --- updated-dependencies: - dependency-name: YamlDotNet dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index c84b390896..3a75ff6c73 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -48,7 +48,7 @@ - + From f73276dae6a8dfecacdd7e968c98638bb789ab77 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 08:41:32 +0000 Subject: [PATCH 292/394] Bump @typescript-eslint/eslint-plugin in /it/typescript Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 7.0.2 to 7.1.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 272 +++++++++++++++++++++++++++++--- it/typescript/package.json | 2 +- 2 files changed, 251 insertions(+), 23 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index ed9ffaf107..d9f19bdc39 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -23,7 +23,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.20", - "@typescript-eslint/eslint-plugin": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", "eslint": "^8.57.0", @@ -837,22 +837,22 @@ } }, "node_modules/@types/semver": { - "version": "7.5.7", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", - "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.2.tgz", - "integrity": "sha512-/XtVZJtbaphtdrWjr+CJclaCVGPtOdBpFEnvtNf/jRV0IiEemRrL0qABex/nEt8isYcnFacm3nPHYQwL+Wb7qg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.0.tgz", + "integrity": "sha512-j6vT/kCulhG5wBmGtstKeiVr1rdXE4nk+DT1k6trYkwlrvW9eOF5ZbgKnd/YR6PcM4uTEXa0h6Fcvf6X7Dxl0w==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/type-utils": "7.0.2", - "@typescript-eslint/utils": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/type-utils": "7.1.0", + "@typescript-eslint/utils": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -877,6 +877,53 @@ } } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", + "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", + "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", + "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/parser": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.2.tgz", @@ -923,13 +970,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.2.tgz", - "integrity": "sha512-IKKDcFsKAYlk8Rs4wiFfEwJTQlHcdn8CLwLaxwd6zb8HNiMcQIFX9sWax2k4Cjj7l7mGS5N1zl7RCHOVwHq2VQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.0.tgz", + "integrity": "sha512-UZIhv8G+5b5skkcuhgvxYWHjk7FW7/JP5lPASMEUoliAPwIH/rxoUSQPia2cuOj9AmDZmwUl1usKm85t5VUMew==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.0.2", - "@typescript-eslint/utils": "7.0.2", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/utils": "7.1.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -949,6 +996,88 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", + "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", + "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", + "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/types": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.2.tgz", @@ -1015,17 +1144,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.2.tgz", - "integrity": "sha512-PZPIONBIB/X684bhT1XlrkjNZJIEevwkKDsdwfiu1WeqBxYEEdIgVDgm8/bbKHVu+6YOpeRqcfImTdImx/4Bsw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.0.tgz", + "integrity": "sha512-WUFba6PZC5OCGEmbweGpnNJytJiLG7ZvDBJJoUcX4qZYf1mGZ97mO2Mps6O2efxJcJdRNpqweCistDbZMwIVHw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/typescript-estree": "7.0.2", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.0", "semver": "^7.5.4" }, "engines": { @@ -1039,6 +1168,105 @@ "eslint": "^8.56.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", + "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", + "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", + "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", + "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/visitor-keys": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index 0f9d6e4f27..59dab6988d 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.20", - "@typescript-eslint/eslint-plugin": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.0.2", "esbuild": "^0.20.1", "eslint": "^8.57.0", From fc10937289dab45bf70cb4633cbfa7e83a6dc1e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 08:47:54 +0000 Subject: [PATCH 293/394] Bump @typescript-eslint/parser from 7.0.2 to 7.1.0 in /it/typescript Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.0.2 to 7.1.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 258 ++------------------------------ it/typescript/package.json | 2 +- 2 files changed, 16 insertions(+), 244 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index d9f19bdc39..16fd6e3d1d 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -24,7 +24,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.20", "@typescript-eslint/eslint-plugin": "^7.1.0", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", @@ -877,63 +877,16 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", - "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", - "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "node_modules/@typescript-eslint/parser": { "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", - "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.0.tgz", + "integrity": "sha512-V1EknKUubZ1gWFjiOZhDSNToOjs63/9O0puCgGS8aDOgpZY326fzFu15QAUjwaXzRZjf/qdsdBrckYdv9YxB8w==", "dev": true, "dependencies": { + "@typescript-eslint/scope-manager": "7.1.0", "@typescript-eslint/types": "7.1.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.2.tgz", - "integrity": "sha512-GdwfDglCxSmU+QTS9vhz2Sop46ebNCXpPPvsByK7hu0rFGRHL+AusKQJ7SoN+LbLh6APFpQwHKmDSwN35Z700Q==", - "dev": true, - "dependencies": { - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/typescript-estree": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4" }, "engines": { @@ -953,13 +906,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.2.tgz", - "integrity": "sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", + "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2" + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -996,7 +949,7 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "node_modules/@typescript-eslint/types": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", @@ -1009,7 +962,7 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "node_modules/@typescript-eslint/typescript-estree": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", @@ -1037,88 +990,6 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", - "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/types": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.2.tgz", - "integrity": "sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz", - "integrity": "sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -1168,65 +1039,7 @@ "eslint": "^8.56.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", - "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", - "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", - "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "node_modules/@typescript-eslint/visitor-keys": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", @@ -1243,47 +1056,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/utils/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz", - "integrity": "sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.0.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index 59dab6988d..978634cea0 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -21,7 +21,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.20", "@typescript-eslint/eslint-plugin": "^7.1.0", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", From 0819fd02f70c1b1d364b6236c048419526d7f790 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 08:51:31 +0000 Subject: [PATCH 294/394] Bump tomlkit from 0.12.3 to 0.12.4 in /it/python Bumps [tomlkit](https://github.com/sdispater/tomlkit) from 0.12.3 to 0.12.4. - [Release notes](https://github.com/sdispater/tomlkit/releases) - [Changelog](https://github.com/sdispater/tomlkit/blob/master/CHANGELOG.md) - [Commits](https://github.com/sdispater/tomlkit/compare/0.12.3...0.12.4) --- updated-dependencies: - dependency-name: tomlkit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 9943996b93..e8770a85a2 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -54,7 +54,7 @@ tomli==2.0.1 ; python_version < '3.11' tomli-w==1.0.0 ; python_version >= '3.7' -tomlkit==0.12.3 ; python_version >= '3.7' +tomlkit==0.12.4 ; python_version >= '3.7' typing-extensions==4.10.0 ; python_version >= '3.7' From 50fe9bb7206e9953e7d042219141641ff3c8416a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 09:00:32 +0000 Subject: [PATCH 295/394] Bump the eslint group in /vscode/microsoft-kiota with 2 updates Bumps the eslint group in /vscode/microsoft-kiota with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser). Updates `@typescript-eslint/eslint-plugin` from 7.0.2 to 7.1.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.0/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 7.0.2 to 7.1.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: eslint - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: eslint ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 94 ++++++++++++------------ vscode/microsoft-kiota/package.json | 4 +- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index f4c0da826d..54a30757ed 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -20,8 +20,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.86.0", - "@typescript-eslint/eslint-plugin": "^7.0.2", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^7.1.0", + "@typescript-eslint/parser": "^7.1.0", "@vscode/test-electron": "^2.3.9", "eslint": "^8.57.0", "glob": "^10.3.10", @@ -543,9 +543,9 @@ } }, "node_modules/@types/semver": { - "version": "7.5.7", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.7.tgz", - "integrity": "sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==", + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", "dev": true }, "node_modules/@types/vscode": { @@ -555,16 +555,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.0.2.tgz", - "integrity": "sha512-/XtVZJtbaphtdrWjr+CJclaCVGPtOdBpFEnvtNf/jRV0IiEemRrL0qABex/nEt8isYcnFacm3nPHYQwL+Wb7qg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.0.tgz", + "integrity": "sha512-j6vT/kCulhG5wBmGtstKeiVr1rdXE4nk+DT1k6trYkwlrvW9eOF5ZbgKnd/YR6PcM4uTEXa0h6Fcvf6X7Dxl0w==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/type-utils": "7.0.2", - "@typescript-eslint/utils": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/type-utils": "7.1.0", + "@typescript-eslint/utils": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -590,15 +590,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.0.2.tgz", - "integrity": "sha512-GdwfDglCxSmU+QTS9vhz2Sop46ebNCXpPPvsByK7hu0rFGRHL+AusKQJ7SoN+LbLh6APFpQwHKmDSwN35Z700Q==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.0.tgz", + "integrity": "sha512-V1EknKUubZ1gWFjiOZhDSNToOjs63/9O0puCgGS8aDOgpZY326fzFu15QAUjwaXzRZjf/qdsdBrckYdv9YxB8w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/typescript-estree": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4" }, "engines": { @@ -618,13 +618,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.0.2.tgz", - "integrity": "sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", + "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2" + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -635,13 +635,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.0.2.tgz", - "integrity": "sha512-IKKDcFsKAYlk8Rs4wiFfEwJTQlHcdn8CLwLaxwd6zb8HNiMcQIFX9sWax2k4Cjj7l7mGS5N1zl7RCHOVwHq2VQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.0.tgz", + "integrity": "sha512-UZIhv8G+5b5skkcuhgvxYWHjk7FW7/JP5lPASMEUoliAPwIH/rxoUSQPia2cuOj9AmDZmwUl1usKm85t5VUMew==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.0.2", - "@typescript-eslint/utils": "7.0.2", + "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/utils": "7.1.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -662,9 +662,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.0.2.tgz", - "integrity": "sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", + "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -675,13 +675,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz", - "integrity": "sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", + "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/visitor-keys": "7.0.2", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/visitor-keys": "7.1.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -727,17 +727,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.0.2.tgz", - "integrity": "sha512-PZPIONBIB/X684bhT1XlrkjNZJIEevwkKDsdwfiu1WeqBxYEEdIgVDgm8/bbKHVu+6YOpeRqcfImTdImx/4Bsw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.0.tgz", + "integrity": "sha512-WUFba6PZC5OCGEmbweGpnNJytJiLG7ZvDBJJoUcX4qZYf1mGZ97mO2Mps6O2efxJcJdRNpqweCistDbZMwIVHw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.0.2", - "@typescript-eslint/types": "7.0.2", - "@typescript-eslint/typescript-estree": "7.0.2", + "@typescript-eslint/scope-manager": "7.1.0", + "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.0", "semver": "^7.5.4" }, "engines": { @@ -752,12 +752,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz", - "integrity": "sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", + "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.0.2", + "@typescript-eslint/types": "7.1.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 13207057ae..8dbba9988c 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -427,8 +427,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.86.0", - "@typescript-eslint/eslint-plugin": "^7.0.2", - "@typescript-eslint/parser": "^7.0.2", + "@typescript-eslint/eslint-plugin": "^7.1.0", + "@typescript-eslint/parser": "^7.1.0", "@vscode/test-electron": "^2.3.9", "eslint": "^8.57.0", "glob": "^10.3.10", From d2dfd0c6b8e62f6fbe48482e5e320a50123d61a1 Mon Sep 17 00:00:00 2001 From: koros Date: Tue, 27 Feb 2024 23:48:01 +0300 Subject: [PATCH 296/394] remove async suffix for request adapter methods --- .../Writers/TypeScript/CodeConstantWriter.cs | 10 +++++----- .../Writers/TypeScript/CodeConstantWriterTests.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs index a3e0f9401b..bdcf9460ba 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeConstantWriter.cs @@ -188,15 +188,15 @@ currentType.TypeDefinition is CodeClass definitionClass && } private string GetSendRequestMethodName(bool isVoid, bool isStream, bool isCollection, string returnType) { - if (isVoid) return "sendNoResponseContentAsync"; + if (isVoid) return "sendNoResponseContent"; if (isCollection) { - if (conventions.IsPrimitiveType(returnType)) return $"sendCollectionOfPrimitiveAsync"; - return $"sendCollectionAsync"; + if (conventions.IsPrimitiveType(returnType)) return $"sendCollectionOfPrimitive"; + return $"sendCollection"; } - if (isStream || conventions.IsPrimitiveType(returnType)) return $"sendPrimitiveAsync"; - return $"sendAsync"; + if (isStream || conventions.IsPrimitiveType(returnType)) return $"sendPrimitive"; + return $"send"; } private void WriteUriTemplateConstant(CodeConstant codeElement, LanguageWriter writer) diff --git a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs index f894b68970..d3210509d7 100644 --- a/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/TypeScript/CodeConstantWriterTests.cs @@ -183,7 +183,7 @@ public void WritesRequestExecutorBodyForCollections() }); writer.Write(constant); var result = tw.ToString(); - Assert.Contains("sendCollectionAsync", result); + Assert.Contains("sendCollection", result); AssertExtensions.CurlyBracesAreClosed(result); } [Fact] From 9ee4b279d5174471547d9006493998ee06f9ed45 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 27 Feb 2024 16:07:29 -0500 Subject: [PATCH 297/394] - adds changelog entry for typescript async suffix removal Signed-off-by: Vincent Biret --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57601a4e2c..373ca86d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- BREAKING - Removed the async suffix from request adapter methods in TypeScript. [microsoft/kiota-typescript#992](https://github.com/microsoft/kiota-typescript/issues/992) - Fixed mantis for bitwise enums in Go. [#3936](https://github.com/microsoft/kiota/issues/3936) - Keyword in enum names for go should not be escaped. [#2877](https://github.com/microsoft/kiota/issues/2877) - Generator method code reduction in Python. [#3695](https://github.com/microsoft/kiota/issues/3695) From fadd589692271ae7c2112faadd47afe9d7a1580d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 08:39:25 +0000 Subject: [PATCH 298/394] Bump @types/node from 20.11.20 to 20.11.21 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.20 to 20.11.21. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 54a30757ed..82e4efd976 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.20", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", - "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", + "version": "20.11.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.21.tgz", + "integrity": "sha512-/ySDLGscFPNasfqStUuWWPfL78jompfIoVzLJPVVAHBh6rpG68+pI2Gk+fNLeI8/f1yPYL4s46EleVIc20F1Ow==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From 4ce66196c311d37296235087486c27b7bee7ef8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 08:40:24 +0000 Subject: [PATCH 299/394] Bump the kiota-dependencies group with 3 updates Bumps the kiota-dependencies group with 3 updates: [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet), [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) and [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet). Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.5 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.5) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.4 to 1.1.8 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.4...v1.1.8) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 624eb73cc0..499be67f16 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -41,7 +41,7 @@ - + From de2457568e9addb62ffd20279f2815cbfc8d45c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 08:45:38 +0000 Subject: [PATCH 300/394] Bump the kiota-dependencies group in /it/csharp with 4 updates Bumps the kiota-dependencies group in /it/csharp with 4 updates: [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet), [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet), [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet) and [Microsoft.Kiota.Serialization.Json](https://github.com/microsoft/kiota-serialization-json-dotnet). Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.6 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.6...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.3 to 1.1.5 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.3...v1.1.5) Updates `Microsoft.Kiota.Serialization.Json` from 1.1.5 to 1.1.8 - [Release notes](https://github.com/microsoft/kiota-serialization-json-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-json-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-json-dotnet/compare/v1.1.5...v1.1.8) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Json dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 2e3df05894..615be10e3f 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -14,7 +14,7 @@ - + From a80c61e7d76f999206f7ecd54d27dfcbe4c93215 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 08:51:11 +0000 Subject: [PATCH 301/394] Bump the kiota-dependencies group in /it/typescript with 7 updates Bumps the kiota-dependencies group in /it/typescript with 7 updates: | Package | From | To | | --- | --- | --- | | [@microsoft/kiota-abstractions](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.43` | `1.0.0-preview.44` | | [@microsoft/kiota-authentication-azure](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.38` | `1.0.0-preview.39` | | [@microsoft/kiota-http-fetchlibrary](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.42` | `1.0.0-preview.43` | | [@microsoft/kiota-serialization-form](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.32` | `1.0.0-preview.33` | | [@microsoft/kiota-serialization-json](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.43` | `1.0.0-preview.44` | | [@microsoft/kiota-serialization-multipart](https://github.com/microsoft/kiota-typescript) | `1.0.0-preview.22` | `1.0.0-preview.23` | | [@microsoft/kiota-serialization-text](https://github.com/microsoft-typescript/kiota) | `1.0.0-preview.40` | `1.0.0-preview.41` | Updates `@microsoft/kiota-abstractions` from 1.0.0-preview.43 to 1.0.0-preview.44 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-abstractions@1.0.0-preview.43...@microsoft/kiota-abstractions@1.0.0-preview.44) Updates `@microsoft/kiota-authentication-azure` from 1.0.0-preview.38 to 1.0.0-preview.39 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-authentication-azure@1.0.0-preview.38...@microsoft/kiota-authentication-azure@1.0.0-preview.39) Updates `@microsoft/kiota-http-fetchlibrary` from 1.0.0-preview.42 to 1.0.0-preview.43 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.42...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.43) Updates `@microsoft/kiota-serialization-form` from 1.0.0-preview.32 to 1.0.0-preview.33 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-form@1.0.0-preview.32...@microsoft/kiota-serialization-form@1.0.0-preview.33) Updates `@microsoft/kiota-serialization-json` from 1.0.0-preview.43 to 1.0.0-preview.44 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-json@1.0.0-preview.43...@microsoft/kiota-serialization-json@1.0.0-preview.44) Updates `@microsoft/kiota-serialization-multipart` from 1.0.0-preview.22 to 1.0.0-preview.23 - [Release notes](https://github.com/microsoft/kiota-typescript/releases) - [Commits](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-serialization-multipart@1.0.0-preview.22...@microsoft/kiota-serialization-multipart@1.0.0-preview.23) Updates `@microsoft/kiota-serialization-text` from 1.0.0-preview.40 to 1.0.0-preview.41 - [Commits](https://github.com/microsoft-typescript/kiota/commits) --- updated-dependencies: - dependency-name: "@microsoft/kiota-abstractions" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-authentication-azure" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-http-fetchlibrary" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-json" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-multipart" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: "@microsoft/kiota-serialization-text" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 68 ++++++++++++++++----------------- it/typescript/package.json | 14 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 16fd6e3d1d..129b201d57 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -10,13 +10,13 @@ "license": "MIT", "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.43", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.38", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.42", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.32", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.43", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.22", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.40", + "@microsoft/kiota-abstractions": "^1.0.0-preview.44", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.39", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.43", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.33", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.44", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.23", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.41", "express": "^4.18.2", "node-fetch": "^2.7.0" }, @@ -678,9 +678,9 @@ "dev": true }, "node_modules/@microsoft/kiota-abstractions": { - "version": "1.0.0-preview.43", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.43.tgz", - "integrity": "sha512-IFMuom+MIry2BnoJ58T5TLmkX2P/KO54/KX8Gu09X8cfW8YUhEF11LB9E/YXabSh4hHfVPb+dc4JF/sR0iPRAw==", + "version": "1.0.0-preview.44", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-abstractions/-/kiota-abstractions-1.0.0-preview.44.tgz", + "integrity": "sha512-926+OvJ40lG5A43JaMOCjorC6hge646i8c67CuPhOo1b7IBXWpRKY6MwUtnamjD14qdrW94L2jvg8sEYBsyJxQ==", "dependencies": { "@opentelemetry/api": "^1.7.0", "@std-uritemplate/std-uritemplate": "^0.0.53", @@ -703,22 +703,22 @@ } }, "node_modules/@microsoft/kiota-authentication-azure": { - "version": "1.0.0-preview.38", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.38.tgz", - "integrity": "sha512-EbEtBO3VXN4Zzu/dzDxmfbccom4JOl41ADXbjZb5f5jZIY+YtHi4adz2UHTKsJ6OytUJAQT3LfyvJT+/hoUfPw==", + "version": "1.0.0-preview.39", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-authentication-azure/-/kiota-authentication-azure-1.0.0-preview.39.tgz", + "integrity": "sha512-g5w/2XoiEaxx2VDhL7SW3fiIcjD82W5aMpP33VX+LLgf/xr6uSEZvblmspFDQ0sWASGrCu9qrosLgv9Il7LjEQ==", "dependencies": { "@azure/core-auth": "^1.5.0", - "@microsoft/kiota-abstractions": "^1.0.0-preview.43", + "@microsoft/kiota-abstractions": "^1.0.0-preview.44", "@opentelemetry/api": "^1.7.0", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-http-fetchlibrary": { - "version": "1.0.0-preview.42", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.42.tgz", - "integrity": "sha512-JuA+C0ucsXe3t75cfYErv6+WgCI8ABysqLEDXzbVqZiR0YxTmzZFjlx88w0MaFDj3VEA8mRaBBBdgU1aS/bTlw==", + "version": "1.0.0-preview.43", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-http-fetchlibrary/-/kiota-http-fetchlibrary-1.0.0-preview.43.tgz", + "integrity": "sha512-UWiGnrCxu8MZ3zP40CK/Vjvs5ZDAg42FRBLEVPrZWqs5vTl36bfDdb1CSLAq8Z/8+ESRXzoyw16+ppXQOhqVdA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.43", + "@microsoft/kiota-abstractions": "^1.0.0-preview.44", "@opentelemetry/api": "^1.7.0", "guid-typescript": "^1.0.9", "node-fetch": "^2.7.0", @@ -726,41 +726,41 @@ } }, "node_modules/@microsoft/kiota-serialization-form": { - "version": "1.0.0-preview.32", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.32.tgz", - "integrity": "sha512-uPv4lTgRnZZjkn8cQBcSXoFti0sv3dxET4RLHhYJaadOGvO97fse7wv99KQX+PixsTIPG0LfFJb6qw5IN0eMdg==", + "version": "1.0.0-preview.33", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-form/-/kiota-serialization-form-1.0.0-preview.33.tgz", + "integrity": "sha512-UxwidpGzlfO/4VmxTsmSZAeGkcSRTPb5AzIu+8D7z/f6OcQV6UGvxrtOlprtCtavd4pyd6hbVdbu9nGgqPXkng==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.43", + "@microsoft/kiota-abstractions": "^1.0.0-preview.44", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-json": { - "version": "1.0.0-preview.43", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.43.tgz", - "integrity": "sha512-xTtdA+tT8AH0i2AH/owUFlIgVICB9W3uZZvK1j1Fon9Wjg4Kz8Bja8f27RoJoi6q4A0lqobisZkisP6/PLlhBQ==", + "version": "1.0.0-preview.44", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-json/-/kiota-serialization-json-1.0.0-preview.44.tgz", + "integrity": "sha512-fcIJS/puCmuKdGtHIK9DKihfVwnISny4aUXjefXoo7ApnSieQwS4xGJUIDSu5QDmea103Uko0W++0l3k7oYuUA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.43", + "@microsoft/kiota-abstractions": "^1.0.0-preview.44", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-multipart": { - "version": "1.0.0-preview.22", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.22.tgz", - "integrity": "sha512-2u0wPMB4qiup2cCWoJSoe/vIItD92CV6yDd022WV9eV5zgbfEzEXUe9jCGu2zGFJ9KRCC1Ko+YxUR6kGArsNYg==", + "version": "1.0.0-preview.23", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-multipart/-/kiota-serialization-multipart-1.0.0-preview.23.tgz", + "integrity": "sha512-VrUEGpfdk9XsHm/kadyBfVQN/67Moc/YMXb3b8Xw+SsF57kyaYetFgPl6dMNb1zie0wQe/DpxDJoP5BKW+kkOA==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.43", + "@microsoft/kiota-abstractions": "^1.0.0-preview.44", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } }, "node_modules/@microsoft/kiota-serialization-text": { - "version": "1.0.0-preview.40", - "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.40.tgz", - "integrity": "sha512-Aa15B155/OzVoyudtzoYlJnTZeYdgrD2GyCpju9KE28YL+Qtz7iRyxZcxR/yQzdYUhV9S27kYBetSzVncfPGlw==", + "version": "1.0.0-preview.41", + "resolved": "https://registry.npmjs.org/@microsoft/kiota-serialization-text/-/kiota-serialization-text-1.0.0-preview.41.tgz", + "integrity": "sha512-Akt5TAYppxbm9o1rvs4XxlRe27sHcjMhmXBLIu1JJDh5r/HvUdQkseSxl/VUWyi6t11Epe6D359tCFJ5PY0+fw==", "dependencies": { - "@microsoft/kiota-abstractions": "^1.0.0-preview.43", + "@microsoft/kiota-abstractions": "^1.0.0-preview.44", "guid-typescript": "^1.0.9", "tslib": "^2.6.2" } diff --git a/it/typescript/package.json b/it/typescript/package.json index 978634cea0..f1b1dea922 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -31,13 +31,13 @@ }, "dependencies": { "@azure/identity": "^4.0.1", - "@microsoft/kiota-abstractions": "^1.0.0-preview.43", - "@microsoft/kiota-authentication-azure": "^1.0.0-preview.38", - "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.42", - "@microsoft/kiota-serialization-form": "^1.0.0-preview.32", - "@microsoft/kiota-serialization-json": "^1.0.0-preview.43", - "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.22", - "@microsoft/kiota-serialization-text": "^1.0.0-preview.40", + "@microsoft/kiota-abstractions": "^1.0.0-preview.44", + "@microsoft/kiota-authentication-azure": "^1.0.0-preview.39", + "@microsoft/kiota-http-fetchlibrary": "^1.0.0-preview.43", + "@microsoft/kiota-serialization-form": "^1.0.0-preview.33", + "@microsoft/kiota-serialization-json": "^1.0.0-preview.44", + "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.23", + "@microsoft/kiota-serialization-text": "^1.0.0-preview.41", "express": "^4.18.2", "node-fetch": "^2.7.0" } From 16ea84dfee4d572ef2eb0161b9e2f2af5fe46e9d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Feb 2024 08:51:19 +0000 Subject: [PATCH 302/394] Bump @types/node from 20.11.20 to 20.11.21 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.20 to 20.11.21. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 16fd6e3d1d..1b79aa868e 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.20", + "@types/node": "^20.11.21", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", @@ -828,9 +828,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.20", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.20.tgz", - "integrity": "sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==", + "version": "20.11.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.21.tgz", + "integrity": "sha512-/ySDLGscFPNasfqStUuWWPfL78jompfIoVzLJPVVAHBh6rpG68+pI2Gk+fNLeI8/f1yPYL4s46EleVIc20F1Ow==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 978634cea0..7cac58c2cc 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.20", + "@types/node": "^20.11.21", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", From 8bfb73d017dccb42f2e5a081d8c8e15eaa4f333b Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 28 Feb 2024 11:24:57 +0300 Subject: [PATCH 303/394] Fix PHP test --- src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs index 375f986024..13e3ad3734 100644 --- a/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Php/CodeMethodWriter.cs @@ -251,7 +251,8 @@ private static void AssignPropertyFromParameter(CodeClass parentClass, CodeMetho { for (var i = 0; i < parameters.Count; i++) { - writer.WriteLine($"$this->{properties[i].Name.ToFirstCharacterLowerCase()} = ${parameters[i].Name.ToFirstCharacterLowerCase()};"); + var isNonNullableCollection = !parameters[i].Type.IsNullable && parameters[i].Type.CollectionKind != CodeTypeBase.CodeTypeCollectionKind.None; + writer.WriteLine($"$this->{properties[i].Name.ToFirstCharacterLowerCase()} = ${parameters[i].Name.ToFirstCharacterLowerCase()}{(isNonNullableCollection ? "?? []" : string.Empty)};"); } } } From b5fbb397afae67aaadf4cce349255abda041d1ef Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 28 Feb 2024 12:32:21 +0300 Subject: [PATCH 304/394] Fix python test --- src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs b/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs index 54d775feab..7439f123bf 100644 --- a/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodePropertyWriter.cs @@ -39,7 +39,8 @@ public override void WriteCodeElement(CodeProperty codeElement, LanguageWriter w case CodePropertyKind.Options: case CodePropertyKind.QueryParameter: conventions.WriteInLineDescription(codeElement, writer); - writer.WriteLine($"{conventions.GetAccessModifier(codeElement.Access)}{codeElement.NamePrefix}{codeElement.Name}: {(codeElement.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(codeElement.Type.IsNullable ? "]" : string.Empty)} = None"); + var isNonNullableCollection = !codeElement.Type.IsNullable && codeElement.Type.CollectionKind != CodeTypeBase.CodeTypeCollectionKind.None; + writer.WriteLine($"{conventions.GetAccessModifier(codeElement.Access)}{codeElement.NamePrefix}{codeElement.Name}: {(codeElement.Type.IsNullable ? "Optional[" : string.Empty)}{returnType}{(codeElement.Type.IsNullable ? "]" : string.Empty)} {(isNonNullableCollection ? "= []" : "= None")}"); writer.WriteLine(); break; case CodePropertyKind.ErrorMessageOverride when parentClass.IsErrorDefinition: From 91057fc512addf51b341efe58058cee4eef1f247 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Wed, 28 Feb 2024 12:56:13 +0300 Subject: [PATCH 305/394] Adds supressions for intergration tests --- it/config.json | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/it/config.json b/it/config.json index e153f64c5a..6ef1c46a70 100644 --- a/it/config.json +++ b/it/config.json @@ -71,10 +71,22 @@ ] }, "./tests/Kiota.Builder.IntegrationTests/GeneratesUritemplateHints.yaml": { - "MockServerITFolder": "query-params" + "MockServerITFolder": "query-params", + "Suppressions": [ + { + "Language": "ruby", + "Rationale": "https://github.com/microsoft/kiota/issues/4262" + } + ] }, "apisguru::github.com:api.github.com": { - "MockServerITFolder": "gh" + "MockServerITFolder": "gh", + "Suppressions": [ + { + "Language": "all", + "Rationale": "https://github.com/microsoft/kiota/issues/4241" + } + ] }, "apisguru::notion.com": { "ExcludePatterns": [ @@ -328,4 +340,4 @@ } ] } -} \ No newline at end of file +} From c1e82dd161d4f2f71c977faa9204725970fd6485 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Feb 2024 14:53:39 -0500 Subject: [PATCH 306/394] - adds all add command options --- .../ApiClientConfiguration.cs | 65 ++++++++++ .../WorkspaceConfiguration.cs | 14 ++- src/kiota/Handlers/Client/AddHandler.cs | 117 ++++++++++++++++++ src/kiota/KiotaClientCommands.cs | 104 ++++++++++++++++ src/kiota/KiotaConfigCommands.cs | 4 +- src/kiota/KiotaHost.cs | 88 +++++++++---- 6 files changed, 364 insertions(+), 28 deletions(-) create mode 100644 src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs create mode 100644 src/kiota/Handlers/Client/AddHandler.cs create mode 100644 src/kiota/KiotaClientCommands.cs diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs new file mode 100644 index 0000000000..e9499aa01f --- /dev/null +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs @@ -0,0 +1,65 @@ +using System.Collections.Generic; + +namespace Kiota.Builder.WorkspaceManagement; + +#pragma warning disable CA2227 // Collection properties should be read only +public class ApiClientConfiguration +{ + /// + /// The location of the OpenAPI description file. + /// + public string DescriptionLocation { get; set; } = string.Empty; + /// + /// The language for this client. + /// + public string Language { get; set; } = string.Empty; + /// + /// The structured mime types used for this client. + /// +#pragma warning disable CA1002 + public List StructuredMimeTypes { get; set; } = new(); +#pragma warning restore CA1002 + /// + /// The path patterns for API endpoints to include for this client. + /// + public HashSet IncludePatterns { get; set; } = new(); + /// + /// The path patterns for API endpoints to exclude for this client. + /// + public HashSet ExcludePatterns { get; set; } = new(); + /// + /// The output path for the generated code, related to the configuration file. + /// + public string OutputPath { get; set; } = string.Empty; + /// + /// The main class name for this client. + /// + public string ClientClassName { get; set; } = string.Empty; + /// + /// Whether the backing store was used for this client. + /// + public bool UsesBackingStore + { + get; set; + } + /// + /// Whether additional data was used for this client. + /// + public bool IncludeAdditionalData + { + get; set; + } + /// + /// Whether backward compatible code was excluded for this client. + /// + public bool ExcludeBackwardCompatible + { + get; set; + } + /// + /// The OpenAPI validation rules to disable during the generation. + /// + public HashSet DisabledValidationRules { get; set; } = new(); + +} +#pragma warning restore CA2227 // Collection properties should be read only diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs index 0b47ec370d..25ae1134aa 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs @@ -1,6 +1,18 @@ -namespace Kiota.Builder.WorkspaceManagement; +using System; +using System.Collections.Generic; + +namespace Kiota.Builder.WorkspaceManagement; public class WorkspaceConfiguration { + /// + /// The version of the configuration file schema. + /// public string Version { get; set; } = "1.0.0"; +#pragma warning disable CA2227 // Collection properties should be read only + /// + /// The clients to generate. + /// + public Dictionary Clients { get; set; } = new Dictionary(StringComparer.OrdinalIgnoreCase); +#pragma warning restore CA2227 // Collection properties should be read only } diff --git a/src/kiota/Handlers/Client/AddHandler.cs b/src/kiota/Handlers/Client/AddHandler.cs new file mode 100644 index 0000000000..e65b15ec5b --- /dev/null +++ b/src/kiota/Handlers/Client/AddHandler.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Kiota.Builder; +using Kiota.Builder.Extensions; + +namespace kiota.Handlers.Client; + +internal class AddHandler : BaseKiotaCommandHandler +{ + public required Option ClassOption + { + get; init; + } + public required Option BackingStoreOption + { + get; init; + } + public required Option OutputOption + { + get; init; + } + public required Option LanguageOption + { + get; init; + } + public required Option DescriptionOption + { + get; init; + } + public required Option NamespaceOption + { + get; init; + } + public required Option AdditionalDataOption + { + get; init; + } + public required Option> DisabledValidationRulesOption + { + get; init; + } + public required Option> StructuredMimeTypesOption + { + get; init; + } + public required Option ExcludeBackwardCompatibleOption + { + get; + set; + } + public required Option> IncludePatternsOption + { + get; init; + } + public required Option> ExcludePatternsOption + { + get; init; + } + public required Option SkipGenerationOption + { + get; init; + } + + public override async Task InvokeAsync(InvocationContext context) + { + string output = context.ParseResult.GetValueForOption(OutputOption) ?? string.Empty; + GenerationLanguage language = context.ParseResult.GetValueForOption(LanguageOption); + string openapi = context.ParseResult.GetValueForOption(DescriptionOption) ?? string.Empty; + bool backingStore = context.ParseResult.GetValueForOption(BackingStoreOption); + bool excludeBackwardCompatible = context.ParseResult.GetValueForOption(ExcludeBackwardCompatibleOption); + bool includeAdditionalData = context.ParseResult.GetValueForOption(AdditionalDataOption); + bool skipGeneration = context.ParseResult.GetValueForOption(SkipGenerationOption); + string className = context.ParseResult.GetValueForOption(ClassOption) ?? string.Empty; + string namespaceName = context.ParseResult.GetValueForOption(NamespaceOption) ?? string.Empty; + List includePatterns = context.ParseResult.GetValueForOption(IncludePatternsOption) ?? new List(); + List excludePatterns = context.ParseResult.GetValueForOption(ExcludePatternsOption) ?? new List(); + List disabledValidationRules = context.ParseResult.GetValueForOption(DisabledValidationRulesOption) ?? new List(); + List structuredMimeTypes = context.ParseResult.GetValueForOption(StructuredMimeTypesOption) ?? new List(); + CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; + AssignIfNotNullOrEmpty(output, (c, s) => c.OutputPath = s); + AssignIfNotNullOrEmpty(openapi, (c, s) => c.OpenAPIFilePath = s); + AssignIfNotNullOrEmpty(className, (c, s) => c.ClientClassName = s); + AssignIfNotNullOrEmpty(namespaceName, (c, s) => c.ClientNamespaceName = s); + Configuration.Generation.UsesBackingStore = backingStore; + Configuration.Generation.ExcludeBackwardCompatible = excludeBackwardCompatible; + Configuration.Generation.IncludeAdditionalData = includeAdditionalData; + Configuration.Generation.Language = language; + if (includePatterns.Count != 0) + Configuration.Generation.IncludePatterns = includePatterns.Select(static x => x.TrimQuotes()).ToHashSet(StringComparer.OrdinalIgnoreCase); + if (excludePatterns.Count != 0) + Configuration.Generation.ExcludePatterns = excludePatterns.Select(static x => x.TrimQuotes()).ToHashSet(StringComparer.OrdinalIgnoreCase); + if (disabledValidationRules.Count != 0) + Configuration.Generation.DisabledValidationRules = disabledValidationRules + .Select(static x => x.TrimQuotes()) + .SelectMany(static x => x.Split(',', StringSplitOptions.RemoveEmptyEntries)) + .ToHashSet(StringComparer.OrdinalIgnoreCase); + if (structuredMimeTypes.Count != 0) + Configuration.Generation.StructuredMimeTypes = new(structuredMimeTypes.SelectMany(static x => x.Split(' ', StringSplitOptions.RemoveEmptyEntries)) + .Select(static x => x.TrimQuotes())); + + Configuration.Generation.OpenAPIFilePath = GetAbsolutePath(Configuration.Generation.OpenAPIFilePath); + Configuration.Generation.OutputPath = NormalizeSlashesInPath(GetAbsolutePath(Configuration.Generation.OutputPath)); + Configuration.Generation.ApiManifestPath = NormalizeSlashesInPath(GetAbsolutePath(Configuration.Generation.ApiManifestPath)); + + var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); + using (loggerFactory) + { + await Task.Delay(0).ConfigureAwait(false); + throw new NotImplementedException(); + } + } +} diff --git a/src/kiota/KiotaClientCommands.cs b/src/kiota/KiotaClientCommands.cs new file mode 100644 index 0000000000..06164aa8f5 --- /dev/null +++ b/src/kiota/KiotaClientCommands.cs @@ -0,0 +1,104 @@ +using System.CommandLine; +using kiota.Handlers.Client; +using Kiota.Builder.Configuration; + +namespace kiota; +public static class KiotaClientCommands +{ + public static Command GetClientNodeCommand() + { + var command = new Command("client", "Manages the Kiota generated API clients"); + command.AddCommand(GetAddCommand()); + command.AddCommand(GetRemoveCommand()); + command.AddCommand(GetEditCommand()); + command.AddCommand(GetGenerateCommand()); + return command; + } + private static Option GetSkipGenerationOption() + { + var skipGeneration = new Option("--skip-generation", "Skips the generation of the client"); + skipGeneration.AddAlias("--sg"); + return skipGeneration; + } + private static Option GetClientNameOption() + { + var clientName = new Option("--client-name", "The name of the client to manage") + { + IsRequired = true, + }; + clientName.AddAlias("--cn"); + return clientName; + } + public static Command GetAddCommand() + { + var defaultConfiguration = new GenerationConfiguration(); + var languageOption = KiotaHost.GetLanguageOption(); + var outputOption = KiotaHost.GetOutputPathOption(defaultConfiguration.OutputPath); + var descriptionOption = KiotaHost.GetDescriptionOption(defaultConfiguration.OpenAPIFilePath, true); + var namespaceOption = KiotaHost.GetNamespaceOption(defaultConfiguration); + var logLevelOption = KiotaHost.GetLogLevelOption(); + var backingStoreOption = KiotaHost.GetBackingStoreOption(defaultConfiguration); + var excludeBackwardCompatible = KiotaHost.GetExcludeBackwardCompatibleOption(defaultConfiguration); + var additionalDataOption = KiotaHost.GetAdditionalDataOption(defaultConfiguration); + var structuredMimeTypesOption = KiotaHost.GetStructuredMimeTypesOption(defaultConfiguration); + var (includePatterns, excludePatterns) = KiotaHost.GetIncludeAndExcludeOptions(defaultConfiguration.IncludePatterns, defaultConfiguration.ExcludePatterns); + var dvrOption = KiotaHost.GetDisableValidationRulesOption(); + var skipGenerationOption = GetSkipGenerationOption(); + var clientNameOption = GetClientNameOption(); + + + var command = new Command("add", "Adds a new client to the Kiota configuration"){ + descriptionOption, + outputOption, + languageOption, + clientNameOption, + namespaceOption, + logLevelOption, + backingStoreOption, + excludeBackwardCompatible, + additionalDataOption, + structuredMimeTypesOption, + includePatterns, + excludePatterns, + dvrOption, + skipGenerationOption, + }; + command.Handler = new AddHandler + { + DescriptionOption = descriptionOption, + OutputOption = outputOption, + LanguageOption = languageOption, + ClassOption = clientNameOption, + NamespaceOption = namespaceOption, + LogLevelOption = logLevelOption, + BackingStoreOption = backingStoreOption, + ExcludeBackwardCompatibleOption = excludeBackwardCompatible, + AdditionalDataOption = additionalDataOption, + StructuredMimeTypesOption = structuredMimeTypesOption, + IncludePatternsOption = includePatterns, + ExcludePatternsOption = excludePatterns, + DisabledValidationRulesOption = dvrOption, + SkipGenerationOption = skipGenerationOption, + }; + + return command; + } + public static Command GetRemoveCommand() + { + var command = new Command("remove", "Removes a client from the Kiota configuration"); + //TODO map the handler + return command; + } + public static Command GetEditCommand() + { + var command = new Command("edit", "Edits a client from the Kiota configuration"); + //TODO map the handler + return command; + } + public static Command GetGenerateCommand() + { + var command = new Command("generate", "Generates one or all clients from the Kiota configuration"); + //TODO map the handler + return command; + } +} diff --git a/src/kiota/KiotaConfigCommands.cs b/src/kiota/KiotaConfigCommands.cs index 24db579a55..a69cdddcf3 100644 --- a/src/kiota/KiotaConfigCommands.cs +++ b/src/kiota/KiotaConfigCommands.cs @@ -14,8 +14,10 @@ public static Command GetConfigNodeCommand() } private static Command GetInitCommand() { - var command = new Command("init", "Initializes the Kiota configuration"); var logLevelOption = KiotaHost.GetLogLevelOption(); + var command = new Command("init", "Initializes the Kiota configuration"){ + logLevelOption, + }; command.Handler = new InitHandler { LogLevelOption = logLevelOption, diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index 2da259af21..dd3d028b6e 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -18,17 +18,22 @@ public static partial class KiotaHost public static RootCommand GetRootCommand() { var rootCommand = new RootCommand(); - rootCommand.AddCommand(GetGenerateCommand()); + if (!IsConfigPreviewEnabled.Value) + rootCommand.AddCommand(GetGenerateCommand()); rootCommand.AddCommand(GetSearchCommand()); rootCommand.AddCommand(GetDownloadCommand()); rootCommand.AddCommand(GetShowCommand()); rootCommand.AddCommand(GetInfoCommand()); - rootCommand.AddCommand(GetUpdateCommand()); + if (!IsConfigPreviewEnabled.Value) + rootCommand.AddCommand(GetUpdateCommand()); rootCommand.AddCommand(GetLoginCommand()); rootCommand.AddCommand(GetLogoutCommand()); rootCommand.AddCommand(GetRpcCommand()); if (IsConfigPreviewEnabled.Value) + { rootCommand.AddCommand(KiotaConfigCommands.GetConfigNodeCommand()); + rootCommand.AddCommand(KiotaClientCommands.GetClientNodeCommand()); + } return rootCommand; } private static Command GetGitHubLoginCommand() @@ -266,14 +271,14 @@ private static Option GetCleanOutputOption(bool defaultValue) cleanOutputOption.AddAlias("--co"); return cleanOutputOption; } - private static Option GetOutputPathOption(string defaultValue) + internal static Option GetOutputPathOption(string defaultValue) { var outputOption = new Option("--output", () => defaultValue, "The output directory path for the generated code files."); outputOption.AddAlias("-o"); outputOption.ArgumentHelpName = "path"; return outputOption; } - private static Option> GetDisableValidationRulesOption() + internal static Option> GetDisableValidationRulesOption() { var parameterName = "--disable-validation-rules"; var option = new Option>(parameterName, () => new List(), "The OpenAPI description validation rules to disable. Accepts multiple values."); @@ -301,13 +306,14 @@ private static Option> GetDisableValidationRulesOption() var kiotaInContainerRaw = Environment.GetEnvironmentVariable("KIOTA_CONTAINER"); return !string.IsNullOrEmpty(kiotaInContainerRaw) && bool.TryParse(kiotaInContainerRaw, out var kiotaInContainer) && kiotaInContainer; }); - private static Option GetDescriptionOption(string defaultValue) + internal static Option GetDescriptionOption(string defaultValue, bool isRequired = false) { var descriptionOption = new Option("--openapi", "The path or URI to the OpenAPI description file used to generate the code files."); - if (isRunningInContainer.Value) + if (isRunningInContainer.Value && !isRequired) descriptionOption.SetDefaultValue(defaultValue); descriptionOption.AddAlias("-d"); descriptionOption.ArgumentHelpName = "path"; + descriptionOption.IsRequired = isRequired; return descriptionOption; } private static Option GetManifestOption(string defaultValue) @@ -322,6 +328,49 @@ private static Option GetManifestOption(string defaultValue) private static partial Regex classNameRegex(); [GeneratedRegex(@"^[\w][\w\._-]+", RegexOptions.Singleline, 500)] private static partial Regex namespaceNameRegex(); + internal static Option GetLanguageOption() + { + var languageOption = new Option("--language", "The target language for the generated code files."); + languageOption.AddAlias("-l"); + languageOption.IsRequired = true; + AddEnumValidator(languageOption, "language"); + return languageOption; + } + internal static Option GetNamespaceOption(GenerationConfiguration defaultConfiguration) + { + var namespaceOption = new Option("--namespace-name", () => defaultConfiguration.ClientNamespaceName, "The namespace to use for the core client class specified with the --class-name option."); + namespaceOption.AddAlias("-n"); + namespaceOption.ArgumentHelpName = "name"; + AddStringRegexValidator(namespaceOption, namespaceNameRegex(), "namespace name"); + return namespaceOption; + } + internal static Option GetBackingStoreOption(GenerationConfiguration defaultConfiguration) + { + var backingStoreOption = new Option("--backing-store", () => defaultConfiguration.UsesBackingStore, "Enables backing store for models."); + backingStoreOption.AddAlias("-b"); + return backingStoreOption; + } + internal static Option GetExcludeBackwardCompatibleOption(GenerationConfiguration defaultConfiguration) + { + var excludeBackwardCompatible = new Option("--exclude-backward-compatible", () => defaultConfiguration.ExcludeBackwardCompatible, "Excludes backward compatible and obsolete assets from the generated result. Should be used for new clients."); + excludeBackwardCompatible.AddAlias("--ebc"); + return excludeBackwardCompatible; + } + internal static Option GetAdditionalDataOption(GenerationConfiguration defaultConfiguration) + { + var additionalDataOption = new Option("--additional-data", () => defaultConfiguration.IncludeAdditionalData, "Will include the 'AdditionalData' property for models."); + additionalDataOption.AddAlias("--ad"); + return additionalDataOption; + } + internal static Option> GetStructuredMimeTypesOption(GenerationConfiguration defaultConfiguration) + { + var structuredMimeTypesOption = new Option>( + "--structured-mime-types", + () => [.. defaultConfiguration.StructuredMimeTypes], + "The MIME types with optional priorities as defined in RFC9110 Accept header to use for structured data model generation. Accepts multiple values."); + structuredMimeTypesOption.AddAlias("-m"); + return structuredMimeTypesOption; + } private static Command GetGenerateCommand() { var defaultConfiguration = new GenerationConfiguration(); @@ -330,31 +379,22 @@ private static Command GetGenerateCommand() var outputOption = GetOutputPathOption(defaultConfiguration.OutputPath); - var languageOption = new Option("--language", "The target language for the generated code files."); - languageOption.AddAlias("-l"); - languageOption.IsRequired = true; - AddEnumValidator(languageOption, "language"); + var languageOption = GetLanguageOption(); var classOption = new Option("--class-name", () => defaultConfiguration.ClientClassName, "The class name to use for the core client class."); classOption.AddAlias("-c"); classOption.ArgumentHelpName = "name"; AddStringRegexValidator(classOption, classNameRegex(), "class name"); - var namespaceOption = new Option("--namespace-name", () => defaultConfiguration.ClientNamespaceName, "The namespace to use for the core client class specified with the --class-name option."); - namespaceOption.AddAlias("-n"); - namespaceOption.ArgumentHelpName = "name"; - AddStringRegexValidator(namespaceOption, namespaceNameRegex(), "namespace name"); + var namespaceOption = GetNamespaceOption(defaultConfiguration); var logLevelOption = GetLogLevelOption(); - var backingStoreOption = new Option("--backing-store", () => defaultConfiguration.UsesBackingStore, "Enables backing store for models."); - backingStoreOption.AddAlias("-b"); + var backingStoreOption = GetBackingStoreOption(defaultConfiguration); - var excludeBackwardCompatible = new Option("--exclude-backward-compatible", () => defaultConfiguration.ExcludeBackwardCompatible, "Excludes backward compatible and obsolete assets from the generated result. Should be used for new clients."); - excludeBackwardCompatible.AddAlias("--ebc"); + var excludeBackwardCompatible = GetExcludeBackwardCompatibleOption(defaultConfiguration); - var additionalDataOption = new Option("--additional-data", () => defaultConfiguration.IncludeAdditionalData, "Will include the 'AdditionalData' property for models."); - additionalDataOption.AddAlias("--ad"); + var additionalDataOption = GetAdditionalDataOption(defaultConfiguration); var serializerOption = new Option>( "--serializer", @@ -372,11 +412,7 @@ private static Command GetGenerateCommand() var cleanOutputOption = GetCleanOutputOption(defaultConfiguration.CleanOutput); - var structuredMimeTypesOption = new Option>( - "--structured-mime-types", - () => [.. defaultConfiguration.StructuredMimeTypes], - "The MIME types with optional priorities as defined in RFC9110 Accept header to use for structured data model generation. Accepts multiple values."); - structuredMimeTypesOption.AddAlias("-m"); + var structuredMimeTypesOption = GetStructuredMimeTypesOption(defaultConfiguration); var (includePatterns, excludePatterns) = GetIncludeAndExcludeOptions(defaultConfiguration.IncludePatterns, defaultConfiguration.ExcludePatterns); @@ -453,7 +489,7 @@ private static Command GetUpdateCommand() }; return command; } - private static (Option>, Option>) GetIncludeAndExcludeOptions(HashSet defaultIncludePatterns, HashSet defaultExcludePatterns) + internal static (Option>, Option>) GetIncludeAndExcludeOptions(HashSet defaultIncludePatterns, HashSet defaultExcludePatterns) { var includePatterns = new Option>( "--include-path", From 0d2dbf7f6add765ea565a4c0f23df50b91c53a12 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 9 Feb 2024 15:20:15 -0500 Subject: [PATCH 307/394] - adds additional mapping to the configuration class so we can efficiently switch context Signed-off-by: Vincent Biret --- .../ApiClientConfiguration.cs | 83 ++++++++++++++++++- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs index e9499aa01f..0169fc14d5 100644 --- a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs @@ -1,4 +1,8 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Linq; +using Kiota.Builder.Configuration; +using Kiota.Builder.Lock; namespace Kiota.Builder.WorkspaceManagement; @@ -32,9 +36,9 @@ public class ApiClientConfiguration /// public string OutputPath { get; set; } = string.Empty; /// - /// The main class name for this client. + /// The main namespace for this client. /// - public string ClientClassName { get; set; } = string.Empty; + public string ClientNamespaceName { get; set; } = string.Empty; /// /// Whether the backing store was used for this client. /// @@ -60,6 +64,79 @@ public bool ExcludeBackwardCompatible /// The OpenAPI validation rules to disable during the generation. /// public HashSet DisabledValidationRules { get; set; } = new(); + /// + /// Initializes a new instance of the class. + /// + public ApiClientConfiguration() + { + + } + /// + /// Initializes a new instance of the class from an existing . + /// + /// The configuration to use to initialize the client configuration + public ApiClientConfiguration(GenerationConfiguration config) + { + ArgumentNullException.ThrowIfNull(config); + Language = config.Language.ToString(); + ClientNamespaceName = config.ClientNamespaceName; + UsesBackingStore = config.UsesBackingStore; + ExcludeBackwardCompatible = config.ExcludeBackwardCompatible; + IncludeAdditionalData = config.IncludeAdditionalData; + StructuredMimeTypes = config.StructuredMimeTypes.ToList(); + IncludePatterns = config.IncludePatterns; + ExcludePatterns = config.ExcludePatterns; + DescriptionLocation = config.OpenAPIFilePath; + DisabledValidationRules = config.DisabledValidationRules; + OutputPath = config.OutputPath; + } + /// + /// Initializes a new instance of the class from an existing to enable migrations. + /// + /// The kiota lock to migrate. + /// The relative output path to output folder from the configuration file. + public ApiClientConfiguration(KiotaLock kiotaLock, string relativeOutputPath) + { + ArgumentNullException.ThrowIfNull(kiotaLock); + ArgumentNullException.ThrowIfNull(relativeOutputPath); + Language = kiotaLock.Language; + ClientNamespaceName = kiotaLock.ClientNamespaceName; + UsesBackingStore = kiotaLock.UsesBackingStore; + ExcludeBackwardCompatible = kiotaLock.ExcludeBackwardCompatible; + IncludeAdditionalData = kiotaLock.IncludeAdditionalData; + StructuredMimeTypes = kiotaLock.StructuredMimeTypes.ToList(); + IncludePatterns = kiotaLock.IncludePatterns; + ExcludePatterns = kiotaLock.ExcludePatterns; + DescriptionLocation = kiotaLock.DescriptionLocation; + DisabledValidationRules = kiotaLock.DisabledValidationRules; + OutputPath = relativeOutputPath; + } + /// + /// Updates the passed configuration with the values from the config file. + /// + /// Generation configuration to update. + /// Client name serving as class name. + public void UpdateGenerationConfigurationFromApiClientConfiguration(GenerationConfiguration config, string clientName) + { + //TODO lock the api manifest as well to have accurate path resolution + ArgumentNullException.ThrowIfNull(config); + ArgumentException.ThrowIfNullOrEmpty(clientName); + config.ClientNamespaceName = ClientNamespaceName; + if (Enum.TryParse(Language, out var parsedLanguage)) + config.Language = parsedLanguage; + config.UsesBackingStore = UsesBackingStore; + config.ExcludeBackwardCompatible = ExcludeBackwardCompatible; + config.IncludeAdditionalData = IncludeAdditionalData; + config.StructuredMimeTypes = new(StructuredMimeTypes); + config.IncludePatterns = IncludePatterns; + config.ExcludePatterns = ExcludePatterns; + config.OpenAPIFilePath = DescriptionLocation; + config.DisabledValidationRules = DisabledValidationRules; + config.OutputPath = OutputPath; + config.ClientClassName = clientName; + config.Serializers.Clear(); + config.Deserializers.Clear(); + } } #pragma warning restore CA2227 // Collection properties should be read only From 63411d9b494aaf955c72530e3aaea485efda0467 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 12 Feb 2024 13:30:13 -0500 Subject: [PATCH 308/394] - adds a level of indirection between builder and lock Signed-off-by: Vincent Biret --- src/Kiota.Builder/KiotaBuilder.cs | 38 +++--------- .../WorkspaceManagementService.cs | 58 +++++++++++++++++++ src/kiota/Handlers/Client/AddHandler.cs | 36 +++++++++++- 3 files changed, 100 insertions(+), 32 deletions(-) create mode 100644 src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 390d151c69..5cd8feb50f 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -21,7 +21,7 @@ using Kiota.Builder.EqualityComparers; using Kiota.Builder.Exceptions; using Kiota.Builder.Extensions; -using Kiota.Builder.Lock; +using Kiota.Builder.WorkspaceManagement; using Kiota.Builder.Logging; using Kiota.Builder.Manifest; using Kiota.Builder.OpenApiExtensions; @@ -51,7 +51,7 @@ public partial class KiotaBuilder private OpenApiDocument? openApiDocument; internal void SetOpenApiDocument(OpenApiDocument document) => openApiDocument = document ?? throw new ArgumentNullException(nameof(document)); - public KiotaBuilder(ILogger logger, GenerationConfiguration config, HttpClient client) + public KiotaBuilder(ILogger logger, GenerationConfiguration config, HttpClient client, bool useKiotaConfig = false) { ArgumentNullException.ThrowIfNull(logger); ArgumentNullException.ThrowIfNull(config); @@ -63,6 +63,7 @@ public KiotaBuilder(ILogger logger, GenerationConfiguration config { MaxDegreeOfParallelism = config.MaxDegreeOfParallelism, }; + workspaceManagementService = new WorkspaceManagementService(logger, useKiotaConfig); } private async Task CleanOutputDirectory(CancellationToken cancellationToken) { @@ -72,7 +73,7 @@ private async Task CleanOutputDirectory(CancellationToken cancellationToken) // not using Directory.Delete on the main directory because it's locked when mapped in a container foreach (var subDir in Directory.EnumerateDirectories(config.OutputPath)) Directory.Delete(subDir, true); - await lockManagementService.BackupLockFileAsync(config.OutputPath, cancellationToken).ConfigureAwait(false); + await workspaceManagementService.BackupStateAsync(config.OutputPath, cancellationToken).ConfigureAwait(false); foreach (var subFile in Directory.EnumerateFiles(config.OutputPath) .Where(x => !x.EndsWith(FileLogLogger.LogFileName, StringComparison.OrdinalIgnoreCase))) File.Delete(subFile); @@ -173,7 +174,7 @@ private static string NormalizeApiManifestPath(RequestInfo request, string? base // Should Generate sw.Start(); - var shouldGenerate = await ShouldGenerate(cancellationToken).ConfigureAwait(false); + var shouldGenerate = await workspaceManagementService.ShouldGenerateAsync(config, openApiDocument?.HashCode ?? string.Empty, cancellationToken).ConfigureAwait(false); StopLogAndReset(sw, $"step {++stepId} - checking whether the output should be updated - took"); OpenApiUrlTreeNode? openApiTree = null; @@ -205,21 +206,6 @@ private void UpdateConfigurationFromOpenApiDocument() config.UpdateConfigurationFromLanguagesInformation(languagesInfo); } - private async Task ShouldGenerate(CancellationToken cancellationToken) - { - if (config.CleanOutput) return true; - var existingLock = await lockManagementService.GetLockFromDirectoryAsync(config.OutputPath, cancellationToken).ConfigureAwait(false); - var configurationLock = new KiotaLock(config) - { - DescriptionHash = openApiDocument?.HashCode ?? string.Empty, - }; - var comparer = new KiotaLockComparer(); - if (!string.IsNullOrEmpty(existingLock?.KiotaVersion) && !configurationLock.KiotaVersion.Equals(existingLock.KiotaVersion, StringComparison.OrdinalIgnoreCase)) - { - logger.LogWarning("API client was generated with version {ExistingVersion} and the current version is {CurrentVersion}, it will be upgraded and you should upgrade dependencies", existingLock?.KiotaVersion, configurationLock.KiotaVersion); - } - return !comparer.Equals(existingLock, configurationLock); - } public async Task GetLanguagesInformationAsync(CancellationToken cancellationToken) { @@ -283,25 +269,17 @@ public async Task GenerateClientAsync(CancellationToken cancellationToken) // Write lock file sw.Start(); - await UpdateLockFile(cancellationToken).ConfigureAwait(false); + await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, cancellationToken).ConfigureAwait(false); StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); } catch { - await lockManagementService.RestoreLockFileAsync(config.OutputPath, cancellationToken).ConfigureAwait(false); + await workspaceManagementService.RestoreStateAsync(config.OutputPath, cancellationToken).ConfigureAwait(false); throw; } return true; } - private readonly LockManagementService lockManagementService = new(); - private async Task UpdateLockFile(CancellationToken cancellationToken) - { - var configurationLock = new KiotaLock(config) - { - DescriptionHash = openApiDocument?.HashCode ?? string.Empty, - }; - await lockManagementService.WriteLockFileAsync(config.OutputPath, configurationLock, cancellationToken).ConfigureAwait(false); - } + private readonly WorkspaceManagementService workspaceManagementService; private static readonly GlobComparer globComparer = new(); [GeneratedRegex(@"([\/\\])\{[\w\d-]+\}([\/\\])", RegexOptions.IgnoreCase | RegexOptions.Singleline, 2000)] private static partial Regex MultiIndexSameLevelCleanupRegex(); diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs new file mode 100644 index 0000000000..e0dead771e --- /dev/null +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -0,0 +1,58 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Kiota.Builder.Configuration; +using Kiota.Builder.Lock; +using Microsoft.Extensions.Logging; + +namespace Kiota.Builder.WorkspaceManagement; + +public class WorkspaceManagementService +{ + private readonly bool UseKiotaConfig; + private readonly ILogger Logger; + public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false) + { + ArgumentNullException.ThrowIfNull(logger); + Logger = logger; + UseKiotaConfig = useKiotaConfig; + } + private readonly LockManagementService lockManagementService = new(); + public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, CancellationToken cancellationToken = default) + { + if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); + var configurationLock = new KiotaLock(generationConfiguration) + { + DescriptionHash = descriptionHash ?? string.Empty, + }; + await lockManagementService.WriteLockFileAsync(generationConfiguration.OutputPath, configurationLock, cancellationToken).ConfigureAwait(false); + } + public async Task RestoreStateAsync(string outputPath, CancellationToken cancellationToken = default) + { + if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); + await lockManagementService.RestoreLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); + } + public async Task BackupStateAsync(string outputPath, CancellationToken cancellationToken = default) + { + if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); + await lockManagementService.BackupLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); + } + public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, string descriptionHash, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(inputConfig); + if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); + if (inputConfig.CleanOutput) return true; + var existingLock = await lockManagementService.GetLockFromDirectoryAsync(inputConfig.OutputPath, cancellationToken).ConfigureAwait(false); + var configurationLock = new KiotaLock(inputConfig) + { + DescriptionHash = descriptionHash, + }; + var comparer = new KiotaLockComparer(); + if (!string.IsNullOrEmpty(existingLock?.KiotaVersion) && !configurationLock.KiotaVersion.Equals(existingLock.KiotaVersion, StringComparison.OrdinalIgnoreCase)) + { + Logger.LogWarning("API client was generated with version {ExistingVersion} and the current version is {CurrentVersion}, it will be upgraded and you should upgrade dependencies", existingLock?.KiotaVersion, configurationLock.KiotaVersion); + } + return !comparer.Equals(existingLock, configurationLock); + + } +} diff --git a/src/kiota/Handlers/Client/AddHandler.cs b/src/kiota/Handlers/Client/AddHandler.cs index e65b15ec5b..86dee29afb 100644 --- a/src/kiota/Handlers/Client/AddHandler.cs +++ b/src/kiota/Handlers/Client/AddHandler.cs @@ -3,10 +3,12 @@ using System.CommandLine; using System.CommandLine.Invocation; using System.Linq; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Extensions; +using Microsoft.Extensions.Logging; namespace kiota.Handlers.Client; @@ -110,8 +112,38 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); using (loggerFactory) { - await Task.Delay(0).ConfigureAwait(false); - throw new NotImplementedException(); + await CheckForNewVersionAsync(logger, cancellationToken); + logger.AppendInternalTracing(); + logger.LogTrace("configuration: {configuration}", JsonSerializer.Serialize(Configuration, KiotaConfigurationJsonContext.Default.KiotaConfiguration)); + + try + { + var builder = new KiotaBuilder(logger, Configuration.Generation, httpClient, true); + //TODO implement skip generation + var result = await builder.GenerateClientAsync(cancellationToken).ConfigureAwait(false); + if (result) + DisplaySuccess("Generation completed successfully"); + else + { + DisplaySuccess("Generation skipped as no changes were detected"); + DisplayCleanHint("generate"); + } + var manifestResult = await builder.GetApiManifestDetailsAsync(true, cancellationToken).ConfigureAwait(false); + var manifestPath = manifestResult is null ? string.Empty : Configuration.Generation.ApiManifestPath; + DisplayInfoHint(language, Configuration.Generation.OpenAPIFilePath, manifestPath); + DisplayGenerateAdvancedHint(includePatterns, excludePatterns, Configuration.Generation.OpenAPIFilePath, manifestPath); + return 0; + } + catch (Exception ex) + { +#if DEBUG + logger.LogCritical(ex, "error generating the client: {exceptionMessage}", ex.Message); + throw; // so debug tools go straight to the source of the exception when attached +#else + logger.LogCritical("error generating the client: {exceptionMessage}", ex.Message); + return 1; +#endif + } } } } From 0173370306ea763b606deed6cf9d5a94f2a778b8 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 12 Feb 2024 13:37:19 -0500 Subject: [PATCH 309/394] - initial implementation of backing/restore for config Signed-off-by: Vincent Biret --- .../WorkspaceConfigurationStorageService.cs | 40 +++++++++++++++++++ .../WorkspaceManagementService.cs | 15 ++++--- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index c49aa71f0f..4903f8d66f 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -1,5 +1,7 @@ using System; using System.IO; +using System.Security.Cryptography; +using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -61,4 +63,42 @@ public Task IsInitializedAsync(CancellationToken cancellationToken = defau } return null; } + public Task BackupConfigAsync(string directoryPath, CancellationToken cancellationToken = default) + { + ArgumentException.ThrowIfNullOrEmpty(directoryPath); + var lockFilePath = Path.Combine(directoryPath, ConfigurationFileName); + //TODO backup the manifest file as well + if (File.Exists(lockFilePath)) + { + var backupFilePath = GetBackupFilePath(directoryPath); + var targetDirectory = Path.GetDirectoryName(backupFilePath); + if (string.IsNullOrEmpty(targetDirectory)) return Task.CompletedTask; + if (!Directory.Exists(targetDirectory)) + Directory.CreateDirectory(targetDirectory); + File.Copy(lockFilePath, backupFilePath, true); + } + return Task.CompletedTask; + } + public Task RestoreConfigAsync(string directoryPath, CancellationToken cancellationToken = default) + { + ArgumentException.ThrowIfNullOrEmpty(directoryPath); + //TODO backup the manifest file as well + var lockFilePath = Path.Combine(directoryPath, ConfigurationFileName); + var targetDirectory = Path.GetDirectoryName(lockFilePath); + if (string.IsNullOrEmpty(targetDirectory)) return Task.CompletedTask; + if (!Directory.Exists(targetDirectory)) + Directory.CreateDirectory(targetDirectory); + var backupFilePath = GetBackupFilePath(directoryPath); + if (File.Exists(backupFilePath)) + { + File.Copy(backupFilePath, lockFilePath, true); + } + return Task.CompletedTask; + } + private static readonly ThreadLocal HashAlgorithm = new(SHA256.Create); + private static string GetBackupFilePath(string outputPath) + { + var hashedPath = BitConverter.ToString((HashAlgorithm.Value ?? throw new InvalidOperationException("unable to get hash algorithm")).ComputeHash(Encoding.UTF8.GetBytes(outputPath))).Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase); + return Path.Combine(Path.GetTempPath(), Constants.TempDirectoryName, "backup", hashedPath, ConfigurationFileName); + } } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index e0dead771e..d916eaa08d 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -18,6 +18,7 @@ public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false) UseKiotaConfig = useKiotaConfig; } private readonly LockManagementService lockManagementService = new(); + private readonly WorkspaceConfigurationStorageService workspaceConfigurationStorageService = new(); public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, CancellationToken cancellationToken = default) { if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); @@ -29,19 +30,23 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene } public async Task RestoreStateAsync(string outputPath, CancellationToken cancellationToken = default) { - if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); - await lockManagementService.RestoreLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); + if (UseKiotaConfig) + await workspaceConfigurationStorageService.RestoreConfigAsync(outputPath, cancellationToken).ConfigureAwait(false); + else + await lockManagementService.RestoreLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); } public async Task BackupStateAsync(string outputPath, CancellationToken cancellationToken = default) { - if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); - await lockManagementService.BackupLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); + if (UseKiotaConfig) + await workspaceConfigurationStorageService.BackupConfigAsync(outputPath, cancellationToken).ConfigureAwait(false); + else + await lockManagementService.BackupLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); } public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, string descriptionHash, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(inputConfig); - if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); if (inputConfig.CleanOutput) return true; + if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); var existingLock = await lockManagementService.GetLockFromDirectoryAsync(inputConfig.OutputPath, cancellationToken).ConfigureAwait(false); var configurationLock = new KiotaLock(inputConfig) { From 03b1843ba0de326f98c31b0bec908ad3c3efdace Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 12 Feb 2024 14:57:40 -0500 Subject: [PATCH 310/394] - initial wiring of config file generation Signed-off-by: Vincent Biret --- .../ApiClientConfigurationComparer.cs | 36 +++++++++++++ .../WorkspaceManagementService.cs | 53 ++++++++++++++----- 2 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 src/Kiota.Builder/WorkspaceManagement/ApiClientConfigurationComparer.cs diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfigurationComparer.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfigurationComparer.cs new file mode 100644 index 0000000000..f17f4af8ca --- /dev/null +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfigurationComparer.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using Kiota.Builder.Lock; + +namespace Kiota.Builder.WorkspaceManagement; +/// +/// Compares two instances. +/// +public class ApiClientConfigurationComparer : IEqualityComparer +{ + private static readonly StringIEnumerableDeepComparer _stringIEnumerableDeepComparer = new(); + /// + public bool Equals(ApiClientConfiguration? x, ApiClientConfiguration? y) + { + return x == null && y == null || x != null && y != null && GetHashCode(x) == GetHashCode(y); + } + /// + public int GetHashCode([DisallowNull] ApiClientConfiguration obj) + { + if (obj == null) return 0; + return + _stringIEnumerableDeepComparer.GetHashCode(obj.DisabledValidationRules?.Order(StringComparer.OrdinalIgnoreCase) ?? Enumerable.Empty()) * 37 + + (string.IsNullOrEmpty(obj.DescriptionLocation) ? 0 : obj.DescriptionLocation.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 31 + + (string.IsNullOrEmpty(obj.OutputPath) ? 0 : obj.OutputPath.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 19 + + (string.IsNullOrEmpty(obj.ClientNamespaceName) ? 0 : obj.ClientNamespaceName.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 23 + + (string.IsNullOrEmpty(obj.Language) ? 0 : obj.Language.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 19 + + obj.ExcludeBackwardCompatible.GetHashCode() * 17 + + obj.UsesBackingStore.GetHashCode() * 13 + + obj.IncludeAdditionalData.GetHashCode() * 7 + + _stringIEnumerableDeepComparer.GetHashCode(obj.StructuredMimeTypes?.Order(StringComparer.OrdinalIgnoreCase) ?? Enumerable.Empty()) * 5 + + _stringIEnumerableDeepComparer.GetHashCode(obj.IncludePatterns?.Order(StringComparer.OrdinalIgnoreCase) ?? Enumerable.Empty()) * 3 + + _stringIEnumerableDeepComparer.GetHashCode(obj.ExcludePatterns?.Order(StringComparer.OrdinalIgnoreCase) ?? Enumerable.Empty()) * 2; + } +} diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index d916eaa08d..f19401c1b5 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -4,6 +4,7 @@ using Kiota.Builder.Configuration; using Kiota.Builder.Lock; using Microsoft.Extensions.Logging; +using Microsoft.Kiota.Abstractions.Extensions; namespace Kiota.Builder.WorkspaceManagement; @@ -21,12 +22,23 @@ public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false) private readonly WorkspaceConfigurationStorageService workspaceConfigurationStorageService = new(); public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, CancellationToken cancellationToken = default) { - if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); - var configurationLock = new KiotaLock(generationConfiguration) + ArgumentNullException.ThrowIfNull(generationConfiguration); + if (UseKiotaConfig) + { + var wsConfig = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false) ?? + new WorkspaceConfiguration(); + wsConfig.Clients.AddOrReplace(generationConfiguration.ClientClassName, new ApiClientConfiguration(generationConfiguration)); + await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, cancellationToken).ConfigureAwait(false); + //TODO generate API manifest + } + else { - DescriptionHash = descriptionHash ?? string.Empty, - }; - await lockManagementService.WriteLockFileAsync(generationConfiguration.OutputPath, configurationLock, cancellationToken).ConfigureAwait(false); + var configurationLock = new KiotaLock(generationConfiguration) + { + DescriptionHash = descriptionHash ?? string.Empty, + }; + await lockManagementService.WriteLockFileAsync(generationConfiguration.OutputPath, configurationLock, cancellationToken).ConfigureAwait(false); + } } public async Task RestoreStateAsync(string outputPath, CancellationToken cancellationToken = default) { @@ -46,18 +58,31 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, { ArgumentNullException.ThrowIfNull(inputConfig); if (inputConfig.CleanOutput) return true; - if (UseKiotaConfig) throw new NotImplementedException("Not implemented yet"); - var existingLock = await lockManagementService.GetLockFromDirectoryAsync(inputConfig.OutputPath, cancellationToken).ConfigureAwait(false); - var configurationLock = new KiotaLock(inputConfig) + if (UseKiotaConfig) { - DescriptionHash = descriptionHash, - }; - var comparer = new KiotaLockComparer(); - if (!string.IsNullOrEmpty(existingLock?.KiotaVersion) && !configurationLock.KiotaVersion.Equals(existingLock.KiotaVersion, StringComparison.OrdinalIgnoreCase)) + var wsConfig = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + if (wsConfig?.Clients.TryGetValue(inputConfig.ClientClassName, out var existingClientConfig) ?? false) + { + var comparer = new ApiClientConfigurationComparer(); + //TODO also compare the api manifest file + return !comparer.Equals(existingClientConfig, new ApiClientConfiguration(inputConfig)); + } + return true; + } + else { - Logger.LogWarning("API client was generated with version {ExistingVersion} and the current version is {CurrentVersion}, it will be upgraded and you should upgrade dependencies", existingLock?.KiotaVersion, configurationLock.KiotaVersion); + var existingLock = await lockManagementService.GetLockFromDirectoryAsync(inputConfig.OutputPath, cancellationToken).ConfigureAwait(false); + var configurationLock = new KiotaLock(inputConfig) + { + DescriptionHash = descriptionHash, + }; + var comparer = new KiotaLockComparer(); + if (!string.IsNullOrEmpty(existingLock?.KiotaVersion) && !configurationLock.KiotaVersion.Equals(existingLock.KiotaVersion, StringComparison.OrdinalIgnoreCase)) + { + Logger.LogWarning("API client was generated with version {ExistingVersion} and the current version is {CurrentVersion}, it will be upgraded and you should upgrade dependencies", existingLock?.KiotaVersion, configurationLock.KiotaVersion); + } + return !comparer.Equals(existingLock, configurationLock); } - return !comparer.Equals(existingLock, configurationLock); } } From 55e73d5559b6c039c5df107433e4a5be3acfdd03 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 12 Feb 2024 16:30:33 -0500 Subject: [PATCH 311/394] - initial implementation of manifest generation Signed-off-by: Vincent Biret --- .../Configuration/GenerationConfiguration.cs | 15 ++++ .../Manifest/ApiDependencyComparer.cs | 30 +++++++ .../Manifest/ManifestManagementService.cs | 15 ++++ .../Manifest/RequestInfoComparer.cs | 20 +++++ .../WorkspaceConfigurationStorageService.cs | 78 +++++++++++++------ .../WorkspaceManagementService.cs | 29 ++++--- ...rkspaceConfigurationStorageServiceTests.cs | 10 ++- 7 files changed, 158 insertions(+), 39 deletions(-) create mode 100644 src/Kiota.Builder/Manifest/ApiDependencyComparer.cs create mode 100644 src/Kiota.Builder/Manifest/RequestInfoComparer.cs diff --git a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs index 8dc08fb33d..0b4e62e45e 100644 --- a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs +++ b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text.Json.Nodes; using Kiota.Builder.Lock; +using Microsoft.OpenApi.ApiManifest; namespace Kiota.Builder.Configuration; #pragma warning disable CA2227 @@ -153,6 +155,19 @@ internal void UpdateConfigurationFromLanguagesInformation(LanguagesInformation l !comparer.Equals(languageInfo.StructuredMimeTypes, StructuredMimeTypes)) StructuredMimeTypes = new(languageInfo.StructuredMimeTypes); } + public const string KiotaHashManifestExtensionKey = "x-ms-kiota-hash"; + public ApiDependency ToApiDependency(string configurationHash, string version = "1.0") + { + var dependency = new ApiDependency() + { + ApiDescriptionUrl = OpenAPIFilePath, + ApiDescriptionVersion = version, + Extensions = new() { + { KiotaHashManifestExtensionKey, JsonValue.Create(configurationHash)} + } + }; + return dependency; + } } #pragma warning restore CA1056 #pragma warning restore CA1002 diff --git a/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs b/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs new file mode 100644 index 0000000000..0b0574c3a3 --- /dev/null +++ b/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Nodes; +using Kiota.Builder.Configuration; +using Microsoft.OpenApi.ApiManifest; + +namespace Kiota.Builder.Manifest; + +public class ApiDependencyComparer : IEqualityComparer +{ + private static readonly RequestInfoComparer requestInfoComparer = new(); + /// + public bool Equals(ApiDependency? x, ApiDependency? y) + { + return x == null && y == null || x != null && y != null && GetHashCode(x) == GetHashCode(y); + } + /// + public int GetHashCode([DisallowNull] ApiDependency obj) + { + if (obj == null) return 0; + return + (string.IsNullOrEmpty(obj.ApiDescriptionUrl) ? 0 : obj.ApiDescriptionUrl.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 37 + + (string.IsNullOrEmpty(obj.ApiDescriptionVersion) ? 0 : obj.ApiDescriptionVersion.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 31 + + (obj.Extensions is not null && obj.Extensions.TryGetValue(GenerationConfiguration.KiotaHashManifestExtensionKey, out var jsonNode) && jsonNode is JsonValue jsonValue && jsonValue.GetValueKind() is JsonValueKind.String ? jsonValue.GetValue().GetHashCode(StringComparison.OrdinalIgnoreCase) : 0) * 19 + + obj.Requests.Select(requestInfoComparer.GetHashCode).Sum() * 17; + } +} diff --git a/src/Kiota.Builder/Manifest/ManifestManagementService.cs b/src/Kiota.Builder/Manifest/ManifestManagementService.cs index f8cc0e87a3..23f25a46f4 100644 --- a/src/Kiota.Builder/Manifest/ManifestManagementService.cs +++ b/src/Kiota.Builder/Manifest/ManifestManagementService.cs @@ -21,4 +21,19 @@ public class ManifestManagementService var jsonDocument = await JsonDocument.ParseAsync(jsonValue).ConfigureAwait(false); return ApiManifestDocument.Load(jsonDocument.RootElement); } + /// + /// Serializes the API manifest document to a JSON representation. + /// + /// The API manifest document to serialize + /// The stream to write the serialized JSON representation + /// The serialized JSON representation + public async Task SerializeManifestDocumentAsync(ApiManifestDocument manifestDocument, Stream stream) + { + ArgumentNullException.ThrowIfNull(manifestDocument); +#pragma warning disable CA2007 + await using var writer = new Utf8JsonWriter(stream, new JsonWriterOptions { Indented = true }); +#pragma warning restore CA2007 + manifestDocument.Write(writer); + await writer.FlushAsync().ConfigureAwait(false); + } } diff --git a/src/Kiota.Builder/Manifest/RequestInfoComparer.cs b/src/Kiota.Builder/Manifest/RequestInfoComparer.cs new file mode 100644 index 0000000000..6c88ea27dd --- /dev/null +++ b/src/Kiota.Builder/Manifest/RequestInfoComparer.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using Microsoft.OpenApi.ApiManifest; + +namespace Kiota.Builder.Manifest; +public class RequestInfoComparer : IEqualityComparer +{ + public bool Equals(RequestInfo? x, RequestInfo? y) + { + return x == null && y == null || x != null && y != null && GetHashCode(x) == GetHashCode(y); + } + + public int GetHashCode([DisallowNull] RequestInfo obj) + { + if (obj == null) return 0; + return (string.IsNullOrEmpty(obj.Method) ? 0 : obj.Method.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 7 + + (string.IsNullOrEmpty(obj.UriTemplate) ? 0 : obj.UriTemplate.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 3; + } +} diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 4903f8d66f..8915778d80 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -5,17 +5,22 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using Kiota.Builder.Manifest; +using Microsoft.OpenApi.ApiManifest; namespace Kiota.Builder.WorkspaceManagement; public class WorkspaceConfigurationStorageService { private const string ConfigurationFileName = "kiota-config.json"; + private const string ManifestFileName = "apimanifest.json"; public string TargetDirectory { get; private set; } private readonly string targetConfigurationFilePath; + private readonly string targetManifestFilePath; + private readonly ManifestManagementService manifestManagementService = new(); public WorkspaceConfigurationStorageService() : this(Directory.GetCurrentDirectory()) { @@ -25,22 +30,30 @@ public WorkspaceConfigurationStorageService(string targetDirectory) ArgumentException.ThrowIfNullOrEmpty(targetDirectory); TargetDirectory = targetDirectory; targetConfigurationFilePath = Path.Combine(TargetDirectory, ConfigurationFileName); + targetManifestFilePath = Path.Combine(TargetDirectory, ManifestFileName); } public async Task InitializeAsync(CancellationToken cancellationToken = default) { if (await IsInitializedAsync(cancellationToken).ConfigureAwait(false)) throw new InvalidOperationException("The workspace configuration already exists"); - await UpdateWorkspaceConfigurationAsync(new WorkspaceConfiguration(), cancellationToken).ConfigureAwait(false); + await UpdateWorkspaceConfigurationAsync(new WorkspaceConfiguration(), null, cancellationToken).ConfigureAwait(false); } - public async Task UpdateWorkspaceConfigurationAsync(WorkspaceConfiguration configuration, CancellationToken cancellationToken = default) + public async Task UpdateWorkspaceConfigurationAsync(WorkspaceConfiguration configuration, ApiManifestDocument? manifestDocument, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(configuration); if (!Directory.Exists(TargetDirectory)) Directory.CreateDirectory(TargetDirectory); #pragma warning disable CA2007 - await using var fileStream = File.Open(targetConfigurationFilePath, FileMode.Create); + await using var configStream = File.Open(targetConfigurationFilePath, FileMode.Create); #pragma warning restore CA2007 - await JsonSerializer.SerializeAsync(fileStream, configuration, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); + await JsonSerializer.SerializeAsync(configStream, configuration, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); + if (manifestDocument != null) + { +#pragma warning disable CA2007 + await using var manifestStream = File.Open(targetManifestFilePath, FileMode.Create); +#pragma warning restore CA2007 + await manifestManagementService.SerializeManifestDocumentAsync(manifestDocument, manifestStream).ConfigureAwait(false); + } } public Task IsInitializedAsync(CancellationToken cancellationToken = default) {// keeping this as a task in case we want to do more complex validation in the future @@ -52,53 +65,70 @@ public Task IsInitializedAsync(CancellationToken cancellationToken = defau WriteIndented = true, }; private static readonly WorkspaceConfigurationGenerationContext context = new(options); - public async Task GetWorkspaceConfigurationAsync(CancellationToken cancellationToken = default) + public async Task<(WorkspaceConfiguration?, ApiManifestDocument?)> GetWorkspaceConfigurationAsync(CancellationToken cancellationToken = default) { if (File.Exists(targetConfigurationFilePath)) { #pragma warning disable CA2007 - await using var fileStream = File.OpenRead(targetConfigurationFilePath); + await using var configStream = File.OpenRead(targetConfigurationFilePath); #pragma warning restore CA2007 - return await JsonSerializer.DeserializeAsync(fileStream, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); + var config = await JsonSerializer.DeserializeAsync(configStream, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); + if (File.Exists(targetManifestFilePath)) + { +#pragma warning disable CA2007 + await using var manifestStream = File.OpenRead(targetManifestFilePath); +#pragma warning restore CA2007 + var manifest = await manifestManagementService.DeserializeManifestDocumentAsync(manifestStream).ConfigureAwait(false); + return (config, manifest); + } + return (config, null); } - return null; + return (null, null); } public Task BackupConfigAsync(string directoryPath, CancellationToken cancellationToken = default) { ArgumentException.ThrowIfNullOrEmpty(directoryPath); - var lockFilePath = Path.Combine(directoryPath, ConfigurationFileName); - //TODO backup the manifest file as well - if (File.Exists(lockFilePath)) + BackupFile(directoryPath, ConfigurationFileName); + BackupFile(directoryPath, ManifestFileName); + return Task.CompletedTask; + } + private static void BackupFile(string directoryPath, string fileName) + { + var sourceFilePath = Path.Combine(directoryPath, fileName); + if (File.Exists(sourceFilePath)) { - var backupFilePath = GetBackupFilePath(directoryPath); + var backupFilePath = GetBackupFilePath(directoryPath, fileName); var targetDirectory = Path.GetDirectoryName(backupFilePath); - if (string.IsNullOrEmpty(targetDirectory)) return Task.CompletedTask; + if (string.IsNullOrEmpty(targetDirectory)) return; if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory); - File.Copy(lockFilePath, backupFilePath, true); + File.Copy(sourceFilePath, backupFilePath, true); } - return Task.CompletedTask; } public Task RestoreConfigAsync(string directoryPath, CancellationToken cancellationToken = default) { ArgumentException.ThrowIfNullOrEmpty(directoryPath); - //TODO backup the manifest file as well - var lockFilePath = Path.Combine(directoryPath, ConfigurationFileName); - var targetDirectory = Path.GetDirectoryName(lockFilePath); - if (string.IsNullOrEmpty(targetDirectory)) return Task.CompletedTask; + RestoreFile(directoryPath, ConfigurationFileName); + RestoreFile(directoryPath, ManifestFileName); + return Task.CompletedTask; + } + private static void RestoreFile(string directoryPath, string fileName) + { + var sourceFilePath = Path.Combine(directoryPath, fileName); + var targetDirectory = Path.GetDirectoryName(sourceFilePath); + if (string.IsNullOrEmpty(targetDirectory)) return; if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory); - var backupFilePath = GetBackupFilePath(directoryPath); + var backupFilePath = GetBackupFilePath(directoryPath, fileName); if (File.Exists(backupFilePath)) { - File.Copy(backupFilePath, lockFilePath, true); + File.Copy(backupFilePath, sourceFilePath, true); } - return Task.CompletedTask; } private static readonly ThreadLocal HashAlgorithm = new(SHA256.Create); - private static string GetBackupFilePath(string outputPath) + private static string GetBackupFilePath(string outputPath, string fileName) { var hashedPath = BitConverter.ToString((HashAlgorithm.Value ?? throw new InvalidOperationException("unable to get hash algorithm")).ComputeHash(Encoding.UTF8.GetBytes(outputPath))).Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase); - return Path.Combine(Path.GetTempPath(), Constants.TempDirectoryName, "backup", hashedPath, ConfigurationFileName); + return Path.Combine(Path.GetTempPath(), Constants.TempDirectoryName, "backup", hashedPath, fileName); } } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index f19401c1b5..e18c4ff01a 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -5,6 +5,8 @@ using Kiota.Builder.Lock; using Microsoft.Extensions.Logging; using Microsoft.Kiota.Abstractions.Extensions; +using Kiota.Builder.Manifest; +using Microsoft.OpenApi.ApiManifest; namespace Kiota.Builder.WorkspaceManagement; @@ -25,11 +27,13 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene ArgumentNullException.ThrowIfNull(generationConfiguration); if (UseKiotaConfig) { - var wsConfig = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false) ?? - new WorkspaceConfiguration(); + var (wsConfig, manifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + wsConfig ??= new WorkspaceConfiguration(); + manifest ??= new ApiManifestDocument("application"); //TODO get the application name wsConfig.Clients.AddOrReplace(generationConfiguration.ClientClassName, new ApiClientConfiguration(generationConfiguration)); - await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, cancellationToken).ConfigureAwait(false); - //TODO generate API manifest + //TODO set the version from something, set the kiota hash config configuration + description + manifest.ApiDependencies.AddOrReplace(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency("foo")); + await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, manifest, cancellationToken).ConfigureAwait(false); } else { @@ -54,18 +58,22 @@ public async Task BackupStateAsync(string outputPath, CancellationToken cancella else await lockManagementService.BackupLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); } + private static readonly KiotaLockComparer lockComparer = new(); + private static readonly ApiClientConfigurationComparer clientConfigurationComparer = new(); + private static readonly ApiDependencyComparer apiDependencyComparer = new(); public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, string descriptionHash, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(inputConfig); if (inputConfig.CleanOutput) return true; if (UseKiotaConfig) { - var wsConfig = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); - if (wsConfig?.Clients.TryGetValue(inputConfig.ClientClassName, out var existingClientConfig) ?? false) + var (wsConfig, apiManifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + if ((wsConfig?.Clients.TryGetValue(inputConfig.ClientClassName, out var existingClientConfig) ?? false) && + (apiManifest?.ApiDependencies.TryGetValue(inputConfig.ClientClassName, out var existingApiManifest) ?? false)) { - var comparer = new ApiClientConfigurationComparer(); - //TODO also compare the api manifest file - return !comparer.Equals(existingClientConfig, new ApiClientConfiguration(inputConfig)); + //TODO set version from something, generate the hash for kiota config and get the list of requests + return !clientConfigurationComparer.Equals(existingClientConfig, new ApiClientConfiguration(inputConfig)) || + !apiDependencyComparer.Equals(inputConfig.ToApiDependency("foo"), existingApiManifest); } return true; } @@ -76,12 +84,11 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, { DescriptionHash = descriptionHash, }; - var comparer = new KiotaLockComparer(); if (!string.IsNullOrEmpty(existingLock?.KiotaVersion) && !configurationLock.KiotaVersion.Equals(existingLock.KiotaVersion, StringComparison.OrdinalIgnoreCase)) { Logger.LogWarning("API client was generated with version {ExistingVersion} and the current version is {CurrentVersion}, it will be upgraded and you should upgrade dependencies", existingLock?.KiotaVersion, configurationLock.KiotaVersion); } - return !comparer.Equals(existingLock, configurationLock); + return !lockComparer.Equals(existingLock, configurationLock); } } diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs index 446bf39673..c51147fd60 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs @@ -12,7 +12,7 @@ public async Task DefensiveProgramming() { Assert.Throws(() => new WorkspaceConfigurationStorageService(string.Empty)); var service = new WorkspaceConfigurationStorageService(); - await Assert.ThrowsAsync(() => service.UpdateWorkspaceConfigurationAsync(null)); + await Assert.ThrowsAsync(() => service.UpdateWorkspaceConfigurationAsync(null, null)); } private readonly string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); [Fact] @@ -33,16 +33,18 @@ public async Task FailsOnDoubleInit() public async Task ReturnsNullOnNonInitialized() { var service = new WorkspaceConfigurationStorageService(tempPath); - var result = await service.GetWorkspaceConfigurationAsync(); - Assert.Null(result); + var (config, manifest) = await service.GetWorkspaceConfigurationAsync(); + Assert.Null(config); + Assert.Null(manifest); } [Fact] public async Task ReturnsConfigurationWhenInitialized() { var service = new WorkspaceConfigurationStorageService(tempPath); await service.InitializeAsync(); - var result = await service.GetWorkspaceConfigurationAsync(); + var (result, manifest) = await service.GetWorkspaceConfigurationAsync(); Assert.NotNull(result); + Assert.Null(manifest); } [Fact] public async Task ReturnsIsInitialized() From 0d48df194032d50247e373102ee08fb031f0837f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 12 Feb 2024 16:34:05 -0500 Subject: [PATCH 312/394] - fixes formatting --- src/Kiota.Builder/KiotaBuilder.cs | 2 +- src/Kiota.Builder/Manifest/ApiDependencyComparer.cs | 2 +- src/Kiota.Builder/Manifest/RequestInfoComparer.cs | 2 +- .../WorkspaceManagement/ApiClientConfigurationComparer.cs | 2 +- .../WorkspaceManagement/WorkspaceManagementService.cs | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 5cd8feb50f..6401d725fb 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -21,13 +21,13 @@ using Kiota.Builder.EqualityComparers; using Kiota.Builder.Exceptions; using Kiota.Builder.Extensions; -using Kiota.Builder.WorkspaceManagement; using Kiota.Builder.Logging; using Kiota.Builder.Manifest; using Kiota.Builder.OpenApiExtensions; using Kiota.Builder.Refiners; using Kiota.Builder.SearchProviders.APIsGuru; using Kiota.Builder.Validation; +using Kiota.Builder.WorkspaceManagement; using Kiota.Builder.Writers; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Any; diff --git a/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs b/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs index 0b0574c3a3..f3bcb1f37f 100644 --- a/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs +++ b/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; diff --git a/src/Kiota.Builder/Manifest/RequestInfoComparer.cs b/src/Kiota.Builder/Manifest/RequestInfoComparer.cs index 6c88ea27dd..0b2958f498 100644 --- a/src/Kiota.Builder/Manifest/RequestInfoComparer.cs +++ b/src/Kiota.Builder/Manifest/RequestInfoComparer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using Microsoft.OpenApi.ApiManifest; diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfigurationComparer.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfigurationComparer.cs index f17f4af8ca..c1503a4ded 100644 --- a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfigurationComparer.cs +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfigurationComparer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index e18c4ff01a..f5bf5aff3b 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -1,11 +1,11 @@ -using System; +using System; using System.Threading; using System.Threading.Tasks; using Kiota.Builder.Configuration; using Kiota.Builder.Lock; +using Kiota.Builder.Manifest; using Microsoft.Extensions.Logging; using Microsoft.Kiota.Abstractions.Extensions; -using Kiota.Builder.Manifest; using Microsoft.OpenApi.ApiManifest; namespace Kiota.Builder.WorkspaceManagement; From ac9474afd55c6fa410f655436e8ffb952c4d2e06 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 13 Feb 2024 08:22:38 -0500 Subject: [PATCH 313/394] - adds support for emiting requests in manifest Signed-off-by: Vincent Biret --- .../Configuration/GenerationConfiguration.cs | 7 +++--- .../OpenApiUrlTreeNodeExtensions.cs | 22 +++++++++++++++---- src/Kiota.Builder/KiotaBuilder.cs | 17 +++++++------- .../Manifest/ApiDependencyComparer.cs | 7 +++++- .../WorkspaceManagementService.cs | 11 +++++----- 5 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs index 0b4e62e45e..f6eb3fb996 100644 --- a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs +++ b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs @@ -156,15 +156,16 @@ internal void UpdateConfigurationFromLanguagesInformation(LanguagesInformation l StructuredMimeTypes = new(languageInfo.StructuredMimeTypes); } public const string KiotaHashManifestExtensionKey = "x-ms-kiota-hash"; - public ApiDependency ToApiDependency(string configurationHash, string version = "1.0") + public ApiDependency ToApiDependency(string configurationHash, Dictionary> templatesWithOperations) { var dependency = new ApiDependency() { ApiDescriptionUrl = OpenAPIFilePath, - ApiDescriptionVersion = version, + ApiDeploymentBaseUrl = ApiRootUrl?.EndsWith('/') ?? false ? ApiRootUrl : $"{ApiRootUrl}/", Extensions = new() { { KiotaHashManifestExtensionKey, JsonValue.Create(configurationHash)} - } + }, + Requests = templatesWithOperations.SelectMany(static x => x.Value.Select(y => new RequestInfo { Method = y.ToUpperInvariant(), UriTemplate = x.Key })).ToList(), }; return dependency; } diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index c88bce001d..0e3d42a3bd 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -182,11 +182,11 @@ private static bool IsPathSegmentWithNumberOfParameters(this string currentSegme private static partial Regex stripExtensionForIndexersTestRegex(); // so {param-name}.json is considered as indexer public static bool IsComplexPathMultipleParameters(this OpenApiUrlTreeNode currentNode) => (currentNode?.DeduplicatedSegment()?.IsPathSegmentWithNumberOfParameters(static x => x.Any()) ?? false) && !currentNode.IsPathSegmentWithSingleSimpleParameter(); - public static string GetUrlTemplate(this OpenApiUrlTreeNode currentNode, OperationType? operationType = null) + public static string GetUrlTemplate(this OpenApiUrlTreeNode currentNode, OperationType? operationType = null, bool includeQueryParameters = true, bool includeBaseUrl = true) { ArgumentNullException.ThrowIfNull(currentNode); var queryStringParameters = string.Empty; - if (currentNode.HasOperations(Constants.DefaultOpenApiLabel)) + if (currentNode.HasOperations(Constants.DefaultOpenApiLabel) && includeQueryParameters) { var pathItem = currentNode.PathItems[Constants.DefaultOpenApiLabel]; var operationQueryParameters = (operationType, pathItem.Operations.Any()) switch @@ -222,11 +222,25 @@ public static string GetUrlTemplate(this OpenApiUrlTreeNode currentNode, Operati .Where(static x => x.In == ParameterLocation.Path && x.Extensions.TryGetValue(OpenApiReservedParameterExtension.Name, out var ext) && ext is OpenApiReservedParameterExtension reserved && reserved.IsReserved.HasValue && reserved.IsReserved.Value) .Select(static x => x.Name) .ToHashSet(StringComparer.OrdinalIgnoreCase) : - new HashSet(); - return "{+baseurl}" + + []; + return (includeBaseUrl ? "{+baseurl}" : string.Empty) + SanitizePathParameterNamesForUrlTemplate(currentNode.Path.Replace('\\', '/'), pathReservedPathParametersIds) + queryStringParameters; } + public static IEnumerable>> GetRequestInfo(this OpenApiUrlTreeNode currentNode) + { + ArgumentNullException.ThrowIfNull(currentNode); + foreach (var childInfo in currentNode.Children.Values.SelectMany(static x => x.GetRequestInfo())) + { + yield return childInfo; + } + if (currentNode.PathItems + .SelectMany(static x => x.Value.Operations) + .ToArray() is { Length: > 0 } operations) + { + yield return new KeyValuePair>(currentNode.GetUrlTemplate(null, false, false).TrimStart('/'), operations.Select(static x => x.Key.ToString().ToUpperInvariant()).ToHashSet(StringComparer.OrdinalIgnoreCase)); + } + } [GeneratedRegex(@"{(?[^}]+)}", RegexOptions.Singleline, 500)] private static partial Regex pathParamMatcher(); private static string SanitizePathParameterNamesForUrlTemplate(string original, HashSet reservedParameterNames) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 6401d725fb..eb79b0dc33 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -172,22 +172,23 @@ private static string NormalizeApiManifestPath(RequestInfo request, string? base UpdateConfigurationFromOpenApiDocument(); StopLogAndReset(sw, $"step {++stepId} - updating generation configuration from kiota extension - took"); - // Should Generate - sw.Start(); - var shouldGenerate = await workspaceManagementService.ShouldGenerateAsync(config, openApiDocument?.HashCode ?? string.Empty, cancellationToken).ConfigureAwait(false); - StopLogAndReset(sw, $"step {++stepId} - checking whether the output should be updated - took"); - OpenApiUrlTreeNode? openApiTree = null; + var shouldGenerate = true; if (openApiDocument != null) { // filter paths sw.Start(); FilterPathsByPatterns(openApiDocument); StopLogAndReset(sw, $"step {++stepId} - filtering API paths with patterns - took"); + SetApiRootUrl(); + + // Should Generate + sw.Start(); + shouldGenerate = await workspaceManagementService.ShouldGenerateAsync(config, openApiDocument.HashCode, cancellationToken).ConfigureAwait(false); + StopLogAndReset(sw, $"step {++stepId} - checking whether the output should be updated - took"); + if (shouldGenerate && generating) { - SetApiRootUrl(); - modelNamespacePrefixToTrim = GetDeeperMostCommonNamespaceNameForModels(openApiDocument); } @@ -269,7 +270,7 @@ public async Task GenerateClientAsync(CancellationToken cancellationToken) // Write lock file sw.Start(); - await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, cancellationToken).ConfigureAwait(false); + await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], cancellationToken).ConfigureAwait(false); StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); } catch diff --git a/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs b/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs index f3bcb1f37f..a72f52aa36 100644 --- a/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs +++ b/src/Kiota.Builder/Manifest/ApiDependencyComparer.cs @@ -11,7 +11,12 @@ namespace Kiota.Builder.Manifest; public class ApiDependencyComparer : IEqualityComparer { + public ApiDependencyComparer(bool compareRequests = false) + { + CompareRequests = compareRequests; + } private static readonly RequestInfoComparer requestInfoComparer = new(); + private readonly bool CompareRequests; /// public bool Equals(ApiDependency? x, ApiDependency? y) { @@ -25,6 +30,6 @@ public int GetHashCode([DisallowNull] ApiDependency obj) (string.IsNullOrEmpty(obj.ApiDescriptionUrl) ? 0 : obj.ApiDescriptionUrl.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 37 + (string.IsNullOrEmpty(obj.ApiDescriptionVersion) ? 0 : obj.ApiDescriptionVersion.GetHashCode(StringComparison.OrdinalIgnoreCase)) * 31 + (obj.Extensions is not null && obj.Extensions.TryGetValue(GenerationConfiguration.KiotaHashManifestExtensionKey, out var jsonNode) && jsonNode is JsonValue jsonValue && jsonValue.GetValueKind() is JsonValueKind.String ? jsonValue.GetValue().GetHashCode(StringComparison.OrdinalIgnoreCase) : 0) * 19 + - obj.Requests.Select(requestInfoComparer.GetHashCode).Sum() * 17; + (CompareRequests ? obj.Requests.Select(requestInfoComparer.GetHashCode).Sum() : 0) * 17; } } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index f5bf5aff3b..d87d1f6882 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Kiota.Builder.Configuration; @@ -22,7 +23,7 @@ public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false) } private readonly LockManagementService lockManagementService = new(); private readonly WorkspaceConfigurationStorageService workspaceConfigurationStorageService = new(); - public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, CancellationToken cancellationToken = default) + public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, Dictionary> templatesWithOperations, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(generationConfiguration); if (UseKiotaConfig) @@ -31,8 +32,8 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene wsConfig ??= new WorkspaceConfiguration(); manifest ??= new ApiManifestDocument("application"); //TODO get the application name wsConfig.Clients.AddOrReplace(generationConfiguration.ClientClassName, new ApiClientConfiguration(generationConfiguration)); - //TODO set the version from something, set the kiota hash config configuration + description - manifest.ApiDependencies.AddOrReplace(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency("foo")); + //TODO set the kiota hash config configuration + description + manifest.ApiDependencies.AddOrReplace(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency("foo", templatesWithOperations)); await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, manifest, cancellationToken).ConfigureAwait(false); } else @@ -71,9 +72,9 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, if ((wsConfig?.Clients.TryGetValue(inputConfig.ClientClassName, out var existingClientConfig) ?? false) && (apiManifest?.ApiDependencies.TryGetValue(inputConfig.ClientClassName, out var existingApiManifest) ?? false)) { - //TODO set version from something, generate the hash for kiota config and get the list of requests + //TODO generate the hash for kiota config return !clientConfigurationComparer.Equals(existingClientConfig, new ApiClientConfiguration(inputConfig)) || - !apiDependencyComparer.Equals(inputConfig.ToApiDependency("foo"), existingApiManifest); + !apiDependencyComparer.Equals(inputConfig.ToApiDependency("foo", []), existingApiManifest); } return true; } From 578d0a1790d119441f39ee7b669e70e5989edd68 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 13 Feb 2024 12:38:53 -0500 Subject: [PATCH 314/394] - implements configuration hash Signed-off-by: Vincent Biret --- ...WorkspaceConfigurationGenerationContext.cs | 1 + .../WorkspaceManagementService.cs | 49 ++++++++++++++++--- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs index cafe2d7573..c312cd0b76 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationGenerationContext.cs @@ -4,6 +4,7 @@ namespace Kiota.Builder.WorkspaceManagement; [JsonSerializable(typeof(WorkspaceConfiguration))] +[JsonSerializable(typeof(ApiClientConfiguration))] internal partial class WorkspaceConfigurationGenerationContext : JsonSerializerContext { } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index d87d1f6882..2d1e598a71 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -1,5 +1,10 @@ using System; using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Security.Cryptography; +using System.Text; +using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Kiota.Builder.Configuration; @@ -31,9 +36,10 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene var (wsConfig, manifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); wsConfig ??= new WorkspaceConfiguration(); manifest ??= new ApiManifestDocument("application"); //TODO get the application name - wsConfig.Clients.AddOrReplace(generationConfiguration.ClientClassName, new ApiClientConfiguration(generationConfiguration)); - //TODO set the kiota hash config configuration + description - manifest.ApiDependencies.AddOrReplace(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency("foo", templatesWithOperations)); + var generationClientConfig = new ApiClientConfiguration(generationConfiguration); + wsConfig.Clients.AddOrReplace(generationConfiguration.ClientClassName, generationClientConfig); + var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, descriptionHash).ConfigureAwait(false); + manifest.ApiDependencies.AddOrReplace(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency(inputConfigurationHash, templatesWithOperations)); await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, manifest, cancellationToken).ConfigureAwait(false); } else @@ -72,9 +78,10 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, if ((wsConfig?.Clients.TryGetValue(inputConfig.ClientClassName, out var existingClientConfig) ?? false) && (apiManifest?.ApiDependencies.TryGetValue(inputConfig.ClientClassName, out var existingApiManifest) ?? false)) { - //TODO generate the hash for kiota config - return !clientConfigurationComparer.Equals(existingClientConfig, new ApiClientConfiguration(inputConfig)) || - !apiDependencyComparer.Equals(inputConfig.ToApiDependency("foo", []), existingApiManifest); + var inputClientConfig = new ApiClientConfiguration(inputConfig); + var inputConfigurationHash = await GetConfigurationHashAsync(inputClientConfig, descriptionHash).ConfigureAwait(false); + return !clientConfigurationComparer.Equals(existingClientConfig, inputClientConfig) || + !apiDependencyComparer.Equals(inputConfig.ToApiDependency(inputConfigurationHash, []), existingApiManifest); } return true; } @@ -93,4 +100,34 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, } } + private static readonly JsonSerializerOptions options = new() + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + WriteIndented = true, + }; + private static readonly WorkspaceConfigurationGenerationContext context = new(options); + private static readonly ThreadLocal HashAlgorithm = new(SHA256.Create); + private async Task GetConfigurationHashAsync(ApiClientConfiguration apiClientConfiguration, string descriptionHash) + { + using var stream = new MemoryStream(); + JsonSerializer.Serialize(stream, apiClientConfiguration, context.ApiClientConfiguration); + await stream.WriteAsync(Encoding.UTF8.GetBytes(descriptionHash)).ConfigureAwait(false); + stream.Position = 0; + if (HashAlgorithm.Value is null) + throw new InvalidOperationException("Hash algorithm is not available"); + return ConvertByteArrayToString(await HashAlgorithm.Value.ComputeHashAsync(stream).ConfigureAwait(false)); + } + private static string ConvertByteArrayToString(byte[] hash) + { + // Build the final string by converting each byte + // into hex and appending it to a StringBuilder + var sbLength = hash.Length * 2; + var sb = new StringBuilder(sbLength, sbLength); + for (var i = 0; i < hash.Length; i++) + { + sb.Append(hash[i].ToString("X2", CultureInfo.InvariantCulture)); + } + + return sb.ToString(); + } } From 317909514c2a6129f5be64719ab8c449fc0af276 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 13 Feb 2024 13:18:01 -0500 Subject: [PATCH 315/394] - normalizes output path to a relative path Signed-off-by: Vincent Biret --- .../ApiClientConfiguration.cs | 24 ++++++++++++++++++- .../WorkspaceConfiguration.cs | 11 ++++++++- .../WorkspaceConfigurationStorageService.cs | 4 ---- .../WorkspaceManagementService.cs | 12 ++++++++-- src/kiota/Handlers/Config/InitHandler.cs | 3 ++- ...rkspaceConfigurationStorageServiceTests.cs | 2 +- 6 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs index 0169fc14d5..cf206d7437 100644 --- a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using Kiota.Builder.Configuration; using Kiota.Builder.Lock; @@ -7,7 +8,7 @@ namespace Kiota.Builder.WorkspaceManagement; #pragma warning disable CA2227 // Collection properties should be read only -public class ApiClientConfiguration +public class ApiClientConfiguration : ICloneable { /// /// The location of the OpenAPI description file. @@ -138,5 +139,26 @@ public void UpdateGenerationConfigurationFromApiClientConfiguration(GenerationCo config.Deserializers.Clear(); } + public object Clone() + { + return new ApiClientConfiguration + { + DescriptionLocation = DescriptionLocation, + Language = Language, + StructuredMimeTypes = [.. StructuredMimeTypes], + IncludePatterns = new(IncludePatterns, StringComparer.OrdinalIgnoreCase), + ExcludePatterns = new(ExcludePatterns, StringComparer.OrdinalIgnoreCase), + OutputPath = OutputPath, + ClientNamespaceName = ClientNamespaceName, + UsesBackingStore = UsesBackingStore, + IncludeAdditionalData = IncludeAdditionalData, + ExcludeBackwardCompatible = ExcludeBackwardCompatible, + DisabledValidationRules = new(DisabledValidationRules, StringComparer.OrdinalIgnoreCase), + }; + } + public void NormalizePaths(string targetDirectory) + { + OutputPath = "./" + Path.GetRelativePath(targetDirectory, OutputPath); + } } #pragma warning restore CA2227 // Collection properties should be read only diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs index 25ae1134aa..29cbb638f3 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfiguration.cs @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Kiota.Builder.WorkspaceManagement; -public class WorkspaceConfiguration +public class WorkspaceConfiguration : ICloneable { /// /// The version of the configuration file schema. @@ -15,4 +16,12 @@ public class WorkspaceConfiguration /// public Dictionary Clients { get; set; } = new Dictionary(StringComparer.OrdinalIgnoreCase); #pragma warning restore CA2227 // Collection properties should be read only + public object Clone() + { + return new WorkspaceConfiguration + { + Version = Version, + Clients = Clients.ToDictionary(static x => x.Key, static x => (ApiClientConfiguration)x.Value.Clone(), StringComparer.OrdinalIgnoreCase) + }; + } } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 8915778d80..8016b4fab2 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -21,10 +21,6 @@ public string TargetDirectory private readonly string targetConfigurationFilePath; private readonly string targetManifestFilePath; private readonly ManifestManagementService manifestManagementService = new(); - public WorkspaceConfigurationStorageService() : this(Directory.GetCurrentDirectory()) - { - - } public WorkspaceConfigurationStorageService(string targetDirectory) { ArgumentException.ThrowIfNullOrEmpty(targetDirectory); diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 2d1e598a71..4d5a50e565 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -20,14 +20,18 @@ public class WorkspaceManagementService { private readonly bool UseKiotaConfig; private readonly ILogger Logger; - public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false) + public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false, string workingDirectory = "") { ArgumentNullException.ThrowIfNull(logger); Logger = logger; UseKiotaConfig = useKiotaConfig; + if (string.IsNullOrEmpty(workingDirectory)) + workingDirectory = Directory.GetCurrentDirectory(); + WorkingDirectory = workingDirectory; + workspaceConfigurationStorageService = new(workingDirectory); } private readonly LockManagementService lockManagementService = new(); - private readonly WorkspaceConfigurationStorageService workspaceConfigurationStorageService = new(); + private readonly WorkspaceConfigurationStorageService workspaceConfigurationStorageService; public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, Dictionary> templatesWithOperations, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(generationConfiguration); @@ -37,6 +41,7 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene wsConfig ??= new WorkspaceConfiguration(); manifest ??= new ApiManifestDocument("application"); //TODO get the application name var generationClientConfig = new ApiClientConfiguration(generationConfiguration); + generationClientConfig.NormalizePaths(WorkingDirectory); wsConfig.Clients.AddOrReplace(generationConfiguration.ClientClassName, generationClientConfig); var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, descriptionHash).ConfigureAwait(false); manifest.ApiDependencies.AddOrReplace(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency(inputConfigurationHash, templatesWithOperations)); @@ -79,6 +84,7 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, (apiManifest?.ApiDependencies.TryGetValue(inputConfig.ClientClassName, out var existingApiManifest) ?? false)) { var inputClientConfig = new ApiClientConfiguration(inputConfig); + inputClientConfig.NormalizePaths(WorkingDirectory); var inputConfigurationHash = await GetConfigurationHashAsync(inputClientConfig, descriptionHash).ConfigureAwait(false); return !clientConfigurationComparer.Equals(existingClientConfig, inputClientConfig) || !apiDependencyComparer.Equals(inputConfig.ToApiDependency(inputConfigurationHash, []), existingApiManifest); @@ -107,6 +113,8 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, }; private static readonly WorkspaceConfigurationGenerationContext context = new(options); private static readonly ThreadLocal HashAlgorithm = new(SHA256.Create); + private readonly string WorkingDirectory; + private async Task GetConfigurationHashAsync(ApiClientConfiguration apiClientConfiguration, string descriptionHash) { using var stream = new MemoryStream(); diff --git a/src/kiota/Handlers/Config/InitHandler.cs b/src/kiota/Handlers/Config/InitHandler.cs index 3c3fd3804e..359411627a 100644 --- a/src/kiota/Handlers/Config/InitHandler.cs +++ b/src/kiota/Handlers/Config/InitHandler.cs @@ -1,5 +1,6 @@ using System; using System.CommandLine.Invocation; +using System.IO; using System.Threading; using System.Threading.Tasks; using Kiota.Builder.WorkspaceManagement; @@ -12,7 +13,7 @@ internal class InitHandler : BaseKiotaCommandHandler public async override Task InvokeAsync(InvocationContext context) { CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; - var workspaceStorageService = new WorkspaceConfigurationStorageService(); + var workspaceStorageService = new WorkspaceConfigurationStorageService(Directory.GetCurrentDirectory()); var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); using (loggerFactory) { diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs index c51147fd60..54aac63f2a 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs @@ -11,7 +11,7 @@ public sealed class WorkspaceConfigurationStorageServiceTests : IDisposable public async Task DefensiveProgramming() { Assert.Throws(() => new WorkspaceConfigurationStorageService(string.Empty)); - var service = new WorkspaceConfigurationStorageService(); + var service = new WorkspaceConfigurationStorageService(Directory.GetCurrentDirectory()); await Assert.ThrowsAsync(() => service.UpdateWorkspaceConfigurationAsync(null, null)); } private readonly string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); From 1c2f9d0df640cab409777b23cdfa78a779edc5b9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 23 Feb 2024 09:07:22 -0500 Subject: [PATCH 316/394] - adds support for skip generation - adds check whether client is present when adding Signed-off-by: Vincent Biret --- .../Configuration/ClientOperation.cs | 8 +++ .../Configuration/GenerationConfiguration.cs | 10 ++++ src/Kiota.Builder/KiotaBuilder.cs | 57 ++++++++++++------- .../WorkspaceManagementService.cs | 6 ++ src/kiota/Handlers/Client/AddHandler.cs | 7 ++- 5 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 src/Kiota.Builder/Configuration/ClientOperation.cs diff --git a/src/Kiota.Builder/Configuration/ClientOperation.cs b/src/Kiota.Builder/Configuration/ClientOperation.cs new file mode 100644 index 0000000000..5f288fcee6 --- /dev/null +++ b/src/Kiota.Builder/Configuration/ClientOperation.cs @@ -0,0 +1,8 @@ +namespace Kiota.Builder.Configuration; +public enum ClientOperation +{ + Add, + Edit, + Remove, + Generate, +} diff --git a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs index f6eb3fb996..8e95375d1b 100644 --- a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs +++ b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs @@ -25,6 +25,14 @@ public bool ShouldGetApiManifest (ApiManifestPath.StartsWith("http", StringComparison.OrdinalIgnoreCase) || File.Exists(ApiManifestPath)); } } + public bool SkipGeneration + { + get; set; + } + public ClientOperation? Operation + { + get; set; + } public string OpenAPIFilePath { get; set; } = "openapi.yaml"; public string ApiManifestPath { get; set; } = "apimanifest.json"; public string OutputPath { get; set; } = "./output"; @@ -134,6 +142,8 @@ public object Clone() ClearCache = ClearCache, DisabledValidationRules = new(DisabledValidationRules ?? Enumerable.Empty(), StringComparer.OrdinalIgnoreCase), MaxDegreeOfParallelism = MaxDegreeOfParallelism, + SkipGeneration = SkipGeneration, + Operation = Operation, }; } private static readonly StringIEnumerableDeepComparer comparer = new(); diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index eb79b0dc33..654a688513 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -173,7 +173,7 @@ private static string NormalizeApiManifestPath(RequestInfo request, string? base StopLogAndReset(sw, $"step {++stepId} - updating generation configuration from kiota extension - took"); OpenApiUrlTreeNode? openApiTree = null; - var shouldGenerate = true; + var shouldGenerate = !config.SkipGeneration; if (openApiDocument != null) { // filter paths @@ -184,7 +184,7 @@ private static string NormalizeApiManifestPath(RequestInfo request, string? base // Should Generate sw.Start(); - shouldGenerate = await workspaceManagementService.ShouldGenerateAsync(config, openApiDocument.HashCode, cancellationToken).ConfigureAwait(false); + shouldGenerate &= await workspaceManagementService.ShouldGenerateAsync(config, openApiDocument.HashCode, cancellationToken).ConfigureAwait(false); StopLogAndReset(sw, $"step {++stepId} - checking whether the output should be updated - took"); if (shouldGenerate && generating) @@ -234,6 +234,9 @@ public async Task GenerateClientAsync(CancellationToken cancellationToken) // Read input stream var inputPath = config.OpenAPIFilePath; + if (config.Operation is ClientOperation.Add && await workspaceManagementService.IsClientPresent(config.ClientClassName, cancellationToken).ConfigureAwait(false)) + throw new InvalidOperationException($"The client {config.ClientClassName} already exists in the workspace"); + try { await CleanOutputDirectory(cancellationToken).ConfigureAwait(false); @@ -248,30 +251,40 @@ public async Task GenerateClientAsync(CancellationToken cancellationToken) { var (stepId, openApiTree, shouldGenerate) = await GetTreeNodeInternal(inputPath, true, sw, cancellationToken).ConfigureAwait(false); - if (!shouldGenerate) + if (shouldGenerate) { - logger.LogInformation("No changes detected, skipping generation"); - return false; - } - // Create Source Model - sw.Start(); - var generatedCode = CreateSourceModel(openApiTree); - StopLogAndReset(sw, $"step {++stepId} - create source model - took"); + // Create Source Model + sw.Start(); + var generatedCode = CreateSourceModel(openApiTree); + StopLogAndReset(sw, $"step {++stepId} - create source model - took"); - // RefineByLanguage - sw.Start(); - await ApplyLanguageRefinement(config, generatedCode, cancellationToken).ConfigureAwait(false); - StopLogAndReset(sw, $"step {++stepId} - refine by language - took"); + // RefineByLanguage + sw.Start(); + await ApplyLanguageRefinement(config, generatedCode, cancellationToken).ConfigureAwait(false); + StopLogAndReset(sw, $"step {++stepId} - refine by language - took"); - // Write language source - sw.Start(); - await CreateLanguageSourceFilesAsync(config.Language, generatedCode, cancellationToken).ConfigureAwait(false); - StopLogAndReset(sw, $"step {++stepId} - writing files - took"); + // Write language source + sw.Start(); + await CreateLanguageSourceFilesAsync(config.Language, generatedCode, cancellationToken).ConfigureAwait(false); + StopLogAndReset(sw, $"step {++stepId} - writing files - took"); - // Write lock file - sw.Start(); - await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], cancellationToken).ConfigureAwait(false); - StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); + // Write lock file + sw.Start(); + await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], cancellationToken).ConfigureAwait(false); + StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); + } + else + { + logger.LogInformation("No changes detected, skipping generation"); + if (config.Operation is ClientOperation.Add or ClientOperation.Edit && config.SkipGeneration) + { + // Write lock file + sw.Start(); + await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], cancellationToken).ConfigureAwait(false); + StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); + } + return false; + } } catch { diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 4d5a50e565..874ce3b48f 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -32,6 +32,12 @@ public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false, s } private readonly LockManagementService lockManagementService = new(); private readonly WorkspaceConfigurationStorageService workspaceConfigurationStorageService; + public async Task IsClientPresent(string clientName, CancellationToken cancellationToken = default) + { + if (!UseKiotaConfig) return false; + var (wsConfig, _) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + return wsConfig?.Clients.ContainsKey(clientName) ?? false; + } public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, Dictionary> templatesWithOperations, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(generationConfiguration); diff --git a/src/kiota/Handlers/Client/AddHandler.cs b/src/kiota/Handlers/Client/AddHandler.cs index 86dee29afb..da7e103dae 100644 --- a/src/kiota/Handlers/Client/AddHandler.cs +++ b/src/kiota/Handlers/Client/AddHandler.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Kiota.Builder; +using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; using Microsoft.Extensions.Logging; @@ -92,6 +93,8 @@ public override async Task InvokeAsync(InvocationContext context) Configuration.Generation.ExcludeBackwardCompatible = excludeBackwardCompatible; Configuration.Generation.IncludeAdditionalData = includeAdditionalData; Configuration.Generation.Language = language; + Configuration.Generation.SkipGeneration = skipGeneration; + Configuration.Generation.Operation = ClientOperation.Add; if (includePatterns.Count != 0) Configuration.Generation.IncludePatterns = includePatterns.Select(static x => x.TrimQuotes()).ToHashSet(StringComparer.OrdinalIgnoreCase); if (excludePatterns.Count != 0) @@ -119,14 +122,12 @@ public override async Task InvokeAsync(InvocationContext context) try { var builder = new KiotaBuilder(logger, Configuration.Generation, httpClient, true); - //TODO implement skip generation var result = await builder.GenerateClientAsync(cancellationToken).ConfigureAwait(false); if (result) DisplaySuccess("Generation completed successfully"); else { - DisplaySuccess("Generation skipped as no changes were detected"); - DisplayCleanHint("generate"); + DisplaySuccess("Generation skipped as no changes were detected or --skip-generation was passed"); } var manifestResult = await builder.GetApiManifestDetailsAsync(true, cancellationToken).ConfigureAwait(false); var manifestPath = manifestResult is null ? string.Empty : Configuration.Generation.ApiManifestPath; From 0cf277c0bc976dd77e15f2867f238fe7989e80af Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 23 Feb 2024 10:06:34 -0500 Subject: [PATCH 317/394] - fixes hints for kiota add command Signed-off-by: Vincent Biret --- .../WorkspaceConfigurationStorageService.cs | 4 ++-- src/kiota/Handlers/BaseKiotaCommandHandler.cs | 11 ++++++++--- src/kiota/Handlers/Client/AddHandler.cs | 15 ++++++++------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 8016b4fab2..00e3be7959 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -12,8 +12,8 @@ namespace Kiota.Builder.WorkspaceManagement; public class WorkspaceConfigurationStorageService { - private const string ConfigurationFileName = "kiota-config.json"; - private const string ManifestFileName = "apimanifest.json"; + public const string ConfigurationFileName = "kiota-config.json"; + public const string ManifestFileName = "apimanifest.json"; public string TargetDirectory { get; private set; diff --git a/src/kiota/Handlers/BaseKiotaCommandHandler.cs b/src/kiota/Handlers/BaseKiotaCommandHandler.cs index a34c4a8d4d..8cc071ff86 100644 --- a/src/kiota/Handlers/BaseKiotaCommandHandler.cs +++ b/src/kiota/Handlers/BaseKiotaCommandHandler.cs @@ -265,18 +265,23 @@ protected void DisplayGenerateHint(string path, string manifest, IEnumerable -o {sourceArg}{includedPathsSuffix}{excludedPathsSuffix}"; DisplayHint("Hint: use kiota generate to generate a client for the OpenAPI description.", example); } - protected void DisplayGenerateAdvancedHint(IEnumerable includePaths, IEnumerable excludePaths, string path, string manifest) + protected void DisplayGenerateAdvancedHint(IEnumerable includePaths, IEnumerable excludePaths, string path, string manifest, string commandName = "generate") { if (!includePaths.Any() && !excludePaths.Any()) { var sourceArg = GetSourceArg(path, manifest); DisplayHint("Hint: use the --include-path and --exclude-path options with glob patterns to filter the paths generated.", - $"Example: kiota generate --include-path \"**/foo\" {sourceArg}"); + $"Example: kiota {commandName} --include-path \"**/foo\" {sourceArg}"); } } private static string GetSourceArg(string path, string manifest) { - return string.IsNullOrEmpty(manifest) ? $"-d \"{path}\"" : $"-m \"{manifest}\""; + return string.IsNullOrEmpty(manifest) ? $"-d \"{path}\"" : $"-a \"{manifest}\""; + } + protected void DisplayGenerateCommandHint() + { + DisplayHint("Hint: use the client generate command to generate the code.", + "Example: kiota client generate"); } protected void DisplayInfoHint(GenerationLanguage language, string path, string manifest) { diff --git a/src/kiota/Handlers/Client/AddHandler.cs b/src/kiota/Handlers/Client/AddHandler.cs index da7e103dae..70c99b4fec 100644 --- a/src/kiota/Handlers/Client/AddHandler.cs +++ b/src/kiota/Handlers/Client/AddHandler.cs @@ -9,6 +9,7 @@ using Kiota.Builder; using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; +using Kiota.Builder.WorkspaceManagement; using Microsoft.Extensions.Logging; namespace kiota.Handlers.Client; @@ -125,14 +126,14 @@ public override async Task InvokeAsync(InvocationContext context) var result = await builder.GenerateClientAsync(cancellationToken).ConfigureAwait(false); if (result) DisplaySuccess("Generation completed successfully"); - else + else if (skipGeneration) { - DisplaySuccess("Generation skipped as no changes were detected or --skip-generation was passed"); - } - var manifestResult = await builder.GetApiManifestDetailsAsync(true, cancellationToken).ConfigureAwait(false); - var manifestPath = manifestResult is null ? string.Empty : Configuration.Generation.ApiManifestPath; - DisplayInfoHint(language, Configuration.Generation.OpenAPIFilePath, manifestPath); - DisplayGenerateAdvancedHint(includePatterns, excludePatterns, Configuration.Generation.OpenAPIFilePath, manifestPath); + DisplaySuccess("Generation skipped as --skip-generation was passed"); + DisplayGenerateCommandHint(); + } // else we get an error because we're adding a client that already exists + var manifestPath = $"{GetAbsolutePath(WorkspaceConfigurationStorageService.ManifestFileName)}#{Configuration.Generation.ClientClassName}"; + DisplayInfoHint(language, string.Empty, manifestPath); + DisplayGenerateAdvancedHint(includePatterns, excludePatterns, string.Empty, manifestPath, "client add"); return 0; } catch (Exception ex) From ac9f89e0c38af04e7308e42c25fc7dc98faa8fbb Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 23 Feb 2024 14:09:58 -0500 Subject: [PATCH 318/394] - fixes formatting Signed-off-by: Vincent Biret --- src/Kiota.Builder/Configuration/ClientOperation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Configuration/ClientOperation.cs b/src/Kiota.Builder/Configuration/ClientOperation.cs index 5f288fcee6..3d7770a738 100644 --- a/src/Kiota.Builder/Configuration/ClientOperation.cs +++ b/src/Kiota.Builder/Configuration/ClientOperation.cs @@ -1,4 +1,4 @@ -namespace Kiota.Builder.Configuration; +namespace Kiota.Builder.Configuration; public enum ClientOperation { Add, From b3b30ad3a3bb4e8b3fe1c020f6fad63d4ba3a1db Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 23 Feb 2024 14:59:43 -0500 Subject: [PATCH 319/394] - adds workspace save of description Signed-off-by: Vincent Biret --- src/Kiota.Builder/Extensions/UriExtensions.cs | 5 ++ src/Kiota.Builder/KiotaBuilder.cs | 47 +++++++--- .../DescriptionStorageService.cs | 53 ++++++++++++ .../WorkspaceConfigurationStorageService.cs | 86 +++++++++++-------- 4 files changed, 146 insertions(+), 45 deletions(-) create mode 100644 src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs diff --git a/src/Kiota.Builder/Extensions/UriExtensions.cs b/src/Kiota.Builder/Extensions/UriExtensions.cs index b0c8e235d5..938f269d9b 100644 --- a/src/Kiota.Builder/Extensions/UriExtensions.cs +++ b/src/Kiota.Builder/Extensions/UriExtensions.cs @@ -10,4 +10,9 @@ public static string GetFileName(this Uri uri) if (uri is null) return string.Empty; return Path.GetFileName($"{uri.Scheme}://{uri.Host}{uri.AbsolutePath}"); } + public static string GetFileExtension(this Uri uri) + { + if (uri is null) return string.Empty; + return Path.GetExtension(uri.GetFileName()).TrimStart('.'); + } } diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 654a688513..58223cc5f0 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -63,8 +63,12 @@ public KiotaBuilder(ILogger logger, GenerationConfiguration config { MaxDegreeOfParallelism = config.MaxDegreeOfParallelism, }; - workspaceManagementService = new WorkspaceManagementService(logger, useKiotaConfig); + var workingDirectory = Directory.GetCurrentDirectory(); + workspaceManagementService = new WorkspaceManagementService(logger, useKiotaConfig, workingDirectory); + descriptionStorageService = new DescriptionStorageService(workingDirectory); + this.useKiotaConfig = useKiotaConfig; } + private readonly bool useKiotaConfig; private async Task CleanOutputDirectory(CancellationToken cancellationToken) { if (config.CleanOutput && Directory.Exists(config.OutputPath)) @@ -268,20 +272,14 @@ public async Task GenerateClientAsync(CancellationToken cancellationToken) await CreateLanguageSourceFilesAsync(config.Language, generatedCode, cancellationToken).ConfigureAwait(false); StopLogAndReset(sw, $"step {++stepId} - writing files - took"); - // Write lock file - sw.Start(); - await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], cancellationToken).ConfigureAwait(false); - StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); + await FinalizeWorkspaceAsync(sw, stepId, openApiTree, inputPath, cancellationToken).ConfigureAwait(false); } else { logger.LogInformation("No changes detected, skipping generation"); if (config.Operation is ClientOperation.Add or ClientOperation.Edit && config.SkipGeneration) { - // Write lock file - sw.Start(); - await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], cancellationToken).ConfigureAwait(false); - StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); + await FinalizeWorkspaceAsync(sw, stepId, openApiTree, inputPath, cancellationToken).ConfigureAwait(false); } return false; } @@ -293,6 +291,22 @@ public async Task GenerateClientAsync(CancellationToken cancellationToken) } return true; } + private async Task FinalizeWorkspaceAsync(Stopwatch sw, int stepId, OpenApiUrlTreeNode? openApiTree, string inputPath, CancellationToken cancellationToken) + { + // Write lock file + sw.Start(); + await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], cancellationToken).ConfigureAwait(false); + StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); + + if (!isDescriptionFromWorkspaceCopy) + { + // Store description in the workspace copy + sw.Start(); + using var descriptionStream = await LoadStream(inputPath, cancellationToken).ConfigureAwait(false); + await descriptionStorageService.UpdateDescriptionAsync(config.ClientClassName, descriptionStream, new Uri(config.OpenAPIFilePath).GetFileExtension(), cancellationToken).ConfigureAwait(false); + StopLogAndReset(sw, $"step {++stepId} - storing description in the workspace copy - took"); + } + } private readonly WorkspaceManagementService workspaceManagementService; private static readonly GlobComparer globComparer = new(); [GeneratedRegex(@"([\/\\])\{[\w\d-]+\}([\/\\])", RegexOptions.IgnoreCase | RegexOptions.Singleline, 2000)] @@ -394,7 +408,8 @@ private void StopLogAndReset(Stopwatch sw, string prefix) o.PoolSize = 20; o.PoolInitialFill = 1; }); - + private readonly DescriptionStorageService descriptionStorageService; + private bool isDescriptionFromWorkspaceCopy; private async Task LoadStream(string inputPath, CancellationToken cancellationToken) { var stopwatch = new Stopwatch(); @@ -403,7 +418,15 @@ private async Task LoadStream(string inputPath, CancellationToken cancel inputPath = inputPath.Trim(); Stream input; - if (inputPath.StartsWith("http", StringComparison.OrdinalIgnoreCase)) + if (useKiotaConfig && + config.Operation is ClientOperation.Edit or ClientOperation.Add && + await descriptionStorageService.GetDescriptionAsync(config.ClientClassName, new Uri(inputPath).GetFileExtension(), cancellationToken).ConfigureAwait(false) is { } descriptionStream) + { + logger.LogInformation("loaded description from the workspace copy"); + input = descriptionStream; + isDescriptionFromWorkspaceCopy = true; + } + else if (inputPath.StartsWith("http", StringComparison.OrdinalIgnoreCase)) try { var cachingProvider = new DocumentCachingProvider(httpClient, logger) @@ -413,6 +436,7 @@ private async Task LoadStream(string inputPath, CancellationToken cancel var targetUri = APIsGuruSearchProvider.ChangeSourceUrlToGitHub(new Uri(inputPath)); // so updating existing clients doesn't break var fileName = targetUri.GetFileName() is string name && !string.IsNullOrEmpty(name) ? name : "description.yml"; input = await cachingProvider.GetDocumentAsync(targetUri, "generation", fileName, cancellationToken: cancellationToken).ConfigureAwait(false); + logger.LogInformation("loaded description from remote source"); } catch (HttpRequestException ex) { @@ -430,6 +454,7 @@ private async Task LoadStream(string inputPath, CancellationToken cancel } inMemoryStream.Position = 0; input = inMemoryStream; + logger.LogInformation("loaded description from local source"); #pragma warning restore CA2000 } catch (Exception ex) when (ex is FileNotFoundException || diff --git a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs new file mode 100644 index 0000000000..a024b61962 --- /dev/null +++ b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using AsyncKeyedLock; + +namespace Kiota.Builder.WorkspaceManagement; + +public class DescriptionStorageService +{ + private const string DescriptionsSubDirectoryRelativePath = ".kiota/clients"; + private readonly string TargetDirectory; + public DescriptionStorageService(string targetDirectory) + { + ArgumentException.ThrowIfNullOrEmpty(targetDirectory); + TargetDirectory = targetDirectory; + } + private static readonly AsyncKeyedLocker localFilesLock = new(o => + { + o.PoolSize = 20; + o.PoolInitialFill = 1; + }); + public async Task UpdateDescriptionAsync(string clientName, Stream description, string extension = "yml", CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(clientName); + ArgumentNullException.ThrowIfNull(description); + ArgumentNullException.ThrowIfNull(extension); + var descriptionFilePath = Path.Combine(TargetDirectory, DescriptionsSubDirectoryRelativePath, $"{clientName}.{extension}"); + using (await localFilesLock.LockAsync(descriptionFilePath, cancellationToken).ConfigureAwait(false)) + { + Directory.CreateDirectory(Path.GetDirectoryName(descriptionFilePath) ?? throw new InvalidOperationException("The target path is invalid")); + using var fs = new FileStream(descriptionFilePath, FileMode.Create); + description.Seek(0, SeekOrigin.Begin); + await description.CopyToAsync(fs, cancellationToken).ConfigureAwait(false); + } + } + public async Task GetDescriptionAsync(string clientName, string extension = "yml", CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(clientName); + ArgumentNullException.ThrowIfNull(extension); + var descriptionFilePath = Path.Combine(TargetDirectory, DescriptionsSubDirectoryRelativePath, $"{clientName}.{extension}"); + if (!File.Exists(descriptionFilePath)) + return null; + using (await localFilesLock.LockAsync(descriptionFilePath, cancellationToken).ConfigureAwait(false)) + { + using var fs = new FileStream(descriptionFilePath, FileMode.Open); + var ms = new MemoryStream(); + await fs.CopyToAsync(ms, cancellationToken).ConfigureAwait(false); + ms.Seek(0, SeekOrigin.Begin); + return ms; + } + } +} diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 00e3be7959..158eebe4b6 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -5,6 +5,7 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using AsyncKeyedLock; using Kiota.Builder.Manifest; using Microsoft.OpenApi.ApiManifest; @@ -28,6 +29,11 @@ public WorkspaceConfigurationStorageService(string targetDirectory) targetConfigurationFilePath = Path.Combine(TargetDirectory, ConfigurationFileName); targetManifestFilePath = Path.Combine(TargetDirectory, ManifestFileName); } + private static readonly AsyncKeyedLocker localFilesLock = new(o => + { + o.PoolSize = 20; + o.PoolInitialFill = 1; + }); public async Task InitializeAsync(CancellationToken cancellationToken = default) { if (await IsInitializedAsync(cancellationToken).ConfigureAwait(false)) @@ -37,18 +43,24 @@ public async Task InitializeAsync(CancellationToken cancellationToken = default) public async Task UpdateWorkspaceConfigurationAsync(WorkspaceConfiguration configuration, ApiManifestDocument? manifestDocument, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(configuration); - if (!Directory.Exists(TargetDirectory)) - Directory.CreateDirectory(TargetDirectory); + using (await localFilesLock.LockAsync(targetConfigurationFilePath, cancellationToken).ConfigureAwait(false)) + { + if (!Directory.Exists(TargetDirectory)) + Directory.CreateDirectory(TargetDirectory); #pragma warning disable CA2007 - await using var configStream = File.Open(targetConfigurationFilePath, FileMode.Create); + await using var configStream = File.Open(targetConfigurationFilePath, FileMode.Create); #pragma warning restore CA2007 - await JsonSerializer.SerializeAsync(configStream, configuration, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); - if (manifestDocument != null) - { + await JsonSerializer.SerializeAsync(configStream, configuration, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); + if (manifestDocument != null) + { + using (await localFilesLock.LockAsync(targetManifestFilePath, cancellationToken).ConfigureAwait(false)) + { #pragma warning disable CA2007 - await using var manifestStream = File.Open(targetManifestFilePath, FileMode.Create); + await using var manifestStream = File.Open(targetManifestFilePath, FileMode.Create); #pragma warning restore CA2007 - await manifestManagementService.SerializeManifestDocumentAsync(manifestDocument, manifestStream).ConfigureAwait(false); + await manifestManagementService.SerializeManifestDocumentAsync(manifestDocument, manifestStream).ConfigureAwait(false); + } + } } } public Task IsInitializedAsync(CancellationToken cancellationToken = default) @@ -64,51 +76,54 @@ public Task IsInitializedAsync(CancellationToken cancellationToken = defau public async Task<(WorkspaceConfiguration?, ApiManifestDocument?)> GetWorkspaceConfigurationAsync(CancellationToken cancellationToken = default) { if (File.Exists(targetConfigurationFilePath)) - { + using (await localFilesLock.LockAsync(targetConfigurationFilePath, cancellationToken).ConfigureAwait(false)) + { #pragma warning disable CA2007 - await using var configStream = File.OpenRead(targetConfigurationFilePath); + await using var configStream = File.OpenRead(targetConfigurationFilePath); #pragma warning restore CA2007 - var config = await JsonSerializer.DeserializeAsync(configStream, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); - if (File.Exists(targetManifestFilePath)) - { + var config = await JsonSerializer.DeserializeAsync(configStream, context.WorkspaceConfiguration, cancellationToken).ConfigureAwait(false); + if (File.Exists(targetManifestFilePath)) + using (await localFilesLock.LockAsync(targetManifestFilePath, cancellationToken).ConfigureAwait(false)) + { #pragma warning disable CA2007 - await using var manifestStream = File.OpenRead(targetManifestFilePath); + await using var manifestStream = File.OpenRead(targetManifestFilePath); #pragma warning restore CA2007 - var manifest = await manifestManagementService.DeserializeManifestDocumentAsync(manifestStream).ConfigureAwait(false); - return (config, manifest); + var manifest = await manifestManagementService.DeserializeManifestDocumentAsync(manifestStream).ConfigureAwait(false); + return (config, manifest); + } + return (config, null); } - return (config, null); - } return (null, null); } - public Task BackupConfigAsync(string directoryPath, CancellationToken cancellationToken = default) + public async Task BackupConfigAsync(string directoryPath, CancellationToken cancellationToken = default) { ArgumentException.ThrowIfNullOrEmpty(directoryPath); - BackupFile(directoryPath, ConfigurationFileName); - BackupFile(directoryPath, ManifestFileName); - return Task.CompletedTask; + await BackupFile(directoryPath, ConfigurationFileName, cancellationToken).ConfigureAwait(false); + await BackupFile(directoryPath, ManifestFileName, cancellationToken).ConfigureAwait(false); } - private static void BackupFile(string directoryPath, string fileName) + private static async Task BackupFile(string directoryPath, string fileName, CancellationToken cancellationToken = default) { var sourceFilePath = Path.Combine(directoryPath, fileName); if (File.Exists(sourceFilePath)) { var backupFilePath = GetBackupFilePath(directoryPath, fileName); - var targetDirectory = Path.GetDirectoryName(backupFilePath); - if (string.IsNullOrEmpty(targetDirectory)) return; - if (!Directory.Exists(targetDirectory)) - Directory.CreateDirectory(targetDirectory); - File.Copy(sourceFilePath, backupFilePath, true); + using (await localFilesLock.LockAsync(backupFilePath, cancellationToken).ConfigureAwait(false)) + { + var targetDirectory = Path.GetDirectoryName(backupFilePath); + if (string.IsNullOrEmpty(targetDirectory)) return; + if (!Directory.Exists(targetDirectory)) + Directory.CreateDirectory(targetDirectory); + File.Copy(sourceFilePath, backupFilePath, true); + } } } - public Task RestoreConfigAsync(string directoryPath, CancellationToken cancellationToken = default) + public async Task RestoreConfigAsync(string directoryPath, CancellationToken cancellationToken = default) { ArgumentException.ThrowIfNullOrEmpty(directoryPath); - RestoreFile(directoryPath, ConfigurationFileName); - RestoreFile(directoryPath, ManifestFileName); - return Task.CompletedTask; + await RestoreFile(directoryPath, ConfigurationFileName, cancellationToken).ConfigureAwait(false); + await RestoreFile(directoryPath, ManifestFileName, cancellationToken).ConfigureAwait(false); } - private static void RestoreFile(string directoryPath, string fileName) + private static async Task RestoreFile(string directoryPath, string fileName, CancellationToken cancellationToken = default) { var sourceFilePath = Path.Combine(directoryPath, fileName); var targetDirectory = Path.GetDirectoryName(sourceFilePath); @@ -118,7 +133,10 @@ private static void RestoreFile(string directoryPath, string fileName) var backupFilePath = GetBackupFilePath(directoryPath, fileName); if (File.Exists(backupFilePath)) { - File.Copy(backupFilePath, sourceFilePath, true); + using (await localFilesLock.LockAsync(sourceFilePath, cancellationToken).ConfigureAwait(false)) + { + File.Copy(backupFilePath, sourceFilePath, true); + } } } private static readonly ThreadLocal HashAlgorithm = new(SHA256.Create); From 56732d873f34e8e3bf7a3b57205c3f356128528d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 23 Feb 2024 15:12:37 -0500 Subject: [PATCH 320/394] - fixes formatting --- .../WorkspaceManagement/DescriptionStorageService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs index a024b61962..9e7df010d7 100644 --- a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading; using System.Threading.Tasks; From e539f90521d66b843d9ac07cfc151aae7e3bd5cf Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 26 Feb 2024 11:19:44 -0500 Subject: [PATCH 321/394] - fixes failing unit tests Signed-off-by: Vincent Biret --- src/kiota/Handlers/KiotaInfoCommandHandler.cs | 2 +- src/kiota/Handlers/KiotaShowCommandHandler.cs | 6 +++--- .../GenerateSample.cs | 15 ++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/kiota/Handlers/KiotaInfoCommandHandler.cs b/src/kiota/Handlers/KiotaInfoCommandHandler.cs index 298bbb6aa4..b8c175ba6e 100644 --- a/src/kiota/Handlers/KiotaInfoCommandHandler.cs +++ b/src/kiota/Handlers/KiotaInfoCommandHandler.cs @@ -78,7 +78,7 @@ public override async Task InvokeAsync(InvocationContext context) openapi = searchResultDescription; } - Configuration.Generation.OpenAPIFilePath = openapi; + Configuration.Generation.OpenAPIFilePath = GetAbsolutePath(openapi); Configuration.Generation.ClearCache = clearCache; Configuration.Generation.Language = language.Value; diff --git a/src/kiota/Handlers/KiotaShowCommandHandler.cs b/src/kiota/Handlers/KiotaShowCommandHandler.cs index 4c6b8febba..fdc9edeed1 100644 --- a/src/kiota/Handlers/KiotaShowCommandHandler.cs +++ b/src/kiota/Handlers/KiotaShowCommandHandler.cs @@ -80,10 +80,10 @@ public override async Task InvokeAsync(InvocationContext context) logger.LogError("no description provided"); return 1; } - Configuration.Generation.OpenAPIFilePath = openapi; + Configuration.Generation.OpenAPIFilePath = GetAbsolutePath(openapi); Configuration.Generation.ApiManifestPath = manifest; - Configuration.Generation.IncludePatterns = includePatterns.ToHashSet(); - Configuration.Generation.ExcludePatterns = excludePatterns.ToHashSet(); + Configuration.Generation.IncludePatterns = [.. includePatterns]; + Configuration.Generation.ExcludePatterns = [.. excludePatterns]; Configuration.Generation.ClearCache = clearCache; try { diff --git a/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs b/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs index 2e73a6efc5..7fba8971a5 100644 --- a/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs +++ b/tests/Kiota.Builder.IntegrationTests/GenerateSample.cs @@ -8,7 +8,7 @@ using Xunit; namespace Kiota.Builder.IntegrationTests; -public class GenerateSample : IDisposable +public sealed class GenerateSample : IDisposable { public void Dispose() { @@ -36,7 +36,7 @@ public async Task GeneratesTodo(GenerationLanguage language, bool backingStore) var configuration = new GenerationConfiguration { Language = language, - OpenAPIFilePath = "ToDoApi.yaml", + OpenAPIFilePath = GetAbsolutePath("ToDoApi.yaml"), OutputPath = $".\\Generated\\Todo\\{language}{backingStoreSuffix}", UsesBackingStore = backingStore, }; @@ -62,7 +62,7 @@ public async Task GeneratesModelWithDictionary(GenerationLanguage language, bool var configuration = new GenerationConfiguration { Language = language, - OpenAPIFilePath = "ModelWithDictionary.yaml", + OpenAPIFilePath = GetAbsolutePath("ModelWithDictionary.yaml"), OutputPath = $".\\Generated\\ModelWithDictionary\\{language}{backingStoreSuffix}", UsesBackingStore = backingStore, }; @@ -88,7 +88,7 @@ public async Task GeneratesResponseWithMultipleReturnFormats(GenerationLanguage var configuration = new GenerationConfiguration { Language = language, - OpenAPIFilePath = "ResponseWithMultipleReturnFormats.yaml", + OpenAPIFilePath = GetAbsolutePath("ResponseWithMultipleReturnFormats.yaml"), OutputPath = $".\\Generated\\ResponseWithMultipleReturnFormats\\{language}{backingStoreSuffix}", UsesBackingStore = backingStore, }; @@ -111,7 +111,7 @@ public async Task GeneratesErrorsInliningParents(GenerationLanguage language) var configuration = new GenerationConfiguration { Language = language, - OpenAPIFilePath = "InheritingErrors.yaml", + OpenAPIFilePath = GetAbsolutePath("InheritingErrors.yaml"), OutputPath = $".\\Generated\\ErrorInlineParents\\{language}", }; await new KiotaBuilder(logger, configuration, _httpClient).GenerateClientAsync(new()); @@ -128,7 +128,7 @@ public async Task GeneratesIdiomaticChildrenNames(GenerationLanguage language) var configuration = new GenerationConfiguration { Language = language, - OpenAPIFilePath = "NoUnderscoresInModel.yaml", + OpenAPIFilePath = GetAbsolutePath("NoUnderscoresInModel.yaml"), OutputPath = OutputPath, CleanOutput = true, }; @@ -162,7 +162,7 @@ public async Task GeneratesUritemplateHints(GenerationLanguage language) var configuration = new GenerationConfiguration { Language = language, - OpenAPIFilePath = "GeneratesUritemplateHints.yaml", + OpenAPIFilePath = GetAbsolutePath("GeneratesUritemplateHints.yaml"), OutputPath = OutputPath, CleanOutput = true, }; @@ -201,4 +201,5 @@ public async Task GeneratesUritemplateHints(GenerationLanguage language) } } + private static string GetAbsolutePath(string relativePath) => Path.Combine(Directory.GetCurrentDirectory(), relativePath); } From 9f0bf8d58f0e3dcb983b48f1fa8f150454b35ebd Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 26 Feb 2024 14:38:13 -0500 Subject: [PATCH 322/394] - fixes an error swallowing issue when parsing media types Signed-off-by: Vincent Biret --- .../Configuration/StructuredMimeTypesCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Configuration/StructuredMimeTypesCollection.cs b/src/Kiota.Builder/Configuration/StructuredMimeTypesCollection.cs index 8e36bb980f..7ab0906591 100644 --- a/src/Kiota.Builder/Configuration/StructuredMimeTypesCollection.cs +++ b/src/Kiota.Builder/Configuration/StructuredMimeTypesCollection.cs @@ -33,7 +33,7 @@ public StructuredMimeTypesCollection(IEnumerable mimeTypes) } else { - return null; + throw new InvalidOperationException($"The provided media type {rawFormat} is not valid"); } } private static string formatMediaType(MediaTypeHeaderValue value) From c8629bca61eb1319a049aefe6df71eed87f5a194 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 26 Feb 2024 14:38:26 -0500 Subject: [PATCH 323/394] - adds unit tests for client configuration Signed-off-by: Vincent Biret --- .../ApiClientConfigurationTests.cs | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs diff --git a/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs b/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs new file mode 100644 index 0000000000..6a73833dd2 --- /dev/null +++ b/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs @@ -0,0 +1,109 @@ +using System; +using Kiota.Builder.Configuration; +using Kiota.Builder.WorkspaceManagement; +using Xunit; + +namespace Kiota.Builder.Tests.WorkspaceManagement; + +public sealed class ApiClientConfigurationTests +{ + [Fact] + public void Clones() + { + var clientConfig = new ApiClientConfiguration + { + ClientNamespaceName = "foo", + DescriptionLocation = "bar", + ExcludeBackwardCompatible = true, + ExcludePatterns = [ + "exclude" + ], + IncludeAdditionalData = true, + IncludePatterns = [ + "include" + ], + Language = "csharp", + OutputPath = "output", + StructuredMimeTypes = [ + "mime" + ], + UsesBackingStore = true, + }; + var cloned = (ApiClientConfiguration)clientConfig.Clone(); + Assert.NotNull(cloned); + Assert.Equal(clientConfig.ClientNamespaceName, cloned.ClientNamespaceName); + Assert.Equal(clientConfig.DescriptionLocation, cloned.DescriptionLocation); + Assert.Equal(clientConfig.ExcludeBackwardCompatible, cloned.ExcludeBackwardCompatible); + Assert.Equal(clientConfig.ExcludePatterns, cloned.ExcludePatterns); + Assert.Equal(clientConfig.IncludeAdditionalData, cloned.IncludeAdditionalData); + Assert.Equal(clientConfig.IncludePatterns, cloned.IncludePatterns); + Assert.Equal(clientConfig.Language, cloned.Language); + Assert.Equal(clientConfig.OutputPath, cloned.OutputPath); + Assert.Equal(clientConfig.StructuredMimeTypes, cloned.StructuredMimeTypes); + Assert.Equal(clientConfig.UsesBackingStore, cloned.UsesBackingStore); + } + + [Fact] + public void CreatesApiClientConfigurationFromGenerationConfiguration() + { + var generationConfiguration = new GenerationConfiguration + { + ApiManifestPath = "manifest", + ClientClassName = "client", + ClientNamespaceName = "namespace", + ExcludeBackwardCompatible = true, + ExcludePatterns = ["exclude"], + IncludeAdditionalData = true, + IncludePatterns = ["include"], + Language = GenerationLanguage.CSharp, + OpenAPIFilePath = "openapi", + OutputPath = "output", + UsesBackingStore = true, + StructuredMimeTypes = ["application/json"], + }; + var clientConfig = new ApiClientConfiguration(generationConfiguration); + Assert.NotNull(clientConfig); + Assert.Equal(generationConfiguration.ClientNamespaceName, clientConfig.ClientNamespaceName); + Assert.Equal(generationConfiguration.OpenAPIFilePath, clientConfig.DescriptionLocation); + Assert.Equal(generationConfiguration.ExcludeBackwardCompatible, clientConfig.ExcludeBackwardCompatible); + Assert.Equal(generationConfiguration.ExcludePatterns, clientConfig.ExcludePatterns); + Assert.Equal(generationConfiguration.IncludeAdditionalData, clientConfig.IncludeAdditionalData); + Assert.Equal(generationConfiguration.IncludePatterns, clientConfig.IncludePatterns); + Assert.Equal(generationConfiguration.Language.ToString(), clientConfig.Language, StringComparer.OrdinalIgnoreCase); + Assert.Equal(generationConfiguration.OutputPath, clientConfig.OutputPath); + Assert.Equal(generationConfiguration.StructuredMimeTypes, clientConfig.StructuredMimeTypes); + Assert.Equal(generationConfiguration.UsesBackingStore, clientConfig.UsesBackingStore); + } + [Fact] + public void UpdatesGenerationConfigurationFromApiClientConfiguration() + { + var clientConfiguration = new ApiClientConfiguration + { + ClientNamespaceName = "namespace", + DescriptionLocation = "openapi", + ExcludeBackwardCompatible = true, + ExcludePatterns = ["exclude"], + IncludeAdditionalData = true, + IncludePatterns = ["include"], + Language = "csharp", + OutputPath = "output", + StructuredMimeTypes = ["application/json"], + UsesBackingStore = true, + }; + var generationConfiguration = new GenerationConfiguration(); + clientConfiguration.UpdateGenerationConfigurationFromApiClientConfiguration(generationConfiguration, "client"); + Assert.Equal(clientConfiguration.ClientNamespaceName, generationConfiguration.ClientNamespaceName); + Assert.Equal(GenerationLanguage.CSharp, generationConfiguration.Language); + Assert.Equal(clientConfiguration.DescriptionLocation, generationConfiguration.OpenAPIFilePath); + Assert.Equal(clientConfiguration.ExcludeBackwardCompatible, generationConfiguration.ExcludeBackwardCompatible); + Assert.Equal(clientConfiguration.ExcludePatterns, generationConfiguration.ExcludePatterns); + Assert.Equal(clientConfiguration.IncludeAdditionalData, generationConfiguration.IncludeAdditionalData); + Assert.Equal(clientConfiguration.IncludePatterns, generationConfiguration.IncludePatterns); + Assert.Equal(clientConfiguration.OutputPath, generationConfiguration.OutputPath); + Assert.Equal(clientConfiguration.StructuredMimeTypes, generationConfiguration.StructuredMimeTypes); + Assert.Equal(clientConfiguration.UsesBackingStore, generationConfiguration.UsesBackingStore); + Assert.Empty(generationConfiguration.Serializers); + Assert.Empty(generationConfiguration.Deserializers); + } + +} From 75c8261c0bc4e164fc68a4530c61a5b272ea2f55 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 26 Feb 2024 14:48:57 -0500 Subject: [PATCH 324/394] - fixed a bug with random string collections comparisons Signed-off-by: Vincent Biret --- src/Kiota.Builder/Lock/StringIEnumerableDeepComparer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Lock/StringIEnumerableDeepComparer.cs b/src/Kiota.Builder/Lock/StringIEnumerableDeepComparer.cs index 2f58afec7d..1a3ba4e4e1 100644 --- a/src/Kiota.Builder/Lock/StringIEnumerableDeepComparer.cs +++ b/src/Kiota.Builder/Lock/StringIEnumerableDeepComparer.cs @@ -17,6 +17,7 @@ public bool Equals(IEnumerable? x, IEnumerable? y) public int GetHashCode(IEnumerable obj) { if (obj == null) return 0; - return string.Join(",", obj.Order(StringComparer.OrdinalIgnoreCase)).GetHashCode(StringComparison.Ordinal); + var concatValue = string.Join(",", obj.Order(StringComparer.OrdinalIgnoreCase)); + return string.IsNullOrEmpty(concatValue) ? 0 : concatValue.GetHashCode(StringComparison.Ordinal); } } From 033fc1c13d8799667f6af1063e4b64cce93d9662 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 26 Feb 2024 14:49:21 -0500 Subject: [PATCH 325/394] - adds unit tests for client configuration comparer Signed-off-by: Vincent Biret --- .../ApiClientConfigurationComparerTests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs diff --git a/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs b/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs new file mode 100644 index 0000000000..f84e7a8667 --- /dev/null +++ b/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs @@ -0,0 +1,21 @@ +using Kiota.Builder.WorkspaceManagement; +using Xunit; + +namespace Kiota.Builder.Tests.WorkspaceManagement; +public sealed class ApiClientConfigurationComparerTests +{ + private readonly ApiClientConfigurationComparer _comparer = new(); + [Fact] + public void Defensive() + { + Assert.Equal(0, _comparer.GetHashCode(null)); + Assert.True(_comparer.Equals(null, null)); + Assert.False(_comparer.Equals(new(), null)); + Assert.False(_comparer.Equals(null, new())); + } + [Fact] + public void GetsHashCode() + { + Assert.Equal(13, _comparer.GetHashCode(new() { UsesBackingStore = true })); + } +} From 7339b4c3fc88e49861ed0be5c8b368d54f2f2caf Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 26 Feb 2024 15:08:37 -0500 Subject: [PATCH 326/394] - fixes formatting --- .../WorspaceManagement/ApiClientConfigurationComparerTests.cs | 2 +- .../WorspaceManagement/ApiClientConfigurationTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs b/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs index f84e7a8667..d7476f9923 100644 --- a/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs +++ b/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs @@ -1,4 +1,4 @@ -using Kiota.Builder.WorkspaceManagement; +using Kiota.Builder.WorkspaceManagement; using Xunit; namespace Kiota.Builder.Tests.WorkspaceManagement; diff --git a/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs b/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs index 6a73833dd2..eb13ac8f08 100644 --- a/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs +++ b/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Kiota.Builder.Configuration; using Kiota.Builder.WorkspaceManagement; using Xunit; From 5346a06723c55128cf472b8420a5cfced78dabac Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 26 Feb 2024 15:19:59 -0500 Subject: [PATCH 327/394] - adds unit tests for request info comparer Signed-off-by: Vincent Biret --- .../Manifest/RequestInfoComparerTests.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/Kiota.Builder.Tests/Manifest/RequestInfoComparerTests.cs diff --git a/tests/Kiota.Builder.Tests/Manifest/RequestInfoComparerTests.cs b/tests/Kiota.Builder.Tests/Manifest/RequestInfoComparerTests.cs new file mode 100644 index 0000000000..70f8a8f9b3 --- /dev/null +++ b/tests/Kiota.Builder.Tests/Manifest/RequestInfoComparerTests.cs @@ -0,0 +1,38 @@ +using Kiota.Builder.Manifest; +using Microsoft.OpenApi.ApiManifest; +using Xunit; + +namespace Kiota.Builder.Tests.Manifest; + +public sealed class RequestInfoComparerTests +{ + private readonly RequestInfoComparer _comparer = new(); + [Fact] + public void Defensive() + { + Assert.Equal(0, _comparer.GetHashCode(null)); + Assert.True(_comparer.Equals(null, null)); + Assert.False(_comparer.Equals(new(), null)); + Assert.False(_comparer.Equals(null, new())); + } + [Fact] + public void GetsHashCode() + { + Assert.Equal(0, _comparer.GetHashCode(new())); + } + [Fact] + public void Compares() + { + var requestInfo = new RequestInfo + { + Method = "get", + UriTemplate = "https://graph.microsoft.com/v1.0/users" + }; + var requestInfo2 = new RequestInfo + { + Method = "get", + UriTemplate = "https://graph.microsoft.com/v1.0/me" + }; + Assert.False(_comparer.Equals(requestInfo, requestInfo2)); + } +} From c7b5d0871f16d8d0fc9896958931e41ca5b9325e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 27 Feb 2024 10:42:53 -0500 Subject: [PATCH 328/394] - adds missing unit tests for structured mime type collection Signed-off-by: Vincent Biret --- .../Configuration/StructuredMimeTypesCollection.cs | 13 ++++--------- .../StructuredMimeTypesCollectionTests.cs | 10 ++++++++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Kiota.Builder/Configuration/StructuredMimeTypesCollection.cs b/src/Kiota.Builder/Configuration/StructuredMimeTypesCollection.cs index 7ab0906591..8ddedc3991 100644 --- a/src/Kiota.Builder/Configuration/StructuredMimeTypesCollection.cs +++ b/src/Kiota.Builder/Configuration/StructuredMimeTypesCollection.cs @@ -13,7 +13,7 @@ public partial class StructuredMimeTypesCollection : ICollection private readonly Dictionary _mimeTypes; public int Count => _mimeTypes.Count; public bool IsReadOnly => false; - public StructuredMimeTypesCollection() : this(Array.Empty()) { } + public StructuredMimeTypesCollection() : this([]) { } public StructuredMimeTypesCollection(IEnumerable mimeTypes) { ArgumentNullException.ThrowIfNull(mimeTypes); @@ -21,20 +21,15 @@ public StructuredMimeTypesCollection(IEnumerable mimeTypes) .OfType>() .ToDictionary(static x => x.Key, static x => x.Value, StringComparer.OrdinalIgnoreCase); } - private static Func isPriorityParameterName = static x => x.Equals("q", StringComparison.OrdinalIgnoreCase); + private static readonly Func isPriorityParameterName = static x => x.Equals("q", StringComparison.OrdinalIgnoreCase); private static KeyValuePair? GetKeyAndPriority(string rawFormat) { - if (string.IsNullOrEmpty(rawFormat)) - return null; - if (MediaTypeHeaderValue.TryParse(rawFormat, out var parsedFormat) && parsedFormat.MediaType is not null) + if (!string.IsNullOrEmpty(rawFormat) && MediaTypeHeaderValue.TryParse(rawFormat, out var parsedFormat) && parsedFormat.MediaType is not null) { var priority = parsedFormat.Parameters.FirstOrDefault(static x => isPriorityParameterName(x.Name)) is { } priorityParameter && float.TryParse(priorityParameter.Value, CultureInfo.InvariantCulture, out var resultPriority) ? resultPriority : 1; return new KeyValuePair(formatMediaType(parsedFormat), priority); } - else - { - throw new InvalidOperationException($"The provided media type {rawFormat} is not valid"); - } + throw new ArgumentException($"The provided media type {rawFormat} is not valid"); } private static string formatMediaType(MediaTypeHeaderValue value) { diff --git a/tests/Kiota.Builder.Tests/Configuration/StructuredMimeTypesCollectionTests.cs b/tests/Kiota.Builder.Tests/Configuration/StructuredMimeTypesCollectionTests.cs index 7d03b4d3f7..fdee071a0f 100644 --- a/tests/Kiota.Builder.Tests/Configuration/StructuredMimeTypesCollectionTests.cs +++ b/tests/Kiota.Builder.Tests/Configuration/StructuredMimeTypesCollectionTests.cs @@ -15,7 +15,7 @@ public void Defensive() [Fact] public void ParsesWithOrWithoutPriorities() { - var mimeTypes = new StructuredMimeTypesCollection(new[] { "application/json", "application/xml;q=0.8" }); + var mimeTypes = new StructuredMimeTypesCollection(["application/json", "application/xml;q=0.8"]); Assert.Equal("application/json", mimeTypes.First(), StringComparer.OrdinalIgnoreCase); Assert.Equal("application/xml;q=0.8", mimeTypes.Last(), StringComparer.OrdinalIgnoreCase); Assert.DoesNotContain("application/atom+xml", mimeTypes); @@ -26,7 +26,7 @@ public void ParsesWithOrWithoutPriorities() [Fact] public void DoesNotAddDuplicates() { - Assert.Throws(() => new StructuredMimeTypesCollection(new[] { "application/json", "application/json;q=0.8" })); + Assert.Throws(() => new StructuredMimeTypesCollection(["application/json", "application/json;q=0.8"])); } [Fact] public void ClearsEntries() @@ -67,4 +67,10 @@ public void MatchesContentType(string configuredTypes, string declaredTypes, str foreach (var expectedType in deserializedExpectedTypes) Assert.Contains(expectedType, result); } + [Fact] + public void ThrowsOnInvalidMimeType() + { + Assert.Throws(() => new StructuredMimeTypesCollection(["application"])); + Assert.Throws(() => new StructuredMimeTypesCollection([null])); + } } From 7d95983411338db0280882fd8bb15cfb1f890410 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 27 Feb 2024 10:44:19 -0500 Subject: [PATCH 329/394] - typo fix Signed-off-by: Vincent Biret --- .../ApiClientConfigurationComparerTests.cs | 0 .../ApiClientConfigurationTests.cs | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename tests/Kiota.Builder.Tests/{WorspaceManagement => WorkspaceManagement}/ApiClientConfigurationComparerTests.cs (100%) rename tests/Kiota.Builder.Tests/{WorspaceManagement => WorkspaceManagement}/ApiClientConfigurationTests.cs (100%) diff --git a/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/ApiClientConfigurationComparerTests.cs similarity index 100% rename from tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationComparerTests.cs rename to tests/Kiota.Builder.Tests/WorkspaceManagement/ApiClientConfigurationComparerTests.cs diff --git a/tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/ApiClientConfigurationTests.cs similarity index 100% rename from tests/Kiota.Builder.Tests/WorspaceManagement/ApiClientConfigurationTests.cs rename to tests/Kiota.Builder.Tests/WorkspaceManagement/ApiClientConfigurationTests.cs From 8ddfb82deb405869c7d3c76a7f83f40d9a14a1e2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 27 Feb 2024 10:52:27 -0500 Subject: [PATCH 330/394] - adds missing unit tests for api dependency comparer Signed-off-by: Vincent Biret --- .../Manifest/ApiDependencyComparerTests.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/Kiota.Builder.Tests/Manifest/ApiDependencyComparerTests.cs diff --git a/tests/Kiota.Builder.Tests/Manifest/ApiDependencyComparerTests.cs b/tests/Kiota.Builder.Tests/Manifest/ApiDependencyComparerTests.cs new file mode 100644 index 0000000000..675b606403 --- /dev/null +++ b/tests/Kiota.Builder.Tests/Manifest/ApiDependencyComparerTests.cs @@ -0,0 +1,24 @@ +using Kiota.Builder.Manifest; +using Microsoft.OpenApi.ApiManifest; +using Xunit; + +namespace Kiota.Builder.Tests.Manifest; + +public sealed class ApiDependencyComparerTests +{ + private readonly ApiDependencyComparer _comparer = new(); + [Fact] + public void Defensive() + { + Assert.Equal(0, _comparer.GetHashCode(null)); + Assert.True(_comparer.Equals(null, null)); + Assert.False(_comparer.Equals(new(), null)); + Assert.False(_comparer.Equals(null, new())); + } + [Fact] + public void Equal() + { + Assert.False(_comparer.Equals(new ApiDependency { ApiDescriptionUrl = "https://foo" }, new ApiDependency { ApiDescriptionUrl = "https://bar" })); + Assert.True(_comparer.Equals(new ApiDependency { ApiDescriptionUrl = "https://foo" }, new ApiDependency { ApiDescriptionUrl = "https://foo" })); + } +} From d1b0a26d690f074e8c9bd7062b0f30ea987d14c4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 27 Feb 2024 11:05:34 -0500 Subject: [PATCH 331/394] - adds tests for workspace configuration --- .../WorkspaceConfigurationTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationTests.cs diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationTests.cs new file mode 100644 index 0000000000..558c32076e --- /dev/null +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationTests.cs @@ -0,0 +1,18 @@ +using Kiota.Builder.WorkspaceManagement; +using Xunit; + +namespace Kiota.Builder.Tests.Manifest; +public sealed class WorkspaceConfigurationTests +{ + [Fact] + public void Clones() + { + var source = new WorkspaceConfiguration + { + Clients = { { "GraphClient", new ApiClientConfiguration { ClientNamespaceName = "foo" } } }, + }; + var cloned = (WorkspaceConfiguration)source.Clone(); + Assert.NotNull(cloned); + Assert.Equal(source.Clients.Count, cloned.Clients.Count); + } +} From 6d37dc62896711f3c244d8059856f395cd956850 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 27 Feb 2024 11:14:45 -0500 Subject: [PATCH 332/394] - adds unit tests for generation configuration Signed-off-by: Vincent Biret --- .../GenerationConfigurationTests.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/Kiota.Builder.Tests/Configuration/GenerationConfigurationTests.cs b/tests/Kiota.Builder.Tests/Configuration/GenerationConfigurationTests.cs index 4871c0f5c2..0ef9d2f6d1 100644 --- a/tests/Kiota.Builder.Tests/Configuration/GenerationConfigurationTests.cs +++ b/tests/Kiota.Builder.Tests/Configuration/GenerationConfigurationTests.cs @@ -1,4 +1,6 @@ -using Kiota.Builder.Configuration; +using System.Collections.Generic; +using System.Linq; +using Kiota.Builder.Configuration; using Xunit; namespace Kiota.Builder.Tests.Configuration; @@ -20,4 +22,23 @@ public void Clones() clone.ClientClassName = "class2"; Assert.NotEqual(generationConfiguration.ClientClassName, clone.ClientClassName); } + [Fact] + public void ToApiDependency() + { + var generationConfiguration = new GenerationConfiguration + { + ClientClassName = "class1", + IncludePatterns = null, + OpenAPIFilePath = "https://pet.store/openapi.yaml", + ApiRootUrl = "https://pet.store/api", + }; + var apiDependency = generationConfiguration.ToApiDependency("foo", new Dictionary>{ + { "foo/bar", new HashSet{"GET"}} + }); + Assert.NotNull(apiDependency); + Assert.Equal("foo", apiDependency.Extensions[GenerationConfiguration.KiotaHashManifestExtensionKey].GetValue()); + Assert.NotEmpty(apiDependency.Requests); + Assert.Equal("foo/bar", apiDependency.Requests[0].UriTemplate); + Assert.Equal("GET", apiDependency.Requests[0].Method); + } } From 348fbc2048a4f711b8cf0f45ed90f215b72aaccc Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 27 Feb 2024 14:18:37 -0500 Subject: [PATCH 333/394] - code linting Signed-off-by: Vincent Biret --- .../Extensions/OpenApiUrlTreeNodeExtensions.cs | 6 +++++- .../WorkspaceManagement/WorkspaceManagementService.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index 0e3d42a3bd..00c818a3e8 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -230,7 +230,11 @@ public static string GetUrlTemplate(this OpenApiUrlTreeNode currentNode, Operati public static IEnumerable>> GetRequestInfo(this OpenApiUrlTreeNode currentNode) { ArgumentNullException.ThrowIfNull(currentNode); - foreach (var childInfo in currentNode.Children.Values.SelectMany(static x => x.GetRequestInfo())) + return currentNode.GetRequestInfoInternal(); + } + private static IEnumerable>> GetRequestInfoInternal(this OpenApiUrlTreeNode currentNode) + { + foreach (var childInfo in currentNode.Children.Values.SelectMany(static x => x.GetRequestInfoInternal())) { yield return childInfo; } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 874ce3b48f..ae37e97660 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -106,7 +106,7 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, }; if (!string.IsNullOrEmpty(existingLock?.KiotaVersion) && !configurationLock.KiotaVersion.Equals(existingLock.KiotaVersion, StringComparison.OrdinalIgnoreCase)) { - Logger.LogWarning("API client was generated with version {ExistingVersion} and the current version is {CurrentVersion}, it will be upgraded and you should upgrade dependencies", existingLock?.KiotaVersion, configurationLock.KiotaVersion); + Logger.LogWarning("API client was generated with version {ExistingVersion} and the current version is {CurrentVersion}, it will be upgraded and you should upgrade dependencies", existingLock.KiotaVersion, configurationLock.KiotaVersion); } return !lockComparer.Equals(existingLock, configurationLock); } From 815ed4432e0dbedb8d8e64f67a8b4f008e0014c5 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 27 Feb 2024 14:32:30 -0500 Subject: [PATCH 334/394] - adds unit tests for backup and restore operations Signed-off-by: Vincent Biret --- .../WorkspaceConfigurationStorageService.cs | 34 +++++++++---------- .../WorkspaceManagementService.cs | 4 +-- ...rkspaceConfigurationStorageServiceTests.cs | 12 +++++++ 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 158eebe4b6..02cb20ca51 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -95,42 +95,40 @@ public Task IsInitializedAsync(CancellationToken cancellationToken = defau } return (null, null); } - public async Task BackupConfigAsync(string directoryPath, CancellationToken cancellationToken = default) + public async Task BackupConfigAsync(CancellationToken cancellationToken = default) { - ArgumentException.ThrowIfNullOrEmpty(directoryPath); - await BackupFile(directoryPath, ConfigurationFileName, cancellationToken).ConfigureAwait(false); - await BackupFile(directoryPath, ManifestFileName, cancellationToken).ConfigureAwait(false); + await BackupFile(ConfigurationFileName, cancellationToken).ConfigureAwait(false); + await BackupFile(ManifestFileName, cancellationToken).ConfigureAwait(false); } - private static async Task BackupFile(string directoryPath, string fileName, CancellationToken cancellationToken = default) + private async Task BackupFile(string fileName, CancellationToken cancellationToken = default) { - var sourceFilePath = Path.Combine(directoryPath, fileName); + var sourceFilePath = Path.Combine(TargetDirectory, fileName); if (File.Exists(sourceFilePath)) { - var backupFilePath = GetBackupFilePath(directoryPath, fileName); + var backupFilePath = GetBackupFilePath(TargetDirectory, fileName); using (await localFilesLock.LockAsync(backupFilePath, cancellationToken).ConfigureAwait(false)) { - var targetDirectory = Path.GetDirectoryName(backupFilePath); - if (string.IsNullOrEmpty(targetDirectory)) return; - if (!Directory.Exists(targetDirectory)) - Directory.CreateDirectory(targetDirectory); + var backupStorageDirectory = Path.GetDirectoryName(backupFilePath); + if (string.IsNullOrEmpty(backupStorageDirectory)) return; + if (!Directory.Exists(backupStorageDirectory)) + Directory.CreateDirectory(backupStorageDirectory); File.Copy(sourceFilePath, backupFilePath, true); } } } - public async Task RestoreConfigAsync(string directoryPath, CancellationToken cancellationToken = default) + public async Task RestoreConfigAsync(CancellationToken cancellationToken = default) { - ArgumentException.ThrowIfNullOrEmpty(directoryPath); - await RestoreFile(directoryPath, ConfigurationFileName, cancellationToken).ConfigureAwait(false); - await RestoreFile(directoryPath, ManifestFileName, cancellationToken).ConfigureAwait(false); + await RestoreFile(ConfigurationFileName, cancellationToken).ConfigureAwait(false); + await RestoreFile(ManifestFileName, cancellationToken).ConfigureAwait(false); } - private static async Task RestoreFile(string directoryPath, string fileName, CancellationToken cancellationToken = default) + private async Task RestoreFile(string fileName, CancellationToken cancellationToken = default) { - var sourceFilePath = Path.Combine(directoryPath, fileName); + var sourceFilePath = Path.Combine(TargetDirectory, fileName); var targetDirectory = Path.GetDirectoryName(sourceFilePath); if (string.IsNullOrEmpty(targetDirectory)) return; if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory); - var backupFilePath = GetBackupFilePath(directoryPath, fileName); + var backupFilePath = GetBackupFilePath(TargetDirectory, fileName); if (File.Exists(backupFilePath)) { using (await localFilesLock.LockAsync(sourceFilePath, cancellationToken).ConfigureAwait(false)) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index ae37e97660..13a0ac9945 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -65,14 +65,14 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene public async Task RestoreStateAsync(string outputPath, CancellationToken cancellationToken = default) { if (UseKiotaConfig) - await workspaceConfigurationStorageService.RestoreConfigAsync(outputPath, cancellationToken).ConfigureAwait(false); + await workspaceConfigurationStorageService.RestoreConfigAsync(cancellationToken).ConfigureAwait(false); else await lockManagementService.RestoreLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); } public async Task BackupStateAsync(string outputPath, CancellationToken cancellationToken = default) { if (UseKiotaConfig) - await workspaceConfigurationStorageService.BackupConfigAsync(outputPath, cancellationToken).ConfigureAwait(false); + await workspaceConfigurationStorageService.BackupConfigAsync(cancellationToken).ConfigureAwait(false); else await lockManagementService.BackupLockFileAsync(outputPath, cancellationToken).ConfigureAwait(false); } diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs index 54aac63f2a..d8002d3a65 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceConfigurationStorageServiceTests.cs @@ -61,6 +61,18 @@ public async Task DoesNotReturnIsInitialized() var result = await service.IsInitializedAsync(); Assert.False(result); } + [Fact] + public async Task BackupsAndRestores() + { + var service = new WorkspaceConfigurationStorageService(tempPath); + await service.InitializeAsync(); + await service.BackupConfigAsync(); + var targetConfigFile = Path.Combine(tempPath, "kiota-config.json"); + File.Delete(targetConfigFile); + Assert.False(File.Exists(targetConfigFile)); + await service.RestoreConfigAsync(); + Assert.True(File.Exists(targetConfigFile)); + } public void Dispose() { if (Directory.Exists(tempPath)) From 162bc2725b0a21f8cc439ef817f9ace529631458 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Feb 2024 09:59:51 -0500 Subject: [PATCH 335/394] - adds unit tests for description storage service Signed-off-by: Vincent Biret --- .../DescriptionStorageServiceTests.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/Kiota.Builder.Tests/WorkspaceManagement/DescriptionStorageServiceTests.cs diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/DescriptionStorageServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/DescriptionStorageServiceTests.cs new file mode 100644 index 0000000000..3b6f53f21b --- /dev/null +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/DescriptionStorageServiceTests.cs @@ -0,0 +1,38 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using Kiota.Builder.WorkspaceManagement; +using Xunit; + +namespace Kiota.Builder.Tests.WorkspaceManagement; + +public sealed class DescriptionStorageServiceTests +{ + private readonly string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + [Fact] + public async Task StoresADescription() + { + var service = new DescriptionStorageService(tempPath); + using var stream = new MemoryStream(); + stream.WriteByte(0x1); + await service.UpdateDescriptionAsync("clientName", stream); + using var result = await service.GetDescriptionAsync("clientName"); + Assert.NotNull(result); + } + [Fact] + public async Task ReturnsNothingIfNoDescriptionIsPresent() + { + var service = new DescriptionStorageService(tempPath); + var result = await service.GetDescriptionAsync("clientNameB"); + Assert.Null(result); + } + [Fact] + public async Task Defensive() + { + Assert.Throws(() => new DescriptionStorageService(string.Empty)); + var service = new DescriptionStorageService(tempPath); + await Assert.ThrowsAsync(() => service.UpdateDescriptionAsync(null, Stream.Null)); + await Assert.ThrowsAsync(() => service.UpdateDescriptionAsync("foo", null)); + await Assert.ThrowsAsync(() => service.GetDescriptionAsync(null)); + } +} From 179c4c88dcc6e9e1041a6ea0d28ca4c7c142bac3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Feb 2024 10:25:14 -0500 Subject: [PATCH 336/394] - adds unit test for workspace management service Signed-off-by: Vincent Biret --- .../WorkspaceManagementServiceTests.cs | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs new file mode 100644 index 0000000000..c8720a431c --- /dev/null +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs @@ -0,0 +1,71 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using Kiota.Builder.Configuration; +using Kiota.Builder.WorkspaceManagement; +using Microsoft.Extensions.Logging; +using Moq; +using Xunit; + +namespace Kiota.Builder.Tests.WorkspaceManagement; + +public sealed class WorkspaceManagementServiceTests : IDisposable +{ + private readonly string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + [Fact] + public void Defensive() + { + Assert.Throws(() => new WorkspaceManagementService(null)); + } + [InlineData(true)] + [InlineData(false)] + [Theory] + public async Task IsClientPresentReturnsFalseOnNoClient(bool usesConfig) + { + var mockLogger = new Mock(); + var service = new WorkspaceManagementService(mockLogger.Object, usesConfig); + var result = await service.IsClientPresent("clientName"); + Assert.False(result); + } + [InlineData(true)] + [InlineData(false)] + [Theory] + public async Task ShouldGenerateReturnsTrue(bool usesConfig) + { + var mockLogger = new Mock(); + var service = new WorkspaceManagementService(mockLogger.Object, usesConfig); + var configuration = new GenerationConfiguration + { + ClientClassName = "clientName", + OutputPath = tempPath, + OpenAPIFilePath = Path.Combine(tempPath, "openapi.yaml"), + }; + var result = await service.ShouldGenerateAsync(configuration, "foo"); + Assert.True(result); + } + [InlineData(true)] + [InlineData(false)] + [Theory] + public async Task ShouldGenerateReturnsFalse(bool usesConfig) + { + var mockLogger = new Mock(); + var service = new WorkspaceManagementService(mockLogger.Object, usesConfig); + var configuration = new GenerationConfiguration + { + ClientClassName = "clientName", + OutputPath = tempPath, + OpenAPIFilePath = Path.Combine(tempPath, "openapi.yaml"), + ApiRootUrl = "https://graph.microsoft.com", + }; + Directory.CreateDirectory(tempPath); + await service.UpdateStateFromConfigurationAsync(configuration, "foo", []); + var result = await service.ShouldGenerateAsync(configuration, "foo"); + Assert.False(result); + } + + public void Dispose() + { + if (Directory.Exists(tempPath)) + Directory.Delete(tempPath, true); + } +} From 4affef67abdce792f5bd85ed3211e6ecd94f2b7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 08:18:15 +0000 Subject: [PATCH 337/394] Bump @types/node from 20.11.21 to 20.11.22 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.21 to 20.11.22. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 8846c1f157..a4b709784d 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.21", + "@types/node": "^20.11.22", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", @@ -828,9 +828,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.21.tgz", - "integrity": "sha512-/ySDLGscFPNasfqStUuWWPfL78jompfIoVzLJPVVAHBh6rpG68+pI2Gk+fNLeI8/f1yPYL4s46EleVIc20F1Ow==", + "version": "20.11.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.22.tgz", + "integrity": "sha512-/G+IxWxma6V3E+pqK1tSl2Fo1kl41pK1yeCyDsgkF9WlVAme4j5ISYM2zR11bgLFJGLN5sVK40T4RJNuiZbEjA==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 02ec476668..804d58dc8d 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.21", + "@types/node": "^20.11.22", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", From 4c5b12f6148070623bded5c4fc286e40ab949ee9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 08:24:40 +0000 Subject: [PATCH 338/394] Bump the kiota-dependencies group with 2 updates Bumps the kiota-dependencies group with 2 updates: [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) and [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet). Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.1 to 1.1.5 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.1...v1.1.5) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 499be67f16..163e8af81f 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -40,7 +40,7 @@ - + From 700cbd1845e2e2ab672ee2902dd681688b11c578 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 08:44:08 +0000 Subject: [PATCH 339/394] Bump @types/node from 20.11.21 to 20.11.22 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.21 to 20.11.22. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 82e4efd976..c7787258e2 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.21.tgz", - "integrity": "sha512-/ySDLGscFPNasfqStUuWWPfL78jompfIoVzLJPVVAHBh6rpG68+pI2Gk+fNLeI8/f1yPYL4s46EleVIc20F1Ow==", + "version": "20.11.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.22.tgz", + "integrity": "sha512-/G+IxWxma6V3E+pqK1tSl2Fo1kl41pK1yeCyDsgkF9WlVAme4j5ISYM2zR11bgLFJGLN5sVK40T4RJNuiZbEjA==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From 3f5337085f0a55eaf82cb329f79654095aa8f243 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 08:44:20 +0000 Subject: [PATCH 340/394] Bump @types/vscode from 1.86.0 to 1.87.0 in /vscode/microsoft-kiota Bumps [@types/vscode](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/vscode) from 1.86.0 to 1.87.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/vscode) --- updated-dependencies: - dependency-name: "@types/vscode" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 8 ++++---- vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 82e4efd976..d395aeef26 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -19,7 +19,7 @@ "@types/adm-zip": "^0.5.5", "@types/mocha": "^10.0.6", "@types/node": "20.x", - "@types/vscode": "^1.86.0", + "@types/vscode": "^1.87.0", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "@vscode/test-electron": "^2.3.9", @@ -549,9 +549,9 @@ "dev": true }, "node_modules/@types/vscode": { - "version": "1.86.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.86.0.tgz", - "integrity": "sha512-DnIXf2ftWv+9LWOB5OJeIeaLigLHF7fdXF6atfc7X5g2w/wVZBgk0amP7b+ub5xAuW1q7qP5YcFvOcit/DtyCQ==", + "version": "1.87.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.87.0.tgz", + "integrity": "sha512-y3yYJV2esWr8LNjp3VNbSMWG7Y43jC8pCldG8YwiHGAQbsymkkMMt0aDT1xZIOFM2eFcNiUc+dJMx1+Z0UT8fg==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 8dbba9988c..e6a0998f9d 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -426,7 +426,7 @@ "@types/adm-zip": "^0.5.5", "@types/mocha": "^10.0.6", "@types/node": "20.x", - "@types/vscode": "^1.86.0", + "@types/vscode": "^1.87.0", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "@vscode/test-electron": "^2.3.9", From 78255e3eb99bdcb2e999286c4b34175c3a9da64e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 08:53:51 +0000 Subject: [PATCH 341/394] Bump the kiota-dependencies group in /it/csharp with 3 updates Bumps the kiota-dependencies group in /it/csharp with 3 updates: [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet), [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet) and [Microsoft.Kiota.Serialization.Form](https://github.com/microsoft/kiota-serialization-form-dotnet). Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.6 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.6...v1.3.7) Updates `Microsoft.Kiota.Serialization.Form` from 1.1.3 to 1.1.5 - [Release notes](https://github.com/microsoft/kiota-serialization-form-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-serialization-form-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-serialization-form-dotnet/compare/v1.1.3...v1.1.5) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Serialization.Form dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 615be10e3f..3734508c83 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -13,7 +13,7 @@ - + From 2e9d8e307fa4902e8ea9125357deabfa6fcbfb9c Mon Sep 17 00:00:00 2001 From: Eastman Date: Thu, 29 Feb 2024 11:58:03 +0300 Subject: [PATCH 342/394] Update package.json --- vscode/microsoft-kiota/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index e6a0998f9d..1adaf4b309 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -8,7 +8,7 @@ "telemetryInstrumentationKey": "4c6357e0-daf9-42b5-bdfb-67878f8957b5", "icon": "images/logo.png", "engines": { - "vscode": "^1.86.0" + "vscode": "^1.87.0" }, "categories": [ "Other" From 2e84c89f0779db16b1e729db76572f8d4f14065c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 09:00:16 +0000 Subject: [PATCH 343/394] Bump the kiota-dependencies group with 1 update Bumps the kiota-dependencies group with 1 update: [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet). Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.4 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.4...v1.3.7) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- src/Kiota.Builder/Kiota.Builder.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj index 163e8af81f..55aa5449fa 100644 --- a/src/Kiota.Builder/Kiota.Builder.csproj +++ b/src/Kiota.Builder/Kiota.Builder.csproj @@ -39,7 +39,7 @@ - + From e6bc9ce4c6952a9e14cea095bf9aa3b74bd508f1 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 29 Feb 2024 10:27:34 -0500 Subject: [PATCH 344/394] Update src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs Co-authored-by: Eastman --- .../WorkspaceManagement/WorkspaceManagementService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 13a0ac9945..7384445ab8 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -124,7 +124,7 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, private async Task GetConfigurationHashAsync(ApiClientConfiguration apiClientConfiguration, string descriptionHash) { using var stream = new MemoryStream(); - JsonSerializer.Serialize(stream, apiClientConfiguration, context.ApiClientConfiguration); + await JsonSerializer.SerializeAsync(stream, apiClientConfiguration, context.ApiClientConfiguration).ConfigureAwait(false); await stream.WriteAsync(Encoding.UTF8.GetBytes(descriptionHash)).ConfigureAwait(false); stream.Position = 0; if (HashAlgorithm.Value is null) From 90e0ced19a15cffb0398bd471736c42b5ee35dfd Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Feb 2024 15:07:36 -0500 Subject: [PATCH 345/394] - code linting Signed-off-by: Vincent Biret --- src/kiota/Handlers/Client/AddHandler.cs | 2 +- src/kiota/Handlers/KiotaDownloadCommandHandler.cs | 2 +- src/kiota/Handlers/KiotaGenerateCommandHandler.cs | 2 +- src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs | 4 ++-- src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs | 2 +- src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs | 4 ++-- src/kiota/Handlers/KiotaInfoCommandHandler.cs | 2 +- src/kiota/Handlers/KiotaSearchCommandHandler.cs | 2 +- src/kiota/Handlers/KiotaShowCommandHandler.cs | 2 +- src/kiota/Handlers/KiotaUpdateCommandHandler.cs | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/kiota/Handlers/Client/AddHandler.cs b/src/kiota/Handlers/Client/AddHandler.cs index 70c99b4fec..f2c8bb2676 100644 --- a/src/kiota/Handlers/Client/AddHandler.cs +++ b/src/kiota/Handlers/Client/AddHandler.cs @@ -116,7 +116,7 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); logger.AppendInternalTracing(); logger.LogTrace("configuration: {configuration}", JsonSerializer.Serialize(Configuration, KiotaConfigurationJsonContext.Default.KiotaConfiguration)); diff --git a/src/kiota/Handlers/KiotaDownloadCommandHandler.cs b/src/kiota/Handlers/KiotaDownloadCommandHandler.cs index b16484d996..771ad67cef 100644 --- a/src/kiota/Handlers/KiotaDownloadCommandHandler.cs +++ b/src/kiota/Handlers/KiotaDownloadCommandHandler.cs @@ -55,7 +55,7 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context); using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); logger.LogTrace("configuration: {configuration}", JsonSerializer.Serialize(Configuration, KiotaConfigurationJsonContext.Default.KiotaConfiguration)); try diff --git a/src/kiota/Handlers/KiotaGenerateCommandHandler.cs b/src/kiota/Handlers/KiotaGenerateCommandHandler.cs index 1a9f39c1d4..084bff1b97 100644 --- a/src/kiota/Handlers/KiotaGenerateCommandHandler.cs +++ b/src/kiota/Handlers/KiotaGenerateCommandHandler.cs @@ -120,7 +120,7 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); logger.AppendInternalTracing(); logger.LogTrace("configuration: {configuration}", JsonSerializer.Serialize(Configuration, KiotaConfigurationJsonContext.Default.KiotaConfiguration)); diff --git a/src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs b/src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs index 09bbdc2206..1b162aa4ab 100644 --- a/src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs +++ b/src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs @@ -21,10 +21,10 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context); using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); try { - return await LoginAsync(logger, cancellationToken); + return await LoginAsync(logger, cancellationToken).ConfigureAwait(false); } catch (Exception ex) { diff --git a/src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs b/src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs index 735a629a05..73241773dc 100644 --- a/src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs +++ b/src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs @@ -15,7 +15,7 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context); using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); try { var deviceCodeAuthProvider = GetGitHubDeviceStorageService(logger); diff --git a/src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs b/src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs index 7eb706638e..517e43b03d 100644 --- a/src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs +++ b/src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs @@ -20,10 +20,10 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context); using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); try { - return await LoginAsync(logger, pat, cancellationToken); + return await LoginAsync(logger, pat, cancellationToken).ConfigureAwait(false); } catch (Exception ex) { diff --git a/src/kiota/Handlers/KiotaInfoCommandHandler.cs b/src/kiota/Handlers/KiotaInfoCommandHandler.cs index b8c175ba6e..53909064cd 100644 --- a/src/kiota/Handlers/KiotaInfoCommandHandler.cs +++ b/src/kiota/Handlers/KiotaInfoCommandHandler.cs @@ -60,7 +60,7 @@ public override async Task InvokeAsync(InvocationContext context) Configuration.Search.ClearCache = clearCache; using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); if (!language.HasValue) { ShowLanguagesTable(); diff --git a/src/kiota/Handlers/KiotaSearchCommandHandler.cs b/src/kiota/Handlers/KiotaSearchCommandHandler.cs index 07b3e19cff..b1fd621d9b 100644 --- a/src/kiota/Handlers/KiotaSearchCommandHandler.cs +++ b/src/kiota/Handlers/KiotaSearchCommandHandler.cs @@ -42,7 +42,7 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context); using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); logger.LogTrace("configuration: {configuration}", JsonSerializer.Serialize(Configuration, KiotaConfigurationJsonContext.Default.KiotaConfiguration)); try diff --git a/src/kiota/Handlers/KiotaShowCommandHandler.cs b/src/kiota/Handlers/KiotaShowCommandHandler.cs index fdc9edeed1..b621a9b26f 100644 --- a/src/kiota/Handlers/KiotaShowCommandHandler.cs +++ b/src/kiota/Handlers/KiotaShowCommandHandler.cs @@ -64,7 +64,7 @@ public override async Task InvokeAsync(InvocationContext context) Configuration.Search.ClearCache = clearCache; using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); var descriptionProvided = (!string.IsNullOrEmpty(openapi) || !string.IsNullOrEmpty(manifest)) && string.IsNullOrEmpty(searchTerm); var (searchResultDescription, statusCode) = await GetDescriptionFromSearchAsync(openapi, manifest, searchTerm, version, loggerFactory, logger, cancellationToken); if (statusCode.HasValue) diff --git a/src/kiota/Handlers/KiotaUpdateCommandHandler.cs b/src/kiota/Handlers/KiotaUpdateCommandHandler.cs index f0a8186c6f..d21b5f71ac 100644 --- a/src/kiota/Handlers/KiotaUpdateCommandHandler.cs +++ b/src/kiota/Handlers/KiotaUpdateCommandHandler.cs @@ -46,7 +46,7 @@ public override async Task InvokeAsync(InvocationContext context) var (loggerFactory, logger) = GetLoggerAndFactory(context); using (loggerFactory) { - await CheckForNewVersionAsync(logger, cancellationToken); + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); try { var locks = await Task.WhenAll(lockFileDirectoryPaths.Select(x => lockService.GetLockFromDirectoryAsync(x, cancellationToken) From a9fed19a6b4e3fd059dfc5c1842bec4e27b7e8d7 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Feb 2024 15:17:46 -0500 Subject: [PATCH 346/394] - fixes error message Signed-off-by: Vincent Biret --- src/kiota/Handlers/Client/AddHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kiota/Handlers/Client/AddHandler.cs b/src/kiota/Handlers/Client/AddHandler.cs index f2c8bb2676..deb60bb8a4 100644 --- a/src/kiota/Handlers/Client/AddHandler.cs +++ b/src/kiota/Handlers/Client/AddHandler.cs @@ -139,10 +139,10 @@ public override async Task InvokeAsync(InvocationContext context) catch (Exception ex) { #if DEBUG - logger.LogCritical(ex, "error generating the client: {exceptionMessage}", ex.Message); + logger.LogCritical(ex, "error adding the client: {exceptionMessage}", ex.Message); throw; // so debug tools go straight to the source of the exception when attached #else - logger.LogCritical("error generating the client: {exceptionMessage}", ex.Message); + logger.LogCritical("error adding the client: {exceptionMessage}", ex.Message); return 1; #endif } From cf44f61a59fcc7630ea2f75e02ab6decf73234ad Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Feb 2024 16:16:15 -0500 Subject: [PATCH 347/394] - adds remove command implementation Signed-off-by: Vincent Biret --- src/Kiota.Builder/KiotaBuilder.cs | 16 ++----- .../DescriptionStorageService.cs | 8 ++++ .../WorkspaceManagementService.cs | 30 +++++++++++- src/kiota/Handlers/Client/RemoveHandler.cs | 48 +++++++++++++++++++ src/kiota/KiotaClientCommands.cs | 17 ++++++- src/kiota/KiotaHost.cs | 2 +- .../WorkspaceManagementServiceTests.cs | 11 +++-- 7 files changed, 111 insertions(+), 21 deletions(-) create mode 100644 src/kiota/Handlers/Client/RemoveHandler.cs diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 58223cc5f0..200458a1e4 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -65,7 +65,6 @@ public KiotaBuilder(ILogger logger, GenerationConfiguration config }; var workingDirectory = Directory.GetCurrentDirectory(); workspaceManagementService = new WorkspaceManagementService(logger, useKiotaConfig, workingDirectory); - descriptionStorageService = new DescriptionStorageService(workingDirectory); this.useKiotaConfig = useKiotaConfig; } private readonly bool useKiotaConfig; @@ -295,17 +294,9 @@ private async Task FinalizeWorkspaceAsync(Stopwatch sw, int stepId, OpenApiUrlTr { // Write lock file sw.Start(); - await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], cancellationToken).ConfigureAwait(false); + using var descriptionStream = !isDescriptionFromWorkspaceCopy ? await LoadStream(inputPath, cancellationToken).ConfigureAwait(false) : Stream.Null; + await workspaceManagementService.UpdateStateFromConfigurationAsync(config, openApiDocument?.HashCode ?? string.Empty, openApiTree?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], descriptionStream, cancellationToken).ConfigureAwait(false); StopLogAndReset(sw, $"step {++stepId} - writing lock file - took"); - - if (!isDescriptionFromWorkspaceCopy) - { - // Store description in the workspace copy - sw.Start(); - using var descriptionStream = await LoadStream(inputPath, cancellationToken).ConfigureAwait(false); - await descriptionStorageService.UpdateDescriptionAsync(config.ClientClassName, descriptionStream, new Uri(config.OpenAPIFilePath).GetFileExtension(), cancellationToken).ConfigureAwait(false); - StopLogAndReset(sw, $"step {++stepId} - storing description in the workspace copy - took"); - } } private readonly WorkspaceManagementService workspaceManagementService; private static readonly GlobComparer globComparer = new(); @@ -408,7 +399,6 @@ private void StopLogAndReset(Stopwatch sw, string prefix) o.PoolSize = 20; o.PoolInitialFill = 1; }); - private readonly DescriptionStorageService descriptionStorageService; private bool isDescriptionFromWorkspaceCopy; private async Task LoadStream(string inputPath, CancellationToken cancellationToken) { @@ -420,7 +410,7 @@ private async Task LoadStream(string inputPath, CancellationToken cancel Stream input; if (useKiotaConfig && config.Operation is ClientOperation.Edit or ClientOperation.Add && - await descriptionStorageService.GetDescriptionAsync(config.ClientClassName, new Uri(inputPath).GetFileExtension(), cancellationToken).ConfigureAwait(false) is { } descriptionStream) + await workspaceManagementService.GetDescriptionCopyAsync(config.ClientClassName, inputPath, cancellationToken).ConfigureAwait(false) is { } descriptionStream) { logger.LogInformation("loaded description from the workspace copy"); input = descriptionStream; diff --git a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs index 9e7df010d7..c1d71077f7 100644 --- a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs @@ -50,4 +50,12 @@ public async Task UpdateDescriptionAsync(string clientName, Stream description, return ms; } } + public void RemoveDescription(string clientName, string extension = "yml") + { + ArgumentNullException.ThrowIfNull(clientName); + ArgumentNullException.ThrowIfNull(extension); + var descriptionFilePath = Path.Combine(TargetDirectory, DescriptionsSubDirectoryRelativePath, $"{clientName}.{extension}"); + if (File.Exists(descriptionFilePath)) + File.Delete(descriptionFilePath); + } } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 7384445ab8..43b481c2a0 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using Kiota.Builder.Configuration; +using Kiota.Builder.Extensions; using Kiota.Builder.Lock; using Kiota.Builder.Manifest; using Microsoft.Extensions.Logging; @@ -29,16 +30,18 @@ public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false, s workingDirectory = Directory.GetCurrentDirectory(); WorkingDirectory = workingDirectory; workspaceConfigurationStorageService = new(workingDirectory); + descriptionStorageService = new(workingDirectory); } private readonly LockManagementService lockManagementService = new(); private readonly WorkspaceConfigurationStorageService workspaceConfigurationStorageService; + private readonly DescriptionStorageService descriptionStorageService; public async Task IsClientPresent(string clientName, CancellationToken cancellationToken = default) { if (!UseKiotaConfig) return false; var (wsConfig, _) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); return wsConfig?.Clients.ContainsKey(clientName) ?? false; } - public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, Dictionary> templatesWithOperations, CancellationToken cancellationToken = default) + public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration generationConfiguration, string descriptionHash, Dictionary> templatesWithOperations, Stream descriptionStream, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(generationConfiguration); if (UseKiotaConfig) @@ -52,6 +55,8 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, descriptionHash).ConfigureAwait(false); manifest.ApiDependencies.AddOrReplace(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency(inputConfigurationHash, templatesWithOperations)); await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, manifest, cancellationToken).ConfigureAwait(false); + if (descriptionStream != Stream.Null) + await descriptionStorageService.UpdateDescriptionAsync(generationConfiguration.ClientClassName, descriptionStream, new Uri(generationConfiguration.OpenAPIFilePath).GetFileExtension(), cancellationToken).ConfigureAwait(false); } else { @@ -112,6 +117,29 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, } } + public async Task GetDescriptionCopyAsync(string clientName, string inputPath, CancellationToken cancellationToken = default) + { + if (!UseKiotaConfig) + return null; + return await descriptionStorageService.GetDescriptionAsync(clientName, new Uri(inputPath).GetFileExtension(), cancellationToken).ConfigureAwait(false); + } + public async Task RemoveClientAsync(string clientName, bool cleanOutput = false, CancellationToken cancellationToken = default) + { + if (!UseKiotaConfig) + throw new InvalidOperationException("Cannot remove a client in lock mode"); + var (wsConfig, manifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + if (wsConfig is null) + throw new InvalidOperationException("Cannot remove a client without a configuration"); + + if (cleanOutput && wsConfig.Clients.TryGetValue(clientName, out var clientConfig) && Directory.Exists(clientConfig.OutputPath)) + Directory.Delete(clientConfig.OutputPath, true); + + if (!wsConfig.Clients.Remove(clientName)) + throw new InvalidOperationException($"The client {clientName} was not found in the configuration"); + manifest?.ApiDependencies.Remove(clientName); + await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, manifest, cancellationToken).ConfigureAwait(false); + descriptionStorageService.RemoveDescription(clientName); + } private static readonly JsonSerializerOptions options = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, diff --git a/src/kiota/Handlers/Client/RemoveHandler.cs b/src/kiota/Handlers/Client/RemoveHandler.cs new file mode 100644 index 0000000000..b95280963e --- /dev/null +++ b/src/kiota/Handlers/Client/RemoveHandler.cs @@ -0,0 +1,48 @@ +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.Threading; +using System.Threading.Tasks; +using Kiota.Builder; +using Kiota.Builder.WorkspaceManagement; +using Microsoft.Extensions.Logging; + +namespace kiota.Handlers.Client; +internal class RemoveHandler : BaseKiotaCommandHandler +{ + public required Option ClassOption + { + get; init; + } + public required Option CleanOutputOption + { + get; init; + } + public override async Task InvokeAsync(InvocationContext context) + { + string className = context.ParseResult.GetValueForOption(ClassOption) ?? string.Empty; + bool cleanOutput = context.ParseResult.GetValueForOption(CleanOutputOption); + CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; + var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); + using (loggerFactory) + { + try + { + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); + var workspaceManagementService = new WorkspaceManagementService(logger, true); + await workspaceManagementService.RemoveClientAsync(className, cleanOutput, cancellationToken).ConfigureAwait(false); + return 0; + } + catch (Exception ex) + { +#if DEBUG + logger.LogCritical(ex, "error removing the client: {exceptionMessage}", ex.Message); + throw; // so debug tools go straight to the source of the exception when attached +#else + logger.LogCritical("error removing the client: {exceptionMessage}", ex.Message); + return 1; +#endif + } + } + } +} diff --git a/src/kiota/KiotaClientCommands.cs b/src/kiota/KiotaClientCommands.cs index 06164aa8f5..aac0085d29 100644 --- a/src/kiota/KiotaClientCommands.cs +++ b/src/kiota/KiotaClientCommands.cs @@ -85,8 +85,21 @@ public static Command GetAddCommand() } public static Command GetRemoveCommand() { - var command = new Command("remove", "Removes a client from the Kiota configuration"); - //TODO map the handler + var clientNameOption = GetClientNameOption(); + var cleanOutputOption = KiotaHost.GetCleanOutputOption(false); + var logLevelOption = KiotaHost.GetLogLevelOption(); + var command = new Command("remove", "Removes a client from the Kiota configuration") + { + clientNameOption, + cleanOutputOption, + logLevelOption, + }; + command.Handler = new RemoveHandler + { + ClassOption = clientNameOption, + CleanOutputOption = cleanOutputOption, + LogLevelOption = logLevelOption, + }; return command; } public static Command GetEditCommand() diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index dd3d028b6e..703b05ed47 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -265,7 +265,7 @@ private static Command GetSearchCommand() }; return searchCommand; } - private static Option GetCleanOutputOption(bool defaultValue) + internal static Option GetCleanOutputOption(bool defaultValue) { var cleanOutputOption = new Option("--clean-output", () => defaultValue, "Removes all files from the output directory before generating the code files."); cleanOutputOption.AddAlias("--co"); diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs index c8720a431c..89adecd868 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs @@ -23,7 +23,8 @@ public void Defensive() public async Task IsClientPresentReturnsFalseOnNoClient(bool usesConfig) { var mockLogger = new Mock(); - var service = new WorkspaceManagementService(mockLogger.Object, usesConfig); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger.Object, usesConfig, tempPath); var result = await service.IsClientPresent("clientName"); Assert.False(result); } @@ -33,7 +34,8 @@ public async Task IsClientPresentReturnsFalseOnNoClient(bool usesConfig) public async Task ShouldGenerateReturnsTrue(bool usesConfig) { var mockLogger = new Mock(); - var service = new WorkspaceManagementService(mockLogger.Object, usesConfig); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger.Object, usesConfig, tempPath); var configuration = new GenerationConfiguration { ClientClassName = "clientName", @@ -49,7 +51,8 @@ public async Task ShouldGenerateReturnsTrue(bool usesConfig) public async Task ShouldGenerateReturnsFalse(bool usesConfig) { var mockLogger = new Mock(); - var service = new WorkspaceManagementService(mockLogger.Object, usesConfig); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger.Object, usesConfig, tempPath); var configuration = new GenerationConfiguration { ClientClassName = "clientName", @@ -58,7 +61,7 @@ public async Task ShouldGenerateReturnsFalse(bool usesConfig) ApiRootUrl = "https://graph.microsoft.com", }; Directory.CreateDirectory(tempPath); - await service.UpdateStateFromConfigurationAsync(configuration, "foo", []); + await service.UpdateStateFromConfigurationAsync(configuration, "foo", [], Stream.Null); var result = await service.ShouldGenerateAsync(configuration, "foo"); Assert.False(result); } From 99260440392b314ebea83f632d04a21fbeb2c4a2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Feb 2024 16:19:50 -0500 Subject: [PATCH 348/394] - adds unit tests for client removal Signed-off-by: Vincent Biret --- .../DescriptionStorageServiceTests.cs | 11 +++++++++++ .../WorkspaceManagementServiceTests.cs | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/DescriptionStorageServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/DescriptionStorageServiceTests.cs index 3b6f53f21b..021ab60bc6 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/DescriptionStorageServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/DescriptionStorageServiceTests.cs @@ -20,6 +20,17 @@ public async Task StoresADescription() Assert.NotNull(result); } [Fact] + public async Task DeletesAStoredDescription() + { + var service = new DescriptionStorageService(tempPath); + using var stream = new MemoryStream(); + stream.WriteByte(0x1); + await service.UpdateDescriptionAsync("clientNameA", stream); + service.RemoveDescription("clientNameA"); + var result = await service.GetDescriptionAsync("clientNameA"); + Assert.Null(result); + } + [Fact] public async Task ReturnsNothingIfNoDescriptionIsPresent() { var service = new DescriptionStorageService(tempPath); diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs index 89adecd868..b4fb935c1d 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs @@ -65,6 +65,25 @@ public async Task ShouldGenerateReturnsFalse(bool usesConfig) var result = await service.ShouldGenerateAsync(configuration, "foo"); Assert.False(result); } + [Fact] + public async Task RemovesAClient() + { + var mockLogger = new Mock(); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger.Object, true, tempPath); + var configuration = new GenerationConfiguration + { + ClientClassName = "clientName", + OutputPath = tempPath, + OpenAPIFilePath = Path.Combine(tempPath, "openapi.yaml"), + ApiRootUrl = "https://graph.microsoft.com", + }; + Directory.CreateDirectory(tempPath); + await service.UpdateStateFromConfigurationAsync(configuration, "foo", [], Stream.Null); + await service.RemoveClientAsync("clientName"); + var result = await service.IsClientPresent("clientName"); + Assert.False(result); + } public void Dispose() { From 2ce9a2bd320cfdcb2f212f2176c3fbe8a2d43754 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Feb 2024 16:24:50 -0500 Subject: [PATCH 349/394] - sets log location to kiota directory for remove command Signed-off-by: Vincent Biret --- .../WorkspaceManagement/DescriptionStorageService.cs | 3 ++- src/kiota/Handlers/Client/RemoveHandler.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs index c1d71077f7..6facf131b6 100644 --- a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs @@ -8,7 +8,8 @@ namespace Kiota.Builder.WorkspaceManagement; public class DescriptionStorageService { - private const string DescriptionsSubDirectoryRelativePath = ".kiota/clients"; + public const string KiotaDirectorySegment = ".kiota"; + private const string DescriptionsSubDirectoryRelativePath = $"{KiotaDirectorySegment}/clients"; private readonly string TargetDirectory; public DescriptionStorageService(string targetDirectory) { diff --git a/src/kiota/Handlers/Client/RemoveHandler.cs b/src/kiota/Handlers/Client/RemoveHandler.cs index b95280963e..1ad2352cf7 100644 --- a/src/kiota/Handlers/Client/RemoveHandler.cs +++ b/src/kiota/Handlers/Client/RemoveHandler.cs @@ -23,7 +23,7 @@ public override async Task InvokeAsync(InvocationContext context) string className = context.ParseResult.GetValueForOption(ClassOption) ?? string.Empty; bool cleanOutput = context.ParseResult.GetValueForOption(CleanOutputOption); CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; - var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); + var (loggerFactory, logger) = GetLoggerAndFactory(context, $"./{DescriptionStorageService.KiotaDirectorySegment}"); using (loggerFactory) { try From c470e0db676ed678190c5cb359883921b12e7c9d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 29 Feb 2024 15:52:56 -0500 Subject: [PATCH 350/394] - adds migrate command handler --- specs/cli/config-migrate.md | 6 +-- src/kiota/Handlers/Config/MigrateHandler.cs | 47 +++++++++++++++++++++ src/kiota/KiotaClientCommands.cs | 2 +- src/kiota/KiotaConfigCommands.cs | 23 +++++++++- 4 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 src/kiota/Handlers/Config/MigrateHandler.cs diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 0992e3dcd8..86b3fa2bb8 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -8,8 +8,8 @@ In the case where conflicting API client names would be migrated, the command wi | Parameters | Required | Example | Description | | -- | -- | -- | -- | -| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | -| `--client-name \| --cn` | No | GraphClient | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | +| `--lock-directory \| --ld` | No | ./output/pythonClient/ | Relative path to the directory containing the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | +| `--client-name \| --cn` | No | GraphClient | Used with `--lock-directory`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | ## Using `kiota config migrate` @@ -181,7 +181,7 @@ Assuming the following folder structure: ``` ```bash -kiota config migrate --lock-location ./generated/graph/csharp/kiota-lock.json --client-name GraphClient +kiota config migrate --lock-directory ./generated/graph/csharp --client-name GraphClient ``` _The resulting `kiota-config.json` file will look like this:_ diff --git a/src/kiota/Handlers/Config/MigrateHandler.cs b/src/kiota/Handlers/Config/MigrateHandler.cs new file mode 100644 index 0000000000..4c94400085 --- /dev/null +++ b/src/kiota/Handlers/Config/MigrateHandler.cs @@ -0,0 +1,47 @@ +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Kiota.Builder.WorkspaceManagement; +using Microsoft.Extensions.Logging; + +namespace kiota.Handlers.Config; + +internal class MigrateHandler : BaseKiotaCommandHandler +{ + public required Option LockDirectoryOption + { + get; + init; + } + public required Option ClassOption + { + get; init; + } + + public async override Task InvokeAsync(InvocationContext context) + { + string lockDirectory = context.ParseResult.GetValueForOption(LockDirectoryOption) ?? Directory.GetCurrentDirectory(); + string className = context.ParseResult.GetValueForOption(ClassOption) ?? string.Empty; + CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; + AssignIfNotNullOrEmpty(className, (c, s) => c.ClientClassName = s); + var workspaceStorageService = new WorkspaceConfigurationStorageService(Directory.GetCurrentDirectory()); + var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); + using (loggerFactory) + { + try + { + await Task.Delay(0).ConfigureAwait(false); + // await workspaceStorageService.MigrateFromLockFileAsync(cancellationToken).ConfigureAwait(false); + return 0; + } + catch (Exception ex) + { + logger.LogCritical(ex, "error migrating the workspace configuration"); + return 1; + } + } + } +} diff --git a/src/kiota/KiotaClientCommands.cs b/src/kiota/KiotaClientCommands.cs index aac0085d29..97dba4e76b 100644 --- a/src/kiota/KiotaClientCommands.cs +++ b/src/kiota/KiotaClientCommands.cs @@ -20,7 +20,7 @@ private static Option GetSkipGenerationOption() skipGeneration.AddAlias("--sg"); return skipGeneration; } - private static Option GetClientNameOption() + internal static Option GetClientNameOption() { var clientName = new Option("--client-name", "The name of the client to manage") { diff --git a/src/kiota/KiotaConfigCommands.cs b/src/kiota/KiotaConfigCommands.cs index a69cdddcf3..abb272ea8d 100644 --- a/src/kiota/KiotaConfigCommands.cs +++ b/src/kiota/KiotaConfigCommands.cs @@ -26,8 +26,27 @@ private static Command GetInitCommand() } private static Command GetMigrateCommand() { - var command = new Command("migrate", "Migrates a kiota lock file to a Kiota configuration"); - //TODO map the handler + var logLevelOption = KiotaHost.GetLogLevelOption(); + var lockDirectoryOption = GetLockDirectoryOption(); + var classOption = KiotaClientCommands.GetClientNameOption(); + var command = new Command("migrate", "Migrates a kiota lock file to a Kiota configuration") + { + logLevelOption, + lockDirectoryOption, + classOption, + }; + command.Handler = new MigrateHandler + { + LogLevelOption = logLevelOption, + LockDirectoryOption = lockDirectoryOption, + ClassOption = classOption, + }; return command; } + private static Option GetLockDirectoryOption() + { + var option = new Option("--lock-directory", "The directory containing a kiota-lock.json file"); + option.AddAlias("--ld"); + return option; + } } From 0bd339c50fc785aa2d036c33f13f5eca490941da Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 29 Feb 2024 16:54:40 -0500 Subject: [PATCH 351/394] - draft implementation of the migration logic Signed-off-by: Vincent Biret --- .../Lock/LockManagementService.cs | 9 ++- .../WorkspaceConfigurationStorageService.cs | 2 + .../WorkspaceManagementService.cs | 67 +++++++++++++++++++ src/kiota/Handlers/Config/MigrateHandler.cs | 24 ++++--- 4 files changed, 92 insertions(+), 10 deletions(-) diff --git a/src/Kiota.Builder/Lock/LockManagementService.cs b/src/Kiota.Builder/Lock/LockManagementService.cs index 10e720835e..db4a17c30d 100644 --- a/src/Kiota.Builder/Lock/LockManagementService.cs +++ b/src/Kiota.Builder/Lock/LockManagementService.cs @@ -15,7 +15,7 @@ namespace Kiota.Builder.Lock; /// public class LockManagementService : ILockManagementService { - private const string LockFileName = "kiota-lock.json"; + internal const string LockFileName = "kiota-lock.json"; /// public IEnumerable GetDirectoriesContainingLockFile(string searchDirectory) { @@ -132,4 +132,11 @@ private static string GetBackupFilePath(string outputPath) var hashedPath = BitConverter.ToString((HashAlgorithm.Value ?? throw new InvalidOperationException("unable to get hash algorithm")).ComputeHash(Encoding.UTF8.GetBytes(outputPath))).Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase); return Path.Combine(Path.GetTempPath(), Constants.TempDirectoryName, "backup", hashedPath, LockFileName); } + public void DeleteLockFile(string directoryPath) + { + ArgumentException.ThrowIfNullOrEmpty(directoryPath); + var lockFilePath = Path.Combine(directoryPath, LockFileName); + if (File.Exists(lockFilePath)) + File.Delete(lockFilePath); + } } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 02cb20ca51..636d1e443e 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -1,4 +1,6 @@ using System; +using System.Collections; +using System.Collections.Generic; using System.IO; using System.Security.Cryptography; using System.Text; diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 43b481c2a0..5d7268e836 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; +using System.Linq; using System.Security.Cryptography; using System.Text; using System.Text.Json; @@ -172,4 +173,70 @@ private static string ConvertByteArrayToString(byte[] hash) return sb.ToString(); } + + public async Task> MigrateFromLockFileAsync(string clientName, string lockDirectory, CancellationToken cancellationToken = default) + { + ArgumentException.ThrowIfNullOrEmpty(lockDirectory); + if (!UseKiotaConfig) + throw new InvalidOperationException("Cannot migrate from lock file in kiota config mode"); + if (!Path.IsPathRooted(lockDirectory)) + lockDirectory = Path.Combine(WorkingDirectory, lockDirectory); + if (Path.GetRelativePath(WorkingDirectory, lockDirectory).StartsWith("..", StringComparison.OrdinalIgnoreCase)) + throw new InvalidOperationException("The lock directory must be a subdirectory of the working directory"); + var (wsConfig, apiManifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + wsConfig ??= new WorkspaceConfiguration(); + apiManifest ??= new ApiManifestDocument("application"); //TODO get the application name + var lockFiles = Directory.GetFiles(lockDirectory, LockManagementService.LockFileName, SearchOption.AllDirectories); + if (lockFiles.Length == 0) + throw new InvalidOperationException("No lock file found in the specified directory"); + var clientNamePassed = !string.IsNullOrEmpty(clientName); + if (lockFiles.Length > 1 && clientNamePassed) + throw new InvalidOperationException("Multiple lock files found in the specified directory and the client name was specified"); + var clientsGenerationConfigurations = new List(); + if (lockFiles.Length == 1) + clientsGenerationConfigurations.Add(await LoadConfigurationFromLockAsync(clientNamePassed ? clientName : string.Empty, lockFiles[0], cancellationToken).ConfigureAwait(false)); + else + clientsGenerationConfigurations.AddRange(await Task.WhenAll(lockFiles.Select(x => LoadConfigurationFromLockAsync(string.Empty, x, cancellationToken))).ConfigureAwait(false)); + var loadedConfigurations = clientsGenerationConfigurations.OfType().ToArray(); + foreach (var configuration in loadedConfigurations) + { + var generationClientConfig = new ApiClientConfiguration(configuration); + generationClientConfig.NormalizePaths(WorkingDirectory); + if (wsConfig.Clients.ContainsKey(configuration.ClientClassName)) + { + Logger.LogError("The client {ClientName} is already present in the configuration", configuration.ClientClassName); + clientsGenerationConfigurations.Remove(configuration); + continue; + } + wsConfig.Clients.Add(configuration.ClientClassName, generationClientConfig); + var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, "migrated").ConfigureAwait(false); + // because it's a migration, we don't want to calculate the exact hash since the description might have changed since the initial generation that created the lock file + apiManifest.ApiDependencies.Add(configuration.ClientClassName, configuration.ToApiDependency(inputConfigurationHash, new()));//TODO get the resolved operations? + //TODO copy the description file + lockManagementService.DeleteLockFile(Path.GetDirectoryName(configuration.OpenAPIFilePath)!); + } + await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, apiManifest, cancellationToken).ConfigureAwait(false); + return clientsGenerationConfigurations.OfType().Select(static x => x.ClientClassName); + } + private async Task LoadConfigurationFromLockAsync(string clientName, string lockFilePath, CancellationToken cancellationToken) + { + if (Path.GetDirectoryName(lockFilePath) is not string lockFileDirectory) + { + Logger.LogWarning("The lock file {LockFilePath} is not in a directory, it will be skipped", lockFilePath); + return null; + } + var lockInfo = await lockManagementService.GetLockFromDirectoryAsync(lockFileDirectory, cancellationToken).ConfigureAwait(false); + if (lockInfo is null) + { + Logger.LogWarning("The lock file {LockFilePath} is not valid, it will be skipped", lockFilePath); + return null; + } + var generationConfiguration = new GenerationConfiguration(); + lockInfo.UpdateGenerationConfigurationFromLock(generationConfiguration); + if (!string.IsNullOrEmpty(clientName)) + { + generationConfiguration.ClientClassName = clientName; + } + return generationConfiguration; + } } diff --git a/src/kiota/Handlers/Config/MigrateHandler.cs b/src/kiota/Handlers/Config/MigrateHandler.cs index 4c94400085..a1b05ade6f 100644 --- a/src/kiota/Handlers/Config/MigrateHandler.cs +++ b/src/kiota/Handlers/Config/MigrateHandler.cs @@ -2,6 +2,7 @@ using System.CommandLine; using System.CommandLine.Invocation; using System.IO; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Kiota.Builder.WorkspaceManagement; @@ -20,21 +21,26 @@ public required Option ClassOption { get; init; } - - public async override Task InvokeAsync(InvocationContext context) + public override async Task InvokeAsync(InvocationContext context) { - string lockDirectory = context.ParseResult.GetValueForOption(LockDirectoryOption) ?? Directory.GetCurrentDirectory(); - string className = context.ParseResult.GetValueForOption(ClassOption) ?? string.Empty; + var workingDirectory = NormalizeSlashesInPath(Directory.GetCurrentDirectory()); + string lockDirectory = context.ParseResult.GetValueForOption(LockDirectoryOption) ?? workingDirectory; + string clientName = context.ParseResult.GetValueForOption(ClassOption) ?? string.Empty; CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; - AssignIfNotNullOrEmpty(className, (c, s) => c.ClientClassName = s); - var workspaceStorageService = new WorkspaceConfigurationStorageService(Directory.GetCurrentDirectory()); - var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); + lockDirectory = NormalizeSlashesInPath(lockDirectory); + var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); using (loggerFactory) { try { - await Task.Delay(0).ConfigureAwait(false); - // await workspaceStorageService.MigrateFromLockFileAsync(cancellationToken).ConfigureAwait(false); + var workspaceManagementService = new WorkspaceManagementService(logger, true, workingDirectory); + var clientNames = await workspaceManagementService.MigrateFromLockFileAsync(clientName, lockDirectory, cancellationToken).ConfigureAwait(false); + if (!clientNames.Any()) + { + logger.LogWarning("no client configuration was migrated"); + return 1; + } + logger.LogInformation("client configurations migrated successfully: {clientNames}", string.Join(", ", clientNames)); return 0; } catch (Exception ex) From 45ece1eb2ffb51416726118db848085517ca247b Mon Sep 17 00:00:00 2001 From: samwelkanda Date: Fri, 1 Mar 2024 03:34:30 +0300 Subject: [PATCH 352/394] Add support for multipart form body --- CHANGELOG.md | 1 + README.md | 2 +- it/python/pyproject.toml | 1 + it/python/requirements-dev.txt | 4 +++- src/Kiota.Builder/Refiners/PythonRefiner.cs | 4 ++++ .../Refiners/PythonReservedNamesProvider.cs | 1 + .../Writers/Python/CodeMethodWriter.cs | 2 +- src/kiota/appsettings.json | 6 +++++- .../Writers/Python/CodeMethodWriterTests.cs | 18 ++++++++++++++++++ 9 files changed, 35 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3e6ed23..79f059e888 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added the init command as part of the experience revamp of [#3356](https://github.com/microsoft/kiota/issues/3356) - Added uri-form encoded serialization for Python. [#2075](https://github.com/microsoft/kiota/issues/2075) +- Added support for multipart form data request body in Python. [#3030](https://github.com/microsoft/kiota/issues/3030) ### Changed diff --git a/README.md b/README.md index 1c7927b704..d83424d85a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The following table provides an overview of the languages supported by Kiota and | Go | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-go) | [FORM](https://github.com/microsoft/kiota-serialization-form-go), [JSON](https://github.com/microsoft/kiota-serialization-json-go), [MULTIPART](https://github.com/microsoft/kiota-serialization-multipart-go), [TEXT](https://github.com/microsoft/kiota-serialization-text-go) | [Anonymous](https://github.com/microsoft/kiota-abstractions-go/blob/main/authentication/anonymous_authentication_provider.go), [API Key](https://github.com/microsoft/kiota-abstractions-go/blob/main/authentication/api_key_authentication_provider.go), [Azure](https://github.com/microsoft/kiota-authentication-azure-go/) | [✔](https://github.com/microsoft/kiota-http-go/) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/go) | | Java | ✔ | [✔](https://github.com/microsoft/kiota-java/tree/main/components/abstractions) | [FORM](https://github.com/microsoft/kiota-java/tree/main/components/serialization/form), [JSON](https://github.com/microsoft/kiota-java/tree/main/components/serialization/json), [MULTIPART](https://github.com/microsoft/kiota-java/tree/main/components/serialization/multipart), [TEXT](https://github.com/microsoft/kiota-java/tree/main/components/serialization/text) | [Anonymous](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/authentication/AnonymousAuthenticationProvider.java), [API Key](https://github.com/microsoft/kiota-java/blob/main/components/abstractions/src/main/java/com/microsoft/kiota/authentication/ApiKeyAuthenticationProvider.java), [Azure](https://github.com/microsoft/kiota-java/tree/main/components/authentication/azure) | [✔](https://github.com/microsoft/kiota-java/tree/main/components/http/okHttp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/java) | | PHP | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-php) | [JSON](https://github.com/microsoft/kiota-serialization-json-php), [❌ FORM](https://github.com/microsoft/kiota/issues/2074), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3029), [TEXT](https://github.com/microsoft/kiota-serialization-text-php) | [Anonymous](https://github.com/microsoft/kiota-abstractions-php/blob/main/src/Authentication/AnonymousAuthenticationProvider.php), [✔️ PHP League](https://github.com/microsoft/kiota-authentication-phpleague-php) | [✔](https://github.com/microsoft/kiota-http-guzzle-php) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/php) | -| Python | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-python) | [FORM](https://github.com/microsoft/kiota-serialization-form-python), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3030), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [✔](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) | +| Python | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-python) | [FORM](https://github.com/microsoft/kiota-serialization-form-python), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [MULTIPART](https://github.com/microsoft/kiota-serialization-multipart-python), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [✔](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) | | Ruby | ✔ | [✔](https://github.com/microsoft/kiota-abstractions-ruby) | [❌ FORM](https://github.com/microsoft/kiota/issues/2077), [JSON](https://github.com/microsoft/kiota-serialization-json-ruby), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3032), [❌ TEXT](https://github.com/microsoft/kiota/issues/1049) | [Anonymous](https://github.com/microsoft/kiota-abstractions-ruby/blob/main/lib/microsoft_kiota_abstractions/authentication/anonymous_authentication_provider.rb), [✔️ OAuth2](https://github.com/microsoft/kiota-authentication-oauth-ruby) | [✔](https://github.com/microsoft/kiota-http-ruby)| | | CLI | ✔ | (see CSharp) + [✔](https://github.com/microsoft/kiota-cli-commons) | (see CSharp) | (see CSharp) | (see CSharp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/cli) | | Swift | [▶](https://github.com/microsoft/kiota/issues/1449) | [✔](./abstractions/swift) | [❌ FORM](https://github.com/microsoft/kiota/issues/2076), [❌ JSON](https://github.com/microsoft/kiota/issues/1451), [❌ FORM](https://github.com/microsoft/kiota/issues/3033), [❌ TEXT](https://github.com/microsoft/kiota/issues/1452) | [Anonymous](./abstractions/swift/Source/MicrosoftKiotaAbstractions/Authentication/AnonymousAuthenticationProvider.swift), [❌ Azure](https://github.com/microsoft/kiota/issues/1453) | [❌](https://github.com/microsoft/kiota/issues/1454)| | diff --git a/it/python/pyproject.toml b/it/python/pyproject.toml index ac6eec4e36..acd33a3e4e 100644 --- a/it/python/pyproject.toml +++ b/it/python/pyproject.toml @@ -13,6 +13,7 @@ dependencies = [ "microsoft-kiota-serialization-json >= 1.0.0", "microsoft-kiota-serialization-text >= 1.0.0", "microsoft-kiota-serialization-form >= 0.1.0", + "microsoft-kiota-serialization-multipart >= 0.1.0", ] license = {file = "LICENSE"} readme = "README.md" diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index e8770a85a2..74f0c0651f 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -104,12 +104,14 @@ microsoft-kiota-authentication-azure==1.0.0 microsoft-kiota-http==1.3.0 -microsoft-kiota-serialization-json==1.0.1 +microsoft-kiota-serialization-json==1.1.0 microsoft-kiota-serialization-text==1.0.0 microsoft-kiota-serialization-form==0.1.0 +microsoft-kiota-serialization-multipart==0.1.0 + msal==1.27.0 msal-extensions==1.1.0 diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 83b0533c0b..3b0bf0adb4 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -113,6 +113,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance "kiota_serialization_json.json_serialization_writer_factory.JsonSerializationWriterFactory", "kiota_serialization_text.text_serialization_writer_factory.TextSerializationWriterFactory", "kiota_serialization_form.form_serialization_writer_factory.FormSerializationWriterFactory", + "kiota_serialization_multipart.multipart_serialization_writer_factory.MultipartSerializationWriterFactory", } ); ReplaceDefaultDeserializationModules( @@ -150,6 +151,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance }, cancellationToken); } + private const string MultipartBodyClassName = "MultipartBody"; private const string AbstractionsPackageName = "kiota_abstractions"; private const string SerializationModuleName = $"{AbstractionsPackageName}.serialization"; private const string StoreModuleName = $"{AbstractionsPackageName}.store"; @@ -160,6 +162,8 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance $"{AbstractionsPackageName}.request_adapter", "RequestAdapter"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestGenerator), $"{AbstractionsPackageName}.method", "Method"), + new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestExecutor, CodeMethodKind.RequestGenerator) && method.Parameters.Any(static y => y.IsOfKind(CodeParameterKind.RequestBody) && y.Type.Name.Equals(MultipartBodyClassName, StringComparison.OrdinalIgnoreCase)), + $"{AbstractionsPackageName}.multipart_body", MultipartBodyClassName), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestGenerator), $"{AbstractionsPackageName}.request_information", "RequestInformation"), new (static x => x is CodeMethod method && method.IsOfKind(CodeMethodKind.RequestGenerator), diff --git a/src/Kiota.Builder/Refiners/PythonReservedNamesProvider.cs b/src/Kiota.Builder/Refiners/PythonReservedNamesProvider.cs index 1e44466513..85b80f741c 100644 --- a/src/Kiota.Builder/Refiners/PythonReservedNamesProvider.cs +++ b/src/Kiota.Builder/Refiners/PythonReservedNamesProvider.cs @@ -44,6 +44,7 @@ public class PythonReservedNamesProvider : IReservedNamesProvider "yield", "property", "BaseRequestBuilder", + "MultipartBody", }); public HashSet ReservedNames => _reservedNames.Value; } diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs index f156bf9262..67eee514f2 100644 --- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs @@ -833,7 +833,7 @@ private void UpdateRequestInformationFromRequestBody(CodeMethod codeElement, Req } else { - var setMethodName = requestParams.requestBody.Type is CodeType bodyType && bodyType.TypeDefinition is CodeClass ? "set_content_from_parsable" : "set_content_from_scalar"; + var setMethodName = requestParams.requestBody.Type is CodeType bodyType && (bodyType.TypeDefinition is CodeClass || bodyType.Name.Equals("MultipartBody", StringComparison.OrdinalIgnoreCase)) ? "set_content_from_parsable" : "set_content_from_scalar"; writer.WriteLine($"{RequestInfoVarName}.{setMethodName}(self.{requestAdapterProperty.Name}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name})"); } } diff --git a/src/kiota/appsettings.json b/src/kiota/appsettings.json index 71ac42668a..91f53fa9c0 100644 --- a/src/kiota/appsettings.json +++ b/src/kiota/appsettings.json @@ -214,6 +214,10 @@ { "Name": "microsoft-kiota-serialization-form", "Version": "0.1.0" + }, + { + "Name": "microsoft-kiota-serialization-multipart", + "Version": "0.1.0" } ], "DependencyInstallCommand": "pip install {0}=={1}" @@ -280,4 +284,4 @@ "DependencyInstallCommand": "dotnet add package {0} --version {1}" } } -} +} \ No newline at end of file diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs index b4d73a1481..fb18a5651e 100644 --- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs @@ -694,6 +694,24 @@ public void WritesRequestGeneratorBodyForParsable() Assert.Contains("return request_info", result); } [Fact] + public void WritesRequestGeneratorBodyForMultipart() + { + setup(); + method.Kind = CodeMethodKind.RequestGenerator; + method.HttpMethod = HttpMethod.Post; + AddRequestProperties(); + AddRequestBodyParameters(false); + method.Parameters.OfKind(CodeParameterKind.RequestBody).Type = new CodeType + { + Name = "MultipartBody", + IsExternal = true, + }; + method.RequestBodyContentType = "multipart/form-data"; + writer.Write(method); + var result = tw.ToString(); + Assert.Contains("set_content_from_parsable", result); + } + [Fact] public void WritesRequestGeneratorBodyWhenUrlTemplateIsOverrode() { setup(); From f6b5c5a1cf1c32f8bdb615f1e57c2478c141b84e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 08:44:10 +0000 Subject: [PATCH 353/394] Bump @vscode/extension-telemetry in /vscode/microsoft-kiota Bumps [@vscode/extension-telemetry](https://github.com/Microsoft/vscode-extension-telemetry) from 0.9.2 to 0.9.3. - [Release notes](https://github.com/Microsoft/vscode-extension-telemetry/releases) - [Commits](https://github.com/Microsoft/vscode-extension-telemetry/compare/v0.9.2...v0.9.3) --- updated-dependencies: - dependency-name: "@vscode/extension-telemetry" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 154 +++++++++-------------- vscode/microsoft-kiota/package.json | 2 +- 2 files changed, 57 insertions(+), 99 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index f6a50400bf..67353ea54e 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -8,7 +8,7 @@ "name": "kiota", "version": "1.10.100000002", "dependencies": { - "@vscode/extension-telemetry": "^0.9.2", + "@vscode/extension-telemetry": "^0.9.3", "@vscode/l10n": "^0.0.18", "adm-zip": "^0.5.10", "is-online": "^10.0.0", @@ -32,7 +32,7 @@ "webpack-cli": "^5.1.4" }, "engines": { - "vscode": "^1.86.0" + "vscode": "^1.87.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -250,96 +250,68 @@ "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==" }, "node_modules/@microsoft/1ds-core-js": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-4.0.4.tgz", - "integrity": "sha512-QOCE0fTDOMNptB791chnVlfnRvb7faDQTaUIO3DfPBkvjF3PUAJJCsqJKWitw7nwVn8L82TFx+K22UifIr0zkg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-4.1.0.tgz", + "integrity": "sha512-pZstuGzxrmyKaVoXrBvRjPYLE6/hR/wMN0qBJyAdq+APLLDO73QL2re3+8SM/J24e6ykieQ3mjUPgs8POjNZWA==", "dependencies": { - "@microsoft/applicationinsights-core-js": "3.0.5", + "@microsoft/applicationinsights-core-js": "3.1.0", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", + "@microsoft/dynamicproto-js": "^2.0.3", "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@nevware21/ts-utils": ">= 0.10.5 < 2.x" } }, "node_modules/@microsoft/1ds-post-js": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-4.0.4.tgz", - "integrity": "sha512-jlPNL16iRXzmXfriGXv0INzrAl3AeDx+eCORjq8ZjRhIvohB6Q88m5E28nL6Drf5hJWE2ehoW4q8Vh612VoEHw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-4.1.0.tgz", + "integrity": "sha512-I82QeHMT8DamsgZ78RdNT0cSde8zGb+uwMTFzd9wE6M52q50oTF6sBRhoaVbsU+RvVxiS4vk9py3AWY/g8EDVA==", "dependencies": { - "@microsoft/1ds-core-js": "4.0.4", + "@microsoft/1ds-core-js": "4.1.0", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", + "@microsoft/dynamicproto-js": "^2.0.3", "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@nevware21/ts-utils": ">= 0.10.5 < 2.x" } }, "node_modules/@microsoft/applicationinsights-channel-js": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.0.6.tgz", - "integrity": "sha512-nWcElBm7OKUv7w0xvegxrQFbMH2NSLBU8WBSaTaiqo48aXqWnKWrqEaGvCGKpOCH5G33of3XC7DUJ6f4gdOEcA==", - "dependencies": { - "@microsoft/applicationinsights-common": "3.0.6", - "@microsoft/applicationinsights-core-js": "3.0.6", - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" - }, - "peerDependencies": { - "tslib": "*" - } - }, - "node_modules/@microsoft/applicationinsights-channel-js/node_modules/@microsoft/applicationinsights-core-js": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.0.6.tgz", - "integrity": "sha512-9OFBYckg/msyllE0NOwXgCvwHochKKUDbydl3LF3UcltGIE14pLYoXiWJd9+m+oRaf0k3CUYl2mVcyytWgPQZw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-channel-js/-/applicationinsights-channel-js-3.1.0.tgz", + "integrity": "sha512-VJUZT1FpQ5+XV3t4/AKprWiyH0gEEPDoJr6E8ZVopKoVVX/AjorkhPcZ4oDlpeEWpBeMxg+PeZOdTMKyY0atOw==", "dependencies": { + "@microsoft/applicationinsights-common": "3.1.0", + "@microsoft/applicationinsights-core-js": "3.1.0", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", + "@microsoft/dynamicproto-js": "^2.0.3", "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@nevware21/ts-utils": ">= 0.10.5 < 2.x" }, "peerDependencies": { "tslib": "*" } }, "node_modules/@microsoft/applicationinsights-common": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-common/-/applicationinsights-common-3.0.6.tgz", - "integrity": "sha512-GlmuaE+U1G7IbfGuElOYdKjmFMErI5b1iJpDfWXY6qpoL2a/sBIc1dviw7NP2/4CwFBkoFGPMDT/3aO3e7Yu3w==", - "dependencies": { - "@microsoft/applicationinsights-core-js": "3.0.6", - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" - }, - "peerDependencies": { - "tslib": "*" - } - }, - "node_modules/@microsoft/applicationinsights-common/node_modules/@microsoft/applicationinsights-core-js": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.0.6.tgz", - "integrity": "sha512-9OFBYckg/msyllE0NOwXgCvwHochKKUDbydl3LF3UcltGIE14pLYoXiWJd9+m+oRaf0k3CUYl2mVcyytWgPQZw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-common/-/applicationinsights-common-3.1.0.tgz", + "integrity": "sha512-PpWdCbTPsH5MSDIkHKaIBpEJcsnPcnAjlTCk+ls0DOfIB/T6bTn3TuKsDfSu/sxdLhDQiJeUXu8G3qOQ3L0nBA==", "dependencies": { + "@microsoft/applicationinsights-core-js": "3.1.0", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@microsoft/dynamicproto-js": "^2.0.3", + "@nevware21/ts-utils": ">= 0.10.5 < 2.x" }, "peerDependencies": { "tslib": "*" } }, "node_modules/@microsoft/applicationinsights-core-js": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.0.5.tgz", - "integrity": "sha512-/x+tkxsVALNWSvwGMyaLwFPdD3p156Pef9WHftXrzrKkJ+685nhrwm9MqHIyEHHpSW09ElOdpJ3rfFVqpKRQyQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.1.0.tgz", + "integrity": "sha512-pHaZ3CQx+KdfRV3yV/xuMEvIEJ1KxlK6klnFcuz4AMXOOPeuvWy1FsUIQ/sVA97TXEDl87LqV6QDnH99bLZpMg==", "dependencies": { "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", + "@microsoft/dynamicproto-js": "^2.0.3", "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@nevware21/ts-utils": ">= 0.10.5 < 2.x" }, "peerDependencies": { "tslib": "*" @@ -354,56 +326,42 @@ } }, "node_modules/@microsoft/applicationinsights-web-basic": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.0.6.tgz", - "integrity": "sha512-HwhZha6c78BVrkgRX5OaZBCO4hX4FlikvVHMKAQHLv1Le9nN7sBnt5VNiV5ikjA3ir04vRXmrDCn0GomMiKZ0g==", - "dependencies": { - "@microsoft/applicationinsights-channel-js": "3.0.6", - "@microsoft/applicationinsights-common": "3.0.6", - "@microsoft/applicationinsights-core-js": "3.0.6", - "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", - "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" - }, - "peerDependencies": { - "tslib": "*" - } - }, - "node_modules/@microsoft/applicationinsights-web-basic/node_modules/@microsoft/applicationinsights-core-js": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-3.0.6.tgz", - "integrity": "sha512-9OFBYckg/msyllE0NOwXgCvwHochKKUDbydl3LF3UcltGIE14pLYoXiWJd9+m+oRaf0k3CUYl2mVcyytWgPQZw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-web-basic/-/applicationinsights-web-basic-3.1.0.tgz", + "integrity": "sha512-H2pDmc9YNTk+aoJ+1nkxSoYo/o2c/YLBO8+n3wdDAKuEpKio0HvMbsiKbGczGpLGixA/yYrd9b9vIikjSwGtUA==", "dependencies": { + "@microsoft/applicationinsights-channel-js": "3.1.0", + "@microsoft/applicationinsights-common": "3.1.0", + "@microsoft/applicationinsights-core-js": "3.1.0", "@microsoft/applicationinsights-shims": "3.0.1", - "@microsoft/dynamicproto-js": "^2.0.2", + "@microsoft/dynamicproto-js": "^2.0.3", "@nevware21/ts-async": ">= 0.3.0 < 2.x", - "@nevware21/ts-utils": ">= 0.10.1 < 2.x" + "@nevware21/ts-utils": ">= 0.10.5 < 2.x" }, "peerDependencies": { "tslib": "*" } }, "node_modules/@microsoft/dynamicproto-js": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.2.tgz", - "integrity": "sha512-MB8trWaFREpmb037k/d0bB7T2BP7Ai24w1e1tbz3ASLB0/lwphsq3Nq8S9I5AsI5vs4zAQT+SB5nC5/dLYTiOg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@microsoft/dynamicproto-js/-/dynamicproto-js-2.0.3.tgz", + "integrity": "sha512-JTWTU80rMy3mdxOjjpaiDQsTLZ6YSGGqsjURsY6AUQtIj0udlF/jYmhdLZu8693ZIC0T1IwYnFa0+QeiMnziBA==", "dependencies": { - "@nevware21/ts-utils": ">= 0.9.4 < 2.x" + "@nevware21/ts-utils": ">= 0.10.4 < 2.x" } }, "node_modules/@nevware21/ts-async": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.3.0.tgz", - "integrity": "sha512-ZUcgUH12LN/F6nzN0cYd0F/rJaMLmXr0EHVTyYfaYmK55bdwE4338uue4UiVoRqHVqNW4KDUrJc49iGogHKeWA==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@nevware21/ts-async/-/ts-async-0.4.0.tgz", + "integrity": "sha512-dbV826TTehQIBIJjh8GDSbwn1Z6+cnkyNbRlpcpdBPH8mROD2zabIUKqWcw9WRdTjjUIm21K+OR4DXWlAyOVTQ==", "dependencies": { "@nevware21/ts-utils": ">= 0.10.0 < 2.x" } }, "node_modules/@nevware21/ts-utils": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.10.1.tgz", - "integrity": "sha512-pMny25NnF2/MJwdqC3Iyjm2pGIXNxni4AROpcqDeWa+td9JMUY4bUS9uU9XW+BoBRqTLUL+WURF9SOd/6OQzRg==" + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/@nevware21/ts-utils/-/ts-utils-0.10.5.tgz", + "integrity": "sha512-+TEvP0+l/VBR5bJZoYFV+o6aQQ1O6y80uys5AVyyCKeWvrgWu/yNydqSBQNsk4BuEfkayg7R9+HCJRRRIvptTA==" }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -775,13 +733,13 @@ "dev": true }, "node_modules/@vscode/extension-telemetry": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.9.2.tgz", - "integrity": "sha512-O6VMCDkzypjULhgy2l6fih3c3fExPmSj7aewtW5jBJYgXcIIjtkJOttIfnKOCP4S8sNfc6xc1Do4MbUDmhduEw==", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.9.3.tgz", + "integrity": "sha512-F1to8DhI5wP30/gqUDeX5LA/eyUuGbGgDMbSuVUJeER+7byehcpsYW2ySjVDHlfXqwGIvMd+QW9g+p0zWaFS3w==", "dependencies": { - "@microsoft/1ds-core-js": "^4.0.3", - "@microsoft/1ds-post-js": "^4.0.3", - "@microsoft/applicationinsights-web-basic": "^3.0.6" + "@microsoft/1ds-core-js": "^4.1.0", + "@microsoft/1ds-post-js": "^4.1.0", + "@microsoft/applicationinsights-web-basic": "^3.1.0" }, "engines": { "vscode": "^1.75.0" diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index 1adaf4b309..c4eaf294fc 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -439,7 +439,7 @@ "webpack-cli": "^5.1.4" }, "dependencies": { - "@vscode/extension-telemetry": "^0.9.2", + "@vscode/extension-telemetry": "^0.9.3", "@vscode/l10n": "^0.0.18", "adm-zip": "^0.5.10", "is-online": "^10.0.0", From ea568752d00c20d4488647659ee6e68cf37af5c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 08:44:33 +0000 Subject: [PATCH 354/394] Bump @types/node from 20.11.22 to 20.11.24 in /vscode/microsoft-kiota Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.22 to 20.11.24. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index f6a50400bf..5261976b4d 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -32,7 +32,7 @@ "webpack-cli": "^5.1.4" }, "engines": { - "vscode": "^1.86.0" + "vscode": "^1.87.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -534,9 +534,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.22", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.22.tgz", - "integrity": "sha512-/G+IxWxma6V3E+pqK1tSl2Fo1kl41pK1yeCyDsgkF9WlVAme4j5ISYM2zR11bgLFJGLN5sVK40T4RJNuiZbEjA==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dev": true, "dependencies": { "undici-types": "~5.26.4" From 5a8f35c85acefda30ca51be483868ba2c0dee015 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 08:44:55 +0000 Subject: [PATCH 355/394] Bump the kiota-dependencies group in /it/csharp with 2 updates Bumps the kiota-dependencies group in /it/csharp with 2 updates: [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet) and [Microsoft.Kiota.Http.HttpClientLibrary](https://github.com/microsoft/kiota-http-dotnet). Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.3...v1.1.4) Updates `Microsoft.Kiota.Http.HttpClientLibrary` from 1.3.6 to 1.3.7 - [Release notes](https://github.com/microsoft/kiota-http-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-http-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-http-dotnet/compare/v1.3.6...v1.3.7) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies - dependency-name: Microsoft.Kiota.Http.HttpClientLibrary dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index 3734508c83..e4ebf7c15d 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -12,7 +12,7 @@ - + From 27f8c86cc0116fe7aee1709a6224675d3904867f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 08:55:24 +0000 Subject: [PATCH 356/394] Bump the kiota-dependencies group in /it/python with 2 updates Bumps the kiota-dependencies group in /it/python with 2 updates: [microsoft-kiota-abstractions](https://github.com/microsoft/kiota) and [microsoft-kiota-http](https://github.com/microsoft/kiota). Updates `microsoft-kiota-abstractions` from 1.2.0 to 1.3.0 - [Release notes](https://github.com/microsoft/kiota/releases) - [Changelog](https://github.com/microsoft/kiota/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota/compare/v1.2.0...v1.3.0) Updates `microsoft-kiota-http` from 1.3.0 to 1.3.1 - [Release notes](https://github.com/microsoft/kiota/releases) - [Changelog](https://github.com/microsoft/kiota/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota/commits) --- updated-dependencies: - dependency-name: microsoft-kiota-abstractions dependency-type: direct:development update-type: version-update:semver-minor dependency-group: kiota-dependencies - dependency-name: microsoft-kiota-http dependency-type: direct:development update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index e8770a85a2..7a8a0ecbc2 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -98,11 +98,11 @@ httpx[http2]==0.27.0 hyperframe==6.0.1 ; python_full_version >= '3.6.1' -microsoft-kiota-abstractions==1.2.0 +microsoft-kiota-abstractions==1.3.0 microsoft-kiota-authentication-azure==1.0.0 -microsoft-kiota-http==1.3.0 +microsoft-kiota-http==1.3.1 microsoft-kiota-serialization-json==1.0.1 From a52f429264064df728731d1edf4cae0a36dffd51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 08:55:36 +0000 Subject: [PATCH 357/394] Bump python-dateutil from 2.8.2 to 2.9.0 in /it/python Bumps [python-dateutil](https://github.com/dateutil/dateutil) from 2.8.2 to 2.9.0. - [Release notes](https://github.com/dateutil/dateutil/releases) - [Changelog](https://github.com/dateutil/dateutil/blob/master/NEWS) - [Commits](https://github.com/dateutil/dateutil/compare/2.8.2...2.9.0) --- updated-dependencies: - dependency-name: python-dateutil dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index e8770a85a2..1e9f0f1dd6 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -122,7 +122,7 @@ pycparser==2.21 pyjwt[crypto]==2.8.0 ; python_version >= '3.7' -python-dateutil==2.8.2 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2' +python-dateutil==2.9.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2' pywin32==306 ; platform_system == 'Windows' From 396d6e8055fb60349a414e3b65e5599516062084 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 08:56:45 +0000 Subject: [PATCH 358/394] Bump azure-core from 1.30.0 to 1.30.1 in /it/python Bumps [azure-core](https://github.com/Azure/azure-sdk-for-python) from 1.30.0 to 1.30.1. - [Release notes](https://github.com/Azure/azure-sdk-for-python/releases) - [Changelog](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/esrp_release.md) - [Commits](https://github.com/Azure/azure-sdk-for-python/compare/azure-core_1.30.0...azure-core_1.30.1) --- updated-dependencies: - dependency-name: azure-core dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index e8770a85a2..5fed1a2d5c 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -76,7 +76,7 @@ async-timeout==4.0.3 ; python_version >= '3.6' attrs==23.2.0 ; python_version >= '3.7' -azure-core==1.30.0 ; python_version >= '3.7' +azure-core==1.30.1 ; python_version >= '3.7' azure-identity==1.15.0 From 11bdb54a2b4ff643f7385eb878d48e170b5ccddc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 09:02:30 +0000 Subject: [PATCH 359/394] Bump express from 4.18.2 to 4.18.3 in /it/typescript Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.18.3. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/master/History.md) - [Commits](https://github.com/expressjs/express/compare/4.18.2...4.18.3) --- updated-dependencies: - dependency-name: express dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 190 +++++++++++++++++++++++--------- it/typescript/package.json | 2 +- 2 files changed, 141 insertions(+), 51 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index a4b709784d..1d853ff0f0 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -17,7 +17,7 @@ "@microsoft/kiota-serialization-json": "^1.0.0-preview.44", "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.23", "@microsoft/kiota-serialization-text": "^1.0.0-preview.41", - "express": "^4.18.2", + "express": "^4.18.3", "node-fetch": "^2.7.0" }, "devDependencies": { @@ -1178,12 +1178,12 @@ "dev": true }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -1191,7 +1191,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -1249,12 +1249,18 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1388,6 +1394,22 @@ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -1466,6 +1488,25 @@ "node": ">= 0.8" } }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/esbuild": { "version": "0.20.1", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.1.tgz", @@ -1692,13 +1733,13 @@ } }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.18.3", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.3.tgz", + "integrity": "sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", "cookie": "0.5.0", @@ -1925,19 +1966,26 @@ "dev": true }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2010,6 +2058,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -2021,17 +2080,6 @@ "resolved": "https://registry.npmjs.org/guid-typescript/-/guid-typescript-1.0.9.tgz", "integrity": "sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ==" }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2041,10 +2089,21 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", "engines": { "node": ">= 0.4" }, @@ -2063,6 +2122,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hasown": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", + "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -2537,9 +2607,9 @@ } }, "node_modules/object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -2788,9 +2858,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", @@ -2951,6 +3021,22 @@ "node": ">= 0.8.0" } }, + "node_modules/set-function-length": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.1.tgz", + "integrity": "sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==", + "dependencies": { + "define-data-property": "^1.1.2", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -2978,13 +3064,17 @@ } }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" diff --git a/it/typescript/package.json b/it/typescript/package.json index 804d58dc8d..4a8d38b275 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -38,7 +38,7 @@ "@microsoft/kiota-serialization-json": "^1.0.0-preview.44", "@microsoft/kiota-serialization-multipart": "^1.0.0-preview.23", "@microsoft/kiota-serialization-text": "^1.0.0-preview.41", - "express": "^4.18.2", + "express": "^4.18.3", "node-fetch": "^2.7.0" } } From 87b0bb973e9267073e4ad66a997dc6daeccd31ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 09:02:50 +0000 Subject: [PATCH 360/394] Bump @types/node from 20.11.22 to 20.11.24 in /it/typescript Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.22 to 20.11.24. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 8 ++++---- it/typescript/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index a4b709784d..c30ec10c28 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.22", + "@types/node": "^20.11.24", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", @@ -828,9 +828,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.22", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.22.tgz", - "integrity": "sha512-/G+IxWxma6V3E+pqK1tSl2Fo1kl41pK1yeCyDsgkF9WlVAme4j5ISYM2zR11bgLFJGLN5sVK40T4RJNuiZbEjA==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dev": true, "dependencies": { "undici-types": "~5.26.4" diff --git a/it/typescript/package.json b/it/typescript/package.json index 804d58dc8d..bfecf337e7 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -19,7 +19,7 @@ "prettier": "./.prettierrc.json", "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", - "@types/node": "^20.11.22", + "@types/node": "^20.11.24", "@typescript-eslint/eslint-plugin": "^7.1.0", "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", From 12c3f948845a5e02a2b97a0a9337e69661308afb Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 09:19:30 -0500 Subject: [PATCH 361/394] - adds the description copy upon migration Signed-off-by: Vincent Biret --- src/Kiota.Builder/DownloadHelper.cs | 80 +++++++++++++++++++ src/Kiota.Builder/KiotaBuilder.cs | 63 +-------------- .../WorkspaceManagementService.cs | 26 +++++- src/kiota/Handlers/Client/RemoveHandler.cs | 2 +- src/kiota/Handlers/Config/MigrateHandler.cs | 2 +- .../WorkspaceManagementServiceTests.cs | 22 ++--- 6 files changed, 120 insertions(+), 75 deletions(-) create mode 100644 src/Kiota.Builder/DownloadHelper.cs diff --git a/src/Kiota.Builder/DownloadHelper.cs b/src/Kiota.Builder/DownloadHelper.cs new file mode 100644 index 0000000000..d2834006ab --- /dev/null +++ b/src/Kiota.Builder/DownloadHelper.cs @@ -0,0 +1,80 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Net.Http; +using System.Security; +using System.Threading; +using System.Threading.Tasks; +using AsyncKeyedLock; +using Kiota.Builder.Caching; +using Kiota.Builder.Configuration; +using Kiota.Builder.Extensions; +using Kiota.Builder.SearchProviders.APIsGuru; +using Kiota.Builder.WorkspaceManagement; +using Microsoft.Extensions.Logging; + +namespace Kiota.Builder; +internal static class DownloadHelper +{ + internal static async Task<(Stream, bool)> LoadStream(string inputPath, HttpClient httpClient, ILogger logger, GenerationConfiguration config, AsyncKeyedLocker localFilesLock, WorkspaceManagementService? workspaceManagementService = default, bool useKiotaConfig = false, CancellationToken cancellationToken = default) + { + var stopwatch = new Stopwatch(); + stopwatch.Start(); + + inputPath = inputPath.Trim(); + + Stream input; + var isDescriptionFromWorkspaceCopy = false; + if (useKiotaConfig && + config.Operation is ClientOperation.Edit or ClientOperation.Add && + workspaceManagementService is not null && + await workspaceManagementService.GetDescriptionCopyAsync(config.ClientClassName, inputPath, cancellationToken).ConfigureAwait(false) is { } descriptionStream) + { + logger.LogInformation("loaded description from the workspace copy"); + input = descriptionStream; + isDescriptionFromWorkspaceCopy = true; + } + else if (inputPath.StartsWith("http", StringComparison.OrdinalIgnoreCase)) + try + { + var cachingProvider = new DocumentCachingProvider(httpClient, logger) + { + ClearCache = config.ClearCache, + }; + var targetUri = APIsGuruSearchProvider.ChangeSourceUrlToGitHub(new Uri(inputPath)); // so updating existing clients doesn't break + var fileName = targetUri.GetFileName() is string name && !string.IsNullOrEmpty(name) ? name : "description.yml"; + input = await cachingProvider.GetDocumentAsync(targetUri, "generation", fileName, cancellationToken: cancellationToken).ConfigureAwait(false); + logger.LogInformation("loaded description from remote source"); + } + catch (HttpRequestException ex) + { + throw new InvalidOperationException($"Could not download the file at {inputPath}, reason: {ex.Message}", ex); + } + else + try + { + var inMemoryStream = new MemoryStream(); + using (await localFilesLock.LockAsync(inputPath, cancellationToken).ConfigureAwait(false)) + {// To avoid deadlocking on update with multiple clients for the same local description + using var fileStream = new FileStream(inputPath, FileMode.Open); + await fileStream.CopyToAsync(inMemoryStream, cancellationToken).ConfigureAwait(false); + } + inMemoryStream.Position = 0; + input = inMemoryStream; + logger.LogInformation("loaded description from local source"); + } + catch (Exception ex) when (ex is FileNotFoundException || + ex is PathTooLongException || + ex is DirectoryNotFoundException || + ex is IOException || + ex is UnauthorizedAccessException || + ex is SecurityException || + ex is NotSupportedException) + { + throw new InvalidOperationException($"Could not open the file at {inputPath}, reason: {ex.Message}", ex); + } + stopwatch.Stop(); + logger.LogTrace("{Timestamp}ms: Read OpenAPI file {File}", stopwatch.ElapsedMilliseconds, inputPath); + return (input, isDescriptionFromWorkspaceCopy); + } +} diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 200458a1e4..9cd0706c7a 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -8,7 +8,6 @@ using System.Linq; using System.Net.Http; using System.Runtime.CompilerServices; -using System.Security; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; @@ -25,7 +24,6 @@ using Kiota.Builder.Manifest; using Kiota.Builder.OpenApiExtensions; using Kiota.Builder.Refiners; -using Kiota.Builder.SearchProviders.APIsGuru; using Kiota.Builder.Validation; using Kiota.Builder.WorkspaceManagement; using Kiota.Builder.Writers; @@ -64,7 +62,7 @@ public KiotaBuilder(ILogger logger, GenerationConfiguration config MaxDegreeOfParallelism = config.MaxDegreeOfParallelism, }; var workingDirectory = Directory.GetCurrentDirectory(); - workspaceManagementService = new WorkspaceManagementService(logger, useKiotaConfig, workingDirectory); + workspaceManagementService = new WorkspaceManagementService(logger, client, useKiotaConfig, workingDirectory); this.useKiotaConfig = useKiotaConfig; } private readonly bool useKiotaConfig; @@ -402,63 +400,8 @@ private void StopLogAndReset(Stopwatch sw, string prefix) private bool isDescriptionFromWorkspaceCopy; private async Task LoadStream(string inputPath, CancellationToken cancellationToken) { - var stopwatch = new Stopwatch(); - stopwatch.Start(); - - inputPath = inputPath.Trim(); - - Stream input; - if (useKiotaConfig && - config.Operation is ClientOperation.Edit or ClientOperation.Add && - await workspaceManagementService.GetDescriptionCopyAsync(config.ClientClassName, inputPath, cancellationToken).ConfigureAwait(false) is { } descriptionStream) - { - logger.LogInformation("loaded description from the workspace copy"); - input = descriptionStream; - isDescriptionFromWorkspaceCopy = true; - } - else if (inputPath.StartsWith("http", StringComparison.OrdinalIgnoreCase)) - try - { - var cachingProvider = new DocumentCachingProvider(httpClient, logger) - { - ClearCache = config.ClearCache, - }; - var targetUri = APIsGuruSearchProvider.ChangeSourceUrlToGitHub(new Uri(inputPath)); // so updating existing clients doesn't break - var fileName = targetUri.GetFileName() is string name && !string.IsNullOrEmpty(name) ? name : "description.yml"; - input = await cachingProvider.GetDocumentAsync(targetUri, "generation", fileName, cancellationToken: cancellationToken).ConfigureAwait(false); - logger.LogInformation("loaded description from remote source"); - } - catch (HttpRequestException ex) - { - throw new InvalidOperationException($"Could not download the file at {inputPath}, reason: {ex.Message}", ex); - } - else - try - { -#pragma warning disable CA2000 // disposed by caller - var inMemoryStream = new MemoryStream(); - using (await localFilesLock.LockAsync(inputPath, cancellationToken).ConfigureAwait(false)) - {// To avoid deadlocking on update with multiple clients for the same local description - using var fileStream = new FileStream(inputPath, FileMode.Open); - await fileStream.CopyToAsync(inMemoryStream, cancellationToken).ConfigureAwait(false); - } - inMemoryStream.Position = 0; - input = inMemoryStream; - logger.LogInformation("loaded description from local source"); -#pragma warning restore CA2000 - } - catch (Exception ex) when (ex is FileNotFoundException || - ex is PathTooLongException || - ex is DirectoryNotFoundException || - ex is IOException || - ex is UnauthorizedAccessException || - ex is SecurityException || - ex is NotSupportedException) - { - throw new InvalidOperationException($"Could not open the file at {inputPath}, reason: {ex.Message}", ex); - } - stopwatch.Stop(); - logger.LogTrace("{Timestamp}ms: Read OpenAPI file {File}", stopwatch.ElapsedMilliseconds, inputPath); + var (input, isCopy) = await DownloadHelper.LoadStream(inputPath, httpClient, logger, config, localFilesLock, workspaceManagementService, useKiotaConfig, cancellationToken).ConfigureAwait(false); + isDescriptionFromWorkspaceCopy = isCopy; return input; } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 5d7268e836..39867089fb 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -3,11 +3,13 @@ using System.Globalization; using System.IO; using System.Linq; +using System.Net.Http; using System.Security.Cryptography; using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; +using AsyncKeyedLock; using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; using Kiota.Builder.Lock; @@ -22,10 +24,13 @@ public class WorkspaceManagementService { private readonly bool UseKiotaConfig; private readonly ILogger Logger; - public WorkspaceManagementService(ILogger logger, bool useKiotaConfig = false, string workingDirectory = "") + private readonly HttpClient HttpClient; + public WorkspaceManagementService(ILogger logger, HttpClient httpClient, bool useKiotaConfig = false, string workingDirectory = "") { ArgumentNullException.ThrowIfNull(logger); + ArgumentNullException.ThrowIfNull(httpClient); Logger = logger; + HttpClient = httpClient; UseKiotaConfig = useKiotaConfig; if (string.IsNullOrEmpty(workingDirectory)) workingDirectory = Directory.GetCurrentDirectory(); @@ -183,9 +188,16 @@ public async Task> MigrateFromLockFileAsync(string clientNam lockDirectory = Path.Combine(WorkingDirectory, lockDirectory); if (Path.GetRelativePath(WorkingDirectory, lockDirectory).StartsWith("..", StringComparison.OrdinalIgnoreCase)) throw new InvalidOperationException("The lock directory must be a subdirectory of the working directory"); + + if (!await workspaceConfigurationStorageService.IsInitializedAsync(cancellationToken).ConfigureAwait(false)) + await workspaceConfigurationStorageService.InitializeAsync(cancellationToken).ConfigureAwait(false); + var (wsConfig, apiManifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); - wsConfig ??= new WorkspaceConfiguration(); - apiManifest ??= new ApiManifestDocument("application"); //TODO get the application name + if (wsConfig is null) + throw new InvalidOperationException("The workspace configuration is not initialized"); + if (apiManifest is null) + throw new InvalidOperationException("The API manifest is not initialized"); + var lockFiles = Directory.GetFiles(lockDirectory, LockManagementService.LockFileName, SearchOption.AllDirectories); if (lockFiles.Length == 0) throw new InvalidOperationException("No lock file found in the specified directory"); @@ -212,12 +224,18 @@ public async Task> MigrateFromLockFileAsync(string clientNam var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, "migrated").ConfigureAwait(false); // because it's a migration, we don't want to calculate the exact hash since the description might have changed since the initial generation that created the lock file apiManifest.ApiDependencies.Add(configuration.ClientClassName, configuration.ToApiDependency(inputConfigurationHash, new()));//TODO get the resolved operations? - //TODO copy the description file + var (stream, _) = await DownloadHelper.LoadStream(configuration.OpenAPIFilePath, HttpClient, Logger, configuration, localFilesLock, null, false, cancellationToken).ConfigureAwait(false); + await descriptionStorageService.UpdateDescriptionAsync(configuration.ClientClassName, stream, string.Empty, cancellationToken).ConfigureAwait(false); lockManagementService.DeleteLockFile(Path.GetDirectoryName(configuration.OpenAPIFilePath)!); } await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, apiManifest, cancellationToken).ConfigureAwait(false); return clientsGenerationConfigurations.OfType().Select(static x => x.ClientClassName); } + private static readonly AsyncKeyedLocker localFilesLock = new(o => + { + o.PoolSize = 20; + o.PoolInitialFill = 1; + }); private async Task LoadConfigurationFromLockAsync(string clientName, string lockFilePath, CancellationToken cancellationToken) { if (Path.GetDirectoryName(lockFilePath) is not string lockFileDirectory) diff --git a/src/kiota/Handlers/Client/RemoveHandler.cs b/src/kiota/Handlers/Client/RemoveHandler.cs index 1ad2352cf7..693c50f03d 100644 --- a/src/kiota/Handlers/Client/RemoveHandler.cs +++ b/src/kiota/Handlers/Client/RemoveHandler.cs @@ -29,7 +29,7 @@ public override async Task InvokeAsync(InvocationContext context) try { await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); - var workspaceManagementService = new WorkspaceManagementService(logger, true); + var workspaceManagementService = new WorkspaceManagementService(logger, httpClient, true); await workspaceManagementService.RemoveClientAsync(className, cleanOutput, cancellationToken).ConfigureAwait(false); return 0; } diff --git a/src/kiota/Handlers/Config/MigrateHandler.cs b/src/kiota/Handlers/Config/MigrateHandler.cs index a1b05ade6f..1be224cfc8 100644 --- a/src/kiota/Handlers/Config/MigrateHandler.cs +++ b/src/kiota/Handlers/Config/MigrateHandler.cs @@ -33,7 +33,7 @@ public override async Task InvokeAsync(InvocationContext context) { try { - var workspaceManagementService = new WorkspaceManagementService(logger, true, workingDirectory); + var workspaceManagementService = new WorkspaceManagementService(logger, httpClient, true, workingDirectory); var clientNames = await workspaceManagementService.MigrateFromLockFileAsync(clientName, lockDirectory, cancellationToken).ConfigureAwait(false); if (!clientNames.Any()) { diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs index b4fb935c1d..cfdb3e0ac2 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Net.Http; using System.Threading.Tasks; using Kiota.Builder.Configuration; using Kiota.Builder.WorkspaceManagement; @@ -12,19 +13,21 @@ namespace Kiota.Builder.Tests.WorkspaceManagement; public sealed class WorkspaceManagementServiceTests : IDisposable { private readonly string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); + private readonly HttpClient httpClient = new(); [Fact] public void Defensive() { - Assert.Throws(() => new WorkspaceManagementService(null)); + Assert.Throws(() => new WorkspaceManagementService(null, httpClient)); + Assert.Throws(() => new WorkspaceManagementService(Mock.Of(), null)); } [InlineData(true)] [InlineData(false)] [Theory] public async Task IsClientPresentReturnsFalseOnNoClient(bool usesConfig) { - var mockLogger = new Mock(); + var mockLogger = Mock.Of(); Directory.CreateDirectory(tempPath); - var service = new WorkspaceManagementService(mockLogger.Object, usesConfig, tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, usesConfig, tempPath); var result = await service.IsClientPresent("clientName"); Assert.False(result); } @@ -33,9 +36,9 @@ public async Task IsClientPresentReturnsFalseOnNoClient(bool usesConfig) [Theory] public async Task ShouldGenerateReturnsTrue(bool usesConfig) { - var mockLogger = new Mock(); + var mockLogger = Mock.Of(); Directory.CreateDirectory(tempPath); - var service = new WorkspaceManagementService(mockLogger.Object, usesConfig, tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, usesConfig, tempPath); var configuration = new GenerationConfiguration { ClientClassName = "clientName", @@ -50,9 +53,9 @@ public async Task ShouldGenerateReturnsTrue(bool usesConfig) [Theory] public async Task ShouldGenerateReturnsFalse(bool usesConfig) { - var mockLogger = new Mock(); + var mockLogger = Mock.Of(); Directory.CreateDirectory(tempPath); - var service = new WorkspaceManagementService(mockLogger.Object, usesConfig, tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, usesConfig, tempPath); var configuration = new GenerationConfiguration { ClientClassName = "clientName", @@ -68,9 +71,9 @@ public async Task ShouldGenerateReturnsFalse(bool usesConfig) [Fact] public async Task RemovesAClient() { - var mockLogger = new Mock(); + var mockLogger = Mock.Of(); Directory.CreateDirectory(tempPath); - var service = new WorkspaceManagementService(mockLogger.Object, true, tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, true, tempPath); var configuration = new GenerationConfiguration { ClientClassName = "clientName", @@ -89,5 +92,6 @@ public void Dispose() { if (Directory.Exists(tempPath)) Directory.Delete(tempPath, true); + httpClient.Dispose(); } } From 5c8da95ab0d1a5bedad3cdd406cf5be512d74215 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 09:28:24 -0500 Subject: [PATCH 362/394] - updates specification regarding requests behaviour Signed-off-by: Vincent Biret --- specs/cli/config-migrate.md | 56 ++----------------- .../WorkspaceManagementService.cs | 2 +- 2 files changed, 5 insertions(+), 53 deletions(-) diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 86b3fa2bb8..4223a65aec 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -2,6 +2,8 @@ This command is valuable in cases where a code base was created with Kiota v1.0 and needs to be migrated to the latest version of Kiota. The `kiota config migrate` command will identify and locate the closest `kiota-config.json` file available. If a file can't be found, it would initialize a new `kiota-config.json` file. Then, it would identify all `kiota-lock.json` files that are within this folder structure and add each of them to the `kiota-config.json` file. Adding the clients to the `kiota-config.json` file would not trigger the generation as it only affects the `kiota-config.json` file. The `kiota client generate` command would need to be executed to generate the code for the clients. +The API manifest won't contain any request after the migration since it could lead to misalignments between the generated client and the reported requests if the description has changed between the initial generation of the client and the migration. To get the requests populated, the user will need to use the generate command. + In the case where conflicting API client names would be migrated, the command will error out and invite the user to re-run the command providing more context for the `--client-name` parameter. ## Parameters @@ -80,64 +82,14 @@ _The resulting `apimanifest.json` file will look like this:_ "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", - "requests": [ - { - "method": "GET", - "uriTemplate": "/users" - }, - { - "method": "POST", - "uriTemplate": "/users" - }, - { - "method": "GET", - "uriTemplate": "/users/$count" - }, - { - "method": "GET", - "uriTemplate": "/users/{user-id}" - }, - { - "method": "PATCH", - "uriTemplate": "/users/{user-id}" - }, - { - "method": "DELETE", - "uriTemplate": "/users/{user-id}" - } - ] + "requests": [] }, "pythonGraphServiceClient": { "x-ms-kiotaHash": "9EDF8506CB74FE44...", "apiDescriptionUrl": "https://aka.ms/graph/v1.0/openapi.yaml", "apiDeploymentBaseUrl": "https://graph.microsoft.com", "apiDescriptionVersion": "v1.0", - "requests": [ - { - "method": "GET", - "uriTemplate": "/users" - }, - { - "method": "POST", - "uriTemplate": "/users" - }, - { - "method": "GET", - "uriTemplate": "/users/$count" - }, - { - "method": "GET", - "uriTemplate": "/users/{user-id}" - }, - { - "method": "PATCH", - "uriTemplate": "/users/{user-id}" - }, - { - "method": "DELETE", - "uriTemplate": "/users/{user-id}" - } - ] + "requests": [] } } } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 39867089fb..a4bbfc8be0 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -221,7 +221,7 @@ public async Task> MigrateFromLockFileAsync(string clientNam continue; } wsConfig.Clients.Add(configuration.ClientClassName, generationClientConfig); - var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, "migrated").ConfigureAwait(false); + var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, "migrated-pending-generate").ConfigureAwait(false); // because it's a migration, we don't want to calculate the exact hash since the description might have changed since the initial generation that created the lock file apiManifest.ApiDependencies.Add(configuration.ClientClassName, configuration.ToApiDependency(inputConfigurationHash, new()));//TODO get the resolved operations? var (stream, _) = await DownloadHelper.LoadStream(configuration.OpenAPIFilePath, HttpClient, Logger, configuration, localFilesLock, null, false, cancellationToken).ConfigureAwait(false); From da0ccf5ea710c4553986a17fb9c6d845b1444d01 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 09:36:48 -0500 Subject: [PATCH 363/394] makes the client name optional for the migrate command Signed-off-by: Vincent Biret --- src/kiota/KiotaClientCommands.cs | 4 ++-- src/kiota/KiotaConfigCommands.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kiota/KiotaClientCommands.cs b/src/kiota/KiotaClientCommands.cs index 97dba4e76b..07a3f998e4 100644 --- a/src/kiota/KiotaClientCommands.cs +++ b/src/kiota/KiotaClientCommands.cs @@ -20,11 +20,11 @@ private static Option GetSkipGenerationOption() skipGeneration.AddAlias("--sg"); return skipGeneration; } - internal static Option GetClientNameOption() + internal static Option GetClientNameOption(bool required = true) { var clientName = new Option("--client-name", "The name of the client to manage") { - IsRequired = true, + IsRequired = required, }; clientName.AddAlias("--cn"); return clientName; diff --git a/src/kiota/KiotaConfigCommands.cs b/src/kiota/KiotaConfigCommands.cs index abb272ea8d..59e0e8f63d 100644 --- a/src/kiota/KiotaConfigCommands.cs +++ b/src/kiota/KiotaConfigCommands.cs @@ -28,7 +28,7 @@ private static Command GetMigrateCommand() { var logLevelOption = KiotaHost.GetLogLevelOption(); var lockDirectoryOption = GetLockDirectoryOption(); - var classOption = KiotaClientCommands.GetClientNameOption(); + var classOption = KiotaClientCommands.GetClientNameOption(false); var command = new Command("migrate", "Migrates a kiota lock file to a Kiota configuration") { logLevelOption, From 28a7a3e8a12f28e2c9769b44da54fad2b0731557 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 09:52:58 -0500 Subject: [PATCH 364/394] - defaults the manifest on migration Signed-off-by: Vincent Biret --- .../WorkspaceManagement/WorkspaceManagementService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index a4bbfc8be0..b604eb5517 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -54,7 +54,7 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene { var (wsConfig, manifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); wsConfig ??= new WorkspaceConfiguration(); - manifest ??= new ApiManifestDocument("application"); //TODO get the application name + manifest ??= defaultManifest; var generationClientConfig = new ApiClientConfiguration(generationConfiguration); generationClientConfig.NormalizePaths(WorkingDirectory); wsConfig.Clients.AddOrReplace(generationConfiguration.ClientClassName, generationClientConfig); @@ -73,6 +73,7 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene await lockManagementService.WriteLockFileAsync(generationConfiguration.OutputPath, configurationLock, cancellationToken).ConfigureAwait(false); } } + private static ApiManifestDocument defaultManifest => new("application"); //TODO get the application name public async Task RestoreStateAsync(string outputPath, CancellationToken cancellationToken = default) { if (UseKiotaConfig) @@ -195,8 +196,7 @@ public async Task> MigrateFromLockFileAsync(string clientNam var (wsConfig, apiManifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); if (wsConfig is null) throw new InvalidOperationException("The workspace configuration is not initialized"); - if (apiManifest is null) - throw new InvalidOperationException("The API manifest is not initialized"); + apiManifest ??= defaultManifest; var lockFiles = Directory.GetFiles(lockDirectory, LockManagementService.LockFileName, SearchOption.AllDirectories); if (lockFiles.Length == 0) From 0d55f1e59194c4adbc908f0453333a5e7d733b37 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 10:08:24 -0500 Subject: [PATCH 365/394] - code linting Signed-off-by: Vincent Biret --- .../WorkspaceManagementService.cs | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index b604eb5517..35a62ae772 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -52,9 +52,7 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene ArgumentNullException.ThrowIfNull(generationConfiguration); if (UseKiotaConfig) { - var (wsConfig, manifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); - wsConfig ??= new WorkspaceConfiguration(); - manifest ??= defaultManifest; + var (wsConfig, manifest) = await LoadConfigurationAndManifestAsync(cancellationToken).ConfigureAwait(false); var generationClientConfig = new ApiClientConfiguration(generationConfiguration); generationClientConfig.NormalizePaths(WorkingDirectory); wsConfig.Clients.AddOrReplace(generationConfiguration.ClientClassName, generationClientConfig); @@ -73,7 +71,6 @@ public async Task UpdateStateFromConfigurationAsync(GenerationConfiguration gene await lockManagementService.WriteLockFileAsync(generationConfiguration.OutputPath, configurationLock, cancellationToken).ConfigureAwait(false); } } - private static ApiManifestDocument defaultManifest => new("application"); //TODO get the application name public async Task RestoreStateAsync(string outputPath, CancellationToken cancellationToken = default) { if (UseKiotaConfig) @@ -179,8 +176,18 @@ private static string ConvertByteArrayToString(byte[] hash) return sb.ToString(); } + private async Task<(WorkspaceConfiguration, ApiManifestDocument)> LoadConfigurationAndManifestAsync(CancellationToken cancellationToken) + { + if (!await workspaceConfigurationStorageService.IsInitializedAsync(cancellationToken).ConfigureAwait(false)) + await workspaceConfigurationStorageService.InitializeAsync(cancellationToken).ConfigureAwait(false); - public async Task> MigrateFromLockFileAsync(string clientName, string lockDirectory, CancellationToken cancellationToken = default) + var (wsConfig, apiManifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + if (wsConfig is null) + throw new InvalidOperationException("The workspace configuration is not initialized"); + apiManifest ??= new("application"); //TODO get the application name + return (wsConfig, apiManifest); + } + private async Task> LoadGenerationConfigurationsFromLockFilesAsync(string lockDirectory, string clientName, CancellationToken cancellationToken = default) { ArgumentException.ThrowIfNullOrEmpty(lockDirectory); if (!UseKiotaConfig) @@ -190,14 +197,6 @@ public async Task> MigrateFromLockFileAsync(string clientNam if (Path.GetRelativePath(WorkingDirectory, lockDirectory).StartsWith("..", StringComparison.OrdinalIgnoreCase)) throw new InvalidOperationException("The lock directory must be a subdirectory of the working directory"); - if (!await workspaceConfigurationStorageService.IsInitializedAsync(cancellationToken).ConfigureAwait(false)) - await workspaceConfigurationStorageService.InitializeAsync(cancellationToken).ConfigureAwait(false); - - var (wsConfig, apiManifest) = await workspaceConfigurationStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); - if (wsConfig is null) - throw new InvalidOperationException("The workspace configuration is not initialized"); - apiManifest ??= defaultManifest; - var lockFiles = Directory.GetFiles(lockDirectory, LockManagementService.LockFileName, SearchOption.AllDirectories); if (lockFiles.Length == 0) throw new InvalidOperationException("No lock file found in the specified directory"); @@ -209,8 +208,14 @@ public async Task> MigrateFromLockFileAsync(string clientNam clientsGenerationConfigurations.Add(await LoadConfigurationFromLockAsync(clientNamePassed ? clientName : string.Empty, lockFiles[0], cancellationToken).ConfigureAwait(false)); else clientsGenerationConfigurations.AddRange(await Task.WhenAll(lockFiles.Select(x => LoadConfigurationFromLockAsync(string.Empty, x, cancellationToken))).ConfigureAwait(false)); - var loadedConfigurations = clientsGenerationConfigurations.OfType().ToArray(); - foreach (var configuration in loadedConfigurations) + return clientsGenerationConfigurations.OfType().ToList(); + } + public async Task> MigrateFromLockFileAsync(string clientName, string lockDirectory, CancellationToken cancellationToken = default) + { + var (wsConfig, apiManifest) = await LoadConfigurationAndManifestAsync(cancellationToken).ConfigureAwait(false); + + var clientsGenerationConfigurations = await LoadGenerationConfigurationsFromLockFilesAsync(lockDirectory, clientName, cancellationToken).ConfigureAwait(false); + foreach (var configuration in clientsGenerationConfigurations.ToArray()) //to avoid modifying the collection as we iterate and remove some entries { var generationClientConfig = new ApiClientConfiguration(configuration); generationClientConfig.NormalizePaths(WorkingDirectory); From f27b8dc0d17c59765527fa202907f7b1d0b7f900 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 10:11:29 -0500 Subject: [PATCH 366/394] - code linting Signed-off-by: Vincent Biret --- src/Kiota.Builder/DownloadHelper.cs | 7 ++++++- src/Kiota.Builder/KiotaBuilder.cs | 8 +------- .../WorkspaceManagement/WorkspaceManagementService.cs | 7 +------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Kiota.Builder/DownloadHelper.cs b/src/Kiota.Builder/DownloadHelper.cs index d2834006ab..6f9dfa3432 100644 --- a/src/Kiota.Builder/DownloadHelper.cs +++ b/src/Kiota.Builder/DownloadHelper.cs @@ -16,7 +16,12 @@ namespace Kiota.Builder; internal static class DownloadHelper { - internal static async Task<(Stream, bool)> LoadStream(string inputPath, HttpClient httpClient, ILogger logger, GenerationConfiguration config, AsyncKeyedLocker localFilesLock, WorkspaceManagementService? workspaceManagementService = default, bool useKiotaConfig = false, CancellationToken cancellationToken = default) + private static readonly AsyncKeyedLocker localFilesLock = new(o => + { + o.PoolSize = 20; + o.PoolInitialFill = 1; + }); + internal static async Task<(Stream, bool)> LoadStream(string inputPath, HttpClient httpClient, ILogger logger, GenerationConfiguration config, WorkspaceManagementService? workspaceManagementService = default, bool useKiotaConfig = false, CancellationToken cancellationToken = default) { var stopwatch = new Stopwatch(); stopwatch.Start(); diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 9cd0706c7a..30d4a7a580 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -391,16 +391,10 @@ private void StopLogAndReset(Stopwatch sw, string prefix) logger.LogDebug("{Prefix} {SwElapsed}", prefix, sw.Elapsed); sw.Reset(); } - - private static readonly AsyncKeyedLocker localFilesLock = new(o => - { - o.PoolSize = 20; - o.PoolInitialFill = 1; - }); private bool isDescriptionFromWorkspaceCopy; private async Task LoadStream(string inputPath, CancellationToken cancellationToken) { - var (input, isCopy) = await DownloadHelper.LoadStream(inputPath, httpClient, logger, config, localFilesLock, workspaceManagementService, useKiotaConfig, cancellationToken).ConfigureAwait(false); + var (input, isCopy) = await DownloadHelper.LoadStream(inputPath, httpClient, logger, config, workspaceManagementService, useKiotaConfig, cancellationToken).ConfigureAwait(false); isDescriptionFromWorkspaceCopy = isCopy; return input; } diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 35a62ae772..d45182bb38 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -229,18 +229,13 @@ public async Task> MigrateFromLockFileAsync(string clientNam var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, "migrated-pending-generate").ConfigureAwait(false); // because it's a migration, we don't want to calculate the exact hash since the description might have changed since the initial generation that created the lock file apiManifest.ApiDependencies.Add(configuration.ClientClassName, configuration.ToApiDependency(inputConfigurationHash, new()));//TODO get the resolved operations? - var (stream, _) = await DownloadHelper.LoadStream(configuration.OpenAPIFilePath, HttpClient, Logger, configuration, localFilesLock, null, false, cancellationToken).ConfigureAwait(false); + var (stream, _) = await DownloadHelper.LoadStream(configuration.OpenAPIFilePath, HttpClient, Logger, configuration, null, false, cancellationToken).ConfigureAwait(false); await descriptionStorageService.UpdateDescriptionAsync(configuration.ClientClassName, stream, string.Empty, cancellationToken).ConfigureAwait(false); lockManagementService.DeleteLockFile(Path.GetDirectoryName(configuration.OpenAPIFilePath)!); } await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, apiManifest, cancellationToken).ConfigureAwait(false); return clientsGenerationConfigurations.OfType().Select(static x => x.ClientClassName); } - private static readonly AsyncKeyedLocker localFilesLock = new(o => - { - o.PoolSize = 20; - o.PoolInitialFill = 1; - }); private async Task LoadConfigurationFromLockAsync(string clientName, string lockFilePath, CancellationToken cancellationToken) { if (Path.GetDirectoryName(lockFilePath) is not string lockFileDirectory) From e3c0ab6d32c4ff6cf2378073ea1541a27618a052 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 10:23:43 -0500 Subject: [PATCH 367/394] - moves api url logic outside of builder Signed-off-by: Vincent Biret --- .../Extensions/OpenApiDocumentExtensions.cs | 21 ++++++++++++ src/Kiota.Builder/KiotaBuilder.cs | 34 ++++--------------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiDocumentExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiDocumentExtensions.cs index e0abc3cb94..dcfdb31c5b 100644 --- a/src/Kiota.Builder/Extensions/OpenApiDocumentExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiDocumentExtensions.cs @@ -2,6 +2,7 @@ using System.Collections.Concurrent; using System.Linq; using System.Threading.Tasks; +using Kiota.Builder.EqualityComparers; using Microsoft.OpenApi.Models; namespace Kiota.Builder.Extensions; @@ -26,4 +27,24 @@ internal static void InitializeInheritanceIndex(this OpenApiDocument openApiDocu }); } } + internal static string? GetAPIRootUrl(this OpenApiDocument openApiDocument, string openAPIFilePath) + { + if (openApiDocument == null) return null; + var candidateUrl = openApiDocument.Servers + .GroupBy(static x => x, new OpenApiServerComparer()) //group by protocol relative urls + .FirstOrDefault() + ?.OrderByDescending(static x => x?.Url, StringComparer.OrdinalIgnoreCase) // prefer https over http + ?.FirstOrDefault() + ?.Url; + if (string.IsNullOrEmpty(candidateUrl)) + return null; + else if (!candidateUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase) && + openAPIFilePath.StartsWith("http", StringComparison.OrdinalIgnoreCase) && + Uri.TryCreate(openAPIFilePath, new(), out var filePathUri) && + Uri.TryCreate(filePathUri, candidateUrl, out var candidateUri)) + { + candidateUrl = candidateUri.ToString(); + } + return candidateUrl.TrimEnd(KiotaBuilder.ForwardSlash); + } } diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 30d4a7a580..2d703d1933 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -357,33 +357,11 @@ internal void FilterPathsByPatterns(OpenApiDocument doc) } internal void SetApiRootUrl() { - if (openApiDocument == null) return; - var candidateUrl = openApiDocument.Servers - .GroupBy(static x => x, new OpenApiServerComparer()) //group by protocol relative urls - .FirstOrDefault() - ?.OrderByDescending(static x => x?.Url, StringComparer.OrdinalIgnoreCase) // prefer https over http - ?.FirstOrDefault() - ?.Url; - if (string.IsNullOrEmpty(candidateUrl)) - { + var candidateUrl = openApiDocument?.GetAPIRootUrl(config.OpenAPIFilePath); + if (candidateUrl is null) logger.LogWarning("No server url found in the OpenAPI document. The base url will need to be set when using the client."); - return; - } - else if (!candidateUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase) && config.OpenAPIFilePath.StartsWith("http", StringComparison.OrdinalIgnoreCase)) - { - try - { - candidateUrl = new Uri(new Uri(config.OpenAPIFilePath), candidateUrl).ToString(); - } -#pragma warning disable CA1031 - catch (Exception ex) -#pragma warning restore CA1031 - { - logger.LogWarning(ex, "Could not resolve the server url from the OpenAPI document. The base url will need to be set when using the client."); - return; - } - } - config.ApiRootUrl = candidateUrl.TrimEnd(ForwardSlash); + else + config.ApiRootUrl = candidateUrl; } private void StopLogAndReset(Stopwatch sw, string prefix) { @@ -399,8 +377,8 @@ private async Task LoadStream(string inputPath, CancellationToken cancel return input; } - private const char ForwardSlash = '/'; - public async Task CreateOpenApiDocumentAsync(Stream input, bool generating = false, CancellationToken cancellationToken = default) + internal const char ForwardSlash = '/'; + internal async Task CreateOpenApiDocumentAsync(Stream input, bool generating = false, CancellationToken cancellationToken = default) { var stopwatch = new Stopwatch(); stopwatch.Start(); From 9e73e70ba2c378251b4518c0e277cf38912fe6f3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 11:10:17 -0500 Subject: [PATCH 368/394] - sets the base url for migration Signed-off-by: Vincent Biret --- src/Kiota.Builder/DownloadHelper.cs | 85 ---------- src/Kiota.Builder/KiotaBuilder.cs | 61 +------ .../OpenApiDocumentDownloadService.cs | 155 ++++++++++++++++++ .../WorkspaceManagementService.cs | 39 +++-- 4 files changed, 187 insertions(+), 153 deletions(-) delete mode 100644 src/Kiota.Builder/DownloadHelper.cs create mode 100644 src/Kiota.Builder/OpenApiDocumentDownloadService.cs diff --git a/src/Kiota.Builder/DownloadHelper.cs b/src/Kiota.Builder/DownloadHelper.cs deleted file mode 100644 index 6f9dfa3432..0000000000 --- a/src/Kiota.Builder/DownloadHelper.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Net.Http; -using System.Security; -using System.Threading; -using System.Threading.Tasks; -using AsyncKeyedLock; -using Kiota.Builder.Caching; -using Kiota.Builder.Configuration; -using Kiota.Builder.Extensions; -using Kiota.Builder.SearchProviders.APIsGuru; -using Kiota.Builder.WorkspaceManagement; -using Microsoft.Extensions.Logging; - -namespace Kiota.Builder; -internal static class DownloadHelper -{ - private static readonly AsyncKeyedLocker localFilesLock = new(o => - { - o.PoolSize = 20; - o.PoolInitialFill = 1; - }); - internal static async Task<(Stream, bool)> LoadStream(string inputPath, HttpClient httpClient, ILogger logger, GenerationConfiguration config, WorkspaceManagementService? workspaceManagementService = default, bool useKiotaConfig = false, CancellationToken cancellationToken = default) - { - var stopwatch = new Stopwatch(); - stopwatch.Start(); - - inputPath = inputPath.Trim(); - - Stream input; - var isDescriptionFromWorkspaceCopy = false; - if (useKiotaConfig && - config.Operation is ClientOperation.Edit or ClientOperation.Add && - workspaceManagementService is not null && - await workspaceManagementService.GetDescriptionCopyAsync(config.ClientClassName, inputPath, cancellationToken).ConfigureAwait(false) is { } descriptionStream) - { - logger.LogInformation("loaded description from the workspace copy"); - input = descriptionStream; - isDescriptionFromWorkspaceCopy = true; - } - else if (inputPath.StartsWith("http", StringComparison.OrdinalIgnoreCase)) - try - { - var cachingProvider = new DocumentCachingProvider(httpClient, logger) - { - ClearCache = config.ClearCache, - }; - var targetUri = APIsGuruSearchProvider.ChangeSourceUrlToGitHub(new Uri(inputPath)); // so updating existing clients doesn't break - var fileName = targetUri.GetFileName() is string name && !string.IsNullOrEmpty(name) ? name : "description.yml"; - input = await cachingProvider.GetDocumentAsync(targetUri, "generation", fileName, cancellationToken: cancellationToken).ConfigureAwait(false); - logger.LogInformation("loaded description from remote source"); - } - catch (HttpRequestException ex) - { - throw new InvalidOperationException($"Could not download the file at {inputPath}, reason: {ex.Message}", ex); - } - else - try - { - var inMemoryStream = new MemoryStream(); - using (await localFilesLock.LockAsync(inputPath, cancellationToken).ConfigureAwait(false)) - {// To avoid deadlocking on update with multiple clients for the same local description - using var fileStream = new FileStream(inputPath, FileMode.Open); - await fileStream.CopyToAsync(inMemoryStream, cancellationToken).ConfigureAwait(false); - } - inMemoryStream.Position = 0; - input = inMemoryStream; - logger.LogInformation("loaded description from local source"); - } - catch (Exception ex) when (ex is FileNotFoundException || - ex is PathTooLongException || - ex is DirectoryNotFoundException || - ex is IOException || - ex is UnauthorizedAccessException || - ex is SecurityException || - ex is NotSupportedException) - { - throw new InvalidOperationException($"Could not open the file at {inputPath}, reason: {ex.Message}", ex); - } - stopwatch.Stop(); - logger.LogTrace("{Timestamp}ms: Read OpenAPI file {File}", stopwatch.ElapsedMilliseconds, inputPath); - return (input, isDescriptionFromWorkspaceCopy); - } -} diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 2d703d1933..d150c807e0 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -11,7 +11,6 @@ using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -using AsyncKeyedLock; using DotNet.Globbing; using Kiota.Builder.Caching; using Kiota.Builder.CodeDOM; @@ -24,7 +23,6 @@ using Kiota.Builder.Manifest; using Kiota.Builder.OpenApiExtensions; using Kiota.Builder.Refiners; -using Kiota.Builder.Validation; using Kiota.Builder.WorkspaceManagement; using Kiota.Builder.Writers; using Microsoft.Extensions.Logging; @@ -32,9 +30,7 @@ using Microsoft.OpenApi.ApiManifest; using Microsoft.OpenApi.MicrosoftExtensions; using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; -using Microsoft.OpenApi.Validations; using HttpMethod = Kiota.Builder.CodeDOM.HttpMethod; [assembly: InternalsVisibleTo("Kiota.Builder.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100957cb48387b2a5f54f5ce39255f18f26d32a39990db27cf48737afc6bc62759ba996b8a2bfb675d4e39f3d06ecb55a178b1b4031dcb2a767e29977d88cce864a0d16bfc1b3bebb0edf9fe285f10fffc0a85f93d664fa05af07faa3aad2e545182dbf787e3fd32b56aca95df1a3c4e75dec164a3f1a4c653d971b01ffc39eb3c4")] @@ -64,7 +60,9 @@ public KiotaBuilder(ILogger logger, GenerationConfiguration config var workingDirectory = Directory.GetCurrentDirectory(); workspaceManagementService = new WorkspaceManagementService(logger, client, useKiotaConfig, workingDirectory); this.useKiotaConfig = useKiotaConfig; + openApiDocumentDownloadService = new OpenApiDocumentDownloadService(client, logger); } + private readonly OpenApiDocumentDownloadService openApiDocumentDownloadService; private readonly bool useKiotaConfig; private async Task CleanOutputDirectory(CancellationToken cancellationToken) { @@ -372,64 +370,15 @@ private void StopLogAndReset(Stopwatch sw, string prefix) private bool isDescriptionFromWorkspaceCopy; private async Task LoadStream(string inputPath, CancellationToken cancellationToken) { - var (input, isCopy) = await DownloadHelper.LoadStream(inputPath, httpClient, logger, config, workspaceManagementService, useKiotaConfig, cancellationToken).ConfigureAwait(false); + var (input, isCopy) = await openApiDocumentDownloadService.LoadStreamAsync(inputPath, config, workspaceManagementService, useKiotaConfig, cancellationToken).ConfigureAwait(false); isDescriptionFromWorkspaceCopy = isCopy; return input; } internal const char ForwardSlash = '/'; - internal async Task CreateOpenApiDocumentAsync(Stream input, bool generating = false, CancellationToken cancellationToken = default) + internal Task CreateOpenApiDocumentAsync(Stream input, bool generating = false, CancellationToken cancellationToken = default) { - var stopwatch = new Stopwatch(); - stopwatch.Start(); - logger.LogTrace("Parsing OpenAPI file"); - var ruleSet = config.DisabledValidationRules.Contains(ValidationRuleSetExtensions.AllValidationRule) ? - ValidationRuleSet.GetEmptyRuleSet() : - ValidationRuleSet.GetDefaultRuleSet(); //workaround since validation rule set doesn't support clearing rules - if (generating) - ruleSet.AddKiotaValidationRules(config); - var settings = new OpenApiReaderSettings - { - RuleSet = ruleSet, - }; - settings.AddMicrosoftExtensionParsers(); - settings.ExtensionParsers.TryAdd(OpenApiKiotaExtension.Name, static (i, _) => OpenApiKiotaExtension.Parse(i)); - try - { - var rawUri = config.OpenAPIFilePath.TrimEnd(ForwardSlash); - var lastSlashIndex = rawUri.LastIndexOf(ForwardSlash); - if (lastSlashIndex < 0) - lastSlashIndex = rawUri.Length - 1; - var documentUri = new Uri(rawUri[..lastSlashIndex]); - settings.BaseUrl = documentUri; - settings.LoadExternalRefs = true; - } -#pragma warning disable CA1031 - catch -#pragma warning restore CA1031 - { - // couldn't parse the URL, it's probably a local file - } - var reader = new OpenApiStreamReader(settings); - var readResult = await reader.ReadAsync(input, cancellationToken).ConfigureAwait(false); - stopwatch.Stop(); - if (generating) - foreach (var warning in readResult.OpenApiDiagnostic.Warnings) - logger.LogWarning("OpenAPI warning: {Pointer} - {Warning}", warning.Pointer, warning.Message); - if (readResult.OpenApiDiagnostic.Errors.Any()) - { - logger.LogTrace("{Timestamp}ms: Parsed OpenAPI with errors. {Count} paths found.", stopwatch.ElapsedMilliseconds, readResult.OpenApiDocument?.Paths?.Count ?? 0); - foreach (var parsingError in readResult.OpenApiDiagnostic.Errors) - { - logger.LogError("OpenAPI error: {Pointer} - {Message}", parsingError.Pointer, parsingError.Message); - } - } - else - { - logger.LogTrace("{Timestamp}ms: Parsed OpenAPI successfully. {Count} paths found.", stopwatch.ElapsedMilliseconds, readResult.OpenApiDocument?.Paths?.Count ?? 0); - } - - return readResult.OpenApiDocument; + return openApiDocumentDownloadService.GetDocumentFromStreamAsync(input, config, generating, cancellationToken); } public static string GetDeeperMostCommonNamespaceNameForModels(OpenApiDocument document) { diff --git a/src/Kiota.Builder/OpenApiDocumentDownloadService.cs b/src/Kiota.Builder/OpenApiDocumentDownloadService.cs new file mode 100644 index 0000000000..2ff8c3d180 --- /dev/null +++ b/src/Kiota.Builder/OpenApiDocumentDownloadService.cs @@ -0,0 +1,155 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Security; +using System.Threading; +using System.Threading.Tasks; +using AsyncKeyedLock; +using Kiota.Builder.Caching; +using Kiota.Builder.Configuration; +using Kiota.Builder.Extensions; +using Kiota.Builder.OpenApiExtensions; +using Kiota.Builder.SearchProviders.APIsGuru; +using Kiota.Builder.Validation; +using Kiota.Builder.WorkspaceManagement; +using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Readers; +using Microsoft.OpenApi.Validations; + +namespace Kiota.Builder; +internal class OpenApiDocumentDownloadService +{ + private readonly ILogger Logger; + private readonly HttpClient HttpClient; + public OpenApiDocumentDownloadService(HttpClient httpClient, ILogger logger) + { + ArgumentNullException.ThrowIfNull(httpClient); + ArgumentNullException.ThrowIfNull(logger); + HttpClient = httpClient; + Logger = logger; + } + private static readonly AsyncKeyedLocker localFilesLock = new(o => + { + o.PoolSize = 20; + o.PoolInitialFill = 1; + }); + internal async Task<(Stream, bool)> LoadStreamAsync(string inputPath, GenerationConfiguration config, WorkspaceManagementService? workspaceManagementService = default, bool useKiotaConfig = false, CancellationToken cancellationToken = default) + { + var stopwatch = new Stopwatch(); + stopwatch.Start(); + + inputPath = inputPath.Trim(); + + Stream input; + var isDescriptionFromWorkspaceCopy = false; + if (useKiotaConfig && + config.Operation is ClientOperation.Edit or ClientOperation.Add && + workspaceManagementService is not null && + await workspaceManagementService.GetDescriptionCopyAsync(config.ClientClassName, inputPath, cancellationToken).ConfigureAwait(false) is { } descriptionStream) + { + Logger.LogInformation("loaded description from the workspace copy"); + input = descriptionStream; + isDescriptionFromWorkspaceCopy = true; + } + else if (inputPath.StartsWith("http", StringComparison.OrdinalIgnoreCase)) + try + { + var cachingProvider = new DocumentCachingProvider(HttpClient, Logger) + { + ClearCache = config.ClearCache, + }; + var targetUri = APIsGuruSearchProvider.ChangeSourceUrlToGitHub(new Uri(inputPath)); // so updating existing clients doesn't break + var fileName = targetUri.GetFileName() is string name && !string.IsNullOrEmpty(name) ? name : "description.yml"; + input = await cachingProvider.GetDocumentAsync(targetUri, "generation", fileName, cancellationToken: cancellationToken).ConfigureAwait(false); + Logger.LogInformation("loaded description from remote source"); + } + catch (HttpRequestException ex) + { + throw new InvalidOperationException($"Could not download the file at {inputPath}, reason: {ex.Message}", ex); + } + else + try + { + var inMemoryStream = new MemoryStream(); + using (await localFilesLock.LockAsync(inputPath, cancellationToken).ConfigureAwait(false)) + {// To avoid deadlocking on update with multiple clients for the same local description + using var fileStream = new FileStream(inputPath, FileMode.Open); + await fileStream.CopyToAsync(inMemoryStream, cancellationToken).ConfigureAwait(false); + } + inMemoryStream.Position = 0; + input = inMemoryStream; + Logger.LogInformation("loaded description from local source"); + } + catch (Exception ex) when (ex is FileNotFoundException || + ex is PathTooLongException || + ex is DirectoryNotFoundException || + ex is IOException || + ex is UnauthorizedAccessException || + ex is SecurityException || + ex is NotSupportedException) + { + throw new InvalidOperationException($"Could not open the file at {inputPath}, reason: {ex.Message}", ex); + } + stopwatch.Stop(); + Logger.LogTrace("{Timestamp}ms: Read OpenAPI file {File}", stopwatch.ElapsedMilliseconds, inputPath); + return (input, isDescriptionFromWorkspaceCopy); + } + + internal async Task GetDocumentFromStreamAsync(Stream input, GenerationConfiguration config, bool generating = false, CancellationToken cancellationToken = default) + { + var stopwatch = new Stopwatch(); + stopwatch.Start(); + Logger.LogTrace("Parsing OpenAPI file"); + var ruleSet = config.DisabledValidationRules.Contains(ValidationRuleSetExtensions.AllValidationRule) ? + ValidationRuleSet.GetEmptyRuleSet() : + ValidationRuleSet.GetDefaultRuleSet(); //workaround since validation rule set doesn't support clearing rules + if (generating) + ruleSet.AddKiotaValidationRules(config); + var settings = new OpenApiReaderSettings + { + RuleSet = ruleSet, + }; + settings.AddMicrosoftExtensionParsers(); + settings.ExtensionParsers.TryAdd(OpenApiKiotaExtension.Name, static (i, _) => OpenApiKiotaExtension.Parse(i)); + try + { + var rawUri = config.OpenAPIFilePath.TrimEnd(KiotaBuilder.ForwardSlash); + var lastSlashIndex = rawUri.LastIndexOf(KiotaBuilder.ForwardSlash); + if (lastSlashIndex < 0) + lastSlashIndex = rawUri.Length - 1; + var documentUri = new Uri(rawUri[..lastSlashIndex]); + settings.BaseUrl = documentUri; + settings.LoadExternalRefs = true; + settings.LeaveStreamOpen = true; + } +#pragma warning disable CA1031 + catch +#pragma warning restore CA1031 + { + // couldn't parse the URL, it's probably a local file + } + var reader = new OpenApiStreamReader(settings); + var readResult = await reader.ReadAsync(input, cancellationToken).ConfigureAwait(false); + stopwatch.Stop(); + if (generating) + foreach (var warning in readResult.OpenApiDiagnostic.Warnings) + Logger.LogWarning("OpenAPI warning: {Pointer} - {Warning}", warning.Pointer, warning.Message); + if (readResult.OpenApiDiagnostic.Errors.Any()) + { + Logger.LogTrace("{Timestamp}ms: Parsed OpenAPI with errors. {Count} paths found.", stopwatch.ElapsedMilliseconds, readResult.OpenApiDocument?.Paths?.Count ?? 0); + foreach (var parsingError in readResult.OpenApiDiagnostic.Errors) + { + Logger.LogError("OpenAPI error: {Pointer} - {Message}", parsingError.Pointer, parsingError.Message); + } + } + else + { + Logger.LogTrace("{Timestamp}ms: Parsed OpenAPI successfully. {Count} paths found.", stopwatch.ElapsedMilliseconds, readResult.OpenApiDocument?.Paths?.Count ?? 0); + } + + return readResult.OpenApiDocument; + } +} diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index d45182bb38..efca606b81 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -37,7 +37,9 @@ public WorkspaceManagementService(ILogger logger, HttpClient httpClient, bool us WorkingDirectory = workingDirectory; workspaceConfigurationStorageService = new(workingDirectory); descriptionStorageService = new(workingDirectory); + openApiDocumentDownloadService = new(HttpClient, Logger); } + private readonly OpenApiDocumentDownloadService openApiDocumentDownloadService; private readonly LockManagementService lockManagementService = new(); private readonly WorkspaceConfigurationStorageService workspaceConfigurationStorageService; private readonly DescriptionStorageService descriptionStorageService; @@ -215,23 +217,36 @@ public async Task> MigrateFromLockFileAsync(string clientNam var (wsConfig, apiManifest) = await LoadConfigurationAndManifestAsync(cancellationToken).ConfigureAwait(false); var clientsGenerationConfigurations = await LoadGenerationConfigurationsFromLockFilesAsync(lockDirectory, clientName, cancellationToken).ConfigureAwait(false); - foreach (var configuration in clientsGenerationConfigurations.ToArray()) //to avoid modifying the collection as we iterate and remove some entries + foreach (var generationConfiguration in clientsGenerationConfigurations.ToArray()) //to avoid modifying the collection as we iterate and remove some entries { - var generationClientConfig = new ApiClientConfiguration(configuration); - generationClientConfig.NormalizePaths(WorkingDirectory); - if (wsConfig.Clients.ContainsKey(configuration.ClientClassName)) + + if (wsConfig.Clients.ContainsKey(generationConfiguration.ClientClassName)) { - Logger.LogError("The client {ClientName} is already present in the configuration", configuration.ClientClassName); - clientsGenerationConfigurations.Remove(configuration); + Logger.LogError("The client {ClientName} is already present in the configuration", generationConfiguration.ClientClassName); + clientsGenerationConfigurations.Remove(generationConfiguration); continue; } - wsConfig.Clients.Add(configuration.ClientClassName, generationClientConfig); - var inputConfigurationHash = await GetConfigurationHashAsync(generationClientConfig, "migrated-pending-generate").ConfigureAwait(false); + var (stream, _) = await openApiDocumentDownloadService.LoadStreamAsync(generationConfiguration.OpenAPIFilePath, generationConfiguration, null, false, cancellationToken).ConfigureAwait(false); +#pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task + await using var msForOpenAPIDocument = new MemoryStream(); // openapi.net doesn't honour leave open + await using var ms = new MemoryStream(); +#pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task + await stream.CopyToAsync(msForOpenAPIDocument, cancellationToken).ConfigureAwait(false); + msForOpenAPIDocument.Seek(0, SeekOrigin.Begin); + await msForOpenAPIDocument.CopyToAsync(ms, cancellationToken).ConfigureAwait(false); + ms.Seek(0, SeekOrigin.Begin); + msForOpenAPIDocument.Seek(0, SeekOrigin.Begin); + var document = await openApiDocumentDownloadService.GetDocumentFromStreamAsync(msForOpenAPIDocument, generationConfiguration, false, cancellationToken).ConfigureAwait(false); + generationConfiguration.ApiRootUrl = document?.GetAPIRootUrl(generationConfiguration.OpenAPIFilePath); + await descriptionStorageService.UpdateDescriptionAsync(generationConfiguration.ClientClassName, ms, string.Empty, cancellationToken).ConfigureAwait(false); + + var clientConfiguration = new ApiClientConfiguration(generationConfiguration); + clientConfiguration.NormalizePaths(WorkingDirectory); + wsConfig.Clients.Add(generationConfiguration.ClientClassName, clientConfiguration); + var inputConfigurationHash = await GetConfigurationHashAsync(clientConfiguration, "migrated-pending-generate").ConfigureAwait(false); // because it's a migration, we don't want to calculate the exact hash since the description might have changed since the initial generation that created the lock file - apiManifest.ApiDependencies.Add(configuration.ClientClassName, configuration.ToApiDependency(inputConfigurationHash, new()));//TODO get the resolved operations? - var (stream, _) = await DownloadHelper.LoadStream(configuration.OpenAPIFilePath, HttpClient, Logger, configuration, null, false, cancellationToken).ConfigureAwait(false); - await descriptionStorageService.UpdateDescriptionAsync(configuration.ClientClassName, stream, string.Empty, cancellationToken).ConfigureAwait(false); - lockManagementService.DeleteLockFile(Path.GetDirectoryName(configuration.OpenAPIFilePath)!); + apiManifest.ApiDependencies.Add(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency(inputConfigurationHash, new())); + lockManagementService.DeleteLockFile(Path.GetDirectoryName(generationConfiguration.OpenAPIFilePath)!); } await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, apiManifest, cancellationToken).ConfigureAwait(false); return clientsGenerationConfigurations.OfType().Select(static x => x.ClientClassName); From 664fcf777fcad6b7b4525f9de24cf428c130165e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Fri, 1 Mar 2024 17:03:05 +0000 Subject: [PATCH 369/394] Updates based on review --- specs/cli/client-add.md | 4 ++-- specs/cli/client-generate.md | 2 +- specs/cli/config-migrate.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/specs/cli/client-add.md b/specs/cli/client-add.md index f17c855f08..4cb2e4e9db 100644 --- a/specs/cli/client-add.md +++ b/specs/cli/client-add.md @@ -16,8 +16,8 @@ Once the `kiota-config.json` file is generated and the OpenAPI description file | Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | -- | -| `--client-name \| --cn` | Yes | graphDelegated | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | Yes, without its value | -| `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | Yes, without its value | +| `--client-name \| --cn` | Yes | graphDelegated | Name of the client and the client class. Unique within the parent API. Defaults to `Client` | No | +| `--openapi \| -d` | Yes | https://aka.ms/graph/v1.0/openapi.yaml | The location of the OpenAPI description in JSON or YAML format to use to generate the SDK. Accepts a URL or a local path. | No | | `--search-key \| --sk` | No | github::microsoftgraph/msgraph-metadata/graph.microsoft.com/v1.0 | The search key used to locate the OpenAPI description. | Yes, without its value | | `--include-path \| -i` | No | /me/chats#GET | A glob pattern to include paths from generation. Accepts multiple values. Defaults to no value which includes everything. | Yes, without its value | | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | Yes, without its value | diff --git a/specs/cli/client-generate.md b/specs/cli/client-generate.md index b65f9df35c..84b93c1705 100644 --- a/specs/cli/client-generate.md +++ b/specs/cli/client-generate.md @@ -12,7 +12,7 @@ In general cases, the `kiota client generate` command will generate the code for | Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | -- | -| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | Yes | +| `--client-name \| --cn` | No | graphDelegated | Name of the client. Unique within the parent API. | Yes, without it's value | | `--refresh \| -r` | No | true | Provided when refreshing the description(s) is required. | Yes | ## Usage diff --git a/specs/cli/config-migrate.md b/specs/cli/config-migrate.md index 18eb53a3f2..cfd1aca484 100644 --- a/specs/cli/config-migrate.md +++ b/specs/cli/config-migrate.md @@ -8,7 +8,7 @@ In the case where conflicting API client names would be migrated, the command wi | Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | -- | -| `--lock-location \| --ll` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | Yes, without its value | +| `--lock-location` | No | ./output/pythonClient/kiota-lock.json | Location of the `kiota-lock.json` file. If not specified, all `kiota-lock.json` files within in the current directory tree will be used. | Yes, without its value | | `--client-name \| --cn` | No | graphDelegated | Used with `--lock-location`, it would allow to specify a name for the API client. Else, name is auto-generated as a concatenation of the `language` and `clientClassName`. | Yes, without its value | ## Using `kiota config migrate` From beca262c302d4b6706e0e8b808f293b8d2778160 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 12:04:26 -0500 Subject: [PATCH 370/394] - fixes lock file deletion Signed-off-by: Vincent Biret --- .../WorkspaceManagement/WorkspaceManagementService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index efca606b81..505e99b7e8 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -245,8 +245,8 @@ public async Task> MigrateFromLockFileAsync(string clientNam wsConfig.Clients.Add(generationConfiguration.ClientClassName, clientConfiguration); var inputConfigurationHash = await GetConfigurationHashAsync(clientConfiguration, "migrated-pending-generate").ConfigureAwait(false); // because it's a migration, we don't want to calculate the exact hash since the description might have changed since the initial generation that created the lock file - apiManifest.ApiDependencies.Add(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency(inputConfigurationHash, new())); - lockManagementService.DeleteLockFile(Path.GetDirectoryName(generationConfiguration.OpenAPIFilePath)!); + apiManifest.ApiDependencies.Add(generationConfiguration.ClientClassName, generationConfiguration.ToApiDependency(inputConfigurationHash, [])); + lockManagementService.DeleteLockFile(Path.Combine(WorkingDirectory, clientConfiguration.OutputPath)); } await workspaceConfigurationStorageService.UpdateWorkspaceConfigurationAsync(wsConfig, apiManifest, cancellationToken).ConfigureAwait(false); return clientsGenerationConfigurations.OfType().Select(static x => x.ClientClassName); @@ -266,6 +266,7 @@ public async Task> MigrateFromLockFileAsync(string clientNam } var generationConfiguration = new GenerationConfiguration(); lockInfo.UpdateGenerationConfigurationFromLock(generationConfiguration); + generationConfiguration.OutputPath = "./" + Path.GetRelativePath(WorkingDirectory, lockFileDirectory); if (!string.IsNullOrEmpty(clientName)) { generationConfiguration.ClientClassName = clientName; From 2a09fdbca88d474bfeaeb58243773fb4a008201b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 12:17:52 -0500 Subject: [PATCH 371/394] - updates message display for migrate command Signed-off-by: Vincent Biret --- src/kiota/Handlers/BaseKiotaCommandHandler.cs | 5 +++++ src/kiota/Handlers/Config/MigrateHandler.cs | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/kiota/Handlers/BaseKiotaCommandHandler.cs b/src/kiota/Handlers/BaseKiotaCommandHandler.cs index 8cc071ff86..32b0baef3a 100644 --- a/src/kiota/Handlers/BaseKiotaCommandHandler.cs +++ b/src/kiota/Handlers/BaseKiotaCommandHandler.cs @@ -243,6 +243,11 @@ _ when string.IsNullOrEmpty(version) => $"Example: kiota show -k {searchTerm} -- DisplayHint("Hint: use the --include-path and --exclude-path options with glob patterns to filter the paths displayed.", example); } } + protected void DisplayGenerateAfterMigrateHint() + { + DisplayHint("Hint: use the generate command to update the client and the manifest requests.", + "Example: kiota client generate"); + } protected void DisplaySearchAddHint() { DisplayHint("Hint: add your own API to the search result https://aka.ms/kiota/addapi."); diff --git a/src/kiota/Handlers/Config/MigrateHandler.cs b/src/kiota/Handlers/Config/MigrateHandler.cs index 1be224cfc8..cb84720b8b 100644 --- a/src/kiota/Handlers/Config/MigrateHandler.cs +++ b/src/kiota/Handlers/Config/MigrateHandler.cs @@ -28,7 +28,7 @@ public override async Task InvokeAsync(InvocationContext context) string clientName = context.ParseResult.GetValueForOption(ClassOption) ?? string.Empty; CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; lockDirectory = NormalizeSlashesInPath(lockDirectory); - var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); + var (loggerFactory, logger) = GetLoggerAndFactory(context, $"./{DescriptionStorageService.KiotaDirectorySegment}"); using (loggerFactory) { try @@ -37,10 +37,11 @@ public override async Task InvokeAsync(InvocationContext context) var clientNames = await workspaceManagementService.MigrateFromLockFileAsync(clientName, lockDirectory, cancellationToken).ConfigureAwait(false); if (!clientNames.Any()) { - logger.LogWarning("no client configuration was migrated"); + DisplayWarning("no client configuration was migrated"); return 1; } - logger.LogInformation("client configurations migrated successfully: {clientNames}", string.Join(", ", clientNames)); + DisplaySuccess($"Client configurations migrated successfully: {string.Join(", ", clientNames)}"); + DisplayGenerateAfterMigrateHint(); return 0; } catch (Exception ex) From a9006bc4d74658a3d878843241fd5891e0af9c24 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 12:18:42 -0500 Subject: [PATCH 372/394] - adds launch configuration for migrate Signed-off-by: Vincent Biret --- .vscode/launch.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index 36465ec859..e5404b0746 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -265,6 +265,20 @@ "console": "internalConsole", "stopAtEntry": false }, + { + "name": "Launch Migrate", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + "program": "${workspaceFolder}/src/kiota/bin/Debug/net8.0/kiota.dll", + "args": ["config", "migrate"], + "cwd": "${workspaceFolder}/samples/msgraph-mail/dotnet", + "console": "internalConsole", + "stopAtEntry": false, + "env": { + "KIOTA_CONFIG_PREVIEW": "true" + } + }, { "name": "Launch Login (github - device)", "type": "coreclr", From 317cd2dbd09774f912d80cd6e4cbd0f17d25bcbb Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 12:22:34 -0500 Subject: [PATCH 373/394] - code linting Signed-off-by: Vincent Biret --- .../WorkspaceManagement/WorkspaceConfigurationStorageService.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs index 636d1e443e..02cb20ca51 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceConfigurationStorageService.cs @@ -1,6 +1,4 @@ using System; -using System.Collections; -using System.Collections.Generic; using System.IO; using System.Security.Cryptography; using System.Text; From 852ad09afd7ae629a9d92d6aa71eb2815a7a4bde Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 14:10:25 -0500 Subject: [PATCH 374/394] - adds tests for lock delete Signed-off-by: Vincent Biret --- .../Extensions/OpenApiDocumentExtensions.cs | 4 ++-- src/Kiota.Builder/KiotaBuilder.cs | 7 +++---- .../WorkspaceManagementService.cs | 8 +++++++- .../Lock/LockManagementServiceTests.cs | 16 ++++++++++++++++ 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/Kiota.Builder/Extensions/OpenApiDocumentExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiDocumentExtensions.cs index dcfdb31c5b..dc46ca6807 100644 --- a/src/Kiota.Builder/Extensions/OpenApiDocumentExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiDocumentExtensions.cs @@ -29,11 +29,11 @@ internal static void InitializeInheritanceIndex(this OpenApiDocument openApiDocu } internal static string? GetAPIRootUrl(this OpenApiDocument openApiDocument, string openAPIFilePath) { - if (openApiDocument == null) return null; + ArgumentNullException.ThrowIfNull(openApiDocument); var candidateUrl = openApiDocument.Servers .GroupBy(static x => x, new OpenApiServerComparer()) //group by protocol relative urls .FirstOrDefault() - ?.OrderByDescending(static x => x?.Url, StringComparer.OrdinalIgnoreCase) // prefer https over http + ?.OrderByDescending(static x => x.Url, StringComparer.OrdinalIgnoreCase) // prefer https over http ?.FirstOrDefault() ?.Url; if (string.IsNullOrEmpty(candidateUrl)) diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index d150c807e0..42b40b2d03 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -355,11 +355,10 @@ internal void FilterPathsByPatterns(OpenApiDocument doc) } internal void SetApiRootUrl() { - var candidateUrl = openApiDocument?.GetAPIRootUrl(config.OpenAPIFilePath); - if (candidateUrl is null) - logger.LogWarning("No server url found in the OpenAPI document. The base url will need to be set when using the client."); - else + if (openApiDocument is not null && openApiDocument.GetAPIRootUrl(config.OpenAPIFilePath) is string candidateUrl) config.ApiRootUrl = candidateUrl; + else + logger.LogWarning("No server url found in the OpenAPI document. The base url will need to be set when using the client."); } private void StopLogAndReset(Stopwatch sw, string prefix) { diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 505e99b7e8..f675f469af 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -237,7 +237,13 @@ public async Task> MigrateFromLockFileAsync(string clientNam ms.Seek(0, SeekOrigin.Begin); msForOpenAPIDocument.Seek(0, SeekOrigin.Begin); var document = await openApiDocumentDownloadService.GetDocumentFromStreamAsync(msForOpenAPIDocument, generationConfiguration, false, cancellationToken).ConfigureAwait(false); - generationConfiguration.ApiRootUrl = document?.GetAPIRootUrl(generationConfiguration.OpenAPIFilePath); + if (document is null) + { + Logger.LogError("The client {ClientName} could not be migrated because the OpenAPI document could not be loaded", generationConfiguration.ClientClassName); + clientsGenerationConfigurations.Remove(generationConfiguration); + continue; + } + generationConfiguration.ApiRootUrl = document.GetAPIRootUrl(generationConfiguration.OpenAPIFilePath); await descriptionStorageService.UpdateDescriptionAsync(generationConfiguration.ClientClassName, ms, string.Empty, cancellationToken).ConfigureAwait(false); var clientConfiguration = new ApiClientConfiguration(generationConfiguration); diff --git a/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs b/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs index df6c5365ab..a00aafe3ff 100644 --- a/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs +++ b/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs @@ -52,4 +52,20 @@ public async Task UsesRelativePaths() await lockManagementService.WriteLockFileAsync(outputDirectory, lockFile); Assert.Equal($"..{Path.DirectorySeparatorChar}information{Path.DirectorySeparatorChar}description.yml", lockFile.DescriptionLocation, StringComparer.OrdinalIgnoreCase); } + [Fact] + public async Task DeletesALock() + { + var lockManagementService = new LockManagementService(); + var descriptionPath = Path.Combine(Path.GetTempPath(), "description.yml"); + var lockFile = new KiotaLock + { + ClientClassName = "foo", + ClientNamespaceName = "bar", + DescriptionLocation = descriptionPath, + }; + var path = Path.GetTempPath(); + await lockManagementService.WriteLockFileAsync(path, lockFile); + lockManagementService.DeleteLockFile(path); + Assert.Null(await lockManagementService.GetLockFromDirectoryAsync(path)); + } } From 3f3437b1dcca7e86b7eaf71c1ee84461fa3a8366 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 1 Mar 2024 14:52:56 -0500 Subject: [PATCH 375/394] - adds unit tests for migration orchestration Signed-off-by: Vincent Biret --- .../ApiClientConfiguration.cs | 3 +- .../DescriptionStorageService.cs | 2 +- .../WorkspaceManagementService.cs | 2 +- .../WorkspaceManagementServiceTests.cs | 85 +++++++++++++++++++ 4 files changed, 89 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs index cf206d7437..46a3f98167 100644 --- a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs @@ -158,7 +158,8 @@ public object Clone() } public void NormalizePaths(string targetDirectory) { - OutputPath = "./" + Path.GetRelativePath(targetDirectory, OutputPath); + if (Path.IsPathRooted(OutputPath)) + OutputPath = "./" + Path.GetRelativePath(targetDirectory, OutputPath); } } #pragma warning restore CA2227 // Collection properties should be read only diff --git a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs index 6facf131b6..1bdd930b69 100644 --- a/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/DescriptionStorageService.cs @@ -9,7 +9,7 @@ namespace Kiota.Builder.WorkspaceManagement; public class DescriptionStorageService { public const string KiotaDirectorySegment = ".kiota"; - private const string DescriptionsSubDirectoryRelativePath = $"{KiotaDirectorySegment}/clients"; + internal const string DescriptionsSubDirectoryRelativePath = $"{KiotaDirectorySegment}/clients"; private readonly string TargetDirectory; public DescriptionStorageService(string targetDirectory) { diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index f675f469af..8ea6d11970 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -244,7 +244,7 @@ public async Task> MigrateFromLockFileAsync(string clientNam continue; } generationConfiguration.ApiRootUrl = document.GetAPIRootUrl(generationConfiguration.OpenAPIFilePath); - await descriptionStorageService.UpdateDescriptionAsync(generationConfiguration.ClientClassName, ms, string.Empty, cancellationToken).ConfigureAwait(false); + await descriptionStorageService.UpdateDescriptionAsync(generationConfiguration.ClientClassName, ms, new Uri(generationConfiguration.OpenAPIFilePath).GetFileExtension(), cancellationToken).ConfigureAwait(false); var clientConfiguration = new ApiClientConfiguration(generationConfiguration); clientConfiguration.NormalizePaths(WorkingDirectory); diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs index cfdb3e0ac2..f02053143d 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs @@ -1,8 +1,10 @@ using System; using System.IO; +using System.Linq; using System.Net.Http; using System.Threading.Tasks; using Kiota.Builder.Configuration; +using Kiota.Builder.Lock; using Kiota.Builder.WorkspaceManagement; using Microsoft.Extensions.Logging; using Moq; @@ -87,6 +89,89 @@ public async Task RemovesAClient() var result = await service.IsClientPresent("clientName"); Assert.False(result); } + [Fact] + public async Task FailsOnMigrateWithoutKiotaConfigMode() + { + var mockLogger = Mock.Of(); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, false, tempPath); + await Assert.ThrowsAsync(() => service.MigrateFromLockFileAsync(string.Empty, tempPath)); + } + [Fact] + public async Task FailsWhenTargetLockDirectoryIsNotSubDirectory() + { + var mockLogger = Mock.Of(); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, true, tempPath); + await Assert.ThrowsAsync(() => service.MigrateFromLockFileAsync(string.Empty, Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()))); + } + [Fact] + public async Task FailsWhenNoLockFilesAreFound() + { + var mockLogger = Mock.Of(); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, true, tempPath); + await Assert.ThrowsAsync(() => service.MigrateFromLockFileAsync(string.Empty, tempPath)); + } + [Fact] + public async Task FailsOnMultipleLockFilesAndClientName() + { + var mockLogger = Mock.Of(); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, true, tempPath); + Directory.CreateDirectory(Path.Combine(tempPath, "client1")); + Directory.CreateDirectory(Path.Combine(tempPath, "client2")); + File.WriteAllText(Path.Combine(tempPath, "client1", LockManagementService.LockFileName), "foo"); + File.WriteAllText(Path.Combine(tempPath, "client2", LockManagementService.LockFileName), "foo"); + await Assert.ThrowsAsync(() => service.MigrateFromLockFileAsync("bar", tempPath)); + } + [Fact] + public async Task MigratesAClient() + { + var mockLogger = Mock.Of(); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, true, tempPath); + var descriptionPath = Path.Combine(tempPath, "description.yml"); + var generationConfiguration = new GenerationConfiguration + { + ClientClassName = "clientName", + OutputPath = Path.Combine(tempPath, "client"), + OpenAPIFilePath = descriptionPath, + ApiRootUrl = "https://graph.microsoft.com", + }; + Directory.CreateDirectory(generationConfiguration.OutputPath); + await File.WriteAllTextAsync(descriptionPath, @$"openapi: 3.0.1 +info: + title: OData Service for namespace microsoft.graph + description: This OData service is located at https://graph.microsoft.com/v1.0 + version: 1.0.1 +servers: + - url: https://localhost:443 +paths: + /enumeration: + get: + responses: + '200': + content: + application/json: + schema: + type: object + properties: + bar: + type: object + properties: + foo: + type: string"); + var classicService = new WorkspaceManagementService(mockLogger, httpClient, false, tempPath); + await classicService.UpdateStateFromConfigurationAsync(generationConfiguration, "foo", [], Stream.Null); + var clientNames = await service.MigrateFromLockFileAsync("clientName", tempPath); + Assert.Single(clientNames); + Assert.Equal("clientName", clientNames.First()); + Assert.False(File.Exists(Path.Combine(tempPath, LockManagementService.LockFileName))); + Assert.True(File.Exists(Path.Combine(tempPath, WorkspaceConfigurationStorageService.ConfigurationFileName))); + Assert.True(File.Exists(Path.Combine(tempPath, WorkspaceConfigurationStorageService.ManifestFileName))); + Assert.True(File.Exists(Path.Combine(tempPath, DescriptionStorageService.DescriptionsSubDirectoryRelativePath, "clientName.yml"))); + } public void Dispose() { From a39f8679f0a58c7b6991d552dc7dd60c27e40ed9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:21:43 +0000 Subject: [PATCH 376/394] Bump the kiota-dependencies group in /it/csharp with 1 update Bumps the kiota-dependencies group in /it/csharp with 1 update: [Microsoft.Kiota.Authentication.Azure](https://github.com/microsoft/kiota-authentication-azure-dotnet). Updates `Microsoft.Kiota.Authentication.Azure` from 1.1.3 to 1.1.4 - [Release notes](https://github.com/microsoft/kiota-authentication-azure-dotnet/releases) - [Changelog](https://github.com/microsoft/kiota-authentication-azure-dotnet/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota-authentication-azure-dotnet/compare/v1.1.3...v1.1.4) --- updated-dependencies: - dependency-name: Microsoft.Kiota.Authentication.Azure dependency-type: direct:production update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/csharp/dotnet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/csharp/dotnet.csproj b/it/csharp/dotnet.csproj index e4ebf7c15d..34c297387e 100644 --- a/it/csharp/dotnet.csproj +++ b/it/csharp/dotnet.csproj @@ -11,7 +11,7 @@ - + From 7497e00d00d03cf12328fd91129f91f362a3f80f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:40:42 +0000 Subject: [PATCH 377/394] Bump python-dateutil from 2.9.0 to 2.9.0.post0 in /it/python Bumps [python-dateutil](https://github.com/dateutil/dateutil) from 2.9.0 to 2.9.0.post0. - [Release notes](https://github.com/dateutil/dateutil/releases) - [Changelog](https://github.com/dateutil/dateutil/blob/master/NEWS) - [Commits](https://github.com/dateutil/dateutil/compare/2.9.0...2.9.0.post0) --- updated-dependencies: - dependency-name: python-dateutil dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 0991e29abb..4ad04c8fe5 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -122,7 +122,7 @@ pycparser==2.21 pyjwt[crypto]==2.8.0 ; python_version >= '3.7' -python-dateutil==2.9.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2' +python-dateutil==2.9.0.post0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2' pywin32==306 ; platform_system == 'Windows' From 6f5eda4d2190fd740d81338055a15b342fd169a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:41:01 +0000 Subject: [PATCH 378/394] Bump pytest from 8.0.2 to 8.1.0 in /it/python Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.0.2 to 8.1.0. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.0.2...8.1.0) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 0991e29abb..a487db2c34 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -42,7 +42,7 @@ pluggy==1.4.0 ; python_version >= '3.7' pylint==3.1.0 -pytest==8.0.2 +pytest==8.1.0 pytest-asyncio==0.23.5 From 3075b8733e26cb5e610c8c277f5ba467319b4e24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:52:23 +0000 Subject: [PATCH 379/394] Bump Microsoft.CodeAnalysis.CSharp from 4.8.0 to 4.9.2 Bumps [Microsoft.CodeAnalysis.CSharp](https://github.com/dotnet/roslyn) from 4.8.0 to 4.9.2. - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) --- updated-dependencies: - dependency-name: Microsoft.CodeAnalysis.CSharp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Kiota.Generated/KiotaGenerated.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kiota.Generated/KiotaGenerated.csproj b/src/Kiota.Generated/KiotaGenerated.csproj index b17d834428..60d1d1715b 100644 --- a/src/Kiota.Generated/KiotaGenerated.csproj +++ b/src/Kiota.Generated/KiotaGenerated.csproj @@ -8,7 +8,7 @@ - + From 4739d35982a90e100de0ca6552960ae24a7f50c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Levert?= Date: Mon, 4 Mar 2024 16:35:17 +0000 Subject: [PATCH 380/394] Review comments. --- specs/cli/client-edit.md | 4 ++-- specs/cli/search.md | 2 +- specs/cli/show.md | 1 - specs/scenarios/telemetry.md | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/specs/cli/client-edit.md b/specs/cli/client-edit.md index 7192c489aa..2e6bcc039c 100644 --- a/specs/cli/client-edit.md +++ b/specs/cli/client-edit.md @@ -18,11 +18,11 @@ Once the `kiota-config.json` file and the API Manifest are updated, the code gen | `--exclude-path \| -e` | No | \*\*/users/\*\* | A glob pattern to exclude paths from generation. Accepts multiple values. Defaults to no value which excludes nothing. | Yes, without its value | | `--language \| -l` | No | csharp | The target language for the generated code files or for the information. | Yes | | `--namespace-name \| -n` | No | Contoso.GraphApp | The namespace of the client class. Defaults to `Microsoft.Graph`. | Yes, without its value | -| `--backing-store \| -b` | No | | Defaults to `false` | Yes, without its value | +| `--backing-store \| -b` | No | | Defaults to `false` | Yes | | `--exclude-backward-compatible \| --ebc` | No | | Whether to exclude the code generated only for backward compatibility reasons or not. Defaults to `false`. | Yes | | `--structured-media-types \| -m` | No | `application/json` |Any valid media type which will match a request body type or a response type in the OpenAPI description. Default are documented [here](https://learn.microsoft.com/en-us/openapi/kiota/using#--structured-mime-types--m). | Yes | | `--skip-generation \| --sg` | No | true | When specified, the generation would be skipped. Defaults to false. | Yes | -| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | Yes | +| `--output \| -o` | No | ./generated/graph/csharp | The output directory or file path for the generated code files. Defaults to `./output`. | Yes, without its value | > [!NOTE] > It is not required to use the CLI to edit clients. It is possible to edit a client by modifying its entry in the `clients` section of the `kiota-config.json` file. See the [kiota-config.json schema](../schemas/kiota-config.json.md) for more information. diff --git a/specs/cli/search.md b/specs/cli/search.md index ddb271f72b..2da4697495 100644 --- a/specs/cli/search.md +++ b/specs/cli/search.md @@ -8,7 +8,7 @@ Search for APIs and their description from various registries. | Parameters | Required | Example | Description | Telemetry | | -- | -- | -- | -- | -- | -| `search-term` | Yes | Graph | The term to search for. | Yes, without its value | +| `search-term` | Yes | github | The term to search for. | Yes, without its value | | `--clear-cache \| --cc` | No | true | Clears any cached data for the current command. Defaults to `False`. | Yes | | `--log-level \| --ll` | No | Critical | The log level to use when logging messages to the main output. Options available: Critical, Debug, Error, Information, None, Trace & Warning. Defaults to `Warning`. | Yes | | `--version \| --v` | No | beta | The version of the OpenAPI document to use | Yes, without its value | diff --git a/specs/cli/show.md b/specs/cli/show.md index d22acf405f..ced7dbfe7f 100644 --- a/specs/cli/show.md +++ b/specs/cli/show.md @@ -21,7 +21,6 @@ Show the API paths tree for an API description. ```bash kiota show -d https://aka.ms/graph/v1.0/openapi.yaml -i **/messages - ``` ```bash diff --git a/specs/scenarios/telemetry.md b/specs/scenarios/telemetry.md index c6a0545131..fad4f250b0 100644 --- a/specs/scenarios/telemetry.md +++ b/specs/scenarios/telemetry.md @@ -82,7 +82,7 @@ The list of commands and their parameters can be found in the [CLI Commands](../ We should offer a way to opt-out of the telemetry collection. This should be done in a very similar way that the `dotnet` CLI does (https://learn.microsoft.com/en-us/dotnet/core/tools/telemetry). To opt out of the telemetry feature, set the KIOTA_CLI_TELEMETRY_OPTOUT environment variable to 1 or true. -Every time the CLI is installed and updated, we should inform the user about the telemetry feature and how to opt-out of it. +Every time the CLI is installed and updated, we should inform the user about the telemetry feature and how to opt-out of it. If the users already opted-out, we should not inform the user and respect their choice. ```bash Telemetry From 474c699541fa2a67a2eceb87bc99f18772c07e60 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 4 Mar 2024 13:19:27 -0500 Subject: [PATCH 381/394] - code linting Signed-off-by: Vincent Biret --- src/kiota/Handlers/KiotaUpdateCommandHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kiota/Handlers/KiotaUpdateCommandHandler.cs b/src/kiota/Handlers/KiotaUpdateCommandHandler.cs index d21b5f71ac..391d2d1f47 100644 --- a/src/kiota/Handlers/KiotaUpdateCommandHandler.cs +++ b/src/kiota/Handlers/KiotaUpdateCommandHandler.cs @@ -70,7 +70,7 @@ public override async Task InvokeAsync(InvocationContext context) DisplaySuccess($"Update of {locks.Length} clients completed successfully"); foreach (var configuration in configurations) DisplayInfoHint(configuration.Language, configuration.OpenAPIFilePath, string.Empty); - if (results.Any(x => x)) + if (Array.Exists(results, static x => x)) DisplayCleanHint("update"); return 0; } From c730593c1a799d6d112a9d01972a9722f83f9d65 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 4 Mar 2024 13:20:19 -0500 Subject: [PATCH 382/394] - generate command implementation Signed-off-by: Vincent Biret --- src/kiota/Handlers/BaseKiotaCommandHandler.cs | 6 +- src/kiota/Handlers/Client/GenerateHandler.cs | 84 +++++++++++++++++++ src/kiota/KiotaClientCommands.cs | 23 ++++- 3 files changed, 108 insertions(+), 5 deletions(-) create mode 100644 src/kiota/Handlers/Client/GenerateHandler.cs diff --git a/src/kiota/Handlers/BaseKiotaCommandHandler.cs b/src/kiota/Handlers/BaseKiotaCommandHandler.cs index 32b0baef3a..f22034eecf 100644 --- a/src/kiota/Handlers/BaseKiotaCommandHandler.cs +++ b/src/kiota/Handlers/BaseKiotaCommandHandler.cs @@ -304,10 +304,10 @@ protected void DisplayInstallHint(LanguageInformation languageInformation, List< languageDependencies.Select(x => " " + string.Format(languageInformation.DependencyInstallCommand, x.Name, x.Version))).ToArray()); } } - protected void DisplayCleanHint(string commandName) + protected void DisplayCleanHint(string commandName, string argumentName = "--clean-output") { - DisplayHint("Hint: to force the generation to overwrite an existing client pass the --clean-output switch.", - $"Example: kiota {commandName} --clean-output"); + DisplayHint($"Hint: to force the generation to overwrite an existing client pass the {argumentName} switch.", + $"Example: kiota {commandName} {argumentName}"); } protected void DisplayInfoAdvancedHint() { diff --git a/src/kiota/Handlers/Client/GenerateHandler.cs b/src/kiota/Handlers/Client/GenerateHandler.cs new file mode 100644 index 0000000000..99f50f83c8 --- /dev/null +++ b/src/kiota/Handlers/Client/GenerateHandler.cs @@ -0,0 +1,84 @@ +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.IO; +using System.Linq; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Kiota.Builder; +using Kiota.Builder.Configuration; +using Kiota.Builder.WorkspaceManagement; +using Microsoft.Extensions.Logging; + +namespace kiota.Handlers.Client; + +internal class GenerateHandler : BaseKiotaCommandHandler +{ + public required Option ClassOption + { + get; init; + } + public required Option RefreshOption + { + get; init; + } + public override async Task InvokeAsync(InvocationContext context) + { + string className = context.ParseResult.GetValueForOption(ClassOption) ?? string.Empty; + bool refresh = context.ParseResult.GetValueForOption(RefreshOption); + CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None; + var (loggerFactory, logger) = GetLoggerAndFactory(context, Configuration.Generation.OutputPath); + using (loggerFactory) + { + await CheckForNewVersionAsync(logger, cancellationToken).ConfigureAwait(false); + logger.AppendInternalTracing(); + logger.LogTrace("configuration: {configuration}", JsonSerializer.Serialize(Configuration, KiotaConfigurationJsonContext.Default.KiotaConfiguration)); + try + { + var workspaceStorageService = new WorkspaceConfigurationStorageService(Directory.GetCurrentDirectory()); + var (config, _) = await workspaceStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + if (config == null) + { + DisplayError("The workspace configuration is missing, please run the init command first."); + return 1; + } + var clientNameWasNotProvided = string.IsNullOrEmpty(className); + foreach (var clientEntry in config + .Clients + .Where(x => clientNameWasNotProvided || x.Key.Equals(className, StringComparison.OrdinalIgnoreCase))) + { + var generationConfiguration = new GenerationConfiguration(); + clientEntry.Value.UpdateGenerationConfigurationFromApiClientConfiguration(generationConfiguration, clientEntry.Key); + generationConfiguration.ClearCache = refresh; + generationConfiguration.ClearCache = refresh; + var builder = new KiotaBuilder(logger, generationConfiguration, httpClient, true); + var result = await builder.GenerateClientAsync(cancellationToken).ConfigureAwait(false); + if (result) + { + DisplaySuccess($"Update of {clientEntry.Key} client completed"); + var manifestPath = $"{GetAbsolutePath(WorkspaceConfigurationStorageService.ManifestFileName)}#{clientEntry.Key}"; + DisplayInfoHint(generationConfiguration.Language, string.Empty, manifestPath); + } + else + { + DisplayWarning($"Update of {clientEntry.Key} skipped, no changes detected"); + DisplayCleanHint("client generate", "--refresh"); + } + } + return 0; + } + catch (Exception ex) + { +#if DEBUG + logger.LogCritical(ex, "error adding the client: {exceptionMessage}", ex.Message); + throw; // so debug tools go straight to the source of the exception when attached +#else + logger.LogCritical("error adding the client: {exceptionMessage}", ex.Message); + return 1; +#endif + } + } + throw new System.NotImplementedException(); + } +} diff --git a/src/kiota/KiotaClientCommands.cs b/src/kiota/KiotaClientCommands.cs index 07a3f998e4..0511a3bec9 100644 --- a/src/kiota/KiotaClientCommands.cs +++ b/src/kiota/KiotaClientCommands.cs @@ -110,8 +110,27 @@ public static Command GetEditCommand() } public static Command GetGenerateCommand() { - var command = new Command("generate", "Generates one or all clients from the Kiota configuration"); - //TODO map the handler + var clientNameOption = GetClientNameOption(false); + var logLevelOption = KiotaHost.GetLogLevelOption(); + var refreshOption = GetRefreshOption(); + var command = new Command("generate", "Generates one or all clients from the Kiota configuration") + { + clientNameOption, + logLevelOption, + refreshOption, + }; + command.Handler = new GenerateHandler + { + ClassOption = clientNameOption, + LogLevelOption = logLevelOption, + RefreshOption = refreshOption, + }; return command; } + private static Option GetRefreshOption() + { + var refresh = new Option("--refresh", "Refreshes the client OpenAPI description before generating the client"); + refresh.AddAlias("--r"); + return refresh; + } } From 2d51ab27fb724a411236baecbe5bdcd66b52d935 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 4 Mar 2024 13:35:27 -0500 Subject: [PATCH 383/394] - adds error message when no client is found Signed-off-by: Vincent Biret --- src/kiota/Handlers/Client/GenerateHandler.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/kiota/Handlers/Client/GenerateHandler.cs b/src/kiota/Handlers/Client/GenerateHandler.cs index 99f50f83c8..570cd1c27e 100644 --- a/src/kiota/Handlers/Client/GenerateHandler.cs +++ b/src/kiota/Handlers/Client/GenerateHandler.cs @@ -44,14 +44,21 @@ public override async Task InvokeAsync(InvocationContext context) return 1; } var clientNameWasNotProvided = string.IsNullOrEmpty(className); - foreach (var clientEntry in config + var clientEntries = config .Clients - .Where(x => clientNameWasNotProvided || x.Key.Equals(className, StringComparison.OrdinalIgnoreCase))) + .Where(x => clientNameWasNotProvided || x.Key.Equals(className, StringComparison.OrdinalIgnoreCase)) + .ToArray(); + if (clientEntries.Length == 0 && !clientNameWasNotProvided) + { + DisplayError($"No client found with the provided name {className}"); + return 1; + } + foreach (var clientEntry in clientEntries) { var generationConfiguration = new GenerationConfiguration(); clientEntry.Value.UpdateGenerationConfigurationFromApiClientConfiguration(generationConfiguration, clientEntry.Key); generationConfiguration.ClearCache = refresh; - generationConfiguration.ClearCache = refresh; + generationConfiguration.CleanOutput = refresh; var builder = new KiotaBuilder(logger, generationConfiguration, httpClient, true); var result = await builder.GenerateClientAsync(cancellationToken).ConfigureAwait(false); if (result) From 79516ebeffb793105ba2a4c32d5f2bc8659a1788 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 4 Mar 2024 13:36:12 -0500 Subject: [PATCH 384/394] - uses original copy of description when refreshing Signed-off-by: Vincent Biret --- src/Kiota.Builder/OpenApiDocumentDownloadService.cs | 2 +- .../WorkspaceManagement/WorkspaceManagementService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Kiota.Builder/OpenApiDocumentDownloadService.cs b/src/Kiota.Builder/OpenApiDocumentDownloadService.cs index 2ff8c3d180..17d06e1a6e 100644 --- a/src/Kiota.Builder/OpenApiDocumentDownloadService.cs +++ b/src/Kiota.Builder/OpenApiDocumentDownloadService.cs @@ -48,7 +48,7 @@ public OpenApiDocumentDownloadService(HttpClient httpClient, ILogger logger) if (useKiotaConfig && config.Operation is ClientOperation.Edit or ClientOperation.Add && workspaceManagementService is not null && - await workspaceManagementService.GetDescriptionCopyAsync(config.ClientClassName, inputPath, cancellationToken).ConfigureAwait(false) is { } descriptionStream) + await workspaceManagementService.GetDescriptionCopyAsync(config.ClientClassName, inputPath, config.CleanOutput, cancellationToken).ConfigureAwait(false) is { } descriptionStream) { Logger.LogInformation("loaded description from the workspace copy"); input = descriptionStream; diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 8ea6d11970..f77b73f0b6 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -123,9 +123,9 @@ public async Task ShouldGenerateAsync(GenerationConfiguration inputConfig, } } - public async Task GetDescriptionCopyAsync(string clientName, string inputPath, CancellationToken cancellationToken = default) + public async Task GetDescriptionCopyAsync(string clientName, string inputPath, bool cleanOutput, CancellationToken cancellationToken = default) { - if (!UseKiotaConfig) + if (!UseKiotaConfig || cleanOutput) return null; return await descriptionStorageService.GetDescriptionAsync(clientName, new Uri(inputPath).GetFileExtension(), cancellationToken).ConfigureAwait(false); } From 0d304fd68596c3f98689a8e758fd5256dcff90c9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 4 Mar 2024 14:27:01 -0500 Subject: [PATCH 385/394] - adds loading include patterns from manifest Signed-off-by: Vincent Biret --- .../Configuration/GenerationConfiguration.cs | 8 +++++++- .../Extensions/OpenApiUrlTreeNodeExtensions.cs | 7 +++++++ src/Kiota.Builder/KiotaBuilder.cs | 5 +++++ .../WorkspaceManagement/ApiClientConfiguration.cs | 11 +++++++++-- src/kiota/Handlers/Client/GenerateHandler.cs | 5 +++-- .../ApiClientConfigurationTests.cs | 15 ++++++++++++++- 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs index 8e95375d1b..0bb711394c 100644 --- a/src/Kiota.Builder/Configuration/GenerationConfiguration.cs +++ b/src/Kiota.Builder/Configuration/GenerationConfiguration.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Text.Json.Nodes; +using Kiota.Builder.Extensions; using Kiota.Builder.Lock; using Microsoft.OpenApi.ApiManifest; @@ -113,6 +114,10 @@ public StructuredMimeTypesCollection StructuredMimeTypes }; public HashSet IncludePatterns { get; set; } = new(0, StringComparer.OrdinalIgnoreCase); public HashSet ExcludePatterns { get; set; } = new(0, StringComparer.OrdinalIgnoreCase); + /// + /// The overrides loaded from the api manifest when refreshing a client, as opposed to the user provided ones. + /// + public HashSet PatternsOverride { get; set; } = new(0, StringComparer.OrdinalIgnoreCase); public bool ClearCache { get; set; @@ -144,6 +149,7 @@ public object Clone() MaxDegreeOfParallelism = MaxDegreeOfParallelism, SkipGeneration = SkipGeneration, Operation = Operation, + PatternsOverride = new(PatternsOverride ?? Enumerable.Empty(), StringComparer.OrdinalIgnoreCase), }; } private static readonly StringIEnumerableDeepComparer comparer = new(); @@ -175,7 +181,7 @@ public ApiDependency ToApiDependency(string configurationHash, Dictionary x.Value.Select(y => new RequestInfo { Method = y.ToUpperInvariant(), UriTemplate = x.Key })).ToList(), + Requests = templatesWithOperations.SelectMany(static x => x.Value.Select(y => new RequestInfo { Method = y.ToUpperInvariant(), UriTemplate = x.Key.DeSanitizeUrlTemplateParameter() })).ToList(), }; return dependency; } diff --git a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs index 00c818a3e8..ea6116804f 100644 --- a/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs +++ b/src/Kiota.Builder/Extensions/OpenApiUrlTreeNodeExtensions.cs @@ -266,6 +266,13 @@ public static string SanitizeParameterNameForUrlTemplate(this string original) .Replace(".", "%2E", StringComparison.OrdinalIgnoreCase) .Replace("~", "%7E", StringComparison.OrdinalIgnoreCase);// - . ~ are invalid uri template character but don't get encoded by Uri.EscapeDataString } + public static string DeSanitizeUrlTemplateParameter(this string original) + { + if (string.IsNullOrEmpty(original)) return original; + return Uri.UnescapeDataString(original.Replace("%2D", "-", StringComparison.OrdinalIgnoreCase) + .Replace("%2E", ".", StringComparison.OrdinalIgnoreCase) + .Replace("%7E", "~", StringComparison.OrdinalIgnoreCase)); + } [GeneratedRegex(@"%[0-9A-F]{2}", RegexOptions.Singleline, 500)] private static partial Regex removePctEncodedCharacters(); public static string SanitizeParameterNameForCodeSymbols(this string original, string replaceEncodedCharactersWith = "") diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 42b40b2d03..b9ae9bf50d 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -321,6 +321,11 @@ internal void FilterPathsByPatterns(OpenApiDocument doc) { var includePatterns = GetFilterPatternsFromConfiguration(config.IncludePatterns); var excludePatterns = GetFilterPatternsFromConfiguration(config.ExcludePatterns); + if (config.PatternsOverride.Count != 0) + { // loading the patterns from the manifest as we don't want to take the user input one and have new operation creep in from the description being updated since last generation + includePatterns = GetFilterPatternsFromConfiguration(config.PatternsOverride); + excludePatterns = []; + } if (includePatterns.Count == 0 && excludePatterns.Count == 0) return; var nonOperationIncludePatterns = includePatterns.Where(static x => x.Value.Count == 0).Select(static x => x.Key).ToList(); diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs index 46a3f98167..a298aef947 100644 --- a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs @@ -4,6 +4,7 @@ using System.Linq; using Kiota.Builder.Configuration; using Kiota.Builder.Lock; +using Microsoft.OpenApi.ApiManifest; namespace Kiota.Builder.WorkspaceManagement; @@ -117,9 +118,9 @@ public ApiClientConfiguration(KiotaLock kiotaLock, string relativeOutputPath) /// /// Generation configuration to update. /// Client name serving as class name. - public void UpdateGenerationConfigurationFromApiClientConfiguration(GenerationConfiguration config, string clientName) + /// The requests to use when updating an existing client. + public void UpdateGenerationConfigurationFromApiClientConfiguration(GenerationConfiguration config, string clientName, IList? requests = default) { - //TODO lock the api manifest as well to have accurate path resolution ArgumentNullException.ThrowIfNull(config); ArgumentException.ThrowIfNullOrEmpty(clientName); config.ClientNamespaceName = ClientNamespaceName; @@ -137,6 +138,12 @@ public void UpdateGenerationConfigurationFromApiClientConfiguration(GenerationCo config.ClientClassName = clientName; config.Serializers.Clear(); config.Deserializers.Clear(); + if (requests is { Count: > 0 }) + { + config.PatternsOverride = requests.Where(static x => !x.Exclude && !string.IsNullOrEmpty(x.Method) && !string.IsNullOrEmpty(x.UriTemplate)) + .Select(static x => $"/{x.UriTemplate}#{x.Method!.ToUpperInvariant()}") + .ToHashSet(); + } } public object Clone() diff --git a/src/kiota/Handlers/Client/GenerateHandler.cs b/src/kiota/Handlers/Client/GenerateHandler.cs index 570cd1c27e..bf8d13a471 100644 --- a/src/kiota/Handlers/Client/GenerateHandler.cs +++ b/src/kiota/Handlers/Client/GenerateHandler.cs @@ -37,7 +37,7 @@ public override async Task InvokeAsync(InvocationContext context) try { var workspaceStorageService = new WorkspaceConfigurationStorageService(Directory.GetCurrentDirectory()); - var (config, _) = await workspaceStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); + var (config, manifest) = await workspaceStorageService.GetWorkspaceConfigurationAsync(cancellationToken).ConfigureAwait(false); if (config == null) { DisplayError("The workspace configuration is missing, please run the init command first."); @@ -56,7 +56,8 @@ public override async Task InvokeAsync(InvocationContext context) foreach (var clientEntry in clientEntries) { var generationConfiguration = new GenerationConfiguration(); - clientEntry.Value.UpdateGenerationConfigurationFromApiClientConfiguration(generationConfiguration, clientEntry.Key); + var requests = !refresh && manifest is not null && manifest.ApiDependencies.TryGetValue(clientEntry.Key, out var value) ? value.Requests : []; + clientEntry.Value.UpdateGenerationConfigurationFromApiClientConfiguration(generationConfiguration, clientEntry.Key, requests); generationConfiguration.ClearCache = refresh; generationConfiguration.CleanOutput = refresh; var builder = new KiotaBuilder(logger, generationConfiguration, httpClient, true); diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/ApiClientConfigurationTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/ApiClientConfigurationTests.cs index eb13ac8f08..130b407c8b 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/ApiClientConfigurationTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/ApiClientConfigurationTests.cs @@ -1,6 +1,7 @@ using System; using Kiota.Builder.Configuration; using Kiota.Builder.WorkspaceManagement; +using Microsoft.OpenApi.ApiManifest; using Xunit; namespace Kiota.Builder.Tests.WorkspaceManagement; @@ -91,7 +92,18 @@ public void UpdatesGenerationConfigurationFromApiClientConfiguration() UsesBackingStore = true, }; var generationConfiguration = new GenerationConfiguration(); - clientConfiguration.UpdateGenerationConfigurationFromApiClientConfiguration(generationConfiguration, "client"); + clientConfiguration.UpdateGenerationConfigurationFromApiClientConfiguration(generationConfiguration, "client", [ + new RequestInfo + { + Method = "GET", + UriTemplate = "path/bar", + }, + new RequestInfo + { + Method = "PATH", + UriTemplate = "path/baz", + }, + ]); Assert.Equal(clientConfiguration.ClientNamespaceName, generationConfiguration.ClientNamespaceName); Assert.Equal(GenerationLanguage.CSharp, generationConfiguration.Language); Assert.Equal(clientConfiguration.DescriptionLocation, generationConfiguration.OpenAPIFilePath); @@ -104,6 +116,7 @@ public void UpdatesGenerationConfigurationFromApiClientConfiguration() Assert.Equal(clientConfiguration.UsesBackingStore, generationConfiguration.UsesBackingStore); Assert.Empty(generationConfiguration.Serializers); Assert.Empty(generationConfiguration.Deserializers); + Assert.Equal(2, generationConfiguration.PatternsOverride.Count); } } From f5a4f897214ea3a84745bc29ca29f0d0bba6ebec Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 4 Mar 2024 14:52:56 -0500 Subject: [PATCH 386/394] - adds additional unit tests for description copy read Signed-off-by: Vincent Biret --- .../WorkspaceManagementServiceTests.cs | 52 +++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs index f02053143d..925e5b0e65 100644 --- a/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs +++ b/tests/Kiota.Builder.Tests/WorkspaceManagement/WorkspaceManagementServiceTests.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Kiota.Builder.Configuration; using Kiota.Builder.Lock; +using Kiota.Builder.Tests.Manifest; using Kiota.Builder.WorkspaceManagement; using Microsoft.Extensions.Logging; using Moq; @@ -33,10 +34,12 @@ public async Task IsClientPresentReturnsFalseOnNoClient(bool usesConfig) var result = await service.IsClientPresent("clientName"); Assert.False(result); } - [InlineData(true)] - [InlineData(false)] + [InlineData(true, true)] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(false, false)] [Theory] - public async Task ShouldGenerateReturnsTrue(bool usesConfig) + public async Task ShouldGenerateReturnsTrue(bool usesConfig, bool cleanOutput) { var mockLogger = Mock.Of(); Directory.CreateDirectory(tempPath); @@ -46,6 +49,7 @@ public async Task ShouldGenerateReturnsTrue(bool usesConfig) ClientClassName = "clientName", OutputPath = tempPath, OpenAPIFilePath = Path.Combine(tempPath, "openapi.yaml"), + CleanOutput = cleanOutput, }; var result = await service.ShouldGenerateAsync(configuration, "foo"); Assert.True(result); @@ -172,6 +176,48 @@ await File.WriteAllTextAsync(descriptionPath, @$"openapi: 3.0.1 Assert.True(File.Exists(Path.Combine(tempPath, WorkspaceConfigurationStorageService.ManifestFileName))); Assert.True(File.Exists(Path.Combine(tempPath, DescriptionStorageService.DescriptionsSubDirectoryRelativePath, "clientName.yml"))); } + [InlineData(true, true)] + [InlineData(true, false)] + [InlineData(false, true)] + [InlineData(false, false)] + [Theory] + public async Task GetsADescription(bool usesConfig, bool cleanOutput) + { + var mockLogger = Mock.Of(); + Directory.CreateDirectory(tempPath); + var service = new WorkspaceManagementService(mockLogger, httpClient, usesConfig, tempPath); + var descriptionPath = Path.Combine(tempPath, $"{DescriptionStorageService.DescriptionsSubDirectoryRelativePath}/clientName.yml"); + var outputPath = Path.Combine(tempPath, "client"); + Directory.CreateDirectory(outputPath); + Directory.CreateDirectory(Path.GetDirectoryName(descriptionPath)); + await File.WriteAllTextAsync(descriptionPath, @$"openapi: 3.0.1 +info: + title: OData Service for namespace microsoft.graph + description: This OData service is located at https://graph.microsoft.com/v1.0 + version: 1.0.1 +servers: + - url: https://localhost:443 +paths: + /enumeration: + get: + responses: + '200': + content: + application/json: + schema: + type: object + properties: + bar: + type: object + properties: + foo: + type: string"); + var descriptionCopy = await service.GetDescriptionCopyAsync("clientName", descriptionPath, cleanOutput); + if (!usesConfig || cleanOutput) + Assert.Null(descriptionCopy); + else + Assert.NotNull(descriptionCopy); + } public void Dispose() { From ae7a1ba655d5a5ec7221e3720ec4576750c16108 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 4 Mar 2024 15:14:31 -0500 Subject: [PATCH 387/394] - removes unused code Signed-off-by: Vincent Biret --- .../ApiClientConfiguration.cs | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs index a298aef947..d47759564f 100644 --- a/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs +++ b/src/Kiota.Builder/WorkspaceManagement/ApiClientConfiguration.cs @@ -93,27 +93,6 @@ public ApiClientConfiguration(GenerationConfiguration config) OutputPath = config.OutputPath; } /// - /// Initializes a new instance of the class from an existing to enable migrations. - /// - /// The kiota lock to migrate. - /// The relative output path to output folder from the configuration file. - public ApiClientConfiguration(KiotaLock kiotaLock, string relativeOutputPath) - { - ArgumentNullException.ThrowIfNull(kiotaLock); - ArgumentNullException.ThrowIfNull(relativeOutputPath); - Language = kiotaLock.Language; - ClientNamespaceName = kiotaLock.ClientNamespaceName; - UsesBackingStore = kiotaLock.UsesBackingStore; - ExcludeBackwardCompatible = kiotaLock.ExcludeBackwardCompatible; - IncludeAdditionalData = kiotaLock.IncludeAdditionalData; - StructuredMimeTypes = kiotaLock.StructuredMimeTypes.ToList(); - IncludePatterns = kiotaLock.IncludePatterns; - ExcludePatterns = kiotaLock.ExcludePatterns; - DescriptionLocation = kiotaLock.DescriptionLocation; - DisabledValidationRules = kiotaLock.DisabledValidationRules; - OutputPath = relativeOutputPath; - } - /// /// Updates the passed configuration with the values from the config file. /// /// Generation configuration to update. From 66aae2caecd65c5f01b3a8610aee2f84a95aae48 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 08:19:59 +0000 Subject: [PATCH 388/394] Bump the kiota-dependencies group in /it/python with 1 update Bumps the kiota-dependencies group in /it/python with 1 update: [microsoft-kiota-serialization-json](https://github.com/microsoft/kiota). Updates `microsoft-kiota-serialization-json` from 1.0.1 to 1.1.0 - [Release notes](https://github.com/microsoft/kiota/releases) - [Changelog](https://github.com/microsoft/kiota/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota/compare/v1.0.1...v1.1.0) --- updated-dependencies: - dependency-name: microsoft-kiota-serialization-json dependency-type: direct:development update-type: version-update:semver-minor dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index 2fab78069b..932f7564a4 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -104,7 +104,7 @@ microsoft-kiota-authentication-azure==1.0.0 microsoft-kiota-http==1.3.1 -microsoft-kiota-serialization-json==1.0.1 +microsoft-kiota-serialization-json==1.1.0 microsoft-kiota-serialization-text==1.0.0 From 5cd6c0345648f4c21aff915a0d83491883bb17f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 08:38:14 +0000 Subject: [PATCH 389/394] Bump the eslint group in /vscode/microsoft-kiota with 2 updates Bumps the eslint group in /vscode/microsoft-kiota with 2 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) and [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser). Updates `@typescript-eslint/eslint-plugin` from 7.1.0 to 7.1.1 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.1/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 7.1.0 to 7.1.1 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: eslint - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: eslint ... Signed-off-by: dependabot[bot] --- vscode/microsoft-kiota/package-lock.json | 88 ++++++++++++------------ vscode/microsoft-kiota/package.json | 4 +- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/vscode/microsoft-kiota/package-lock.json b/vscode/microsoft-kiota/package-lock.json index 8c25b0d6d8..d8f65ff4c8 100644 --- a/vscode/microsoft-kiota/package-lock.json +++ b/vscode/microsoft-kiota/package-lock.json @@ -20,8 +20,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.87.0", - "@typescript-eslint/eslint-plugin": "^7.1.0", - "@typescript-eslint/parser": "^7.1.0", + "@typescript-eslint/eslint-plugin": "^7.1.1", + "@typescript-eslint/parser": "^7.1.1", "@vscode/test-electron": "^2.3.9", "eslint": "^8.57.0", "glob": "^10.3.10", @@ -513,16 +513,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.0.tgz", - "integrity": "sha512-j6vT/kCulhG5wBmGtstKeiVr1rdXE4nk+DT1k6trYkwlrvW9eOF5ZbgKnd/YR6PcM4uTEXa0h6Fcvf6X7Dxl0w==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.1.tgz", + "integrity": "sha512-zioDz623d0RHNhvx0eesUmGfIjzrk18nSBC8xewepKXbBvN/7c1qImV7Hg8TI1URTxKax7/zxfxj3Uph8Chcuw==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/type-utils": "7.1.0", - "@typescript-eslint/utils": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/scope-manager": "7.1.1", + "@typescript-eslint/type-utils": "7.1.1", + "@typescript-eslint/utils": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -548,15 +548,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.0.tgz", - "integrity": "sha512-V1EknKUubZ1gWFjiOZhDSNToOjs63/9O0puCgGS8aDOgpZY326fzFu15QAUjwaXzRZjf/qdsdBrckYdv9YxB8w==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.1.tgz", + "integrity": "sha512-ZWUFyL0z04R1nAEgr9e79YtV5LbafdOtN7yapNbn1ansMyaegl2D4bL7vHoJ4HPSc4CaLwuCVas8CVuneKzplQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/typescript-estree": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/scope-manager": "7.1.1", + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/typescript-estree": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1", "debug": "^4.3.4" }, "engines": { @@ -576,13 +576,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", - "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.1.tgz", + "integrity": "sha512-cirZpA8bJMRb4WZ+rO6+mnOJrGFDd38WoXCEI57+CYBqta8Yc8aJym2i7vyqLL1vVYljgw0X27axkUXz32T8TA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0" + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -593,13 +593,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.0.tgz", - "integrity": "sha512-UZIhv8G+5b5skkcuhgvxYWHjk7FW7/JP5lPASMEUoliAPwIH/rxoUSQPia2cuOj9AmDZmwUl1usKm85t5VUMew==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.1.tgz", + "integrity": "sha512-5r4RKze6XHEEhlZnJtR3GYeCh1IueUHdbrukV2KSlLXaTjuSfeVF8mZUVPLovidCuZfbVjfhi4c0DNSa/Rdg5g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.1.0", - "@typescript-eslint/utils": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.1", + "@typescript-eslint/utils": "7.1.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -620,9 +620,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", - "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.1.tgz", + "integrity": "sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -633,13 +633,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", - "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.1.tgz", + "integrity": "sha512-9ZOncVSfr+sMXVxxca2OJOPagRwT0u/UHikM2Rd6L/aB+kL/QAuTnsv6MeXtjzCJYb8PzrXarypSGIPx3Jemxw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -685,17 +685,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.0.tgz", - "integrity": "sha512-WUFba6PZC5OCGEmbweGpnNJytJiLG7ZvDBJJoUcX4qZYf1mGZ97mO2Mps6O2efxJcJdRNpqweCistDbZMwIVHw==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.1.tgz", + "integrity": "sha512-thOXM89xA03xAE0lW7alstvnyoBUbBX38YtY+zAUcpRPcq9EIhXPuJ0YTv948MbzmKh6e1AUszn5cBFK49Umqg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/scope-manager": "7.1.1", + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/typescript-estree": "7.1.1", "semver": "^7.5.4" }, "engines": { @@ -710,12 +710,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", - "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.1.tgz", + "integrity": "sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", + "@typescript-eslint/types": "7.1.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/vscode/microsoft-kiota/package.json b/vscode/microsoft-kiota/package.json index c4eaf294fc..c72f5009a4 100644 --- a/vscode/microsoft-kiota/package.json +++ b/vscode/microsoft-kiota/package.json @@ -427,8 +427,8 @@ "@types/mocha": "^10.0.6", "@types/node": "20.x", "@types/vscode": "^1.87.0", - "@typescript-eslint/eslint-plugin": "^7.1.0", - "@typescript-eslint/parser": "^7.1.0", + "@typescript-eslint/eslint-plugin": "^7.1.1", + "@typescript-eslint/parser": "^7.1.1", "@vscode/test-electron": "^2.3.9", "eslint": "^8.57.0", "glob": "^10.3.10", From e19232dc85e23188e61a0efdea69c5f790faf595 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 08:56:13 +0000 Subject: [PATCH 390/394] Bump @typescript-eslint/eslint-plugin in /it/typescript Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 7.1.0 to 7.1.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 266 +++++++++++++++++++++++++++++--- it/typescript/package.json | 2 +- 2 files changed, 248 insertions(+), 20 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index 533e8b8a32..e80adeb6ea 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -23,7 +23,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.24", - "@typescript-eslint/eslint-plugin": "^7.1.0", + "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", "eslint": "^8.57.0", @@ -843,16 +843,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.0.tgz", - "integrity": "sha512-j6vT/kCulhG5wBmGtstKeiVr1rdXE4nk+DT1k6trYkwlrvW9eOF5ZbgKnd/YR6PcM4uTEXa0h6Fcvf6X7Dxl0w==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.1.1.tgz", + "integrity": "sha512-zioDz623d0RHNhvx0eesUmGfIjzrk18nSBC8xewepKXbBvN/7c1qImV7Hg8TI1URTxKax7/zxfxj3Uph8Chcuw==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/type-utils": "7.1.0", - "@typescript-eslint/utils": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/scope-manager": "7.1.1", + "@typescript-eslint/type-utils": "7.1.1", + "@typescript-eslint/utils": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -877,6 +877,53 @@ } } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.1.tgz", + "integrity": "sha512-cirZpA8bJMRb4WZ+rO6+mnOJrGFDd38WoXCEI57+CYBqta8Yc8aJym2i7vyqLL1vVYljgw0X27axkUXz32T8TA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.1.tgz", + "integrity": "sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.1.tgz", + "integrity": "sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/parser": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.0.tgz", @@ -923,13 +970,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.0.tgz", - "integrity": "sha512-UZIhv8G+5b5skkcuhgvxYWHjk7FW7/JP5lPASMEUoliAPwIH/rxoUSQPia2cuOj9AmDZmwUl1usKm85t5VUMew==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.1.1.tgz", + "integrity": "sha512-5r4RKze6XHEEhlZnJtR3GYeCh1IueUHdbrukV2KSlLXaTjuSfeVF8mZUVPLovidCuZfbVjfhi4c0DNSa/Rdg5g==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "7.1.0", - "@typescript-eslint/utils": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.1", + "@typescript-eslint/utils": "7.1.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -949,6 +996,88 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.1.tgz", + "integrity": "sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.1.tgz", + "integrity": "sha512-9ZOncVSfr+sMXVxxca2OJOPagRwT0u/UHikM2Rd6L/aB+kL/QAuTnsv6MeXtjzCJYb8PzrXarypSGIPx3Jemxw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.1.tgz", + "integrity": "sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/types": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", @@ -1015,17 +1144,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.0.tgz", - "integrity": "sha512-WUFba6PZC5OCGEmbweGpnNJytJiLG7ZvDBJJoUcX4qZYf1mGZ97mO2Mps6O2efxJcJdRNpqweCistDbZMwIVHw==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.1.1.tgz", + "integrity": "sha512-thOXM89xA03xAE0lW7alstvnyoBUbBX38YtY+zAUcpRPcq9EIhXPuJ0YTv948MbzmKh6e1AUszn5cBFK49Umqg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/typescript-estree": "7.1.0", + "@typescript-eslint/scope-manager": "7.1.1", + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/typescript-estree": "7.1.1", "semver": "^7.5.4" }, "engines": { @@ -1039,6 +1168,105 @@ "eslint": "^8.56.0" } }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.1.tgz", + "integrity": "sha512-cirZpA8bJMRb4WZ+rO6+mnOJrGFDd38WoXCEI57+CYBqta8Yc8aJym2i7vyqLL1vVYljgw0X27axkUXz32T8TA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.1.tgz", + "integrity": "sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.1.tgz", + "integrity": "sha512-9ZOncVSfr+sMXVxxca2OJOPagRwT0u/UHikM2Rd6L/aB+kL/QAuTnsv6MeXtjzCJYb8PzrXarypSGIPx3Jemxw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.1.tgz", + "integrity": "sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "7.1.1", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@typescript-eslint/visitor-keys": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index 077b7c8906..aefb0ed747 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.24", - "@typescript-eslint/eslint-plugin": "^7.1.0", + "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.0", "esbuild": "^0.20.1", "eslint": "^8.57.0", From 026ff7a2fb5bd9eecd7bb162e53e9107469e3961 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:18:26 +0000 Subject: [PATCH 391/394] Bump @typescript-eslint/parser from 7.1.0 to 7.1.1 in /it/typescript Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.1.0 to 7.1.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.1.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- it/typescript/package-lock.json | 258 ++------------------------------ it/typescript/package.json | 2 +- 2 files changed, 16 insertions(+), 244 deletions(-) diff --git a/it/typescript/package-lock.json b/it/typescript/package-lock.json index e80adeb6ea..72ab6d0a82 100644 --- a/it/typescript/package-lock.json +++ b/it/typescript/package-lock.json @@ -24,7 +24,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.24", "@typescript-eslint/eslint-plugin": "^7.1.1", - "@typescript-eslint/parser": "^7.1.0", + "@typescript-eslint/parser": "^7.1.1", "esbuild": "^0.20.1", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", @@ -877,63 +877,16 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.1.tgz", - "integrity": "sha512-cirZpA8bJMRb4WZ+rO6+mnOJrGFDd38WoXCEI57+CYBqta8Yc8aJym2i7vyqLL1vVYljgw0X27axkUXz32T8TA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.1", - "@typescript-eslint/visitor-keys": "7.1.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.1.tgz", - "integrity": "sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "node_modules/@typescript-eslint/parser": { "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.1.tgz", - "integrity": "sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.1.tgz", + "integrity": "sha512-ZWUFyL0z04R1nAEgr9e79YtV5LbafdOtN7yapNbn1ansMyaegl2D4bL7vHoJ4HPSc4CaLwuCVas8CVuneKzplQ==", "dev": true, "dependencies": { + "@typescript-eslint/scope-manager": "7.1.1", "@typescript-eslint/types": "7.1.1", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.1.0.tgz", - "integrity": "sha512-V1EknKUubZ1gWFjiOZhDSNToOjs63/9O0puCgGS8aDOgpZY326fzFu15QAUjwaXzRZjf/qdsdBrckYdv9YxB8w==", - "dev": true, - "dependencies": { - "@typescript-eslint/scope-manager": "7.1.0", - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/typescript-estree": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", + "@typescript-eslint/typescript-estree": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1", "debug": "^4.3.4" }, "engines": { @@ -953,13 +906,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.0.tgz", - "integrity": "sha512-6TmN4OJiohHfoOdGZ3huuLhpiUgOGTpgXNUPJgeZOZR3DnIpdSgtt83RS35OYNNXxM4TScVlpVKC9jyQSETR1A==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.1.tgz", + "integrity": "sha512-cirZpA8bJMRb4WZ+rO6+mnOJrGFDd38WoXCEI57+CYBqta8Yc8aJym2i7vyqLL1vVYljgw0X27axkUXz32T8TA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0" + "@typescript-eslint/types": "7.1.1", + "@typescript-eslint/visitor-keys": "7.1.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -996,7 +949,7 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "node_modules/@typescript-eslint/types": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.1.tgz", "integrity": "sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==", @@ -1009,7 +962,7 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "node_modules/@typescript-eslint/typescript-estree": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.1.tgz", "integrity": "sha512-9ZOncVSfr+sMXVxxca2OJOPagRwT0u/UHikM2Rd6L/aB+kL/QAuTnsv6MeXtjzCJYb8PzrXarypSGIPx3Jemxw==", @@ -1037,88 +990,6 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.1.tgz", - "integrity": "sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.1", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/types": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.0.tgz", - "integrity": "sha512-qTWjWieJ1tRJkxgZYXx6WUYtWlBc48YRxgY2JN1aGeVpkhmnopq+SUC8UEVGNXIvWH7XyuTjwALfG6bFEgCkQA==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.0.tgz", - "integrity": "sha512-k7MyrbD6E463CBbSpcOnwa8oXRdHzH1WiVzOipK3L5KSML92ZKgUBrTlehdi7PEIMT8k0bQixHUGXggPAlKnOQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.0", - "@typescript-eslint/visitor-keys": "7.1.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -1168,65 +1039,7 @@ "eslint": "^8.56.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.1.1.tgz", - "integrity": "sha512-cirZpA8bJMRb4WZ+rO6+mnOJrGFDd38WoXCEI57+CYBqta8Yc8aJym2i7vyqLL1vVYljgw0X27axkUXz32T8TA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.1", - "@typescript-eslint/visitor-keys": "7.1.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.1.1.tgz", - "integrity": "sha512-KhewzrlRMrgeKm1U9bh2z5aoL4s7K3tK5DwHDn8MHv0yQfWFz/0ZR6trrIHHa5CsF83j/GgHqzdbzCXJ3crx0Q==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.1.1.tgz", - "integrity": "sha512-9ZOncVSfr+sMXVxxca2OJOPagRwT0u/UHikM2Rd6L/aB+kL/QAuTnsv6MeXtjzCJYb8PzrXarypSGIPx3Jemxw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.1", - "@typescript-eslint/visitor-keys": "7.1.1", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { + "node_modules/@typescript-eslint/visitor-keys": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.1.tgz", "integrity": "sha512-yTdHDQxY7cSoCcAtiBzVzxleJhkGB9NncSIyMYe2+OGON1ZsP9zOPws/Pqgopa65jvknOjlk/w7ulPlZ78PiLQ==", @@ -1243,47 +1056,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/utils/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.1.0.tgz", - "integrity": "sha512-FhUqNWluiGNzlvnDZiXad4mZRhtghdoKW6e98GoEOYSu5cND+E39rG5KwJMUzeENwm1ztYBRqof8wMLP+wNPIA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "7.1.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", diff --git a/it/typescript/package.json b/it/typescript/package.json index aefb0ed747..fe9d131ffa 100644 --- a/it/typescript/package.json +++ b/it/typescript/package.json @@ -21,7 +21,7 @@ "@es-exec/esbuild-plugin-start": "^0.0.5", "@types/node": "^20.11.24", "@typescript-eslint/eslint-plugin": "^7.1.1", - "@typescript-eslint/parser": "^7.1.0", + "@typescript-eslint/parser": "^7.1.1", "esbuild": "^0.20.1", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", From 06828dbc7f874a1c34bfd8b4d27ee08738234ce9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 5 Mar 2024 13:32:35 -0500 Subject: [PATCH 392/394] - removes unnecessary field Signed-off-by: Vincent Biret --- .../WorkspaceManagement/WorkspaceManagementService.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs index 8ea6d11970..7874db312c 100644 --- a/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs +++ b/src/Kiota.Builder/WorkspaceManagement/WorkspaceManagementService.cs @@ -24,20 +24,18 @@ public class WorkspaceManagementService { private readonly bool UseKiotaConfig; private readonly ILogger Logger; - private readonly HttpClient HttpClient; public WorkspaceManagementService(ILogger logger, HttpClient httpClient, bool useKiotaConfig = false, string workingDirectory = "") { ArgumentNullException.ThrowIfNull(logger); ArgumentNullException.ThrowIfNull(httpClient); Logger = logger; - HttpClient = httpClient; UseKiotaConfig = useKiotaConfig; if (string.IsNullOrEmpty(workingDirectory)) workingDirectory = Directory.GetCurrentDirectory(); WorkingDirectory = workingDirectory; workspaceConfigurationStorageService = new(workingDirectory); descriptionStorageService = new(workingDirectory); - openApiDocumentDownloadService = new(HttpClient, Logger); + openApiDocumentDownloadService = new(httpClient, Logger); } private readonly OpenApiDocumentDownloadService openApiDocumentDownloadService; private readonly LockManagementService lockManagementService = new(); From e4add6219433e2fca0ea1589c6720e5d2e517650 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 08:50:31 +0000 Subject: [PATCH 393/394] Bump the kiota-dependencies group in /it/python with 1 update Bumps the kiota-dependencies group in /it/python with 1 update: [microsoft-kiota-abstractions](https://github.com/microsoft/kiota). Updates `microsoft-kiota-abstractions` from 1.3.0 to 1.3.1 - [Release notes](https://github.com/microsoft/kiota/releases) - [Changelog](https://github.com/microsoft/kiota/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/kiota/commits) --- updated-dependencies: - dependency-name: microsoft-kiota-abstractions dependency-type: direct:development update-type: version-update:semver-patch dependency-group: kiota-dependencies ... Signed-off-by: dependabot[bot] --- it/python/requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it/python/requirements-dev.txt b/it/python/requirements-dev.txt index cc6e4e453f..35d6c6103a 100644 --- a/it/python/requirements-dev.txt +++ b/it/python/requirements-dev.txt @@ -98,7 +98,7 @@ httpx[http2]==0.27.0 hyperframe==6.0.1 ; python_full_version >= '3.6.1' -microsoft-kiota-abstractions==1.3.0 +microsoft-kiota-abstractions==1.3.1 microsoft-kiota-authentication-azure==1.0.0 From 35ce3f8f147a7921cafc692b127bd94d524609c1 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 6 Mar 2024 05:53:44 -0500 Subject: [PATCH 394/394] security/pipeline compliance (#4137) * - removes older compliance tasks Signed-off-by: Vincent Biret * - adds the 1es template Signed-off-by: Vincent Biret * - replaces forbidden tasks Signed-off-by: Vincent Biret * - fixes parameters for publish artifact tasks Signed-off-by: Vincent Biret * - fixes task version Signed-off-by: Vincent Biret * - switches to the required pool Signed-off-by: Vincent Biret * - fixes os name to 1es accepted values Signed-off-by: Vincent Biret * - removes linux agent where possible Signed-off-by: Vincent Biret * - adds note for conversion requirement Signed-off-by: Vincent Biret * - switches to a loop due to 1es limitations Signed-off-by: Vincent Biret * - typo fix Signed-off-by: Vincent Biret * - fixes depends on condition Signed-off-by: Vincent Biret * - adds baseline suppression for app settings stage Signed-off-by: Vincent Biret * - moves the pool to the jobs only Signed-off-by: Vincent Biret * - adds windows pool for source analysis Signed-off-by: Vincent Biret * - adds image information Signed-off-by: Vincent Biret * - adds baseline for all checkout jobs Signed-off-by: Vincent Biret * - fixes indent Signed-off-by: Vincent Biret * - switches macOS steps to regular pipeline pool Signed-off-by: Vincent Biret * - switches to configurable preview branch Signed-off-by: Vincent Biret * - fixes reference to parameter Signed-off-by: Vincent Biret * - fixes condition Signed-off-by: Vincent Biret * - adds missing quotes Signed-off-by: Vincent Biret * - disambiguates artifact upload Signed-off-by: Vincent Biret * - adds iteration over binaries download in deploy step Signed-off-by: Vincent Biret * - indent fix Signed-off-by: Vincent Biret * - improves download titles Signed-off-by: Vincent Biret * - adds request package parent path for compliance Signed-off-by: Vincent Biret * - adds missing SBOM source Signed-off-by: Vincent Biret --------- Signed-off-by: Vincent Biret --- .azure-pipelines/ci-build.yml | 1347 +++++++++++++++-------------- guardian/SDL/common/.gdnbaselines | 28 + guardian/SDL/common/.gdnsuppress | 28 + 3 files changed, 751 insertions(+), 652 deletions(-) create mode 100644 guardian/SDL/common/.gdnbaselines create mode 100644 guardian/SDL/common/.gdnsuppress diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 04e0492407..c5e7a5fcf4 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -21,671 +21,714 @@ trigger: exclude: - "*preview*" # exclude preview tags so we don't publish twice schedules: -- cron: "0 18 * * 4" # 18:00 UTC every Thursday ~ 14:00 EST every Thursday - displayName: Weekly preview - branches: - include: - - main - always: true + - cron: "0 18 * * 4" # 18:00 UTC every Thursday ~ 14:00 EST every Thursday + displayName: Weekly preview + branches: + include: + - main + always: true variables: buildPlatform: "Any CPU" buildConfiguration: "Release" ProductBinPath: '$(Build.SourcesDirectory)\src\kiota\bin\$(BuildConfiguration)' - previewBranch: "refs/heads/main" - -stages: - - stage: build - jobs: - - job: update_appsettings - pool: - vmImage: ubuntu-latest - steps: - - checkout: self - clean: true - submodules: true - - - pwsh: $(Build.SourcesDirectory)/scripts/update-versions.ps1 - displayName: "Update dependencies versions" - - - pwsh: | - New-Item -Path $(Build.ArtifactStagingDirectory)/AppSettings -ItemType Directory -Force -Verbose - Copy-Item $(Build.SourcesDirectory)/src/kiota/appsettings.json $(Build.ArtifactStagingDirectory)/AppSettings/appsettings.json -Force -Verbose - displayName: Prepare staging folder for upload - - - task: PublishBuildArtifacts@1 - displayName: "Publish Artifact: AppSettings" - inputs: - ArtifactName: AppSettings - PathtoPublish: "$(Build.ArtifactStagingDirectory)/AppSettings" - - - job: build - dependsOn: [update_appsettings] - pool: - vmImage: windows-latest # needed for compliance tasks - steps: - - checkout: self - clean: true - submodules: true - - - task: DownloadPipelineArtifact@2 - inputs: - artifact: AppSettings - source: current - targetPath: $(Build.ArtifactStagingDirectory)/AppSettings - - - pwsh: | - Copy-Item $(Build.ArtifactStagingDirectory)/AppSettings/appsettings.json $(Build.SourcesDirectory)/src/kiota/appsettings.json -Force -Verbose - displayName: Copy the appsettings.json - - - task: UseDotNet@2 - displayName: "Use .NET 6" # needed for ESRP signing - inputs: - version: 6.x - - - task: UseDotNet@2 - displayName: "Use .NET 8" - inputs: - version: 8.x - - - task: PoliCheck@2 - displayName: 'Run PoliCheck "/src"' - inputs: - inputType: CmdLine - cmdLineArgs: '/F:$(Build.SourcesDirectory)/src /T:9 /Sev:"1|2" /PE:2 /O:poli_result_src.xml' - - - task: PoliCheck@2 - displayName: 'Run PoliCheck "/tests"' - inputs: - inputType: CmdLine - cmdLineArgs: '/F:$(Build.SourcesDirectory)/tests /T:9 /Sev:"1|2" /PE:2 /O:poli_result_test.xml' - - # Install the nuget tool. - - task: NuGetToolInstaller@0 - displayName: "Use NuGet >=6.1.0" - inputs: - versionSpec: ">=6.1.0" - checkLatest: true - - - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch $(previewBranch) -excludeHeadingDash - displayName: "Set version suffix" - - - pwsh: $(Build.SourcesDirectory)/scripts/update-version-suffix-for-source-generator.ps1 -versionSuffix "$(versionSuffix)" - displayName: "Set version suffix in csproj for generators" - - - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 - displayName: "Get Kiota's version-number from .csproj" - - - pwsh: $(Build.SourcesDirectory)/scripts/get-release-notes.ps1 -version $(artifactVersion) - condition: eq(variables['isPrerelease'], 'false') - displayName: "Get release notes from CHANGELOG.md" - - - pwsh: $(Build.SourcesDirectory)/scripts/get-release-notes.ps1 -version Unreleased - condition: eq(variables['isPrerelease'], 'true') - - # Build the Product project - - task: DotNetCoreCLI@2 - condition: eq(variables['isPrerelease'], 'true') - displayName: "build" - inputs: - projects: '$(Build.SourcesDirectory)\kiota.sln' - arguments: '--configuration $(BuildConfiguration) --no-incremental --version-suffix "$(versionSuffix)"' - - # Build the Product project - - task: DotNetCoreCLI@2 - condition: eq(variables['isPrerelease'], 'false') - displayName: "build" - inputs: - projects: '$(Build.SourcesDirectory)\kiota.sln' - arguments: '--configuration $(BuildConfiguration) --no-incremental' - - # Run the Unit test - - task: DotNetCoreCLI@2 - displayName: "test" - inputs: - command: test - projects: '$(Build.SourcesDirectory)\kiota.sln' - arguments: "--configuration $(BuildConfiguration) --no-build" - - # CredScan - - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3 - displayName: "Run CredScan - Src" - inputs: - toolMajorVersion: "V2" - scanFolder: '$(Build.SourcesDirectory)\src' - debugMode: false - - - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3 - displayName: "Run CredScan - Tests" - inputs: - toolMajorVersion: "V2" - scanFolder: '$(Build.SourcesDirectory)\tests' - debugMode: false - - - task: AntiMalware@3 - displayName: "Run MpCmdRun.exe - ProductBinPath" - inputs: - FileDirPath: "$(ProductBinPath)" - enabled: false - - - task: BinSkim@4 - displayName: "Run BinSkim - Product Binaries" - inputs: - InputType: Basic - AnalyzeTargetGlob: '$(ProductBinPath)\**\kiota.dll' - AnalyzeSymPath: "$(ProductBinPath)" - AnalyzeVerbose: true - AnalyzeHashes: true - AnalyzeEnvironment: true - - - task: PublishSecurityAnalysisLogs@3 - displayName: "Publish Security Analysis Logs" - inputs: - ArtifactName: SecurityLogs - - - task: PostAnalysis@2 - displayName: "Post Analysis" - inputs: - BinSkim: true - CredScan: true - PoliCheck: true - - - task: EsrpCodeSigning@2 - displayName: "ESRP CodeSigning" - inputs: - ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" - FolderPath: src - signConfigType: inlineSignParams - UseMinimatch: true - Pattern: | - **\*.exe - **\*.dll - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ - { - "parameterName": "OpusName", - "parameterValue": "Microsoft" - }, - { - "parameterName": "OpusInfo", - "parameterValue": "http://www.microsoft.com" - }, - { - "parameterName": "FileDigest", - "parameterValue": "/fd \"SHA256\"" - }, + +parameters: + - name: previewBranch + type: string + default: "refs/heads/main" + - name: distributions + type: object + default: + - architecture: "win-x86" + jobPrefix: "win_x86" + os: "windows" + image: "windows-latest" + pool: Azure-Pipelines-1ESPT-ExDShared + - architecture: "win-x64" + jobPrefix: "win_x64" + os: "windows" + image: "windows-latest" + pool: Azure-Pipelines-1ESPT-ExDShared + - architecture: "linux-x64" + jobPrefix: "linux_x64" + os: "linux" + image: "ubuntu-latest" + pool: Azure-Pipelines-1ESPT-ExDShared + - architecture: "osx-x64" + jobPrefix: "osx_x64" + os: "macOS" + image: "macOS-latest" + pool: Azure Pipelines + # MacOS images aren't available in 1ES templates + # https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/onboarding/macos-support + - architecture: "osx-arm64" + jobPrefix: "osx_arm64" + os: "macOS" + image: "macOS-latest" + pool: Azure Pipelines + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + sdl: + sourceAnalysisPool: + name: Azure-Pipelines-1ESPT-ExDShared + os: windows + image: windows-latest + stages: + - stage: build + jobs: + - job: update_appsettings + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: linux + image: ubuntu-latest + templateContext: + sdl: + baseline: + baselineFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnbaselines + suppression: + suppressionFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnsuppress + steps: + - checkout: self + clean: true + submodules: true + + - pwsh: $(Build.SourcesDirectory)/scripts/update-versions.ps1 + displayName: "Update dependencies versions" + + - pwsh: | + New-Item -Path $(Build.ArtifactStagingDirectory)/AppSettings -ItemType Directory -Force -Verbose + Copy-Item $(Build.SourcesDirectory)/src/kiota/appsettings.json $(Build.ArtifactStagingDirectory)/AppSettings/appsettings.json -Force -Verbose + displayName: Prepare staging folder for upload + + - task: 1ES.PublishPipelineArtifact@1 + displayName: "Publish Artifact: AppSettings" + inputs: + artifactName: AppSettings + targetPath: "$(Build.ArtifactStagingDirectory)/AppSettings" + + - job: build + dependsOn: [update_appsettings] + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: windows # needed for compliance tasks + image: windows-latest + templateContext: + sdl: + baseline: + baselineFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnbaselines + suppression: + suppressionFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnsuppress + steps: + - checkout: self + clean: true + submodules: true + + - task: DownloadPipelineArtifact@2 + inputs: + artifact: AppSettings + source: current + targetPath: $(Build.ArtifactStagingDirectory)/AppSettings + + - pwsh: | + Copy-Item $(Build.ArtifactStagingDirectory)/AppSettings/appsettings.json $(Build.SourcesDirectory)/src/kiota/appsettings.json -Force -Verbose + displayName: Copy the appsettings.json + + - task: UseDotNet@2 + displayName: "Use .NET 6" # needed for ESRP signing + inputs: + version: 6.x + + - task: UseDotNet@2 + displayName: "Use .NET 8" + inputs: + version: 8.x + + # Install the nuget tool. + - task: NuGetToolInstaller@0 + displayName: "Use NuGet >=6.1.0" + inputs: + versionSpec: ">=6.1.0" + checkLatest: true + + - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }} -excludeHeadingDash + displayName: "Set version suffix" + + - pwsh: $(Build.SourcesDirectory)/scripts/update-version-suffix-for-source-generator.ps1 -versionSuffix "$(versionSuffix)" + displayName: "Set version suffix in csproj for generators" + + - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 + displayName: "Get Kiota's version-number from .csproj" + + - pwsh: $(Build.SourcesDirectory)/scripts/get-release-notes.ps1 -version $(artifactVersion) + condition: eq(variables['isPrerelease'], 'false') + displayName: "Get release notes from CHANGELOG.md" + + - pwsh: $(Build.SourcesDirectory)/scripts/get-release-notes.ps1 -version Unreleased + condition: eq(variables['isPrerelease'], 'true') + + # Build the Product project + - task: DotNetCoreCLI@2 + condition: eq(variables['isPrerelease'], 'true') + displayName: "build" + inputs: + projects: '$(Build.SourcesDirectory)\kiota.sln' + arguments: '--configuration $(BuildConfiguration) --no-incremental --version-suffix "$(versionSuffix)"' + + # Build the Product project + - task: DotNetCoreCLI@2 + condition: eq(variables['isPrerelease'], 'false') + displayName: "build" + inputs: + projects: '$(Build.SourcesDirectory)\kiota.sln' + arguments: "--configuration $(BuildConfiguration) --no-incremental" + + # Run the Unit test + - task: DotNetCoreCLI@2 + displayName: "test" + inputs: + command: test + projects: '$(Build.SourcesDirectory)\kiota.sln' + arguments: "--configuration $(BuildConfiguration) --no-build" + + - task: EsrpCodeSigning@2 + displayName: "ESRP CodeSigning" + inputs: + ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" + FolderPath: src + signConfigType: inlineSignParams + UseMinimatch: true + Pattern: | + **\*.exe + **\*.dll + inlineOperation: | + [ { - "parameterName": "PageHash", - "parameterValue": "/NPH" + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" }, { - "parameterName": "TimeStamp", - "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" } - ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - - # Pack - - pwsh: dotnet pack $(Build.SourcesDirectory)/src/kiota/kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg --version-suffix "$(versionSuffix)" - condition: eq(variables['isPrerelease'], 'true') - displayName: "pack kiota" - - - pwsh: dotnet pack $(Build.SourcesDirectory)/src/kiota/kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg - condition: eq(variables['isPrerelease'], 'false') - displayName: "pack kiota" - - - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Kiota.Builder/Kiota.Builder.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg --version-suffix "$(versionSuffix)" - condition: eq(variables['isPrerelease'], 'true') - displayName: "pack kiota builder" - - - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Kiota.Builder/Kiota.Builder.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg - condition: eq(variables['isPrerelease'], 'false') - displayName: "pack kiota builder" - - - task: EsrpCodeSigning@2 - displayName: "ESRP CodeSigning Nuget Packages" - inputs: - ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" - FolderPath: "$(Build.ArtifactStagingDirectory)" - UseMinimatch: true - Pattern: "*.nupkg" - signConfigType: inlineSignParams - inlineOperation: | - [ - { - "keyCode": "CP-401405", - "operationSetCode": "NuGetSign", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-401405", - "operationSetCode": "NuGetVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - - - task: CopyFiles@2 - displayName: Prepare staging folder for upload - inputs: - targetFolder: $(Build.ArtifactStagingDirectory)/Nugets - sourceFolder: $(Build.ArtifactStagingDirectory) - content: "*.nupkg" - - - task: PublishBuildArtifacts@1 - displayName: "Publish Artifact: Nugets" - inputs: - ArtifactName: Nugets - PathtoPublish: "$(Build.ArtifactStagingDirectory)/Nugets" - - - - job: build_binaries - dependsOn: [update_appsettings] - pool: - vmImage: $(vmImage) - strategy: - matrix: - win-x86: - architecture: 'win-x86' - vmImage: 'ubuntu-latest' - win-x64: - architecture: 'win-x64' - vmImage: 'ubuntu-latest' - linux-x64: - architecture: 'linux-x64' - vmImage: 'ubuntu-latest' - osx-x64: - architecture: 'osx-x64' - vmImage: 'macOS-latest' - osx-arm64: - architecture: 'osx-arm64' - vmImage: 'macOS-latest' - steps: - - checkout: self - clean: true - submodules: true - - task: UseDotNet@2 - displayName: "Use .NET 6" # needed for ESRP signing - inputs: - version: 6.x - - task: UseDotNet@2 - displayName: "Use .NET 8" - inputs: - version: 8.x - - - task: DownloadPipelineArtifact@2 - inputs: - artifact: AppSettings - source: current - targetPath: $(Build.ArtifactStagingDirectory)/AppSettings - - - pwsh: | - Copy-Item $(Build.ArtifactStagingDirectory)/AppSettings/appsettings.json $(Build.SourcesDirectory)/src/kiota/appsettings.json -Force -Verbose - displayName: Copy the appsettings.json - - - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch $(previewBranch) -excludeHeadingDash - displayName: "Set version suffix" - - - pwsh: $(Build.SourcesDirectory)/scripts/update-version-suffix-for-source-generator.ps1 -versionSuffix "$(versionSuffix)" - displayName: "Set version suffix in csproj for generators" - - - pwsh: dotnet publish src/kiota/kiota.csproj -c Release --runtime $(architecture) -p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/binaries/$(architecture) --version-suffix "$(versionSuffix)" - condition: eq(variables['isPrerelease'], 'true') - displayName: publish kiota as executable - - - pwsh: dotnet publish src/kiota/kiota.csproj -c Release --runtime $(architecture) -p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/binaries/$(architecture) - condition: eq(variables['isPrerelease'], 'false') - displayName: publish kiota as executable - - - task: AzureKeyVault@2 - displayName: "Azure Key Vault: Get Secrets" - inputs: - azureSubscription: "MicrosofGraphKeyVault connection" - KeyVaultName: MicrosofGraphKeyVault - SecretsFilter: "graph-cli-apple-developer-certificate,graph-cli-apple-developer-certificate-password" - condition: and(succeeded(), startsWith(variables['architecture'], 'osx')) - - bash: | - set -e - security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain - security default-keychain -s $(agent.tempdirectory)/buildagent.keychain - security unlock-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain - echo "$(graph-cli-apple-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12 - security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(graph-cli-apple-developer-certificate-password)" -T /usr/bin/codesign - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain - codesign -s 6V7V694XP3 --deep --force --options runtime --entitlements scripts/entitlements.plist $(Build.ArtifactStagingDirectory)/binaries/$(architecture)/kiota - displayName: Set Hardened Entitlements - condition: and(succeeded(), startsWith(variables['architecture'], 'osx')) - - - task: EsrpCodeSigning@2 - condition: and(succeeded(), startsWith(variables['architecture'], 'win')) - inputs: - ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" - FolderPath: $(Build.ArtifactStagingDirectory)/binaries/$(architecture) - signConfigType: inlineSignParams - UseMinimatch: true - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ + ] + SessionTimeout: 20 + + # Pack + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/kiota/kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg --version-suffix "$(versionSuffix)" + condition: eq(variables['isPrerelease'], 'true') + displayName: "pack kiota" + + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/kiota/kiota.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg + condition: eq(variables['isPrerelease'], 'false') + displayName: "pack kiota" + + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Kiota.Builder/Kiota.Builder.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg --version-suffix "$(versionSuffix)" + condition: eq(variables['isPrerelease'], 'true') + displayName: "pack kiota builder" + + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Kiota.Builder/Kiota.Builder.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg + condition: eq(variables['isPrerelease'], 'false') + displayName: "pack kiota builder" + + - task: EsrpCodeSigning@2 + displayName: "ESRP CodeSigning Nuget Packages" + inputs: + ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" + FolderPath: "$(Build.ArtifactStagingDirectory)" + UseMinimatch: true + Pattern: "*.nupkg" + signConfigType: inlineSignParams + inlineOperation: | + [ { - "parameterName": "OpusName", - "parameterValue": "Microsoft" + "keyCode": "CP-401405", + "operationSetCode": "NuGetSign", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" }, { - "parameterName": "OpusInfo", - "parameterValue": "http://www.microsoft.com" - }, - { - "parameterName": "FileDigest", - "parameterValue": "/fd \"SHA256\"" - }, - { - "parameterName": "PageHash", - "parameterValue": "/NPH" - }, - { - "parameterName": "TimeStamp", - "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + "keyCode": "CP-401405", + "operationSetCode": "NuGetVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" } - ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - Pattern: | - **\*.exe - **\*.dll - - pwsh: Remove-Item $(Build.ArtifactStagingDirectory)/binaries/$(architecture)/*.md -Verbose -Force -ErrorAction SilentlyContinue - - task: ArchiveFiles@2 - displayName: Archive binaries - inputs: - rootFolderOrFile: $(Build.ArtifactStagingDirectory)/binaries/$(architecture) - includeRootFolder: false - archiveType: zip - archiveFile: $(Build.ArtifactStagingDirectory)/binaries/$(architecture).zip - replaceExistingArchive: true - - task: EsrpCodeSigning@2 - condition: and(succeeded(), startsWith(variables['architecture'], 'osx')) - inputs: - ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" - FolderPath: $(Build.ArtifactStagingDirectory)/binaries - signConfigType: inlineSignParams - UseMinimatch: true - inlineOperation: | - [ - { - "keyCode": "CP-401337-Apple", - "OperationCode": "MacAppDeveloperSign", - "Parameters": { - "Hardening": "--options=runtime" - }, - "ToolName": "sign", - "ToolVersion": "1.0" - } - ] - SessionTimeout: 20 - Pattern: | - **/*.zip - - task: EsrpCodeSigning@2 - condition: and(succeeded(), startsWith(variables['architecture'], 'osx')) - inputs: - ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" - FolderPath: $(Build.ArtifactStagingDirectory)/binaries - signConfigType: inlineSignParams - UseMinimatch: true - inlineOperation: | - [ - { - "keyCode": "CP-401337-Apple", - "OperationCode": "MacAppNotarize", - "Parameters": { - "BundleId": "com.microsoft.kiota" - }, - "ToolName": "sign", - "ToolVersion": "1.0" - } - ] - SessionTimeout: 20 - Pattern: | - **/*.zip - - task: PublishBuildArtifacts@1 - displayName: "Publish Artifact: binaries" - inputs: - ArtifactName: Binaries - PathToPublish: "$(Build.ArtifactStagingDirectory)/binaries/$(architecture).zip" - - - - job: build_vscode_extension - dependsOn: [build_binaries] - pool: - vmImage: ubuntu-latest - steps: - - checkout: self - clean: true - submodules: true - - task: NodeTool@0 - inputs: - versionSpec: "18.x" - - task: DownloadPipelineArtifact@2 - inputs: - artifact: Binaries - source: current - targetPath: $(Build.ArtifactStagingDirectory)/Binaries - - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch $(previewBranch) - displayName: "Set version suffix" - - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 - displayName: "Get Kiota's version-number from .csproj" - - pwsh: $(Build.SourcesDirectory)/scripts/update-vscode-releases.ps1 -version $(artifactVersion)$(versionSuffix) -filePath $(Build.SourcesDirectory)/vscode/microsoft-kiota/package.json -binaryFolderPath $(Build.ArtifactStagingDirectory)/Binaries - displayName: "Update VSCode extension version-number" - - pwsh: npm i -g @vscode/vsce - displayName: "Install vsce" - - pwsh: npm ci - displayName: "Install dependencies" - workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota - - pwsh: vsce package --pre-release - displayName: "Package VSCode extension as pre-release" - workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota - condition: eq(variables['isPrerelease'], 'true') - - pwsh: vsce package - displayName: "Package VSCode extension as release" - workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota - condition: eq(variables['isPrerelease'], 'false') - - task: CopyFiles@2 - displayName: Prepare staging folder for upload - inputs: - targetFolder: $(Build.ArtifactStagingDirectory)/VSCode - sourceFolder: $(Build.SourcesDirectory)/vscode/microsoft-kiota - contents: "*.vsix" - - task: PublishBuildArtifacts@1 - displayName: "Publish Artifact: VSCode" - inputs: - ArtifactName: VSCode - PathToPublish: "$(Build.ArtifactStagingDirectory)/VSCode" - - - stage: deploy - condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], variables['previewBranch'])), succeeded()) - dependsOn: build - jobs: - - job: vs_marketplace - variables: - - group: kiota-vscode-extension-publish - dependsOn: - - github_release - pool: - vmImage: ubuntu-latest - steps: - - download: none - - checkout: self - clean: true - submodules: true - - task: DownloadPipelineArtifact@2 - inputs: - artifact: VSCode - source: current - - task: NodeTool@0 - inputs: - versionSpec: "18.x" - - pwsh: npm i -g @vscode/vsce - - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch $(previewBranch) - displayName: "Set version suffix" - - pwsh: | - Get-ChildItem -Path $(Pipeline.Workspace) -Filter *.vsix -Recurse | ForEach-Object { - Write-Host "Publishing $_.FullName" - if ($Env:isPrerelease -eq "true") { - Write-Host "Publishing $_.FullName as a pre-release" - vsce publish --pat "$(vs-marketplace-token)" --packagePath $_.FullName --pre-release - } - else { - Write-Host "Publishing $_.FullName as a release" - vsce publish --pat "$(vs-marketplace-token)" --packagePath $_.FullName - } - } - env: - isPrerelease: $(isPrerelease) - - deployment: github_release - dependsOn: [] - environment: kiota-github-releases - pool: - vmImage: ubuntu-latest - strategy: - runOnce: - deploy: - steps: - - download: none - - checkout: self - clean: true - submodules: true - - task: DownloadPipelineArtifact@2 - inputs: - artifact: Binaries - source: current - - task: DownloadPipelineArtifact@2 - inputs: - artifact: VSCode - source: current + ] + SessionTimeout: 20 + + - task: CopyFiles@2 + displayName: Prepare staging folder for upload + inputs: + targetFolder: $(Build.ArtifactStagingDirectory)/Nugets + sourceFolder: $(Build.ArtifactStagingDirectory) + content: "*.nupkg" + + - task: 1ES.PublishPipelineArtifact@1 + displayName: "Publish Artifact: Nugets" + inputs: + artifactName: Nugets + targetPath: "$(Build.ArtifactStagingDirectory)/Nugets" + + # using a loop instead of a matrix due to 1ES template limitations + # https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/1es-pipeline-templates/faqs + - ${{ each distribution in parameters.distributions }}: + - job: ${{ distribution.jobPrefix }}_build_binaries + dependsOn: [update_appsettings] + pool: + name: ${{ distribution.pool }} + os: ${{ distribution.os }} + image: ${{ distribution.image }} + templateContext: + sdl: + baseline: + baselineFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnbaselines + suppression: + suppressionFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnsuppress + + steps: + - checkout: self + clean: true + submodules: true + - task: UseDotNet@2 + displayName: "Use .NET 6" # needed for ESRP signing + inputs: + version: 6.x + - task: UseDotNet@2 + displayName: "Use .NET 8" + inputs: + version: 8.x + + - task: DownloadPipelineArtifact@2 + inputs: + artifact: AppSettings + source: current + targetPath: $(Build.ArtifactStagingDirectory)/AppSettings + + - pwsh: | + Copy-Item $(Build.ArtifactStagingDirectory)/AppSettings/appsettings.json $(Build.SourcesDirectory)/src/kiota/appsettings.json -Force -Verbose + displayName: Copy the appsettings.json + + - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }} -excludeHeadingDash + displayName: "Set version suffix" + + - pwsh: $(Build.SourcesDirectory)/scripts/update-version-suffix-for-source-generator.ps1 -versionSuffix "$(versionSuffix)" + displayName: "Set version suffix in csproj for generators" + + - pwsh: dotnet publish src/kiota/kiota.csproj -c Release --runtime ${{ distribution.architecture }} -p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }} --version-suffix "$(versionSuffix)" + condition: eq(variables['isPrerelease'], 'true') + displayName: publish kiota as executable + + - pwsh: dotnet publish src/kiota/kiota.csproj -c Release --runtime ${{ distribution.architecture }} -p:PublishSingleFile=true --self-contained --output $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }} + condition: eq(variables['isPrerelease'], 'false') + displayName: publish kiota as executable + + - task: AzureKeyVault@2 + displayName: "Azure Key Vault: Get Secrets" + inputs: + azureSubscription: "MicrosofGraphKeyVault connection" + KeyVaultName: MicrosofGraphKeyVault + SecretsFilter: "graph-cli-apple-developer-certificate,graph-cli-apple-developer-certificate-password" + condition: and(succeeded(), startsWith('${{ distribution.architecture }}', 'osx')) + - bash: | + set -e + security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain + security default-keychain -s $(agent.tempdirectory)/buildagent.keychain + security unlock-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain + echo "$(graph-cli-apple-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12 + security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(graph-cli-apple-developer-certificate-password)" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain + codesign -s 6V7V694XP3 --deep --force --options runtime --entitlements scripts/entitlements.plist $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }}/kiota + displayName: Set Hardened Entitlements + condition: and(succeeded(), startsWith('${{ distribution.architecture }}', 'osx')) + + - task: EsrpCodeSigning@2 + condition: and(succeeded(), startsWith('${{ distribution.architecture }}', 'win')) + inputs: + ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" + FolderPath: $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }} + signConfigType: inlineSignParams + UseMinimatch: true + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + Pattern: | + **\*.exe + **\*.dll + - pwsh: Remove-Item $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }}/*.md -Verbose -Force -ErrorAction SilentlyContinue + - task: ArchiveFiles@2 + displayName: Archive binaries + inputs: + rootFolderOrFile: $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }} + includeRootFolder: false + archiveType: zip + archiveFile: $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }}.zip + replaceExistingArchive: true + - task: EsrpCodeSigning@2 + condition: and(succeeded(), startsWith('${{ distribution.architecture }}', 'osx')) + inputs: + ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" + FolderPath: $(Build.ArtifactStagingDirectory)/binaries + signConfigType: inlineSignParams + UseMinimatch: true + inlineOperation: | + [ + { + "keyCode": "CP-401337-Apple", + "OperationCode": "MacAppDeveloperSign", + "Parameters": { + "Hardening": "--options=runtime" + }, + "ToolName": "sign", + "ToolVersion": "1.0" + } + ] + SessionTimeout: 20 + Pattern: | + **/*.zip + - task: EsrpCodeSigning@2 + condition: and(succeeded(), startsWith('${{ distribution.architecture }}', 'osx')) + inputs: + ConnectedServiceName: "microsoftgraph ESRP CodeSign DLL and NuGet (AKV)" + FolderPath: $(Build.ArtifactStagingDirectory)/binaries + signConfigType: inlineSignParams + UseMinimatch: true + inlineOperation: | + [ + { + "keyCode": "CP-401337-Apple", + "OperationCode": "MacAppNotarize", + "Parameters": { + "BundleId": "com.microsoft.kiota" + }, + "ToolName": "sign", + "ToolVersion": "1.0" + } + ] + SessionTimeout: 20 + Pattern: | + **/*.zip + - task: 1ES.PublishPipelineArtifact@1 + displayName: "Publish Artifact: binaries" + inputs: + artifactName: Binaries_${{ distribution.jobPrefix }} + sbomBuildDropPath: $(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }} + targetPath: "$(Build.ArtifactStagingDirectory)/binaries/${{ distribution.architecture }}.zip" + + - job: build_vscode_extension + dependsOn: + [ + win_x64_build_binaries, + win_x86_build_binaries, + linux_x64_build_binaries, + osx_x64_build_binaries, + osx_arm64_build_binaries, + ] + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: linux + image: ubuntu-latest + templateContext: + sdl: + baseline: + baselineFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnbaselines + suppression: + suppressionFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnsuppress + steps: + - checkout: self + clean: true + submodules: true + - task: NodeTool@0 + inputs: + versionSpec: "18.x" + - ${{ each distribution in parameters.distributions }}: - task: DownloadPipelineArtifact@2 + displayName: Download ${{ distribution.jobPrefix }} binaries from artifacts inputs: - artifact: Nugets + artifact: Binaries_${{ distribution.jobPrefix }} source: current - - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch $(previewBranch) - displayName: "Set version suffix" - - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 - displayName: "Get Kiota's version-number from .csproj" - - pwsh: $(Build.SourcesDirectory)/scripts/get-release-notes.ps1 -version $(artifactVersion) -createNotes - condition: eq(variables['isPrerelease'], 'false') - displayName: "Get release notes from CHANGELOG.md" - - pwsh: $(Build.SourcesDirectory)/scripts/get-release-notes.ps1 -version Unreleased -createNotes - condition: eq(variables['isPrerelease'], 'true') - displayName: "Get release notes from CHANGELOG.md" - - task: GitHubRelease@1 - condition: eq(variables['isPrerelease'], 'false') - inputs: - gitHubConnection: 'microsoftkiota' - tagSource: userSpecifiedTag - tag: 'v$(artifactVersion)' - title: 'v$(artifactVersion)' - releaseNotesSource: filePath - releaseNotesFilePath: $(Build.SourcesDirectory)/release-notes.txt - assets: | - $(Pipeline.Workspace)/*.zip - $(Pipeline.Workspace)/*.vsix - $(Pipeline.Workspace)/*.nupkg - $(Pipeline.Workspace)/*.snupkg - addChangeLog: false - - task: GitHubRelease@1 - condition: eq(variables['isPrerelease'], 'true') - inputs: - gitHubConnection: 'microsoftkiota' - tagSource: userSpecifiedTag - tag: 'v$(artifactVersion)$(versionSuffix)' - title: 'v$(artifactVersion)$(versionSuffix)' - releaseNotesSource: filePath - releaseNotesFilePath: $(Build.SourcesDirectory)/release-notes.txt - assets: | - $(Pipeline.Workspace)/*.zip - $(Pipeline.Workspace)/*.vsix - $(Pipeline.Workspace)/*.nupkg - $(Pipeline.Workspace)/*.snupkg - addChangeLog: false - isPreRelease: true - - - deployment: deploy_kiota - dependsOn: [] - environment: nuget-org - pool: - vmImage: ubuntu-latest - strategy: - runOnce: - deploy: - steps: - - download: none - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - - powershell: | - Remove-Item "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.Builder.*.nupkg" -Verbose - displayName: remove other nupkgs to avoid duplication - - task: NuGetCommand@2 - displayName: "NuGet push" - inputs: - command: push - packagesToPush: "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.*.nupkg" - nuGetFeedType: external - publishFeedCredentials: "OpenAPI Nuget Connection" - - - deployment: deploy_builder - dependsOn: [] - environment: nuget-org - pool: - vmImage: ubuntu-latest - strategy: - runOnce: - deploy: - steps: - - download: none - - task: DownloadPipelineArtifact@2 - displayName: Download nupkg from artifacts - inputs: - artifact: Nugets - source: current - - powershell: | - Remove-Item "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.*.nupkg" -Verbose -Exclude "*.Builder.*" - displayName: remove other nupkgs to avoid duplication - - task: NuGetCommand@2 - displayName: "NuGet push" - inputs: - command: push - packagesToPush: "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.Builder.*.nupkg" - nuGetFeedType: external - publishFeedCredentials: "OpenAPI Nuget Connection" + targetPath: $(Build.ArtifactStagingDirectory)/Binaries + - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }} + displayName: "Set version suffix" + - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 + displayName: "Get Kiota's version-number from .csproj" + - pwsh: $(Build.SourcesDirectory)/scripts/update-vscode-releases.ps1 -version $(artifactVersion)$(versionSuffix) -filePath $(Build.SourcesDirectory)/vscode/microsoft-kiota/package.json -binaryFolderPath $(Build.ArtifactStagingDirectory)/Binaries + displayName: "Update VSCode extension version-number" + - pwsh: npm i -g @vscode/vsce + displayName: "Install vsce" + - pwsh: npm ci + displayName: "Install dependencies" + workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota + - pwsh: vsce package --pre-release + displayName: "Package VSCode extension as pre-release" + workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota + condition: eq(variables['isPrerelease'], 'true') + - pwsh: vsce package + displayName: "Package VSCode extension as release" + workingDirectory: $(Build.SourcesDirectory)/vscode/microsoft-kiota + condition: eq(variables['isPrerelease'], 'false') + - task: CopyFiles@2 + displayName: Prepare staging folder for upload + inputs: + targetFolder: $(Build.ArtifactStagingDirectory)/VSCode + sourceFolder: $(Build.SourcesDirectory)/vscode/microsoft-kiota + contents: "*.vsix" + - task: 1ES.PublishPipelineArtifact@1 + displayName: "Publish Artifact: VSCode" + inputs: + artifactName: VSCode + targetPath: "$(Build.ArtifactStagingDirectory)/VSCode" + + - stage: deploy + condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}')), succeeded()) + dependsOn: build + jobs: + - job: vs_marketplace + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: linux + image: ubuntu-latest + templateContext: + sdl: + baseline: + baselineFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnbaselines + suppression: + suppressionFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnsuppress + variables: + - group: kiota-vscode-extension-publish + dependsOn: + - github_release + steps: + - download: none + - checkout: self + clean: true + submodules: true + - task: DownloadPipelineArtifact@2 + inputs: + artifact: VSCode + source: current + - task: NodeTool@0 + inputs: + versionSpec: "18.x" + - pwsh: npm i -g @vscode/vsce + - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }} + displayName: "Set version suffix" + - pwsh: | + Get-ChildItem -Path $(Pipeline.Workspace) -Filter *.vsix -Recurse | ForEach-Object { + Write-Host "Publishing $_.FullName" + if ($Env:isPrerelease -eq "true") { + Write-Host "Publishing $_.FullName as a pre-release" + vsce publish --pat "$(vs-marketplace-token)" --packagePath $_.FullName --pre-release + } + else { + Write-Host "Publishing $_.FullName as a release" + vsce publish --pat "$(vs-marketplace-token)" --packagePath $_.FullName + } + } + env: + isPrerelease: $(isPrerelease) + - deployment: github_release + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: linux + image: ubuntu-latest + templateContext: + sdl: + baseline: + baselineFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnbaselines + suppression: + suppressionFile: $(Build.SourcesDirectory)/guardian/SDL/common/.gdnsuppress + dependsOn: [] + environment: kiota-github-releases + strategy: + runOnce: + deploy: + steps: + - download: none + - checkout: self + clean: true + submodules: true + - ${{ each distribution in parameters.distributions }}: + - task: DownloadPipelineArtifact@2 + displayName: Download ${{ distribution.jobPrefix }} binaries from artifacts + inputs: + artifact: Binaries_${{ distribution.jobPrefix }} + source: current + - task: DownloadPipelineArtifact@2 + inputs: + artifact: VSCode + source: current + - task: DownloadPipelineArtifact@2 + inputs: + artifact: Nugets + source: current + - pwsh: $(Build.SourcesDirectory)/scripts/get-prerelease-version.ps1 -currentBranch $(Build.SourceBranch) -previewBranch ${{ parameters.previewBranch }} + displayName: "Set version suffix" + - pwsh: $(Build.SourcesDirectory)/scripts/get-version-from-csproj.ps1 + displayName: "Get Kiota's version-number from .csproj" + - pwsh: $(Build.SourcesDirectory)/scripts/get-release-notes.ps1 -version $(artifactVersion) -createNotes + condition: eq(variables['isPrerelease'], 'false') + displayName: "Get release notes from CHANGELOG.md" + - pwsh: $(Build.SourcesDirectory)/scripts/get-release-notes.ps1 -version Unreleased -createNotes + condition: eq(variables['isPrerelease'], 'true') + displayName: "Get release notes from CHANGELOG.md" + - task: GitHubRelease@1 + condition: eq(variables['isPrerelease'], 'false') + inputs: + gitHubConnection: "microsoftkiota" + tagSource: userSpecifiedTag + tag: "v$(artifactVersion)" + title: "v$(artifactVersion)" + releaseNotesSource: filePath + releaseNotesFilePath: $(Build.SourcesDirectory)/release-notes.txt + assets: | + $(Pipeline.Workspace)/*.zip + $(Pipeline.Workspace)/*.vsix + $(Pipeline.Workspace)/*.nupkg + $(Pipeline.Workspace)/*.snupkg + addChangeLog: false + - task: GitHubRelease@1 + condition: eq(variables['isPrerelease'], 'true') + inputs: + gitHubConnection: "microsoftkiota" + tagSource: userSpecifiedTag + tag: "v$(artifactVersion)$(versionSuffix)" + title: "v$(artifactVersion)$(versionSuffix)" + releaseNotesSource: filePath + releaseNotesFilePath: $(Build.SourcesDirectory)/release-notes.txt + assets: | + $(Pipeline.Workspace)/*.zip + $(Pipeline.Workspace)/*.vsix + $(Pipeline.Workspace)/*.nupkg + $(Pipeline.Workspace)/*.snupkg + addChangeLog: false + isPreRelease: true + + - deployment: deploy_kiota + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: linux + image: ubuntu-latest + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + steps: + - download: none + - task: DownloadPipelineArtifact@2 + displayName: Download nupkg from artifacts + inputs: + artifact: Nugets + source: current + - powershell: | + Remove-Item "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.Builder.*.nupkg" -Verbose + displayName: remove other nupkgs to avoid duplication + - task: 1ES.PublishNuget@1 + displayName: "NuGet push" + inputs: + packagesToPush: "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.*.nupkg" + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: "OpenAPI Nuget Connection" + + - deployment: deploy_builder + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: linux + image: ubuntu-latest + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + steps: + - download: none + - task: DownloadPipelineArtifact@2 + displayName: Download nupkg from artifacts + inputs: + artifact: Nugets + source: current + - powershell: | + Remove-Item "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.*.nupkg" -Verbose -Exclude "*.Builder.*" + displayName: remove other nupkgs to avoid duplication + - task: 1ES.PublishNuget@1 + displayName: "NuGet push" + inputs: + packagesToPush: "$(Pipeline.Workspace)/Microsoft.OpenApi.Kiota.Builder.*.nupkg" + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: "OpenAPI Nuget Connection" diff --git a/guardian/SDL/common/.gdnbaselines b/guardian/SDL/common/.gdnbaselines new file mode 100644 index 0000000000..1231ed2191 --- /dev/null +++ b/guardian/SDL/common/.gdnbaselines @@ -0,0 +1,28 @@ +{ + "hydrated": true, + "properties": { + "helpUri": "https://eng.ms/docs/microsoft-security/security/azure-security/cloudai-security-fundamentals-engineering/security-integration/guardian-wiki/microsoft-guardian/general/baselines", + "hydrationStatus": "This file contains identifying data. It is **NOT** safe to check into your repo. To dehydrate this file, run `guardian dehydrate --help` and follow the guidance." + }, + "version": "1.0.0", + "baselines": { + "default": { + "name": "default", + "createdDate": "2024-02-06 16:30:49Z", + "lastUpdatedDate": "2024-02-06 16:30:49Z" + } + }, + "results": { + "b3736a918ff8d688843a2c76bfce1661c484e260144140c9df23f1147da102c0": { + "signature": "b3736a918ff8d688843a2c76bfce1661c484e260144140c9df23f1147da102c0", + "alternativeSignatures": [], + "target": "spotbugs.xml", + "memberOf": [ + "default" + ], + "tool": "spotbugs", + "ruleId": "gdn.unknownFormatResult", + "createdDate": "2024-02-06 16:30:49Z" + } + } +} \ No newline at end of file diff --git a/guardian/SDL/common/.gdnsuppress b/guardian/SDL/common/.gdnsuppress new file mode 100644 index 0000000000..a699b50b61 --- /dev/null +++ b/guardian/SDL/common/.gdnsuppress @@ -0,0 +1,28 @@ +{ + "hydrated": true, + "properties": { + "helpUri": "https://eng.ms/docs/microsoft-security/security/azure-security/cloudai-security-fundamentals-engineering/security-integration/guardian-wiki/microsoft-guardian/general/suppressions", + "hydrationStatus": "This file contains identifying data. It is **NOT** safe to check into your repo. To dehydrate this file, run `guardian dehydrate --help` and follow the guidance." + }, + "version": "1.0.0", + "suppressionSets": { + "default": { + "name": "default", + "createdDate": "2024-02-06 16:30:49Z", + "lastUpdatedDate": "2024-02-06 16:30:49Z" + } + }, + "results": { + "b3736a918ff8d688843a2c76bfce1661c484e260144140c9df23f1147da102c0": { + "signature": "b3736a918ff8d688843a2c76bfce1661c484e260144140c9df23f1147da102c0", + "alternativeSignatures": [], + "target": "spotbugs.xml", + "memberOf": [ + "default" + ], + "tool": "spotbugs", + "ruleId": "gdn.unknownFormatResult", + "createdDate": "2024-02-06 16:30:49Z" + } + } +} \ No newline at end of file