Replies: 1 comment 1 reply
-
The current interpretation of names is done with ...
property1:
type: string
nullable: true
nestedObjectName:
+ title: nestedObjectName
+ $id: nestedObjectName
+ x-modelgen-inferred-name: nestedObjectName
type: object
properties:
objectProperty1:
type: string
nullable: true
objectProperty2:
type: string
nullable: true
restOfProperties:
type: string
nullable: true
... If you cant change the input document, you can change the naming formatting behavior i.e. map the name to something else: https://modelina.org/examples?selectedExample=overwrite-naming-formatting, although not optimal.
The general problem when it comes to naming of models is the possibility of "clashing" one or more models together, that are NOT supposed to be named the same thing. Especially with larger inputs. So property names are not the best determiner of naming strategy as they are never really unique, but if you see a better way of doing it feel free to propose it ✌️ |
Beta Was this translation helpful? Give feedback.
-
Greetings,
I noticed when generating C# models based on a provided yaml contract that, if nested objects were present in the specifications this would result in AnonymousSchema being created. :
Contract :
Results in :
And the object :
This is not great for code readability afterwards.
I wanted to know if there was a way around that or a solution to improve that ? I did not find any in the documentation so far.
Could it be possible to generate the class using the name of the property, maybe with a prefix/suffix to avoid issue ?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions