2024 Feb 07 11:46 AM - edited 2024 Mar 05 4:13 PM
Week 2 is now live: February Developer Challenge - CAP Plugins: Week 2 - SAP Community
Now that the challenge is complete: here is my sample solution: jung-thomas/dev-challenge-feb-2024: Developer Challenge February 2024 (github.com)
Welcome back to our monthly Developer Challenge series. These are fun puzzles that also challenge you to learn something new. For February 2024 the challenge will focus on SAP Cloud Application Programming Model and its concept of plugins. To participate in the challenge you just have to post a screenshot of your solution as a reply here in this discussion.
SAP Cloud Application Programming Model (CAP) plugins are extensions to the CAP framework that enable developers to enhance the capabilities of their CAP-based applications. These plugins can be used to add custom features, integrate with external services, or modify the default behavior of the CAP framework. In the February 2024 Developer Challenge, you are going to learn just how easy and powerful these extensions are. We will build a simple, sample CAP application and then each week your challenge will be to integrate a different plugin into this application.
Customization and Extension: Plugins allow developers to extend the core functionality of CAP by adding custom logic, services, or features that are not part of the standard CAP framework.
Integration: They can be used to integrate CAP applications with other SAP solutions, third-party services, or APIs. This helps in building more comprehensive and connected systems.
Reusability: Plugins can be developed in a way that they are reusable across different CAP projects. This promotes code reuse and consistency across applications.
Community Contributions: Apart from official SAP-provided plugins, the community of developers can create and share their own plugins, fostering an ecosystem of tools and extensions.
Simplified Development: By encapsulating complex or repetitive tasks into plugins, developers can simplify the application development process, focusing more on business logic rather than boilerplate code.
Configuration and Customization: Plugins often come with configurable options allowing developers to tailor them according to specific project requirements.
Overall, CAP plugins are a powerful way to extend the capabilities of the SAP Cloud Application Programming Model, enabling developers to build more feature-rich, integrated, and efficient applications.
https://cap.cloud.sap/docs/plugins/
GraphQL Adapter: This plugin automatically generates a GraphQL schema for application models and allows querying services using GraphQL. It's activated by adding a @graphql annotation to service definitions.
OData v2 Proxy: This protocol adapter exposes services as OData v2 services, converting OData V2 requests to CDS OData V4 calls and responses.
UI5 Dev Server: Integrates UI5 tooling-based projects into the CDS server, serving dynamic UI5 resources and transpiling TypeScript implementations for UI5 controls.
Change Tracking: Automatically captures, stores, and views changes in modeled entities. Entities and elements for change tracking are specified using @changelog annotations.
Audit Logging: Logs personal data-related operations with the SAP Audit Log Service, using annotations to mark entities and fields related to personal data.
Notifications: Integrates with the SAP Alert Notifications service to send notifications via various channels (email, Slack, Microsoft Teams, SAP Fiori). It provides a simple programmatic API for sending notifications.
Week 1 of the challenge will be the most time consuming of all the weeks, simply because we need to get an initial sample application running. After we have our baseline project, this week and all subsequent weeks will just focus on adding one or more CAP plugins to that project.
We will walk you through the initial project creation step-by-step. But later in the challenge once you are adding the plugins you will be expected to figure out that part on your own. That's the "challenge" after all.
Note: You can also create your project using the cds command line with the command: cds init --add nodejs,mta,sample
We have our running CAP application and it exposes OData V4 services and has a nice annotation based Fiori UI. You are ready for the real challenge to begin.
OData V4 support is excellent, but what if you also need OData V2 for backwards compatibility? This is the first of the CAP Plugins we will use. Your challenge, should you choose to accept it, is to use what you have learned about CAP plugins here and use the @cap-js-community/odata-v2-adapter plugin. You should be able to complete this challenge with a single command!
Bonus 1: Use the test tool to compare the format and structural differences between OData V2 and OData V4 both on the service endpoints and the metadata documents.
Bonus 2: using only configuration in the package.json, change the default path from /odata/v2 to /devchallenge/v2 for only the OData V2 service endpoint.
2024 Feb 07 1:21 PM - edited 2024 Feb 07 1:26 PM
2024 Feb 07 9:11 PM
2024 Feb 07 11:02 PM
2024 Feb 08 5:33 AM
2024 Feb 08 6:14 AM
2024 Feb 08 7:46 AM
2024 Feb 08 8:29 AM
2024 Feb 08 9:48 AM
2024 Feb 08 2:44 PM
2024 Feb 08 2:51 PM
@Sap/cds-odata-v2-adapter-proxy is the older version and now deprecated. See @sap/cds-odata-v2-adapter-proxy - npm (npmjs.com) -
2024 Feb 08 10:50 AM
2024 Feb 08 2:35 PM
I see you found the new badge signature as well. New SAP Community - Profile Signatures - SAP Community
2024 Feb 08 12:51 PM
2024 Feb 08 1:41 PM
Hi Thomas!
Love to see this challenge. I want to point out that we also have developed the new database services with the plugin technique. Including support for postgres
Cheers
Patrice
2024 Feb 08 2:01 PM
Very true. In this challenge I am focused on the non-DB service plugins. But that's an idea for a future challenge - exploring the various DB services and how they plugin as well. It's very elegant architecture. I actually did a video on hybrid testing with cds bind combined with the multi-DB service plugins - including Postgres
2024 Feb 08 2:41 PM
Test Page with V2 end points
Custom Path for v2 end points
2024 Feb 08 3:27 PM
1. ODataV2 default
2. test page Odatav2
3). changed the default path
2024 Feb 08 9:04 PM
2024 Feb 09 11:06 AM
2024 Feb 09 1:39 PM
2024 Feb 09 2:11 PM
2024 Feb 09 7:06 PM
2024 Feb 09 7:55 PM
The screenshots of the challenge:
2024 Feb 10 6:28 AM
Hi @thomas_jung ,
while generating the project via generator, i do not see the option "Extended sample with UI". any suggestions?
Also, tried using: cds init -> cds add mta -> cds add samples but that does not adds the sample UI artefacts too!
Thanks.
2024 Feb 10 1:34 PM
2024 Feb 10 6:45 AM
The screenshot of the challenge (used the another existing project, instead of creating the new one):
2024 Feb 10 1:32 PM
2024 Feb 10 10:34 AM
2024 Feb 10 9:28 PM
2024 Feb 11 2:19 PM
Screenshots about V2 endpoints.
And response below:
2024 Feb 11 3:06 PM
2024 Feb 12 11:44 AM
Finished task and the result below:
2024 Feb 12 2:50 PM
TASK 1:
2024 Feb 12 4:23 PM
2024 Feb 12 7:12 PM
2024 Feb 12 8:09 PM
2024 Feb 13 3:56 AM
2024 Feb 13 5:40 AM - edited 2024 Feb 13 5:46 AM
Application | |
Diff. between V2 and V4
| Action tag |
Service path change for v2 |
2024 Feb 13 12:07 PM
Nice challenge.
V2 Endpoints
Bonus 1
Bonus 2