types_from_serializers icon indicating copy to clipboard operation
types_from_serializers copied to clipboard

Cannot use name_from_serializer

Open reinvanimschoot opened this issue 1 year ago • 1 comments

  • [X] I have tried upgrading by running bundle update types_from_serializers.
  • [X] I have read the troubleshooting section before opening an issue.

Description 📖

When using:

if Rails.env.development?
  TypesFromSerializers.config do |config|
    config.name_from_serializer = ->(name) { name }
  end
end

and then issuing the command:

bundle exec rake types_from_serializers:generate

no serializers are found

bundle exec rake types_from_serializers:generate
Generating TypeScript interfaces...completed in 0.0 seconds.
Found 0 serializers:

while, when removing the line config.name_from_serializer = ->(name) { name }, everything works as it should.

I only wanted to make sure the generated types got a prefix, which should not interfere with the finding of serializers.

reinvanimschoot avatar Jan 10 '24 13:01 reinvanimschoot

Hi Rein, thanks for reporting.

Can you replicate it in the examples in this repo or provide a minimal reproduction?

ElMassimo avatar Feb 23 '24 12:02 ElMassimo

I could not replicate this, using config.name_from_serializer = ->(name) { name } will generate interfaces, with a different name and in different dirs as expected.

Feel free to reopen if you provide a reproduction.

ElMassimo avatar Aug 23 '24 15:08 ElMassimo