beckn / protocol-server

protocol-server
4 stars 7 forks source link

P-26 | Protocol server supporting Open API Specification 3.1 #202

Open emmayank opened 1 month ago

emmayank commented 1 month ago

Ticket Contents

Purpose

Each network has its own policy rules that need to be validated at the protocol layer. Currently, BAP and BPP must write custom business logic to validate these policy rules, leading to increased development and maintenance overhead. Additionally, this approach creates a higher likelihood of inconsistencies at the protocol level among different participants (BAP/BPP). The purpose is to validate the policy rules specified in Level 2 (L2) configurations of Open API Specification 3.1 directly at the protocol level, thereby reducing overhead and ensuring uniformity across participants.

Objective

Following are the Objective for this goal :

  1. Support for Open API Specification 3.1 Validation: Ensure the protocol server fully supports validation according to Open API Specification 3.1.
  2. Automated Policy Rule Validation: Implement automated validation of policy rules at the protocol layer to eliminate the need for BAP/BPP to write custom business logic, reducing development and maintenance overhead.
  3. Uniformity Across Participants: Achieve consistency in policy rule validation at the protocol level, minimizing discrepancies among different participants (BAP/BPP) and enhancing interoperability.
  4. Efficient Validation Process: Optimize the protocol server to validate API endpoints against L2 configurations with minimal latency, aiming for a maximum of 20 milliseconds to ensure prompt and efficient validation.
  5. Simplified Development Workflow: Simplify the development workflow for BAP/BPP by offloading policy rule validation to the protocol server, allowing developers to focus on core business logic and functionality.

Goals

Assess Middleware Compatibility:

Middleware Integration:

Configuration Validation:

Testing and Verification:

Documentation and Reporting:

Deployment and Monitoring:

Acceptance Criteria

Full Support for Open API Specification 3.1:

  1. The selected middleware is integrated into the protocol server with no functional disruptions.
  2. The protocol server successfully validates API endpoints against the L2 Confgis written in open API Specification 3.1 without errors.
  3. Comprehensive testing shows no major issues or bugs in the validation process.

Latency Performance:

  1. Validation of API endpoints against L2 configurations occurs within a maximum latency of 20 milliseconds.

Documentation and Reporting:

  1. Complete and accurate documentation of middleware selection, integration steps, and validation results. Detailed reports on latency tests and overall system performance improvements are provided.

Implementation Details

Explore this library for the validation - https://www.npmjs.com/package/openapi-backend

Product Name

Protocol Server

Domain

Validation

Tech Skills Needed

JavaScript, Node.js

Complexity

Low

Category

Backend

emmayank commented 1 month ago

Here is the sample L2Config written in Open API Specification 3.1 - https://github.com/rajaneeshk90/local-retail-rk/blob/layer2-28thJune/api/l2-config/localretail_shopping_1.1.0.yaml

emmayank commented 1 month ago

Here is the Postman collection to validate against the above L2 Config

OAS3.1.postman_collection.json

harshcrop commented 1 month ago

assigning this issue to @mishalabdullah

Mishalabdullah commented 1 month ago

@emmayank and @harshcrop, How can I test the schema validator using the sample l2 config and the post collection provided ?

emmayank commented 1 month ago

Hi @Mishalabdullah , Add the L2Config, and then make the request as given in the postman collection. for each API i have given some positive and negative cases. for negative cases you should be getting error from the validator.

madhukaraman commented 3 weeks ago

Hey @emmayank this looks interesting to me, can I pick this one ?

emmayank commented 3 weeks ago

Hi @madhukaraman, can you please go through the issue and let us know the ETA, will assign you the issue post that.

madhukaraman commented 3 weeks ago

Hey @emmayank , can we get discord vc understand the repository and task better so that I can provide you the ETA.

KPRASANT9 commented 2 weeks ago

Same with me, Any high level info would be highly appreciated.

harshcrop commented 2 weeks ago

@KPRASANT9 @madhukaraman Please review the repository and familiarize yourselves with it. We've outlined most of the details regarding what we aim to achieve in this issue. Let us know what support you need to get started.

meenakshi2468 commented 1 day ago

https://github.com/cdimascio/express-openapi-validator/pull/882 : Link shared by Venkatesh - updating here.

emmayank commented 1 day ago

The content in this PR is now available on branch oas-3.1 and package express-openapi-validator@6.0.0-alpha.1. please try it out.

experimental OAS 3.1 in alpha (contributions welcome - see branch oas-3.1 and pr-882)

npm install express-openapi-validator@6.0.0-alpha.1 To contribute submit PRs against the oas-3.1 branch.

emmayank commented 1 day ago

The current plugin is now supporting OAS3.1. instead of replacing the plugin we need to test if it is working fine with the current plugin