-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds kiota client edit command #4294
Conversation
When editing a client, the subsequent run loses some parameters. For instance, using the following :
My PostsClient2.cs file looks like this: // <auto-generated/>
using KiotaPosts.Client.Posts;
using Microsoft.Kiota.Abstractions.Extensions;
using Microsoft.Kiota.Abstractions;
using Microsoft.Kiota.Serialization.Form;
using Microsoft.Kiota.Serialization.Json;
using Microsoft.Kiota.Serialization.Multipart;
using Microsoft.Kiota.Serialization.Text;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System;
namespace KiotaPosts.Client {
/// <summary>
/// The main entry point of the SDK, exposes the configuration and the fluent API.
/// </summary>
public class PostsClient2 : BaseRequestBuilder {
/// <summary>The posts property</summary>
public PostsRequestBuilder Posts { get =>
new PostsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>
/// Instantiates a new <see cref="PostsClient2"/> and sets the default values.
/// </summary>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public PostsClient2(IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}", new Dictionary<string, object>()) {
ApiClientBuilder.RegisterDefaultSerializer<JsonSerializationWriterFactory>();
ApiClientBuilder.RegisterDefaultSerializer<TextSerializationWriterFactory>();
ApiClientBuilder.RegisterDefaultSerializer<FormSerializationWriterFactory>();
ApiClientBuilder.RegisterDefaultSerializer<MultipartSerializationWriterFactory>();
ApiClientBuilder.RegisterDefaultDeserializer<JsonParseNodeFactory>();
ApiClientBuilder.RegisterDefaultDeserializer<TextParseNodeFactory>();
ApiClientBuilder.RegisterDefaultDeserializer<FormParseNodeFactory>();
if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) {
RequestAdapter.BaseUrl = "https://jsonplaceholder.typicode.com";
}
PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl);
}
}
} When running then this:
My // <auto-generated/>
using KiotaPosts.Client.Edit.Posts;
using Microsoft.Kiota.Abstractions.Extensions;
using Microsoft.Kiota.Abstractions;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System;
namespace KiotaPosts.Client.Edit {
/// <summary>
/// The main entry point of the SDK, exposes the configuration and the fluent API.
/// </summary>
public class PostsClient2 : BaseRequestBuilder {
/// <summary>The posts property</summary>
public PostsRequestBuilder Posts { get =>
new PostsRequestBuilder(PathParameters, RequestAdapter);
}
/// <summary>
/// Instantiates a new <see cref="PostsClient2"/> and sets the default values.
/// </summary>
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
public PostsClient2(IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}", new Dictionary<string, object>()) {
if (string.IsNullOrEmpty(RequestAdapter.BaseUrl)) {
RequestAdapter.BaseUrl = "https://jsonplaceholder.typicode.com";
}
PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl);
}
}
} And I now get serializers registrations error:
|
When using the same name of the client in different casing, it works. Should we consider this a "good thing" or a "bad thing"? I don't know what the implications could be but it feels a little bit scary IMO. {
"version": "1.0.0",
"clients": {
"PostsClient": {
"descriptionLocation": "https://raw.githubusercontent.com/sebastienlevert/jsonplaceholder-api/main/openapi.yaml",
"language": "CSharp",
"structuredMimeTypes": [
"application/json",
"text/plain;q=0.9",
"application/x-www-form-urlencoded;q=0.2",
"multipart/form-data;q=0.1"
],
"includePatterns": [],
"excludePatterns": [],
"outputPath": "./dotnet/generated/posts",
"clientNamespaceName": "KiotaPosts.Client.Edit2",
"usesBackingStore": false,
"includeAdditionalData": true,
"excludeBackwardCompatible": false,
"disabledValidationRules": []
},
"postsClient": {
"descriptionLocation": "https://raw.githubusercontent.com/sebastienlevert/jsonplaceholder-api/main/openapi.yaml",
"language": "TypeScript",
"structuredMimeTypes": [
"application/json",
"text/plain;q=0.9",
"application/x-www-form-urlencoded;q=0.2",
"multipart/form-data;q=0.1"
],
"includePatterns": [],
"excludePatterns": [],
"outputPath": "./typescript/generated/posts",
"clientNamespaceName": "ApiSdk",
"usesBackingStore": false,
"includeAdditionalData": true,
"excludeBackwardCompatible": false,
"disabledValidationRules": []
}
}
} Same thing for files in the The |
When removing a client, we do not remove the cached yaml file for the client in the I ran this and the information and generated output was removed, but not the
|
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Thanks for all the great feedback Seb! The api dependencies with difference casing issue will be fixed once this is merged and the dependency is updated in kiota. |
7f785d0
to
7c97dc9
Compare
Signed-off-by: Vincent Biret <[email protected]>
for the directory removal, I'll only be able to remove /clients, not .kiota. This is because it's where we're placing the log file, and it's in use. |
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
- updates changelog for one twelve release
Co-authored-by: Eastman <[email protected]>
Quality Gate passedIssues Measures |
fixes #3356