Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7852
Closed
Open
Issue created Nov 01, 2020 by Administrator@rootContributor0 of 1 checklist item completed0/1 checklist item

[BUG][aspnetcore] Client for GitHub OpenAPI Description is not created properly InlineObject and InlineResponse

Created by: venuselite

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

GitHub OpenAPI Documentation

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&lt;ExcludeEnum&gt;>))]
        [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
        public enum List&lt;ExcludeEnum&gt;
        {
            
            /// <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 &#x60;workflow_id&#x60; with the workflow file name. For example, you could use &#x60;main.yaml&#x60;.  You must configure your GitHub Actions workflow to run when the [&#x60;workflow_dispatch&#x60; webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The &#x60;inputs&#x60; are configured in the workflow file. For more information about how to configure the &#x60;workflow_dispatch&#x60; event in the workflow file, see \&quot;[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch).\&quot;  You must authenticate using an access token with the &#x60;repo&#x60; scope to use this endpoint. GitHub Apps must have the &#x60;actions:write&#x60; permission to use this endpoint. For more information, see \&quot;[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line).\&quot;</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);
Assignee
Assign to
Time tracking