diff --git a/schematics_to_swagger/__init__.py b/schematics_to_swagger/__init__.py
index d108f3f..d203de0 100644
--- a/schematics_to_swagger/__init__.py
+++ b/schematics_to_swagger/__init__.py
@@ -54,17 +54,24 @@ def _map_schematics_type(t):
 
 
 def model_to_definition(model):
-    fields = model.fields.items()
+    properties = {}
+    required = []
+
+    for field_name, field in model.fields.items():
+        if field_name.startswith(f'_{model.__name__}'):
+            continue  # Exclude private fields
+        properties[field_name] = _map_schematics_type(field)
+        if getattr(field, 'required'):
+            required.append(field_name)
+
     result_info = {
         'type': 'object',
         'title': model.__name__,
         'description': model.__doc__,
-        'properties': {k: _map_schematics_type(v) for k, v in fields}
+        'properties': properties
     }
-    required = [k for k, v in fields if getattr(v, 'required')]
     if required:
         result_info['required'] = required
-
     return result_info
 
 

Hide private model fields in swagger doc
diff --git a/tests/models.py b/tests/models.py
index 5392711..7cd4582 100644
--- a/tests/models.py
+++ b/tests/models.py
@@ -16,3 +16,10 @@ class WeatherStats(Model):
     last_report = types.ModelType(WeatherReport)
     prev_reports = types.ListType(types.ModelType(WeatherReport))
     date_list = types.ListType(types.DateTimeType())
+
+
+class WeatherPrivateData(Model):
+    """Some sample model with private field"""
+    city = types.StringType(max_length=50, metadata={'readOnly': True})
+    temperature = types.DecimalType(required=True)
+    __private_information = types.StringType(max_length=50)
diff --git a/tests/test_model.py b/tests/test_model.py
index ddeabe3..1ed6fba 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -53,6 +53,23 @@ WEATHER_STATS_DEF = {
         }
     },
 }
+WEATHER_PRIVATE_DATA = {
+    'title': 'WeatherPrivateData',
+    'type': 'object',
+    'description': 'Some sample model with private field',
+    'properties': {
+        'city': {
+            'type': 'string',
+            'maxLength': 50,
+            'readOnly': True
+        },
+        'temperature': {
+            'type': 'number',
+            'format': 'double'
+        }
+    },
+    'required': ['temperature']
+}
 
 
 def test_model_to_definition():
@@ -64,7 +81,8 @@ def test_model_to_definition():
 def test_read_models_from_module():
     expected = {
         'WeatherReport': WEATHER_REPORT_DEFINITION,
-        'WeatherStats': WEATHER_STATS_DEF
+        'WeatherStats': WEATHER_STATS_DEF,
+        'WeatherPrivateData': WEATHER_PRIVATE_DATA
     }
     data = schematics_to_swagger.read_models_from_module(models)
     assert expected == data
@@ -74,3 +92,9 @@ def test_compound_type():
     expected = WEATHER_STATS_DEF
     data = schematics_to_swagger.model_to_definition(models.WeatherStats)
     assert expected == data
+
+
+def test_private_fields():
+    expected = WEATHER_PRIVATE_DATA
+    definition = schematics_to_swagger.model_to_definition(models.WeatherPrivateData)
+    assert expected == definition

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest>=3.6 pytest-cov codecov flake8
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
flake8==5.0.4
idna==3.10
importlib-metadata==4.2.0
iniconfig==1.1.1
mccabe==0.7.0
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
requests==2.27.1
schematics==2.1.1
-e git+https://github.com/Alexei-Kornienko/schematics_to_swagger.git@3ddc537a8ed7682e9bb709ebd749b99d7ef09473#egg=schematics_to_swagger
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: schematics_to_swagger
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
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - 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=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - coverage==6.2
      - flake8==5.0.4
      - idna==3.10
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - mccabe==0.7.0
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - requests==2.27.1
      - schematics==2.1.1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/schematics_to_swagger

tests/test_model.py::test_read_models_from_module tests/test_model.py::test_private_fields
tests/test_model.py::test_model_to_definition tests/test_model.py::test_compound_type
schematics_to_swagger/__init__.py
schematics_to_swagger/__init__.py