Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default client name GraphClient => ApiClient #199

Merged
merged 3 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Escapes language reserved keywords #184
- Replaces custom URL tree node by class provided by OpenAPI.net #179
- Adds support for collections as root responses #191
- Changes default namespace and class name to api client #199

## [0.0.4] - 2021-04-28

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ Kiota accepts the following parameters during the generation:

| Name | Shorthand | Required | Description | Accepted values | Default Value |
| ---- | --------- | -------- | ----------- | --------------- | ------------- |
| class-name | c | no | The class name to use the for main entry point | A valid class name according to the target language specification. | GraphClient |
| class-name | c | no | The class name to use the for main entry point | A valid class name according to the target language specification. | ApiClient |
| language | l | no | The programming language to generate the SDK in. | csharp, java, or typescript | csharp |
| loglevel | ll | no | The log level to use when logging events to the main output. | Microsoft.Extensions.Logging.LogLevel values | Warning |
| namespace-name | n | no | The namespace name to use the for main entry point. | Valid namespace/module name according to target language specifications. | GraphClient |
| namespace-name | n | no | The namespace name to use the for main entry point. | Valid namespace/module name according to target language specifications. | ApiClient |
| openapi | d | no | URI or Path to the OpenAPI description (JSON or YAML) to use to generate the SDK. | A valid URI pointing to an HTTP document or a file on the local file-system. | ./openapi.yml |
| output | o | no | The output path of the folder the code will be generated in. The folders will be created during the generation if they don't already exist. | A valid path to a folder. | ./output |

Expand Down
5 changes: 2 additions & 3 deletions src/Kiota.Builder/GenerationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ namespace Kiota.Builder {
public class GenerationConfiguration {
public string OpenAPIFilePath { get; set; } = "openapi.yaml";
public string OutputPath { get; set; } = "./output";
public string ClientClassName { get; set; } = "GraphClient";
public string ClientNamespaceName { get; set; } = "GraphClient";
public string SchemaRootNamespaceName { get; set; } = "microsoft.graph";
public string ClientClassName { get; set; } = "ApiClient";
public string ClientNamespaceName { get; set; } = "ApiClient";
public GenerationLanguage Language { get; set; } = GenerationLanguage.CSharp;
public string ApiRootUrl { get; set; } = "https://graph.microsoft.com/v1.0";
public List<string> PropertiesPrefixToStrip { get; set; } = new() { "@odata."};
Expand Down
4 changes: 2 additions & 2 deletions src/kiota/KiotaHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public static RootCommand GetRootCommand()
var languageOption = new Option("--language", "The target language for the generated code files.") { Argument = new Argument<GenerationLanguage?>(() => GenerationLanguage.CSharp) };
languageOption.AddAlias("-l");
AddEnumValidator<GenerationLanguage>(languageOption.Argument, "language");
var classOption = new Option("--class-name", "The class name to use for the core client class.") { Argument = new Argument<string>(() => "GraphClient") };
var classOption = new Option("--class-name", "The class name to use for the core client class.") { Argument = new Argument<string>(() => "ApiClient") };
classOption.AddAlias("-c");
AddStringRegexValidator(classOption.Argument, @"^[a-zA-Z_][\w_-]+", "class name");

var namespaceOption = new Option("--namespace-name", "The namespace to use for the core client class specified with the --class-name option.") { Argument = new Argument<string>(() => "GraphClient") };
var namespaceOption = new Option("--namespace-name", "The namespace to use for the core client class specified with the --class-name option.") { Argument = new Argument<string>(() => "ApiClient") };
namespaceOption.AddAlias("-n");
AddStringRegexValidator(namespaceOption.Argument, @"^[\w][\w\._-]+", "namespace name");

Expand Down