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

Issue:
[Feature] Support more media types for images
**What is a problem?**
OpenApi specification describes the ContentType as:

The Content-Type for encoding a specific property. Default value depends on the property type: for string with format being binary – application/octet-stream; for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.

precisely **a wildcard media type (e.g. image/*)**

Openapi3-parser support only one image type:
image/png

**Describe the solution you'd like**
Openapi3-parser is able to parse Content type with various types of images, for example image/jpeg and others

**Describe alternatives you've considered**

**Additional context**
https://spec.openapis.org/oas/v3.0.3#fixed-fields-12




Discussion / hints:
Hi @rtyping, there is a possibility to disable strict content-type checks with `parse()` function calls by passing `strict_enum=False` as an argument. It will allow you to use any Content-Type you want, even if it is not officially registered as a media type. However, I will extend the current enum with a few more values for images.

Fix patch:
diff --git a/src/openapi_parser/enumeration.py b/src/openapi_parser/enumeration.py
index 3ac22e7..16e8667 100644
--- a/src/openapi_parser/enumeration.py
+++ b/src/openapi_parser/enumeration.py
@@ -107,6 +107,13 @@ class ContentType(Enum):
     HTML = 'text/html'
     PDF = 'application/pdf'
     PNG = 'image/png'
+    JPEG = 'image/jpeg'
+    GIF = 'image/gif'
+    SVG = 'image/svg+xml'
+    AVIF = 'image/avif'
+    BMP = 'image/bmp'
+    WEBP = 'image/webp'
+    Image = 'image/*'
     BINARY = 'application/octet-stream'
 
 


Test patch:
diff --git a/tests/test_enumeration.py b/tests/test_enumeration.py
index 3959156..9dad776 100644
--- a/tests/test_enumeration.py
+++ b/tests/test_enumeration.py
@@ -149,6 +149,13 @@ def test_parameter_location_error() -> None:
     ("text/html", ContentType.HTML),
     ("application/pdf", ContentType.PDF),
     ("image/png", ContentType.PNG),
+    ("image/jpeg", ContentType.JPEG),
+    ("image/gif", ContentType.GIF),
+    ("image/svg+xml", ContentType.SVG),
+    ("image/avif", ContentType.AVIF),
+    ("image/bmp", ContentType.BMP),
+    ("image/webp", ContentType.WEBP),
+    ("image/*", ContentType.Image),
     ("application/octet-stream", ContentType.BINARY),
 )