Open andreskrey opened 4 years ago
Unfortunately this is not possible yet.
I believe this would require us to rethink model registration to either delay the generation of the name to the actual description of the model, or to describe models as soon as they are described. I don't think I'll have the time for such a refactoring soon unfortunately but in case you'd like to give it a try that would be greatly appreciated.
Another great feature would be a configuration option to turn off the schemas section in the UI/json file.
As the auto-generated schemas are often duplicated (example: User, User2, User3) because of variety of groups for the model, I think it would be great if there is such an option.
As the auto-generated schemas are often duplicated (example: User, User2, User3) because of variety of groups for the model
LIke only use inline schemas versus named?
If you happen to use any code generation, you'll get some weird things happening if that's the plan.
According to the documentation, one can define alternative model names based on groups and areas by adding configuration on the nelmio yml file.
This creates a confusing coupling between your PHP class models and your nelmio configuration. The only way to verify the link between schemas defined at the bottom of the generated documentation and actual PHP classes is by checking the config file, then checking the defined class with namespace, and then checking the groups on that class.
I was wondering if it could be possible to define such configuration inside the class itself. For example:
So with this approach, schemas defined in the documentation would be "MyModelWithId" and "MyModelWithName".
Is this possible with the current latest version? Alternative names are built with the container and this generates new models, which overrides the existing ones by matching hashes (as I understood the code). Is it possible to achieve the same functionality as it is described here?