Thanks to visit codestin.com
Credit goes to github.com

Skip to content

jolie2surface creates wrong types with interface extenders #554

@Niels-Erik

Description

@Niels-Erik

Describe the bug
If an extender adds something to the request side and not the response side, jolie2surface will use the same new type if one of two Request-Repsones have void as request and the other has void as response.
running jolie2surface on the port "input" on this:

type type1 {
  thing: any
}

type type2 { ones*: type1 }

interface api {
  requestResponse:
    call1(void)(type2),
    call2(type1)(void)
}

type type3 { extend: string }

interface extender TokenExtender {
  RequestResponse:
    *( type3 )( void )
}

service bug {

  outputPort output {
    location: "local"
    interfaces: api
  }

  inputPort input {
    location: "local"
    aggregates: output with TokenExtender
  }

  courier input {
    [ interface api( request )( response ){
      forward( request )( response )
    } ]
  }

  main{ linkIn(l) }
}

Gives the following output:

type input_void:void {
        .extend:string
}
type input_type2:void {
        .ones[0,*]:type1
}
type input_type1:void {
        .extend:string
        .thing:any
}

type type1:void {
        .thing:any
}

interface inputSurface {
RequestResponse:
        call1( input_void )( input_type2 ),
        call2( input_type1 )( input_void ) 
}

outputPort input {
        Location: "local"
        Interfaces: inputSurface
}

Where we can see that input_void is used as response of call2, which is wrong.
To Reproduce
Steps to reproduce the behavior:

  1. Create bug.ol with the first code
  2. run jolie2surface bug.ol input
  3. See that the output is wrong

Expected behavior
That jolie2surface gave the correct output as described

Desktop (please complete the following information):

  • OS: windows
  • Jolie version 1.13.0-git
  • Java Version 21

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions