Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-140250

Rest builder does not honor openAPI XML Object wrapped field.

Details

    Description

      Reproduction steps:

      1. Add an array definition to the rest-openapi.yaml without setting "wrapped:" "true"
        for example:
          
                TestObject:
                  type: object
                  properties:
                    arrayObjects:
                      type: array
                      wrapped: false
                      items:
                        $ref: '#/components/schemas/ArrayObject'
                ArrayObject:
                  type: object
                  properties:
                    title:
                      type: string
      2. Try to invoke an endpoint using xml without the wrapped field
        curl --location --request POST 'http://localhost:8080/o/mymodule/v1.0/myendpoint' \
        -u '[email protected]:test' \
        --header 'Content-Type: application/xml' \
        --data-raw '<?xml version="1.0" encoding="UTF-8"?>
        <TestObject>
        <arrayObjects>
        <title>string</title>
        </arrayObjects>
        </TestObject>'

      Actual behavior: calling the endpoint fails with the following error:

      "status" : "BAD_REQUEST",
      "title" : "Unable to map JSON path: arrayObjects.null"

      Expected behavior: you should be able to invoke the endpoint the mentioned way

      Attachments

        Activity

          People

            brian.chan Brian Chan
            zalan.szakolci Zalán Szakolci
            Enterprise Release HU Enterprise Release HU
            Javier Gamarra Javier Gamarra (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              1 year, 9 weeks, 4 days ago

              Packages

                Version Package
                7.1.X
                7.2.X
                7.3.X
                7.4.3.5 CE GA5
                7.4.13 DXP U1
                Master