-
Notifications
You must be signed in to change notification settings - Fork 69
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
Version parsers #274
Version parsers #274
Conversation
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
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.
This looks OK, but I'm trying to understand the benefit and where you have actually removed duplicate code. I see these three lines being consolidated by combining the two version files:
function parser(name: string, parser = new PassThroughParser()): MappedParser {
return { name: name, parser: parser };
}
But I think that could addressed by moving that code into https://github.com/cloudevents/sdk-javascript/blob/master/src/parsers.ts and having both versions import it. They already have a dependency on the parsers file anyway. Personally, I prefer to have code for each version in a distinct file. Not sure how others feel about this.
@grant I'm not sure but my view on that is you are trying to "consolidate versions for the future" that approach is good so 👍 to that. So for what I understood when a new v.x spec come out, the project has the structure to add the things without much effort or something (?) also centralizing things in versions.ts ? In other hand @lance's comment makes sense. So my question is your PR wording not accurate meaning or something ? anyway I'm trying to get the point |
@lance I have no idea how many times and how often new versions will be created/added. The approach looks good to me but not sure about the benefit related with the occurrence of the future changes/additions in versions. 👍 |
The Is there something you'd like me to change? |
I don't have any strong feelings on keeping things separate. ATM, since there are only 2 versions, it probably doesn't matter combining them. |
Not necessarily - was just trying to have some conversation around these questions. |
To be clear, I saw a lot of improvements beyond this, but I'd never finish a concrete PR if I went chasing them. |
Proposed Changes
Description