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.
Best way to handle "application/problem+json" #114
Closed
Description
Hi there,
The framework I am using (https://github.com/zalando/connexion) returns validation errors as Content-Type "application/problem+json" (https://tools.ietf.org/html/rfc7807) and this generates an error for me using Core API:
coreapi.exceptions.NoCodecAvailable: Unsupported media in Content-Type header 'application/problem+json'
As a kind of hackish test, I have created a file jsonproblem.py to make available a new codec JSONProbemCodec which does nothing apart from provide a different media type:
# coding: utf-8
from coreapi.codecs.jsondata import JSONCodec
class JSONProblemCodec(JSONCodec):
media_type = 'application/problem+json'
So my question is two-fold really.
- Am I going about this the right way - is this the best way to add support for a very simple new JSON media type?
- If this is the way to go, would you accept a PR into this repository or should I create an independant pip package (which seems like overkill to me)?
Any advice appreciated. I'm keen to recommend coreapi as a simple python interface for our customers to use with our new API, but I just need to iron a few teething issues first. This is the first issue I have hit during testing.
Metadata
Metadata
Assignees
Labels
No labels