ballerina-lang icon indicating copy to clipboard operation
ballerina-lang copied to clipboard

[Improvement]: When generating records from XML the field names are capitalized.

Open ayeshLK opened this issue 1 year ago • 0 comments

Description

Consider the following XML:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
   <s:Header>
      <a:Action s:mustUnderstand="1">http://htng.org/PWSWG/2010/12/DescriptiveContent_SubmitResponse</a:Action>
      <h:TimeStamp xmlns:h="http://htng.org/1.3/Header/" xmlns="http://htng.org/1.3/Header/">2024-07-04T15:37:45.3605563Z</h:TimeStamp>
      <a:RelatesTo>999999001</a:RelatesTo>
      <a:MessageID>5d7c1d79-a8dc-4185-a49e-834375ae3c3e</a:MessageID>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <OTA_HotelDescriptiveContentNotifRS xmlns="http://www.opentravel.org/OTA/2003/05">
         <Errors>
            <Error ShortText="Invalid Username/Password"/>
         </Errors>
      </OTA_HotelDescriptiveContentNotifRS>
   </s:Body>
</s:Envelope>

Following is the generated record types:

type A_Action record {
    string \#content;
    @xmldata:Attribute
    string mustUnderstand;
};

@xmldata:Namespace {prefix: "h", uri: "http://htng.org/1.3/Header/"}
type H_TimeStamp record {
    string \#content;
    @xmldata:Attribute
    string 'xmlns;
};

type S_Header record {
    @xmldata:Namespace {prefix: "a", uri: "http://www.w3.org/2005/08/addressing"}
    A_Action Action;
    @xmldata:Namespace {prefix: "h", uri: "http://htng.org/1.3/Header/"}
    H_TimeStamp TimeStamp;
    @xmldata:Namespace {prefix: "a", uri: "http://www.w3.org/2005/08/addressing"}
    int RelatesTo;
    @xmldata:Namespace {prefix: "a", uri: "http://www.w3.org/2005/08/addressing"}
    string MessageID;
};

type Error record {
    @xmldata:Attribute
    string ShortText;
};

type Errors record {
    @xmldata:Namespace {uri: "http://www.opentravel.org/OTA/2003/05"}
    Error Error;
};

@xmldata:Namespace {uri: "http://www.opentravel.org/OTA/2003/05"}
type OTA_HotelDescriptiveContentNotifRS record {
    @xmldata:Namespace {uri: "http://www.opentravel.org/OTA/2003/05"}
    Errors Errors;
};

type S_Body record {
    @xmldata:Namespace {uri: "http://www.opentravel.org/OTA/2003/05"}
    OTA_HotelDescriptiveContentNotifRS OTA_HotelDescriptiveContentNotifRS;
};

@xmldata:Name {value: "Envelope"}
@xmldata:Namespace {prefix: "s", uri: "http://www.w3.org/2003/05/soap-envelope"}
type S_Envelope record {
    @xmldata:Namespace {prefix: "s", uri: "http://www.w3.org/2003/05/soap-envelope"}
    S_Header Header;
    @xmldata:Namespace {prefix: "s", uri: "http://www.w3.org/2003/05/soap-envelope"}
    S_Body Body;
};

If you check the S_Envelope record, the field names are capitalized which is not the Ballerina convention.

Describe your problem(s)

No response

Describe your solution(s)

No response

Related area

-> Other Area

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

ayeshLK avatar Jul 04 '24 15:07 ayeshLK