C# Generation that shares existing DTO project #5867
Replies: 3 comments 1 reply
-
Yes, this is possible. With Kiota, you can customize the generation process to use your existing DTOs instead of generating new ones. Here are the key steps: Configure Kiota to skip DTO generation In your Kiota generation command or configuration, you'll want to use options that prevent regenerating DTOs and instead use your existing types. The exact method depends on your specific Kiota setup, but typically involves specifying a custom namespace mapping or using configuration flags to reference existing types. |
Beta Was this translation helpful? Give feedback.
-
sure bro, I'll help you configure Kiota to use your existing DTOs. Here's a detailed approach:
In your Kiota generation command, you'll want to add flags like: kiota generate \
--openapi path/to/openapi.json \
--output ./generated \
--namespace-mapping "Your.Existing.Namespace=YourSharedProject.Models" \
--skip-generation-if-type-exists \
--exclude-type-names "ListOfYourDTOsToSkip" Key configuration points: Use --namespace-mapping to tell Kiota about your existing types In your project: Reference your shared DTOs project |
Beta Was this translation helpful? Give feedback.
-
but ListOfYourExistingDTOs may be a full list of every single class? thanks |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I have a C# minimal api server that generates an openapi.json file. All of our DTOs are in a separate shared project. I'd like to reuse that shared project instead of having Kiota generate a less accurate version of those DTOs so that our Maui/Uno project can just reference the shared library along with the shared client.
Is this possible?
Beta Was this translation helpful? Give feedback.
All reactions