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

[feat] - Add async serdes.deserialize support & req/res as context #749

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

Conversation

macyabbey-okta
Copy link

@macyabbey-okta macyabbey-okta commented Jul 17, 2022

  • Leverage ajv asyc keywords in serdes deserialization.
  • Leverage passContext for format.validate, deserialize, serialize
  • Add tests for async and context
  • Allow HttpErrors thrown from deserialize to influence errors thrown to express error handling. Determine status code of resulting error based on what aspect of the request originated the deserialization failure.
  • Modify schema pre-processor to not share memory between ajv instance and apiDoc.
  • Modify schema pre-processor to not share memory between request and response apiDoc.
  • Update CONTRIBUTING.md with explanation of how package works, diagram and code notes.

@cdimascio

Add test coverage:

image

image

Full run pass:
image

macyabbey-okta and others added 25 commits July 17, 2022 09:33
- Leverage ajv /asyc in serdes deserialization.
- Leverage passContext for format.validate, deserialize, serialize
- Add tests for async and context
- Allow HttpErrors thrown from deserialize to influence errors thrown to express error handling pipeline.
- Modify schema pre-processor to not share memory between ajv instance and apiDoc.
- Modify schema pre-processor to not share memory between request and response apiDoc.
…rows HttpErrors. Deviates when deserialization is occuring in query/body/params. Functionality is a no-op if package consumers throw an Ajv.ValidationError from their deserialize function instead of an HttpError.
…chema. Make sure the schema passsed to compile has if it needs it. Additionally add test coverage, and make sure the ajv instance used for preprocessing respects passContext config for validateRequests.
…el schema has a dscriminator would lose the /body prefix of the instancePath, making error messages inconsistent. Additionally, respect the actual class type of an HttpError thrown from a deserialize/validate function.
…e request if those properties are not set in data.
B-->C["Multi-part parsing / validation"];
C-->D["Security enforcement"];
D-->E["Request validation"];
E-->F["Response validation"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems off; how can a response be validated before a handler has an opportunity to generate it?

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.

None yet

3 participants