Skip to content

Commit

Permalink
- fixes #96 adds generation sequence documentation to getting started
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet committed Apr 19, 2021
1 parent 5f2df36 commit 20a66e3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This library builds on top of the [Microsoft.OpenAPI.NET](https://github.com/mic

- [.NET SDK 5.0](https://dotnet.microsoft.com/download) *
- [Visual Studio Code](https://code.visualstudio.com/)
- [Microsoft Graph PowerShell SDK](https://github.com/microsoftgraph/msgraph-sdk-powershell), cloned into the same parent folder of this repository.
- [Microsoft Graph PowerShell SDK](https://github.com/microsoftgraph/msgraph-sdk-powershell), cloned into the same parent folder of this repository. This dependency is only required if you want to generate SDKs for Microsoft Graph.

#### TypeScript tools

Expand All @@ -30,6 +30,37 @@ No additional tools are required for dotnet projects.

> Note: tools marked with * are required.
### Generating SDKs

Installing the tools and cloning this repository, you will need to build Kiota. You can either use Visual Studio Code or Visual Studio or execute the following commands:

```Shell
dotnet publish ./src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -r win-x64
```

> Note: refer to [.NET runtime identifier catalog](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog) so select the appropriate runtime for your platform.
Navigate to the output directory (usually under `src/kiota/bin/Release/net5.0`) and start generating SDKs by running Kiota.

```Shell
kiota.exe --openapi ../msgraph-sdk-powershell/openApiDocs/v1.0/mail.yml --language csharp -o ../somepath -n samespaceprefix
```

> Note: once your SDK is generated in your target project, you will need to add references to kiota abstractions and kiota core in your project. Refer to [Initializing targed projects][#initializing-targed-projects]
#### Parameters reference

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 |
| language | l | no | The programming language to generate the SDK in. | csharp, java, or typescript | csharp |
| loglevel | | 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 namesapce/module name according to target language specifications. | GraphClient |
| openapi | | 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 ouput 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 |

### Debugging

If you are using Visual Studio Code as your IDE, the **launch.json** file already contains the configuration to run Kiota. By default this configuration will use the `openApiDocs/v1.0/Mail.yml` under the PowerShell repository as the OpenAPI to generate an SDK for. By default this configuration will output the generated files in a graphdotnetv4|graphjavav4|graphtypescriptv4 folder located in the parent folder this repository is cloned in.
Expand Down
2 changes: 1 addition & 1 deletion src/kiota/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static RootCommand GetRootCommand(GenerationConfiguration configuration)
languageOption,
new Option("--openapi", "The path to the OpenAPI description file used to generate the code.") {Argument = new Argument<string>(() => "openapi.yml")},
classOption,
new Option("--loglevel") { Argument = new Argument<LogLevel>(() => LogLevel.Warning)},
new Option("--loglevel", "The log level to use when logging events to the main output.") { Argument = new Argument<LogLevel>(() => LogLevel.Warning)},
namespaceOption,
};
command.Handler = CommandHandler.Create<string, GenerationLanguage?, string, string, LogLevel, string>(async (output, language, openapi, classname, loglevel, namespacename) =>
Expand Down

0 comments on commit 20a66e3

Please sign in to comment.