kontent-ai / model-generator-net

Kontent.ai .NET model generator.
https://www.nuget.org/packages/Kontent.Ai.ModelGenerator
MIT License
17 stars 19 forks source link

Add Support for Generating Management Models using Codename References #192

Open nkooman-bzs opened 2 months ago

nkooman-bzs commented 2 months ago

Motivation

Generated Management models are tightly coupled to an environment since they use ID references. Typically we find that we have multiple environments in our Kontent.ai projects. When creating tools that utilize the Management SDK is becomes difficult to manage n number of models based the number of environments present.

Proposed solution

  1. Create a new KontentElementCodenameAttribute in the Management SDK to reference fields using codenames instead of IDs.
  2. Update model generation to include a new app setting that controls whether to use KontentElementIdAttribute or KontentElementCodenameAttribute. By default the tool would use KontentElementIdAttribute to prevent breaking changes. Perhaps in a major release we could swap to using KontentElementCodenameAttribute as the default.

Additional context

N/A

pokornyd commented 1 month ago

Hello Nick, thank you for the submission. I certainly think this makes sense and will prioritize it during my upcoming OS maintenance week, thank you for your patience.