go-openapi / runtime

openapi runtime interfaces
Apache License 2.0
245 stars 147 forks source link

Infer runtime producers/consumers from spec #33

Open GlenDC opened 7 years ago

GlenDC commented 7 years ago

Currently runtime's producers/consumers are statically set via a predefined list. While those defaults might not be bad, this could probably be done smarter, by inferring the information from the OpenAPI/Swagger2.0 Spec.

Relevant TODO: https://github.com/go-openapi/runtime/blob/master/client/runtime.go#L136

mikkeloscar commented 7 years ago

by inferring the information from the OpenAPI/Swagger2.0 Spec.

I think this means using the values from runtime.ClientOperation which most likely comes from a client generated by go-swagger, e.g. comes from the swagger spec.

I will try to find some time in the weekend to work on this unless someone picks it up before.

GlenDC commented 7 years ago

Go for it @mikkeloscar

Were you in the meanwhile able to have a working version for now, using my steps listed in issue #31?

mikkeloscar commented 7 years ago

@GlenDC sorry, I never really got around to this. I realized that it's not that trivial, as you were also suggesting, because you need to implement a consumer/producer for the particular mime type.

For my use case it was the right thing to just use the json consumer like you suggested in #31.