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
  • #7042
Closed
Open
Issue created Jul 24, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][aspnetcore] Virtual and abstract not used correctly

Created by: Sshnyari

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

In the server generated code for aspnetcore:

  1. When using the 'generateBody' option to false, we get a virtual method with no body. It should be an abstract method if the method have no body, and the class should also be made abstract in this case.

  2. When using the 'operationModifier', we get abstract methods, but not an abstract class. The class should also be abstract for it to work.

Also, unless I am mistaken, it seems that these two options (generateBody and operationModifier) have the same purpose

openapi-generator version

4.3.1

OpenAPI declaration file content or url

can be reproduced with the petstore file

Command line used for generation

openapi-generator generate -g aspnetcore -i petstore.json -c config.json -o src and one of the following config.json files can be used depending on the case (1 or 2)

{
	"aspnetCoreVersion":"3.1",
	"operationModifier": "abstract"
}

or

{
	"aspnetCoreVersion":"3.1",
	"generateBody": false
}
Steps to reproduce

just running the command is enough to see the results

Related issues/PRs
Suggest a fix

changing virtual with abstract when relevant and adding abstract to the class when methods are abstract

Assignee
Assign to
Time tracking