Open itaru2622 opened 1 year ago
@itaru2622 Thank you for creating the issue.
class Target(BaseModel): # generated class keeps the same name as input jsonschema(3def.json)
make sense. But, it isn't easy to decide the name priority. Because Allof may not need to be a model. :sweat_smile:
reference = self.model_resolver.add(path, name, class_name=True, loaded=True)
After checking the result of parsing child nodes, the method reserves the model name with path and name. We need a new method to change the reserved name.
@koxudaxi Thank you for your response and hint.
Please consider this issue when fixing #796. I guess, if the path has the jsonschema file name besides parent schema name, then both of this issue and #796 may be fixed at once.
Describe the bug my assumed usecase is shown in figure. in this use-case, the same definition name('Target' in this report) appears in lots of places within multiple jsonschema files, but it is normal condition.
I have three jsonschema, 3def.json is the input to datamodel-code-generator. 1def.json, 2def.json are refered from above 3def.json
To Reproduce
Example schema:
3def.json(input to datamodel-code-generator)
1def.json (refered from 3def.json)
2def.json(refered from 3def.json):
produced classes at current:
Used commandline:
Expected behavior The below classes expected to be genrated:
Version:
Additional context none.