[ 
https://issues.apache.org/jira/browse/THRIFT-1011?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Usman Ismail updated THRIFT-1011:
---------------------------------

    Description: 
If you define multiple thrift files and use a data type from one file in 
another the generated code is broken because it tries to use the fully 
qualified class name as object type without adding an import call. While this 
works in java it does not work in as3.

For example, if we have a file types.thrift

*******types.thrift************
namespace com.xxx.xxx.types

struct Type1 {
  1: string param1,
}

********************************

and a file service.thrift

***********service.thrift**********
namespace com.xxx.xxx.services

include "types.thrift"
service Service1 {
    void method (1:types.Type1 object),
}
********************************

This will generate a method definition like 

public function method(object:com.xxx.xxx.types.Type1, onError:Function, 
onSuccess:Function):void 

but will not generate the import 
import :com.xxx.xxx.types.Type1;









  was:
If you define multiple thrift files and use a data type from one file in 
another the generated code is broken because it tries to use the fully 
qualified class name as object type without adding an import call. While this 
works in java it does not work in as3.

For example, if we have a file types.thrift

*******types.thrift************
namespace com.xxx.xxx.types

struct Type1 {
  1: String param1,
}

********************************

and a file service.thrift

***********service.thrift**********
namespace com.xxx.xxx.services

include = "types.thrift"
service Service1 {
    void method (1:types.Type1 object);
}
********************************

This will generate a method definition like 

public function method(object:com.xxx.xxx.types.Type1, onError:Function, 
onSuccess:Function):void 

but will not generate the import 
import :com.xxx.xxx.types.Type1;










> Error generating package imports when using classes from other packages
> -----------------------------------------------------------------------
>
>                 Key: THRIFT-1011
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1011
>             Project: Thrift
>          Issue Type: Bug
>          Components: AS3 - Compiler
>    Affects Versions: 0.1, 0.2, 0.3, 0.4, 0.5
>         Environment: All Environments 
>            Reporter: Usman Ismail
>             Fix For: 0.7
>
>         Attachments: service.thrift, thrift_1039194_e21ec8f84f339cbb0c5f.patch
>
>
> If you define multiple thrift files and use a data type from one file in 
> another the generated code is broken because it tries to use the fully 
> qualified class name as object type without adding an import call. While this 
> works in java it does not work in as3.
> For example, if we have a file types.thrift
> *******types.thrift************
> namespace com.xxx.xxx.types
> struct Type1 {
>   1: string param1,
> }
> ********************************
> and a file service.thrift
> ***********service.thrift**********
> namespace com.xxx.xxx.services
> include "types.thrift"
> service Service1 {
>     void method (1:types.Type1 object),
> }
> ********************************
> This will generate a method definition like 
> public function method(object:com.xxx.xxx.types.Type1, onError:Function, 
> onSuccess:Function):void 
> but will not generate the import 
> import :com.xxx.xxx.types.Type1;

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to