-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add a metadata parser #175
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the handler idea, but
metadata: await this.metadataHandler.handleSafe(input),
seems repetitive.
Why don't the parsers just not return any metadata?
And then we have one wrapping parser whose sole job it is to add the metadata (so to execute that line)?
The reason it's currently like this is because BodyParsers return a Representation which needs to contain a RepresentationMetadata. Other options include replacing that line for every BodyParser with |
(After offline discussion:) Let's have body parsers take metadata as input, to which they can add if they want to, and then return as part of the representation. The metadata is provided by metadata extractors, and can inform body parsing. |
4edd4a3
to
a712d68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good stuff, I like the design. Very elegant an extensible.
Just nits—process as you see fit. No need for me to re-review.
a712d68
to
dcd366c
Compare
dcd366c
to
13c231d
Compare
Resolves #75 .
Since we now have decent metadata support, we still need a clean way to put the incoming metadata in there. So this is my suggestion for it.
Note that for the MetadataParsers their functionality is similar to AsyncHandlers but I used a new interface since the contracts is slightly different (it's no problem if they can't handle it, and all parsers should be executed regardless of the result of others).