microsoft / microsoft/kiota

Add Option to Generate DTOs/POCOs Only (Without API)

Open
#6,943 0 comments 0 reactions 0 assignees View on GitHub
type:feature
Dominant language
C#
Stars
3.8k
Forks
333
Avg merge
16h 29m
Merged PRs (30d)
116

Description

### Summary
Please provide an option in Kiota to generate only DTOs/POCOs from an OpenAPI specification, without generating API client code.

### Motivation
In design-first API development, where the OpenAPI specification is created before implementation, automatically generating DTOs/POCOs directly from the spec significantly reduces manual effort, minimizes errors, and ensures consistency between the specification and the codebase.

### Proposed Solution
Introduce a command-line or configuration option to generate DTOs/POCOs only. The generated models should be straightforward and intuitive for developers to read and use.

### Additional Context
NSwag provides a similar feature, and I am very thankful to the maintainer for their work. However, as is often the case with open-source software, the typical issues exist, such as limited support. One example is adding support for the 'oneOf' construct for code generators, which is still under development, as visible from this 10 year-old still-open issue [here](https://github.com/RicoSuter/NJsonSchema/issues/13). Another tool is [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator), which suffers from even more issues when it comes to DTO-only generation.

I think adding this capability to Kiota would address an important use case for many projects, since no existing tool currently offers this functionality without requiring users to perform a fair amount of DIY post-processing.

Thank you for considering this request!

Contributor guide

Open the contributing guide

Research direction

Start at Kiota's command-line and configuration entry points and trace how OpenAPI specifications select generated outputs. Define the option's scope across supported generators, then verify that a sample specification produces DTOs/POCOs without API client code and that existing generation behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.