Skip to content
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

Updated Schema Validator to support openapi 3.1.0 #232

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tanyamadaan
Copy link

This PR introduces modifications to the validation layer of the protocol server to enhance its OpenAPI validation capabilities, specifically targeting OpenAPI 3.1.0 specifications. Key changes include:

Package Update:

  • Added openapi-backend version 5.11.0 to package.json. This library was chosen as an alternative to express-openapi-validator due to its limitations in handling certain validation keywords, such as contains, introduced in OpenAPI 3.1.0.

Migration to openapi-backend:

  • The validation middleware has been completely refactored to replace express-openapi-validator, which could not fully support OpenAPI 3.1.0 schemas, even with the latest alpha releases.

  • A custom middleware has been developed using openapi-backend to handle request validations in a manner consistent with the previous behavior of express-openapi-validator. This custom middleware ensures that validation errors are caught and managed properly, while also allowing validated requests to pass through to subsequent middleware.

Redis Utility Update:

  • Updated the setWithExpiry method in the Redis utility to include a fallback mechanism for setting the expiry time. The updated logic ensures that if the provided expiry is not a positive integer, it defaults to 400 seconds:

@vbabuEM
Copy link
Contributor

vbabuEM commented Sep 26, 2024

Hello ABee, @em-abee ,
Tanya from ONDC has raised a PR for making Protocol Server OpenAPI 3.1 compatible.
Please have a look. The following things stands out in my mind

  1. Someone might have to do an indepth check of the older library to see the additional tasks it was doing during run (I think Rahul had done it sometime). We have to ensure (either by code walkthrough or test) that this new library also does those.
  2. Adding this should not regress on the latency optimization the team had done with ONest support. Please ensure that it is thoroughly tested on that front before integrating.

Having said that, please prioritize this as it might be required for the ONDC winroom.

Thanks with regards,
Venkatesh

cc @tanyamadaan , @em-abee , @shreyvishal , @faizmagic , @rahul-eminds , @binrange

@em-abee
Copy link
Contributor

em-abee commented Oct 4, 2024

Hi @tanyamadaan,

May I know the base branch details, is it for your internal use?
Also, we have fixed it conditionally for 3.1.0, see if this is helpful.
#233

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants