Types.Analyzer generates invalid class names when assembly contains certain characters
Product
Hot Chocolate
Version
13.9.0
Link to minimal reproduction
https://github.com/Keyslam/HotChocolate-SourceGeneratorAssemblyName
Steps to reproduce
- Create an assembly with an invalid character for a class in its same (For example
HotChocolate-Test) - Add the
HotChocolateandHotChocolate.Types.Analyzerspackages - Define a class that inherits from
ObjectType
What is expected?
The source generator should generate a valid ...TypesRequestExecutorBuilderExtensions file
What is actually happening?
The ...TypesRequestExecutorBuilderExtensions class name includes the invalid characters, causing compile issues.
Relevant log output
No response
Additional context
I think modifying Types.Analyzers.Helpers.GeneratorUtils.CreateModuleName to strip out invalid characters would be a good solution. If that is acceptable I can submit a PR for it. https://github.com/ChilliCream/graphql-platform/blob/1af5a4775e4f77e0757b739ee0081fd962ac6901/src/HotChocolate/Core/src/Types.Analyzers/Helpers/GeneratorUtils.cs#L40
As a workaround you can override the module name with the ModuleInfo ....