Petals BC REST

Move from Jettison to Staxon for JSON<->XML conversion, customization via SU parameters

Details

  • Type: Improvement Request Improvement Request
  • Status: In Progress In Progress
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.0.1-BC
  • Fix Version/s: 2.5.0-BC
  • Security Level: Public
  • Description:
    Hide

    Jettison is quite limited in the way it can be customized and its badgerfish conversion implementation is missing some important features (in particular to handle JSON document that would be converted to XML documents with multiple roots, something forbidden in XML).

    Staxon is an alternative implementation that supports an improved badgerfish conversion that is customizable.
    It is also more efficient in terms of memory usage and can use gson, jackson or jsr353 as the JSON reader/writer.

    Moving to Staxon introduces the following SU parameters (both for provides and consumes):

    http-body-to-json-multiple-pi default to false
    http-body-from-json-multiple-pi default to false
    
    http-body-to-json-virtual-root default to null
    http-body-from-json-virtual-root default to null
    
    http-body-to-json-auto-array default to false
    
    http-body-to-json-auto-primitive default to false
    
    http-body-to-json-pretty-print default to false
    
    http-body-to-json-ns-declarations default to false
    
    namespace-mapping/@prefix (value is the namespace URI, no mapping by default)

    See https://github.com/beckchr/staxon/wiki/Factory-Configuration for details.

    We could also introduce options to exploit XMLMultipleStreamWriter (see https://github.com/beckchr/staxon/wiki/Mastering-Arrays).

    Show
    Jettison is quite limited in the way it can be customized and its badgerfish conversion implementation is missing some important features (in particular to handle JSON document that would be converted to XML documents with multiple roots, something forbidden in XML). Staxon is an alternative implementation that supports an improved badgerfish conversion that is customizable. It is also more efficient in terms of memory usage and can use gson, jackson or jsr353 as the JSON reader/writer. Moving to Staxon introduces the following SU parameters (both for provides and consumes):
    http-body-to-json-multiple-pi default to false
    http-body-from-json-multiple-pi default to false
    
    http-body-to-json-virtual-root default to null
    http-body-from-json-virtual-root default to null
    
    http-body-to-json-auto-array default to false
    
    http-body-to-json-auto-primitive default to false
    
    http-body-to-json-pretty-print default to false
    
    http-body-to-json-ns-declarations default to false
    
    namespace-mapping/@prefix (value is the namespace URI, no mapping by default)
    See https://github.com/beckchr/staxon/wiki/Factory-Configuration for details. We could also introduce options to exploit XMLMultipleStreamWriter (see https://github.com/beckchr/staxon/wiki/Mastering-Arrays).
  • Environment:
    -

Activity




Transition Status Change Time Execution Times Last Executer Last Execution Date
New New Open Open
25s
1
Victor NOËL
Tue, 17 Jan 2017 - 14:33:38 +0100
Open Open In Progress In Progress
40s
1
Victor NOËL
Tue, 17 Jan 2017 - 14:34:18 +0100
Christophe DENEUX made changes - Tue, 11 Apr 2023 - 11:37:18 +0200
Fix Version/s 2.5.0-BC [ 11099 ]
Fix Version/s 1.1.0-BC [ 10696 ]
Fix Version/s 2.4.0-BC [ 10903 ]
Christophe DENEUX made changes - Thu, 27 Sep 2018 - 11:11:35 +0200
Fix Version/s 1.3.1-BC [ 10903 ]
Fix Version/s 1.3.0-BC [ 10864 ]
Christophe DENEUX made changes - Thu, 26 Jul 2018 - 16:43:30 +0200
Assignee Victor NOËL [ vnoel ]
Fix Version/s 1.2.1-BC [ 10864 ]
Fix Version/s 1.2.0-BC [ 10821 ]
Christophe DENEUX made changes - Thu, 15 Feb 2018 - 14:48:35 +0100
Fix Version/s 1.1.2-BC [ 10821 ]
Fix Version/s 1.1.1-BC [ 10768 ]
Christophe DENEUX made changes - Thu, 4 Jan 2018 - 11:21:51 +0100
Fix Version/s 1.1.1-BC [ 10768 ]
Hide
Christophe DENEUX added a comment - Thu, 4 Jan 2018 - 11:21:36 +0100 - edited

Parameter naming rework is postponed to version 1.3.1 or upper

Show
Christophe DENEUX added a comment - Thu, 4 Jan 2018 - 11:21:36 +0100 - edited Parameter naming rework is postponed to version 1.3.1 or upper
Christophe DENEUX made changes - Tue, 5 Dec 2017 - 12:05:41 +0100
Description Jettison is quite limited in the way it can be customized and its badgerfish conversion implementation is missing some important features (in particular to handle JSON document that would be converted to XML documents with multiple roots, something forbidden in XML).

Staxon is an alternative implementation that supports an improved badgerfish conversion that is customizable.
It is also more efficient in terms of memory usage and can use gson, jackson or jsr353 as the JSON reader/writer.

Moving to Staxon introduces the following SU parameters (both for provides and consumes):

{code}
http-body-to-json-multiple-pi default to false
http-body-from-json-multiple-pi default to false

http-body-to-json-virtual-root default to null
http-body-from-json-virtual-root default to null

http-body-to-json-auto-array default to false

http-body-to-json-auto-primitive default to false

http-body-to-json-pretty-print default to false

http-body-to-json-ns-declarations default to false
{code}

See https://github.com/beckchr/staxon/wiki/Factory-Configuration for details.

We could also introduce options to exploit {{XMLMultipleStreamWriter}} (see https://github.com/beckchr/staxon/wiki/Mastering-Arrays).
Jettison is quite limited in the way it can be customized and its badgerfish conversion implementation is missing some important features (in particular to handle JSON document that would be converted to XML documents with multiple roots, something forbidden in XML).

Staxon is an alternative implementation that supports an improved badgerfish conversion that is customizable.
It is also more efficient in terms of memory usage and can use gson, jackson or jsr353 as the JSON reader/writer.

Moving to Staxon introduces the following SU parameters (both for provides and consumes):

{code}
http-body-to-json-multiple-pi default to false
http-body-from-json-multiple-pi default to false

http-body-to-json-virtual-root default to null
http-body-from-json-virtual-root default to null

http-body-to-json-auto-array default to false

http-body-to-json-auto-primitive default to false

http-body-to-json-pretty-print default to false

http-body-to-json-ns-declarations default to false

namespace-mapping/@prefix (value is the namespace URI, no mapping by default)
{code}

See https://github.com/beckchr/staxon/wiki/Factory-Configuration for details.

We could also introduce options to exploit {{XMLMultipleStreamWriter}} (see https://github.com/beckchr/staxon/wiki/Mastering-Arrays).
Hide
Christophe DENEUX added a comment - Tue, 5 Dec 2017 - 12:00:52 +0100

Add support of namespace mapping when receiving a JSON HTTP response:

<rest:operation name="xxx:yyy">
   ...
   <rest:namespace-mapping prefix="prefix-one">http://petals.org/namespace-1</rest:namespace-mapping>
   <rest:namespace-mapping prefix="prefix-two">http://petals.org/namespace-2</rest:namespace-mapping>
   ...
</rest:operation>
Show
Christophe DENEUX added a comment - Tue, 5 Dec 2017 - 12:00:52 +0100 Add support of namespace mapping when receiving a JSON HTTP response:
<rest:operation name="xxx:yyy">
   ...
   <rest:namespace-mapping prefix="prefix-one">http://petals.org/namespace-1</rest:namespace-mapping>
   <rest:namespace-mapping prefix="prefix-two">http://petals.org/namespace-2</rest:namespace-mapping>
   ...
</rest:operation>
Hide
Victor NOËL added a comment - Fri, 16 Jun 2017 - 10:09:23 +0200

This is kept open until we decide if we change the default values and parameters names.
Also once it's done, it must be documented!

Show
Victor NOËL added a comment - Fri, 16 Jun 2017 - 10:09:23 +0200 This is kept open until we decide if we change the default values and parameters names. Also once it's done, it must be documented!
Christophe DENEUX made changes - Fri, 27 Jan 2017 - 13:54:42 +0100
Fix Version/s 1.1.0 [ 10696 ]
Hide
Christophe DENEUX added a comment - Wed, 18 Jan 2017 - 11:28:47 +0100 - edited

About default values, they should be:

  • multiple-pi: true, to manage easily empty array
  • auto-array: false,
  • ns-declarations: false
Show
Christophe DENEUX added a comment - Wed, 18 Jan 2017 - 11:28:47 +0100 - edited About default values, they should be:
  • multiple-pi: true, to manage easily empty array
  • auto-array: false,
  • ns-declarations: false
Hide
Christophe DENEUX added a comment - Wed, 18 Jan 2017 - 09:44:24 +0100 - edited

Perhaps following parameter names should be more human readable as following:

<rest:operation name="edm:archiver">
   ...
   <rest:xml-payload-to-json-conversion>
      <rest:multiple-pi enable="true/false">
      <rest:virtual-root>metadatas</rest:virtual-root>
      <rest:auto-array enable="true/false">
      <rest:ns-declarations enable="true/false">
   </rest:xml-payload-to-json-conversion>
   ...
</rest:operation>

Why don't you provide a parameter to configure namespace mapping ?

In my mind, the parameter 'pretty-print' is not needed. I think that a JSON or XML payload formatted for better readability is not needed by service consumer or provider. Perhaps can we enable it if the log level is set to FINE.

Show
Christophe DENEUX added a comment - Wed, 18 Jan 2017 - 09:44:24 +0100 - edited Perhaps following parameter names should be more human readable as following:
<rest:operation name="edm:archiver">
   ...
   <rest:xml-payload-to-json-conversion>
      <rest:multiple-pi enable="true/false">
      <rest:virtual-root>metadatas</rest:virtual-root>
      <rest:auto-array enable="true/false">
      <rest:ns-declarations enable="true/false">
   </rest:xml-payload-to-json-conversion>
   ...
</rest:operation>
Why don't you provide a parameter to configure namespace mapping ? In my mind, the parameter 'pretty-print' is not needed. I think that a JSON or XML payload formatted for better readability is not needed by service consumer or provider. Perhaps can we enable it if the log level is set to FINE.
Victor NOËL made changes - Tue, 17 Jan 2017 - 14:34:18 +0100
Status Open [ 10002 ] In Progress [ 10003 ]
Victor NOËL made changes - Tue, 17 Jan 2017 - 14:33:38 +0100
Field Original Value New Value
Status New [ 10000 ] Open [ 10002 ]
Priority Major [ 3 ]
Assignee Christophe DENEUX [ cdeneux ] Victor NOËL [ vnoel ]

People

Dates

  • Created:
    Tue, 17 Jan 2017 - 14:33:13 +0100
    Updated:
    Tue, 11 Apr 2023 - 11:37:18 +0200