Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

_get_operation does not populate "produces" #24

Copy link
Copy link
@robynsmith

Description

@robynsmith
Issue body actions

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?

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.