Open
Description
Bug Report Checklist
- [ x] Have you provided a full/minimal spec to reproduce the issue?
- [ x] Have you validated the input using an OpenAPI validator (example)?
- [ x] Have you tested with the latest master to confirm the issue still exists?
- [ x] Have you searched for related issues/PRs?
- [ x] What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Hello,
I am trying to generate a client for the GitHub OpenAPI Documentation
I am using the aspnetcore generator. Unfortunately, a lot of InlineResponse and InlineObject models are created with syntax errors.
openapi-generator version
I am using the latest master but have also tried out the v5.0.0-beta2.
OpenAPI declaration file content or url
Generation Details and steps to reproduce
I am doing the following steps to generate the client.
runner.sh
#!/bin/bash
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.0.0-beta2 validate \
-i https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.0.0-beta2 generate \
-i https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json \
-g aspnetcore \
-c /local/config.yaml \
-o /local/out/aspnetcore
config.yaml
aspnetCoreVersion: 3.1
buildTarget: library
compatibilityVersion: Version_3_1
isLibrary: true
operationIsAsync: true
operationResultTask: true
packageName: Library.Github
packageTitle: Github Api Client
useDateTimeOffset: true
useNewtonsoft: true
useSwashbuckle: true
When observing the result and trying to build it I get the following:
Models/InlineObject166.cs(65,55): error CS1003: Syntax error, ',' expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(65,56): error CS1003: Syntax error, ',' expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(65,58): error CS1003: Syntax error, ',' expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(65,59): error CS1003: Syntax error, ',' expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(65,70): error CS1003: Syntax error, ',' expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(65,71): error CS1003: Syntax error, ',' expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(65,73): error CS1003: Syntax error, ',' expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(67,25): error CS1514: { expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(67,25): error CS1513: } expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(67,25): error CS1519: Invalid token '&' in class, struct, or interface member declaration [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(67,28): error CS1519: Invalid token ';' in class, struct, or interface member declaration [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(67,40): error CS1519: Invalid token '&' in class, struct, or interface member declaration [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(67,43): error CS1519: Invalid token ';' in class, struct, or interface member declaration [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(74,30): error CS1519: Invalid token '=' in class, struct, or interface member declaration [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
Models/InlineObject166.cs(199,1): error CS1022: Type or namespace definition, or end-of-file expected [/Users/pw/Projects/github-api/out/aspnetcore/src/Library.Github/Library.Github.csproj]
0 Warning(s)
15 Error(s)
I then had a look at some of the InlineObjcet classes and some syntax errors there:
/// <summary>
/// Exclude attributes from the API response to improve performance
/// </summary>
/// <value>Exclude attributes from the API response to improve performance</value>
[TypeConverter(typeof(CustomEnumConverter<List<ExcludeEnum>>))]
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public enum List<ExcludeEnum>
{
/// <summary>
/// Enum RepositoriesEnum for repositories
/// </summary>
[EnumMember(Value = "repositories")]
RepositoriesEnum = 1
}
furthermore, the one of and any of does not seem to be generated properly..
/// <summary>
/// Create a workflow dispatch event
/// </summary>
/// <remarks>You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. You must configure your GitHub Actions workflow to run when the [`workflow_dispatch` webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The `inputs` are configured in the workflow file. For more information about how to configure the `workflow_dispatch` event in the workflow file, see \"[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch).\" You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. For more information, see \"[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line).\"</remarks>
/// <param name="owner"></param>
/// <param name="repo"></param>
/// <param name="workflowId">The ID of the workflow. You can also pass the workflow file name as a string.</param>
/// <param name="inlineObject63"></param>
/// <response code="204">Empty response</response>
[HttpPost]
[Route("/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches")]
[ValidateModelState]
[SwaggerOperation("ActionsCreateWorkflowDispatch")]
public abstract Task<IActionResult> ActionsCreateWorkflowDispatch([FromRoute][Required]string owner, [FromRoute][Required]string repo, [FromRoute][Required]OneOfintegerstring workflowId, [FromBody]InlineObject63 inlineObject63);