-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested Serializers #19
Comments
Hi Mark! Thanks for reporting! This is indeed a bug, ideally nested serializers would be included in the same file.
Completely agree. |
Didn't realize until now, but a workaround I was using in my projects is to have it in the same file but with a different name: class FooBarSerializer < BaseSerializer
attributes :id
end
class FooSerializer < BaseSerializer
belongs_to :bar, serializer: FooBarSerializer
end However, the nested idiom is better because it avoids polluting the global namespace. |
The inline serializers are explicitly removed from the list of serializers to generate interfaces for. Removing this check seems to work? What was the original reason to skip generating types for inline serializers? types_from_serializers/types_from_serializers/lib/types_from_serializers/generator.rb Line 318 in 146ba40
|
Howdy! Given this serializer (in a single file, verbatim):
The generated TS file is invalid:
The
./FooSerializer/Bar
does not exist.Am I doing something wrong, or is this currently unsupported?
I find this pattern of nesting serializers is very useful when you need a representation of a child resource that depends on the parent context vs. having one large serializer in the base directory with a lot of flags/conditionals.
The text was updated successfully, but these errors were encountered: