OpenAPITools / OpenAPITools/openapi-generator

Generate chsarp models from nuget package instead of Client.Models

Open
#5,886 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

I have several controllers that take models located from another nuget package. When I generate the client, the models get transformed into the Client namespace instead of coming from the nuget package they are referenced from the controller.

openapi-generator version

4.3.0

Command line used for generation

openapi-generator generate -g csharp-netcore -c c:_git\swagger_config.json -i http://localhost:5000/swagger/v1/swagger.json

Also tried:

openapi-generator generate -g csharp-netcore -c c:_git\swagger_config.json -i http://localhost:5000/swagger/v1/swagger.json --model-package My.External.Nuget.Package

(All this seemed to do was postfix the namespace with My.External.Nuget.Package)

Steps to reproduce

Generate a project with a model from an external nuget package.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the csharp-netcore generator, the supplied swagger URL, and the swagger_config.json configuration, comparing generation with and without --model-package. Trace how externally referenced models are represented in the generated client and define done as reusing the NuGet package models instead of generating duplicates in Client.Models.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.