-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Open
Labels
Component: Framework/ReflectionComponent: WebapiUse with concrete module component label E.g. "Component: Webapi" + "Catalog"Use with concrete module component label E.g. "Component: Webapi" + "Catalog"Issue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P4No current plan to fix. Fixing can be deferred as a logical part of more important work.No current plan to fix. Fixing can be deferred as a logical part of more important work.Progress: PR in progressReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releaseSeverity: S4Affects aesthetics, professional look and feel, “quality” or “usability”.Affects aesthetics, professional look and feel, “quality” or “usability”.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject itfeature request
Description
Precondition (*)
Magento 2.3.x
Summary (*)
I want to return JSON in camelCase in my custom webapi.xml and interface that I have created.
There is no way to configure in webapi.xml the format that you wish to use.
By default M2 will return data like so: server_transaction_id but my third party JavaScript is expecting serverTransactionId for example.
Secondly, It is also rather annoying to have to create an interface to do this instead of just being able to use json_encode the data. Using json_encode is not the solution as you end up with \ in the format.
See below:
Examples (*)
interface Check3dsVersionInterface
{
/**
* @return string
*/
public function getServerTransactionId();
/**
* @param string $serverTransactionId
* @return $this
*/
public function setServerTransactionId($serverTransactionId);
webapi.xml:
<route url="/V1/xx-payments/:cartId/check-3ds-version" method="POST">
<service class="xx\xx\Api\xxServiceInterface" method="check3dsVersion"/>
<resources>
<resource ref="anonymous" />
</resources>
</route>
Proposed solution
In webapi.xml, it would be useful to specify the format of the json, for example to return as camelCase or as it is currently which is underscores
shikhamis11, adeptofvoltron, msilvagarcia, Litiano, themarcosdev and 3 moreadeptofvoltron, mlambley, Litiano, themarcosdev and AbiudSM
Metadata
Metadata
Assignees
Labels
Component: Framework/ReflectionComponent: WebapiUse with concrete module component label E.g. "Component: Webapi" + "Catalog"Use with concrete module component label E.g. "Component: Webapi" + "Catalog"Issue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P4No current plan to fix. Fixing can be deferred as a logical part of more important work.No current plan to fix. Fixing can be deferred as a logical part of more important work.Progress: PR in progressReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releaseSeverity: S4Affects aesthetics, professional look and feel, “quality” or “usability”.Affects aesthetics, professional look and feel, “quality” or “usability”.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject itfeature request
Type
Projects
Status
Pull Request in Progress