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

Add ContentTypeForm functionality to DecodeForm #4

Merged
merged 12 commits into from Apr 29, 2021
Merged

Add ContentTypeForm functionality to DecodeForm #4

merged 12 commits into from Apr 29, 2021

Conversation

syntaqx
Copy link
Contributor

@syntaqx syntaqx commented Sep 1, 2017

Some of my companies legacy applications require the ability to use ContentTypeForm. I didn't realize go-chi/render didn't support this until we started running into random breakage..

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

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

Can you show us the use case for this PR so we fully understand it?

We're trying to keep go-chi packages without any unnecessary 3rd party vendor dependencies. I'm not yet sure if we want to pull in gorilla/schema.

@syntaqx
Copy link
Contributor Author

syntaqx commented Sep 2, 2017

Literally I just want the ability for decoding the following:

$ curl -d "name=test" -X POST http://mysite.com/create

I would say we could spend the time to recreate the functionality of gorilla/schema if you're trying to keep this repository free of dependencies, but it's pretty much the defacto standard for dealing with form data, and has fixed a lot of edge cases around them.

@VojtechVitek
Copy link
Contributor

VojtechVitek commented Sep 2, 2017

@syntaqx
Copy link
Contributor Author

syntaqx commented Sep 2, 2017

If I'm not mistaken, go-querystring is specifically for the case of utilizing urlencoded query arguments, rather than extracting form data into url.Values.

When comparing ajg/form and gorilla/schema, it seems like both implementations could be viable, it's honestly a flip of the coin on that one.

@syntaqx
Copy link
Contributor Author

syntaqx commented Sep 5, 2017

@VojtechVitek How would you like me to proceed with this? I believe that gorilla/schema is a good choice for this, but if you would like to vet the others, that's reasonable.

@VojtechVitek
Copy link
Contributor

VojtechVitek commented Sep 5, 2017

@syntaqx you're right, go-querystring only implements encoding.

We should evaluate decide between the two other packages. Both seem very mature to me.

However, https://github.com/ajg/form looks simpler and more elegant to me.

https://github.com/gorilla/schema looks quite complex for what it's supposed to do, especially the internal cache: https://github.com/gorilla/schema/blob/master/cache.go#L18-L33

@syntaqx syntaqx changed the title Use gorilla/schema for ContentTypeForm Add functionality for DecodeForm Oct 31, 2017
@syntaqx
Copy link
Contributor Author

syntaqx commented Oct 31, 2017

Sorry for the massive delay on this. I've switched to using ajg/form. Please let me know if you have additional concerns.

@syntaqx
Copy link
Contributor Author

syntaqx commented Nov 1, 2017

@VojtechVitek Let me know if you need anything from me. Would love to switch over to using this package instead of a fork again!

@VojtechVitek
Copy link
Contributor

@syntaqx thanks, I'll take a look when I have some spare time. I'm too busy right now with my job

