pwweb / artomator

Artomator: Custom commands making life easier for Laravel.
MIT License
4 stars 1 forks source link

Additional parameter to name GraphQL entities to avoid name clashes #29

Closed frankpde closed 4 years ago

frankpde commented 4 years ago

When using the following command

artisan artomator:graphql_scaffold **Type** --tableName=my_table_name --prefix=Path/To/Model

the GraphQL schema is generated successfully, but using Type as a name for the type, mutation and queries. Since this could possibly lead to name clashes (a type could exist for e.g. addresses, projects, etc.) there should be the possibility to pass an additional parameter (e.g. --gqlname) to avoid this. That way e.g. --gqlname=AddressType could be passed and that would be used for replacement for the schema file.

Bonus: Detection if a gqlname is already in use and subsequent notification in the command line.

rabrowne85 commented 4 years ago

Added to the command --gqlName=NewGraphQLName can now be used to override the GraphQL schema file. However, it will revert to the ModelName if not used.