You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Brian Forbis (JIRA)" <ji...@apache.org> on 2018/06/21 17:27:00 UTC

[jira] [Commented] (THRIFT-3547) NodeJS generated require() paths should mirror include paths

    [ https://issues.apache.org/jira/browse/THRIFT-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16519606#comment-16519606 ] 

Brian Forbis commented on THRIFT-3547:
--------------------------------------

I have attempted to hack around this issue by creating files like:
 * a-foo.thrift
 * b-foo.thrift

Which would then generate something like:
 * a-foo_types.js
 * b-foo_types.js

However, if the thrift files both define a service such as FooService, they will still clobber each other's files because you can only have one FooService.js You could just call them AFooService and BFooService, but it starts to get pretty hacky and the generated code in other languages that DO support namespaces would look pretty funky.

> NodeJS generated require() paths should mirror include paths
> ------------------------------------------------------------
>
>                 Key: THRIFT-3547
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3547
>             Project: Thrift
>          Issue Type: Bug
>          Components: Node.js - Compiler
>    Affects Versions: 0.9.3
>            Reporter: Yunchi Luo
>            Priority: Major
>
> NodeJS uses file paths rather than namespaces to manage modules. However, the Thrift generated code ignores file paths.
> I.e. if we have
> foo.thrift:
> include "../../shared.thrift";
> It will turn into
> foo_types.js:
> var shared_types = require("./shared.thrift");
> This forces us to put all generated node code in the same directory. It's problematic since if we happen to have
> a/foo.thrift
> b/foo.thrift
> One file will have to overwrite the other...
> I'm happy to make a patch for this, but unclear to me how much of a breaking change this would be for people, if it is at all.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)