Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

_get_operation does not populate "produces" #24

Open
robynsmith opened this issue Nov 4, 2016 · 1 comment
Open

_get_operation does not populate "produces" #24

robynsmith opened this issue Nov 4, 2016 · 1 comment

Comments

@robynsmith
Copy link

When attempting to document an API which uses header based versioning, I'm running into issues with errors like the following:

{
  "detail": "Could not satisfy the request Accept header."
}

When attempting to use "try it out" in the swagger UI.

After much debugging, I determined this is the source of the issue:

https://github.com/core-api/python-openapi-codec/blob/master/openapi_codec/encode.py#L78

Consumes is populated, but produces is NOT populated. We managed to get a "workaround" in play by manually patching it:

from openapi_codec import encode

old_get_operation = encode._get_operation

def patch_get_operation(operation_id, link, tags):
    operation = old_get_operation(operation_id, link, tags)
    operation["produces"] = ["application/vnd.acme.v2+json"]
    return operation

Is there a plan in the roadmap to implement this aspect of the swagger spec?

@tomchristie
Copy link
Contributor

It's not actively on the roadmap on the moment, given that Core API is a dynamic approach (clients don't need to know what might be produced, they can just inspect what was produced), but it's entirely possible that we'll get around to including it as we work through some of the "Core API for creating automated documentation" work that'll be happening for REST framework 3.6. Keeping this open and on the backlog.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants