On Mon, 12 Oct 2015 20:46:35 GMT, Martin Drasar wrote:

Hi,

the wrapper seems a bit clunky for my case, but I like the serialization policy. However, I am not sure, how to use the policy with the Rest interface generator.

Suppose I have this code:

struct SomeIDs
{
  UUID id1,
  UUID id2
}

interface API
{
  @property someIDs getIDs();
}

class RestServer : API
{
  private URLRouter _router;
  public:
    this() {
      _router = new URLRouter();
      _router.registerRestInterface(this, MethodStyle.camelCase);
    }
  ...
}

Where do I apply the policy?

Thanks,
Martin

The REST interface indeed currently doesn't support policy customization. It's planned to enable general customization of the serialization in some form and at that point it would become possible. But until then, you'd either have to go with the wrapper, or add to/fromRepresentation to SomeIDs.

Adding a @serializationPolicy!Policy attribute to be recognized by the REST interface would also be relatively straight-forward, so that could also be an option. It would just have to be thought through completely to avoid conflicts with possible future extensions.