RejectedSoftware Forums

Sign up

bug with REST subInterfaces

Hi,

I am trying to do this (vibe-d.0.7.28)

interface API {
  //Sub-APIs
  @property WebViewAPI webView();

}

class APIImpl : API {
private:
  WebViewAPI mWebViewAPI;

public:
  this() {
    mWebViewAPI = new WebViewAPIImpl();
  }
  //Sub-APIs
  @property WebViewAPI webView() {
    return mWebViewAPI;
  }
}

interface WebViewAPI {
  //@property WebViewMapAPI map();
}

class WebViewAPIImpl : WebViewAPI {
}


but get the following error:

../../.dub/packages/vibe-d-0.7.28/vibe-d/source/vibe/web/internal/rest/jsclient.d(35,52): Error: no property 'name' for type 'SubInterface'
../../.dub/packages/vibe-d-0.7.28/vibe-d/source/vibe/web/rest.d(293,28): Error: template instance vibe.web.internal.rest.jsclient.generateInterface!(API, Appender!string) error instantiating
../../.dub/packages/vibe-d-0.7.28/vibe-d/source/vibe/web/rest.d(221,24):        instantiated from here: generateRestJSClient!(API, Appender!string)
source/web/webserver.d(82,52):        instantiated from here: serveRestJSClient!(API)


it seems like the SubInterface struct in vibe/web/internal/rest/common.d does not have the 'name' property that is asked for in vibe/web/internal/rest/jsclient.d:

common.d

struct SubInterface {
	RestInterfaceSettings settings;
}

jsclient.d

foreach (i, SI; intf.SubInterfaceTypes) {
		output.generateInterface!SI(intf.subInterfaces[i].name, intf.subInterfaces[i].settings);
	}


I expect this is a bug? Or am I missing something? I assume the vibe examples in the 'examples' folder are run also as part of the regression run, and they use sub-interfaces..?

-Øivind

Re: bug with REST subInterfaces

On Mon, 30 May 2016 14:54:04 GMT, Øivind Loe wrote:

Hi,

I am trying to do this (vibe-d.0.7.28)

(...)

but get the following error:

../../.dub/packages/vibe-d-0.7.28/vibe-d/source/vibe/web/internal/rest/jsclient.d(35,52): Error: no property 'name' for type 'SubInterface'
../../.dub/packages/vibe-d-0.7.28/vibe-d/source/vibe/web/rest.d(293,28): Error: template instance vibe.web.internal.rest.jsclient.generateInterface!(API, Appender!string) error instantiating
../../.dub/packages/vibe-d-0.7.28/vibe-d/source/vibe/web/rest.d(221,24):        instantiated from here: generateRestJSClient!(API, Appender!string)
source/web/webserver.d(82,52):        instantiated from here: serveRestJSClient!(API)


it seems like the SubInterface struct in vibe/web/internal/rest/common.d does not have the 'name' property that is asked for in vibe/web/internal/rest/jsclient.d:

(...)

I expect this is a bug? Or am I missing something? I assume the vibe examples in the 'examples' folder are run also as part of the regression run, and they use sub-interfaces..?

-Øivind

Definitely a bug. The examples didn't catch it, because the ones with sub interfaces don't use the JS client generator.

I've opened a ticket and pushed the fix: #1506