deepcode-ci-bot[bot]: ## DeepCode failed to analyze this pull request
Something went wrong despite trying multiple times, sorry about that.
Please comment this pull request with "Retry DeepCode" to manually retry, or [contact us](https://www.deepcode.ai/feedback?select=4&utm_source=gh_review) so that a human can look into the issue.

codecov[bot]: # [Codecov](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52?src=pr&el=h1) Report
> Merging [#52](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52?src=pr&el=desc) into [master](https://codecov.io/gh/hh-h/aiohttp-swagger3/commit/a4a0a383cceacf93fe611d2285fdec0a15201bcd&el=desc) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52/graphs/tree.svg?width=650&height=150&src=pr&token=vsUkD2f5wc)](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master      #52   +/-   ##
=======================================
  Coverage   98.77%   98.78%           
=======================================
  Files          11       11           
  Lines        1147     1150    +3     
=======================================
+ Hits         1133     1136    +3     
  Misses         14       14           
```


| [Impacted Files](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [aiohttp\_swagger3/\_\_init\_\_.py](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52/diff?src=pr&el=tree#diff-YWlvaHR0cF9zd2FnZ2VyMy9fX2luaXRfXy5weQ==) | `100.00% <100.00%> (ø)` | |
| [aiohttp\_swagger3/validators.py](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52/diff?src=pr&el=tree#diff-YWlvaHR0cF9zd2FnZ2VyMy92YWxpZGF0b3JzLnB5) | `98.25% <100.00%> (+<0.01%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52?src=pr&el=footer). Last update [a4a0a38...4b0fbc7](https://codecov.io/gh/hh-h/aiohttp-swagger3/pull/52?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

hh-h: Retry DeepCode
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index a2e38bd..9b803cc 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,11 @@
 Changelog
 =========
 
+0.4.1 (09-03-2020)
+------------------
+
+- allow for unknown string formats. Closes `#51 <https://github.com/hh-h/aiohttp-swagger3/issues/51>`_
+
 0.4.0 (07-03-2020)
 ------------------
 
diff --git a/aiohttp_swagger3/__init__.py b/aiohttp_swagger3/__init__.py
index 21e7e4b..099fbec 100644
--- a/aiohttp_swagger3/__init__.py
+++ b/aiohttp_swagger3/__init__.py
@@ -7,7 +7,7 @@ __all__ = (
     "SwaggerUiSettings",
     "__version__",
 )
-__version__ = "0.4.0"
+__version__ = "0.4.1"
 __author__ = "Valetov Konstantin"
 
 from .swagger_docs import SwaggerDocs
diff --git a/aiohttp_swagger3/validators.py b/aiohttp_swagger3/validators.py
index ed205cc..3befab2 100644
--- a/aiohttp_swagger3/validators.py
+++ b/aiohttp_swagger3/validators.py
@@ -65,6 +65,10 @@ class StringFormat(enum.Enum):
     IPv4 = "ipv4"
     IPv6 = "ipv6"
 
+    @classmethod
+    def _missing_(cls, value: object) -> "StringFormat":
+        return StringFormat.Default
+
 
 @attr.attrs(slots=True, frozen=True, eq=False, hash=False, auto_attribs=True)
 class Integer(Validator):

Custom string formats
Hello!
 
In our project we need to validate some string formats, which are not represented in aiohhtp-swagger3, like a IPv4Network (192.168.100.0/24). Specification [says](https://swagger.io/specification/?sbsearch=String#dataTypeFormat), that custom formats may be used even though undefined by this specification.
diff --git a/tests/test_docs_queries.py b/tests/test_docs_queries.py
index d1b3a29..11a429d 100644
--- a/tests/test_docs_queries.py
+++ b/tests/test_docs_queries.py
@@ -680,3 +680,27 @@ async def test_wrong_item_in_array(swagger_docs, aiohttp_client):
     assert resp.status == 400
     error = error_to_json(await resp.text())
     assert error == {"array": {"1": "value should be type of int"}}
+
+
+async def test_unknown_string_format(swagger_docs, aiohttp_client):
+    async def handler(request):
+        """
+        ---
+        parameters:
+
+          - name: array
+            in: query
+            required: true
+            schema:
+              type: string
+              format: something_unknown
+
+        responses:
+          '200':
+            description: OK.
+
+        """
+        return web.json_response()
+
+    swagger = swagger_docs()
+    swagger.add_route("GET", "/r", handler)

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-xdist pytest-cov codecov
apt-get update apt-get install -y gcc
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
aiohttp==3.6.2
-e git+https://github.com/hh-h/aiohttp-swagger3.git@a4a0a383cceacf93fe611d2285fdec0a15201bcd#egg=aiohttp_swagger3
async-timeout==3.0.1
attrs==19.3.0
certifi==2025.1.31
chardet==3.0.4
charset-normalizer==3.4.1
codecov==2.1.13
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
fastjsonschema==2.14.3
idna==3.10
iniconfig==2.1.0
multidict==4.7.6
packaging==24.2
pluggy==1.5.0
propcache==0.3.1
pytest==8.3.5
pytest-cov==6.0.0
pytest-xdist==3.6.1
PyYAML==5.3
requests==2.32.3
strict-rfc3339==0.7
tomli==2.2.1
urllib3==2.3.0
yarl==1.18.3

name: aiohttp-swagger3
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - aiohttp==3.6.2
      - async-timeout==3.0.1
      - attrs==19.3.0
      - certifi==2025.1.31
      - chardet==3.0.4
      - charset-normalizer==3.4.1
      - codecov==2.1.13
      - coverage==7.8.0
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - fastjsonschema==2.14.3
      - idna==3.10
      - iniconfig==2.1.0
      - multidict==4.7.6
      - packaging==24.2
      - pluggy==1.5.0
      - propcache==0.3.1
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pytest-xdist==3.6.1
      - pyyaml==5.3
      - requests==2.32.3
      - strict-rfc3339==0.7
      - tomli==2.2.1
      - urllib3==2.3.0
      - yarl==1.18.3
prefix: /opt/conda/envs/aiohttp-swagger3

tests/test_docs_queries.py::test_unknown_string_format[pyloop]
tests/test_docs_queries.py::test_query_array[pyloop] tests/test_docs_queries.py::test_array[pyloop] tests/test_docs_queries.py::test_enum[pyloop] tests/test_docs_queries.py::test_primitives[pyloop] tests/test_docs_queries.py::test_string_formats[pyloop] tests/test_docs_queries.py::test_corner_cases[pyloop] tests/test_docs_queries.py::test_string_pattern[pyloop] tests/test_docs_queries.py::test_decorated_routes[pyloop] tests/test_docs_queries.py::test_missing_query_parameter[pyloop] tests/test_docs_queries.py::test_wrong_item_in_array[pyloop]
CHANGELOG.rst aiohttp_swagger3/__init__.py aiohttp_swagger3/validators.py
CHANGELOG.rst aiohttp_swagger3/__init__.py aiohttp_swagger3/validators.py