Repository: manchenkoff/openapi3-parser (language: python)

Issue:
[BUG] Lack of Support for RFC 7807 and application/problem+json Content Type
### Description

The Python OpenAPI3-parser library currently lacks support for RFC 7807, leading to an issue when handling the application/problem+json content type. According to RFC 7807, this content type is commonly used for representing errors in a machine-readable format, allowing for standardized error responses.

### Problem

When attempting to process errors using the application/problem+json content type, the library raises an exception, hindering the smooth integration of error handling in accordance with RFC 7807.

### Expected Behavior

The OpenAPI3-parser library should provide support for RFC 7807, allowing users to seamlessly handle error responses in the specified JSON format without encountering exceptions.

### Steps to Reproduce

1. Define an OpenAPI specification that includes error responses conforming to RFC 7807.
2. Implement a build process using the OpenAPI3-parser library.
3. Trigger an error response with the application/problem+json content type.

### Current Behavior

The library raises an exception when attempting to process the error response with the application/problem+json content type.

### Proposed Solution

Implement support for RFC 7807 in the OpenAPI3-parser library, ensuring that the application/problem+json content type is handled without raising exceptions. This enhancement will enable users to seamlessly integrate standardized error handling into their applications.

Updating the enum `ContentType` in the file `openapi_parser/enumeration.py` by adding an entry `JSON_PROBLEM = 'application/problem+json' resolves this issues.

### Impact

This improvement will benefit users who rely on RFC 7807 for consistent error representations and enhance the overall compatibility of the OpenAPI3-parser library with industry standards.


Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
index 5efc05c..8872fe7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -128,3 +128,6 @@ dmypy.json
 # Cython debug symbols
 cython_debug/
 
+# VS Code
+.history
+.vscode
diff --git a/src/openapi_parser/enumeration.py b/src/openapi_parser/enumeration.py
index 2660516..3ac22e7 100644
--- a/src/openapi_parser/enumeration.py
+++ b/src/openapi_parser/enumeration.py
@@ -99,6 +99,7 @@ class ContentType(Enum):
     JSON = 'application/json'
     JSON_TEXT = 'text/json'
     JSON_ANY = 'application/*+json'
+    JSON_PROBLEM = 'application/problem+json'
     XML = 'application/xml'
     FORM = 'application/x-www-form-urlencoded'
     MULTIPART_FORM = 'multipart/form-data'


Test patch:
diff --git a/tests/test_enumeration.py b/tests/test_enumeration.py
index ebf1f8c..3959156 100644
--- a/tests/test_enumeration.py
+++ b/tests/test_enumeration.py
@@ -140,6 +140,7 @@ def test_parameter_location_error() -> None:
 media_type_provider = (
     ("application/json", ContentType.JSON),
     ("application/*+json", ContentType.JSON_ANY),
+    ("application/problem+json", ContentType.JSON_PROBLEM),
     ("text/json", ContentType.JSON_TEXT),
     ("application/xml", ContentType.XML),
     ("application/x-www-form-urlencoded", ContentType.FORM),