OpenAPITools / OpenAPITools/openapi-generator

Dependency on client if only generating models

Open
#13,848 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,

Using the csharp-netcore generator, I only need the models to be generated.

--global-property=models,modelDocs=false,modelTests=false,apiTests=false
"packageName": "Test",
  "targetFramework": "net6.0",
  "optionalProjectFile": false,
  "optionalAssemblyInfo": false,
  "optionalEmitDefaultValue":  true,
  "validatable": false,
  "useCollection": true,
  "returnICollection": true,
  "optionalEmitDefaultValues": true,
  "library": "generichost"

Unfortunately the models have a dependency on the client because they include JsonConverters

 Utf8JsonReader guidReader = reader;
            bool guidDeserialized = Client.ClientUtils.TryDeserialize<Guid>(ref guidReader, options, out Guid? guid);

            Utf8JsonReader academicSessionReader = reader;
            bool academicSessionDeserialized = Client.ClientUtils.TryDeserialize<AcademicSession>(ref academicSessionReader, options, out AcademicSession? academicSession);

Is there a way I could make those models not needing the client?

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 with the csharp-netcore generator and its handling of the models-only global property. Inspect why generated model JsonConverters reference Client.ClientUtils and determine how models can be emitted without that client dependency. Done means generating only models with the shown options produces models that compile without the client.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.