@@ -7,6 +7,8 @@ import (
"io"
"io/ioutil"
"net/http"

"github.com/ajg/form"
Copy link
Contributor

Choose a reason for hiding this comment

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

should we bring in github.com/ajg/form as golang/dep dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that's a more global question for you, for the project. Currently there's no dependency tooling, so I didn't add any.

@otraore
Copy link

otraore commented Jan 17, 2018

Any reason as to why this isn't merged yet, we need this at work too.

@VojtechVitek
Copy link
Contributor

@otraore I want to get this merged together with golang/dep files.

@syntaqx
Copy link
Contributor Author

syntaqx commented Jan 17, 2018

I've added dep.

@syntaqx
Copy link
Contributor Author

syntaqx commented May 1, 2018

Any follow up on this?

@VojtechVitek
Copy link
Contributor

Sorry I'm too busy at this point. I'll try to come back to this when I have some spare time.

@syntaqx
Copy link
Contributor Author

syntaqx commented Jun 30, 2018

Hey @VojtechVitek - I know you've been busy, but was just wondering if you've had the chance to look at this? If not, perhaps you'd be willing to add myself or someone else as a maintainer? Would love to be able to keep using this, but without support it's becoming very unreasonable.

@syntaqx
Copy link
Contributor Author

syntaqx commented Jun 30, 2018

As an aside, gorilla/schema seems to be a better package overall, but I think the general purpose of this PR can use either. Seems that there are occasional reflection issues with ajg/form where it has issues deciphering things, but that can be overridden on a per-application basis, rather than needing to be packaged as the primary option.

@syntaqx syntaqx changed the title Add functionality for DecodeForm Add ContentTypeForm functionality for DecodeForm Jun 30, 2018
@syntaqx syntaqx changed the title Add ContentTypeForm functionality for DecodeForm Add ContentTypeForm functionality to DecodeForm Jun 30, 2018
@SuperFluffy
Copy link

Is there some progress on this? I'd love to see this land.

@syntaqx
Copy link
Contributor Author

syntaqx commented Sep 20, 2018

¯\(ツ)/¯ can't seem to get him to merge it.

@VojtechVitek
Copy link
Contributor

VojtechVitek commented Sep 21, 2018

Open-source is tough, man. Merging this PR means I'd have to spend hours of testing this changeset in the pre-production & production environments with all of our projects.

I'm willing to do that - but not right away, since I have different priorities at this time.

Send bitcoin or ETH and I'll find some time sooner! :D

@syntaqx
Copy link
Contributor Author

syntaqx commented Sep 24, 2018

@VojtechVitek While I can appreciate having to find time to deal with a PR on an open-source project, it's literally been a year since I opened this. I'd be happy to manage this project if you're unable to?

@VojtechVitek
Copy link
Contributor

You're right. I'm slow. And I'm sorry.

I'll try to test this when I find some time soonish.

@syntaqx
Copy link
Contributor Author

syntaqx commented Jan 30, 2019

Happy 2019 @VojtechVitek - How're we doing on getting this merged friend? Especially given we have Semantic Versioning now, I feel like the issue is less complicated.

@pzeinlinger
Copy link

Hey @VojtechVitek,
what about merging this PR? It's not complicated, and we have been running this for quite some time now in production. No issues at all.

@FryDay
Copy link

FryDay commented Apr 27, 2021

Is this project no longer maintained? This is a pretty simple PR and has been open for 4 years.

@VojtechVitek
Copy link
Contributor

I'm sorry. I don't currently use go-chi/render.

This PR has some old module mgmt system, so I prefer not to merge it right away.

@syntaqx
Copy link
Contributor Author

syntaqx commented Apr 27, 2021

I'm more than happy to include Go modules, assuming that you will actually make an effort to get this merged.

What are you using instead of this project, so that people can look to that?

Additionally, I'm more than happy to help maintain this project if you're open to it. It certainly needs a few modernization updates, but there's plenty of participation on the project that could use responses, and some additional features would make it a more than viable option for folks.and would be more than happy to even maintain the repository to provide it with some additional functionality that it would benefit from, b

@syntaqx
Copy link
Contributor Author

syntaqx commented Apr 27, 2021

@VojtechVitek I've updated the pull request:

  • Uses go modules
  • Swapped Travis for GitHub Actions (the old tests relied on goimports, and given that I don't use Travis I just swapped to actions instead) - Let me know if you have any concerns here.
  • Added a couple of everyone's favorite change: build badges in the readme

If we could move to getting this merged in, that would be awesome. Also, please let me know your thoughts on the future of this project, as I would be more than happy to provide it a bit of attention and some much needed updates, but I don't want another 4 years of PR delays ;)

@syntaqx
Copy link
Contributor Author

syntaqx commented Apr 27, 2021

Sorry, couple minor updates there; didn't realize the linting wasn't passing. Actually good for review/merge now.

@FryDay
Copy link

FryDay commented Apr 28, 2021

I would be willing to assist @syntaqx in maintaining Render. Chi and Render are certainly being used in production in various projects and really need to be kept current.

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks for switching to Go Modules and to Github Actions too. Great job!

For reference:
https://github.com/syntaqx/go-chi-render/runs/2451985236
https://github.com/syntaqx/go-chi-render/runs/2451985149

@@ -66,7 +66,7 @@ func PlainText(w http.ResponseWriter, r *http.Request, v string) {
if status, ok := r.Context().Value(StatusCtxKey).(int); ok {
w.WriteHeader(status)
}
w.Write([]byte(v))
w.Write([]byte(v)) //nolint:errcheck
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: _ = w.Write() would be imho more idiomatic than using some special comments

@VojtechVitek VojtechVitek merged commit 996350f into go-chi:master Apr 29, 2021
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

6 participants