#1 2016-05-11 12:26:13

sevo
Member
Registered: 2015-11-10
Posts: 27

Default Enumname in Response, not Enumindex

How to respond as default with Enumname instead of the Enumindex?
I've found the option TTextWriterOption.twoEnumSetsAsTextInRecord but i don't know how to set this option as default.

Offline

#2 2016-05-11 13:00:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Default Enumname in Response, not Enumindex

In which context?

Offline

#3 2016-05-11 13:09:21

sevo
Member
Registered: 2015-11-10
Posts: 27

Re: Default Enumname in Response, not Enumindex

Interface-Based-Service, out-Records containing Enums.

Offline

#4 2016-05-11 13:24:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Default Enumname in Response, not Enumindex

This is not handled yet at SOA level.

You can have a workaround and use RawJSON as SOA parameter type, and manually serialize your record as JSON, with the proper options to have enumerations as text.

BTW, why do you want enumerations as text?

Offline

#5 2016-05-11 13:48:11

sevo
Member
Registered: 2015-11-10
Posts: 27

Re: Default Enumname in Response, not Enumindex

We have javascript clients reading and writing enum-names as text.

With current trunk, enum-names, as well as enum-index, as request-paramter are still working, but in the response is the enum-index.

With mORMot-version "mORMot_and_Open_Source_friends_2014-07-02_074115_da7141e88e", Default was enum-name. Using Delphi 2010.

We use the swagger-api to develop the client against. With RawJSON as parameter type we will lose the type-info.

Offline

Board footer

Powered by FluxBB