Annotated links: Episode 38 of Hands-on SAP dev with qmacro
This is a searchable description of the content of a live stream recording, specifically “Ep.38 – Converting API EDMX metadata to CSN” in the “Hands-on SAP dev with qmacro” series. There are links directly to specific highlights in the video recording. For links to annotations of other episodes, please see the “Catch the replays” section of the series blog post.
Brief synopsis: In this episode we take a look at how OData metadata information, in the form of EDMX, can be converted to Core Schema Notation (CSN), and take a look at some SAP API Hub features along the way.
04:05 Some small giveaways for #HandsOnSAPDev live stream family members – badges from SAP TechEd and some awesome #HandsOnSAPDev stickers that Ronnie Sletta got made for us. We’ll bring some to TechEd and can give away up to 20 here.
09:50 The special secret keyword you need to send me when you request some badges or stickers 🙂
15:15 Looking at the original WWW browser that Tim Berners-Lee developed on the NeXT Cube, a beautiful simulation, and also pleasing that my blog can be rendered even with the very first browser that existed. Nice!
19:30 Showing how I manage the activities relating to Tech Aloud – using a GitHub repo related project, with various kanban style columns (Submitted, Planned, Recorded, Published in this particular case).
21:20 Feel free to submit articles / posts that you think are relevant and worthwhile for the Tech Aloud podcast. Read more about that in this post: Submit suggestions for Tech Aloud during SAP TechEd Barcelona.
21:50 Demonstrating the automatic assignment of a new issue in a repo to a project in that repo, specifically to a particular column in that project. Done using a GitHub Action, which you can find here: action-add-issue-to-project-column.
27:55 Going to https://developers.sap.com you can get to the missions available in the SAP TechEd App Space, one of which is on CAP & the SAP Cloud SDK: “S/4HANA Extensions with Cloud Application Programming Model (CAP)”.
29:10 The first tutorial in that mission is what Kevin was referring to, where a file called
API_BUSINESS_PARTNER.json is presented to be used in the tutorial (and a subsequent tutorial too). The question is – what format is it in (CSN) and how was it actually generated?
31:55 There are two packages available in the SAP NPM Registry:
@sap/edmx2csn for exactly this sort of requirement.
35:45 Adding the API to the SAP API Hub “API Cockpit” to try it out in the browser.
38:20 Poking the API from the terminal with curl, one step at a time. First getting a 401 (Unauthorized) response of course, then (eventually!) a 307 Temporary Redirect, which is better.
41:20 Looking briefly at the difference between HTTP response codes 307 (Temporary Redirect) and 302 (Moved Temporarily). Looks like this Stack Overflow answer is useful to read: What’s the difference between a 302 and a 307 redirect?.
44:30 To convert this EDMX we need one of two packages mentioned earlier. We opt to install
@sap/edmx2csn into a skeleton NPM project locally.
45:35 Looking at the metadata of the package with
npm info @sap/edmx2csn before installing it with
npm i -D @sap/edmx2csn.
46:50 Exploring what we’ve got inside
node_modules/ as a result of the package install, including the “binary” (executable!) and its location and invocation options.
50:20 Downloading the tutorial-specific, older version of
API_BUSINESS_PARTNER.json to compare it with the one we’ve just created with the
edmx2csn tool, to see if it’s the same or if there are some differences.
53:40 Using the excellent jq tool to format both the old and the new JSON CSN files so we can compare them properly, and it turns out that there’s only a single (repeated) difference, in the end: part of the Cardinality is expressed now using ‘max’ rather than ‘targetMax’. And that’s it!
58:10 Come and see us in the Developer Garage next week if you’re at SAP TechEd in Barcelona, and perhaps pick up a #HandsOnSAPDev sticker when you’re there!