-
Notifications
You must be signed in to change notification settings - Fork 168
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
Revamp transforming message formats
tutorial
#8233
Revamp transforming message formats
tutorial
#8233
Conversation
(L17) let's add a full stop. |
(L255) The parameter name should be reservation not payload. |
(L262-L267) We decided to remove log statements except for error logs. |
swan-lake/integration-tutorials/transforming-message-formats.md
Outdated
Show resolved
Hide resolved
(L60) Shall we change the appointment number to 1? |
(L351) Should be [reservation.hospitalId] |
swan-lake/integration-tutorials/transforming-message-formats.md
Outdated
Show resolved
Hide resolved
swan-lake/integration-tutorials/transforming-message-formats.md
Outdated
Show resolved
Hide resolved
…vamp-transform-message-formats # Conflicts: # swan-lake/integration-tutorials/content-based-message-routing.md # swan-lake/integration-tutorials/service-orchestration.md
d052e79
into
ballerina-platform:integration-tutorials
Import the | ||
- `ballerina/http` module to develop the REST API and define the client that can be used to send requests to the backend services | ||
- `ballerina/log` module to log debug, error, or info level information for each client request | ||
3. Generate record types corresponding to the payloads from the hospital service and input/output of the transforming function by providing samples of the expected JSON payloads. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't spoken about a "transforming function" before we get here, so may not make sense to the user.
I would have
- if there is a request payload, show generating the record for that. if not, show generating a record for the payload from the backend.
- if there are other request or response payloads, say "Similarly, generate records ...". Don't have to give the JSON payloads and/or show generating records here.
- then say "The generated record types will be as follows." for all.
So basically, show one JSON -> record generation for whatever we encounter first. And then say generate similarly for others and show the records.
> **Note:** | ||
> When the fields of the JSON objects are expected to be exactly those specified in the sample payload, the generated records can be updated to be [closed records](https://ballerina.io/learn/by-example/controlling-openness/), which would indicate that no other fields are allowed or expected. | ||
|
||
4. Define the [HTTP service (REST API)](https://ballerina.io/learn/by-example/#rest-service) that has the resource that accepts user requests, retrieves relevant details from the backend service, and responds to the request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to include something about transforming here.
|
||
return <http:InternalServerError> {body: resp.message()}; | ||
``` | ||
- If the response is not a `ReservationResponse` record, log the information at `ERROR` level. Return a "NotFound" response if the response from the hospital service is an `http:ClientRequestError` response or an "InternalServerError" response otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix "NotFound" -> http:NotFound
.
Same for "InternalServerError".
|
||
> **Note:** | ||
> When the fields of the JSON objects are expected to be exactly those specified in the sample payload, the generated records can be updated to be [closed records](https://ballerina.io/learn/by-example/controlling-openness/), which would indicate that no other fields are allowed or expected. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a note about making ssn an array of fixed-length (and maybe link to a BBE).
Purpose
$title
Checklist
Page addition
permalink
to pages.Page removal
redirect_from
on the alternative page.redirections.js
file.Page rename
redirect_from
.redirect_to:
(if applicable).Page restrcuture
permalink
to pages.redirect_from
.redirect_to:
(if applicable).