Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request body of the generated custom connector operation is incorrect #4036

Open
kalaiyarasiganeshalingam opened this issue Feb 18, 2025 · 1 comment

Comments

@kalaiyarasiganeshalingam
Copy link
Contributor

Description

When the field type is an object or array, the generated request body has that field value as a string.

Tested open API definition: https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml

Generated connector's addPet operation configurations:

Image

In the spec,

Category type is JSON object
Photo Urls type is array
Tags type is object array

Wire logs for this operation

Image

Steps to Reproduce

Source code:

<?xml version="1.0" encoding="UTF-8"?>
<api context="/test_1" name="test_1" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="GET" uri-template="/">
        <inSequence>
            <log category="INFO">
                <message></message>
                <property name="test" value="start"/>
            </log>
            <payloadFactory media-type="json" template-type="default">
                <format>
                    {
                    "id": 10,
                    "name": "doggie",
                    "category": {
                    "id": 1,
                    "name": "Dogs"
                    },
                    "photoUrls": [
                    "string"
                    ],
                    "tags": [
                    {
                    "id": 0,
                    "name": "string"
                    }
                    ],
                    "status": "available"
                    }
                </format>
            </payloadFactory>
            <log category="INFO">
                <message></message>
                <property name="result" expression="${payload}"/>
            </log>
            <swagger_petstore___openapi_3_0.addPet configKey="test_con">
                <id>12</id>
                <name>doggie</name>
                <category>{${payload.category}}</category>
                <photoUrls>{${payload.photoUrls}}</photoUrls>
                <tags>{${payload.tags}}</tags>
                <status>available</status>
                <responseVariable>swagger_petstore___openapi_3_0_addPet_288</responseVariable>
                <overwriteBody>false</overwriteBody>
            </swagger_petstore___openapi_3_0.addPet>
            <log category="INFO">
                <message></message>
                <property name=" test" value=" finished"/>
            </log>
        </inSequence>
        <faultSequence>
        </faultSequence>
    </resource>
</api>

Version

latest

Environment Details (with versions)

No response

@kalaiyarasiganeshalingam kalaiyarasiganeshalingam changed the title Generated Custom connector operation's request body incorrect Request body of the generated custom connector operation is incorrect Feb 18, 2025
@RDPerera
Copy link

We currently do not fully support mappings from OAS to MI, but we are working on it step by step. Here is the current mapping status:

Primitive Data Types

OpenAPI Data Type Mapped Representation in Synapse
integer synapse:number
boolean synapse:number
string synapse:string
number synapse:string
null (OpenAPI 3.1) Not explicitly handled

String Formats

OpenAPI Data Type Mapped Representation in Synapse
date Not explicitly handled
date-time Not explicitly handled
password Not explicitly handled
byte Not explicitly handled
binary Not explicitly handled
email Not explicitly handled
uuid Not explicitly handled

Complex Data Types

OpenAPI Data Type Mapped Representation in Synapse
array Not explicitly handled
object Not explicitly handled

The mapping logic assigns integer and boolean types to synapse:number.
All other types (e.g., string, number, date, binary) are mapped to synapse:string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants