Event Information
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.
This episode, titled “Converting API EDMX metadata to CSN“, was streamed live on Fri 04 Oct 2019 and is approximately one hour in length. The stream recording is available on YouTube.
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.
01:50 The latest edition to my keyboard family, the Vortex Core, a 40% keyboard layout.
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 🙂
11:20 The Developer Garage is the place to be at SAP TechEd Barcelona next week, where you’ll be able to also get your hands on a #HandsOnSAPDev sticker (you will have to ‘earn’ it though!).
12:10 Reminding everyone of the upcoming Advent Of Code in December; I’d like to be better prepared this year, possibly with a setup similar to what we used in Ep.0 (using nodemon).
14:15 Looking at GitHub Actions; I created a JavaScript based action to automate the assignment of new issues in a repo to a column in a project in that same repo (I use GitHub repo projects to organise a lot of my working activities).
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!
16:30 Info on the new Tech Aloud podcast that I created, read more about it (especially how to subscribe and listen!) in this blog post: New podcast – Tech Aloud.
18:00 A quick note on Domain Specific Languages (DSLs), which are wonderful and something that is evident in CAP, as I explain in this SAP Community post: Tech Aloud podcast – an introduction.
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.
24:55 Looking at the workflow definition in the Tech Aloud podcast management repo to see how the job (that uses the GitHub Action) is set up. See submission.yml.
25:40 A quick reading recommendation: “When to use SAP Fiori elements” that was recently shared by the Twitter @sapdevs account.
26:40 Looking at the question asked by Kevin Hu on the SAP Community about the conversion of an S/4HANA API (from the SAP API Business Hub) to Core Schema Notation (CSN).
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/edm-converters
and @sap/edmx2csn
for exactly this sort of requirement.
33:00 Logging on to the SAP API Business Hub to get to the API so we can look at it and download the definition in the form of an EDMX file (OData FTW!).
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.
39:45 The tutorial that explains the use of the APIKey header is this one: Testing API Business Hub APIs with Curl.
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?.
43:40 Grabbing the API’s metadata from the API specification page in EDMX format (JSON and YAML are also available).
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!