Skip to content

Commit a4036a1

Browse files
authored
Merge pull request #98 from sphinx-contrib/use-oas2-convertor
Use OAS 2 -> 3 converter in 'httpdomain' renderer
2 parents 66e978b + 45da875 commit a4036a1

File tree

2 files changed

+575
-0
lines changed

2 files changed

+575
-0
lines changed

sphinxcontrib/openapi/renderers/_httpdomain.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import requests
1111
import sphinx.util.logging as logging
1212

13+
from sphinxcontrib.openapi import _lib2to3 as lib2to3
1314
from sphinxcontrib.openapi.renderers import abc
1415
from sphinxcontrib.openapi.schema_utils import example_from_schema
1516

@@ -153,6 +154,9 @@ def __init__(self, state, options):
153154

154155
def render_restructuredtext_markup(self, spec):
155156
"""Spec render entry point."""
157+
158+
if spec.get("swagger") == "2.0":
159+
spec = lib2to3.convert(spec)
156160
yield from self.render_paths(spec.get("paths", {}))
157161

158162
def render_paths(self, paths):

0 commit comments

Comments
 (0)