BUG - GET REST API returns strings for non-string primitives

Here's the setup:

  • In Nuxeo Studio, create new Document Type “mydoc”
  • On Schema tab, add a field “foo” type “Boolean”
  • Save
  • In DM, update project from studio
  • Create a new “mydoc” in Document Management
  • Call REST API /nuxeo/api/v1/path/default-domain/workspaces/myworkspace/mydoc
  • In returned JSON, the field “foo” is returned as “true” or “false” (with the quotes)

By comparison, POSTing to the same API allows a JSON boolean to be posted. It would seem to be most useful if the GET API worked the same way.

When I get some time I'll go through the Nuxeo DM code and find the spot where this is ocurring and post follow-up comment on this question.

0 votes

0 answers

1513 views

ANSWER

Dug through the nuxeo-features code base and found:

line 277 of org.nuxeo.ecm.automation.jaxrs.io.documents.JsonDocumentWriter.

Pretty much gonna always write a string :-) @nuxeo is this by design?

11/26/2013