sc-oa 0.7.0.14__py3-none-any.whl → 0.7.0.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of sc-oa might be problematic. Click here for more details.

@@ -1,45 +1,37 @@
1
- Metadata-Version: 2.1
2
- Name: sc-oa
3
- Version: 0.7.0.14
4
- Summary: Fork of the OpenAPI (fka Swagger) spec renderer for Sphinx
5
- Home-page: https://github.com/olivier-heurtier/sphinxcontrib-openapi/tree/mymaster
6
- Author: Ihor Kalnytskyi
7
- Requires-Dist: sphinx
8
- Requires-Dist: sphinxcontrib-httpdomain
9
- Requires-Dist: PyYAML
10
- Requires-Dist: jsonschema
11
- Requires-Dist: m2r2
12
- Requires-Dist: picobox
13
- Requires-Dist: deepmerge
14
- Requires-Dist: setuptools
15
-
16
- Olivier Heurtier
17
- Author-email: ihor@kalnytskyi.com
18
- License: BSD
19
- Classifier: Topic :: Documentation
20
- Classifier: Topic :: Documentation :: Sphinx
21
- Classifier: License :: OSI Approved :: BSD License
22
- Classifier: Environment :: Console
23
- Classifier: Intended Audience :: Developers
24
- Classifier: Operating System :: OS Independent
25
- Classifier: Programming Language :: Python
26
- Classifier: Programming Language :: Python :: 3
27
- Classifier: Programming Language :: Python :: 3 :: Only
28
- Classifier: Programming Language :: Python :: 3.8
29
- Classifier: Programming Language :: Python :: 3.9
30
- Classifier: Programming Language :: Python :: 3.10
31
- Classifier: Programming Language :: Python :: 3.11
32
- Classifier: Programming Language :: Python :: 3.12
33
- Classifier: Programming Language :: Python :: Implementation :: CPython
34
- Classifier: Framework :: Sphinx
35
- Classifier: Framework :: Sphinx :: Extension
36
- Requires-Python: >=3.8
37
- License-File: LICENSE
38
- Requires-Dist: sphinx
39
- Requires-Dist: sphinxcontrib-httpdomain
40
- Requires-Dist: PyYAML
41
- Requires-Dist: jsonschema
42
- Requires-Dist: m2r2
43
- Requires-Dist: picobox
44
- Requires-Dist: deepmerge
45
- Requires-Dist: setuptools
1
+ Metadata-Version: 2.4
2
+ Name: sc-oa
3
+ Version: 0.7.0.15
4
+ Summary: Fork of the OpenAPI (fka Swagger) spec renderer for Sphinx
5
+ Home-page: https://github.com/olivier-heurtier/sphinxcontrib-openapi/tree/mymaster
6
+ Author: Ihor Kalnytskyi
7
+ Olivier Heurtier
8
+ Author-email: ihor@kalnytskyi.com
9
+ License: BSD
10
+ Classifier: Topic :: Documentation
11
+ Classifier: Topic :: Documentation :: Sphinx
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: Implementation :: CPython
25
+ Classifier: Framework :: Sphinx
26
+ Classifier: Framework :: Sphinx :: Extension
27
+ Requires-Python: >=3.8
28
+ License-File: LICENSE
29
+ Requires-Dist: sphinx
30
+ Requires-Dist: sphinxcontrib-httpdomain
31
+ Requires-Dist: PyYAML
32
+ Requires-Dist: jsonschema
33
+ Requires-Dist: m2r2
34
+ Requires-Dist: picobox
35
+ Requires-Dist: deepmerge
36
+ Requires-Dist: setuptools
37
+ Dynamic: license-file
@@ -0,0 +1,26 @@
1
+ sc_oa-0.7.0.15.dist-info/licenses/LICENSE,sha256=tgm4r1GgqXjKU6uEH1LIWT7ncoq7S56ZbuxNW-F94iU,1342
2
+ sphinxcontrib/__init__.py,sha256=lT1-9KgirBnjSt96Te_iPODBQdpXXnxmZa8yMD8-TYw,269
3
+ sphinxcontrib/openapi/__init__.py,sha256=U1Y6TAHjvJ4fky2prU1k_Vs9YtROsZq3RlBQPDgYOLY,3181
4
+ sphinxcontrib/openapi/__main__.py,sha256=CeXNtxW1vYEwojIlVxlMhoXz2qIxsCbJp58JEIoo5Js,2522
5
+ sphinxcontrib/openapi/_lib2to3.py,sha256=4LDmNmnGKTfXeq9TbVR0YXbwjYhFwq89zGA6XOtYgts,14002
6
+ sphinxcontrib/openapi/directive.py,sha256=FRZ2JgOekkNK-ltpkNjTDkEpJdkZa5PyXCisHsBa9bU,2117
7
+ sphinxcontrib/openapi/openapi20.py,sha256=zkwCm4aeZLMFNLM-uzj6UJQ4rHtFPdc95Airl3tpd78,9247
8
+ sphinxcontrib/openapi/openapi30.py,sha256=PfXQ7N2fPz2GtWAcvwatDv2l7X5o8npblLLaGXxvbyA,29881
9
+ sphinxcontrib/openapi/schema_utils.py,sha256=mI6_4-b8b9j8dane9rHM5y9-Pe7yJgFuLQCBzQWLn3k,4583
10
+ sphinxcontrib/openapi/utils.py,sha256=XGgO2HH6iYlPmn7jP-p36vlKxa50QM4TMnCg8I7-g-g,4480
11
+ sphinxcontrib/openapi/locale/openapi.pot,sha256=69Ry6f7i1NPPE8AxGBBjAJNlK2klcWDbW01Z4eZeTtw,3999
12
+ sphinxcontrib/openapi/locale/es_ES/LC_MESSAGES/openapi.mo,sha256=qdW6yFaSVB_BsexvwM33U8X12yoHikgaI8N7a4U_gI4,1919
13
+ sphinxcontrib/openapi/locale/es_ES/LC_MESSAGES/openapi.po,sha256=FuLzvZ9-I-2CQ9nQTh4VhZ23FqlzYdD-SqMUPujpUUE,4527
14
+ sphinxcontrib/openapi/locale/fr_FR/LC_MESSAGES/openapi.mo,sha256=YS2uZZZ4bHpDXJmShv33NZhtIWcir9-qERusNDR-vqY,1956
15
+ sphinxcontrib/openapi/locale/fr_FR/LC_MESSAGES/openapi.po,sha256=wRkEX1USVUETXnFMXPFo_OH8NjVZJGymMn13E5a2iBo,4570
16
+ sphinxcontrib/openapi/renderers/__init__.py,sha256=76shdyGAuHpJ9Gy3y0MQP1hyT3OMI6uTSrnRMYHwklI,426
17
+ sphinxcontrib/openapi/renderers/_description.py,sha256=1J_e_4nl4wMT2dGkYdNbdQH80UuBJsNNQPq5axlcswM,728
18
+ sphinxcontrib/openapi/renderers/_httpdomain.py,sha256=vLpVQts97dRUzLi4lrPcD1UzGG7dBiPWgnPzbeIozdk,25166
19
+ sphinxcontrib/openapi/renderers/_httpdomain_old.py,sha256=4rbrX_zAaobYgwAI0veDSDhjPNWX4iIJJz9Sp-bKxcg,2691
20
+ sphinxcontrib/openapi/renderers/_model.py,sha256=Cb6eYXU7tVuDbwVnnECkyjKWw5lgWzFKVLpEY-yK1Z0,15867
21
+ sphinxcontrib/openapi/renderers/_toc.py,sha256=vY0giwCeyoBejkhEDD0Ok_vGCtZKobICnb1CK7vhDJQ,1526
22
+ sphinxcontrib/openapi/renderers/abc.py,sha256=CuIda0iT0jdEUd2OBGQdq4VcHl2XWKoCAayYztKAzOA,1531
23
+ sc_oa-0.7.0.15.dist-info/METADATA,sha256=LrAexuL3wY6he4XhL0NwuxHsow_wQ5vv6V-X-JFd7z4,1405
24
+ sc_oa-0.7.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ sc_oa-0.7.0.15.dist-info/top_level.txt,sha256=VJrV3_vaiKQVgVpR0I1iecxoO0drzGu-M0j40PVP2QQ,14
26
+ sc_oa-0.7.0.15.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,23 +1,23 @@
1
- Copyright (c) 2016, Igor Kalnitsky <igor@kalnitsky.org>.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
-
7
- * Redistributions of source code must retain the above copyright notice, this
8
- list of conditions and the following disclaimer.
9
-
10
- * Redistributions in binary form must reproduce the above copyright notice,
11
- this list of conditions and the following disclaimer in the documentation
12
- and/or other materials provided with the distribution.
13
-
14
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ Copyright (c) 2016, Igor Kalnitsky <igor@kalnitsky.org>.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sphinxcontrib/__init__.py CHANGED
@@ -1,10 +1,10 @@
1
- """
2
- sphinxcontrib
3
- ~~~~~~~~~~~~~
4
-
5
- This package is a namespace package that contains all extensions
6
- distributed in the ``sphinx-contrib`` distribution.
7
-
8
- :copyright: (c) 2016 by Igor Kalnitsky.
9
- :license: BSD, see LICENSE for details.
10
- """
1
+ """
2
+ sphinxcontrib
3
+ ~~~~~~~~~~~~~
4
+
5
+ This package is a namespace package that contains all extensions
6
+ distributed in the ``sphinx-contrib`` distribution.
7
+
8
+ :copyright: (c) 2016 by Igor Kalnitsky.
9
+ :license: BSD, see LICENSE for details.
10
+ """
@@ -1,93 +1,93 @@
1
- """get_distribution
2
- sphinxcontrib.openapi
3
- ---------------------
4
-
5
- The OpenAPI spec renderer for Sphinx. It's a new way to document your
6
- RESTful API. Based on ``sphinxcontrib-httpdomain``.
7
-
8
- :copyright: (c) 2016, Ihor Kalnytskyi.
9
- :license: BSD, see LICENSE for details.
10
- """
11
-
12
- import os
13
- from importlib.metadata import distribution, PackageNotFoundError
14
- from sphinxcontrib.openapi import renderers, directive
15
- from sphinx.domains import Domain
16
- import yaml
17
- from docutils import nodes
18
-
19
- try:
20
- __version__ = distribution(__name__).version
21
- except PackageNotFoundError:
22
- # package is not installed
23
- __version__ = None
24
-
25
-
26
- _DEFAULT_RENDERER_NAME = "httpdomain:old"
27
-
28
-
29
- def oasversion_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
30
- fn = text
31
- env = inliner.document.settings.env
32
- rel_fn, fn = env.relfn2path(fn)
33
- y = yaml.load(open(fn, 'r').read(), Loader=yaml.FullLoader)
34
- s = y['info']['version']
35
- retnode = nodes.inline(text=s, role=typ.lower(), classes=[typ])
36
- return [retnode], []
37
-
38
-
39
- class OpenAPIDomain(Domain):
40
- name = 'openapi'
41
- label = 'OpenAPI Documentation'
42
-
43
- directives = {
44
- 'httpdomain:old': directive.create_directive_from_renderer(
45
- renderers.HttpdomainOldRenderer),
46
- 'httpdomain': directive.create_directive_from_renderer(renderers.HttpdomainRenderer),
47
- 'model': directive.create_directive_from_renderer(renderers.ModelRenderer),
48
- 'toc': directive.create_directive_from_renderer(renderers.TocRenderer),
49
- 'description': directive.create_directive_from_renderer(renderers.DescriptionRenderer),
50
- }
51
-
52
- roles = {
53
- 'version': oasversion_role
54
- }
55
-
56
-
57
- def setup(app):
58
- app.add_config_value("openapi_default_renderer", _DEFAULT_RENDERER_NAME, "html")
59
- app.add_config_value("openapi_renderers", {}, "html")
60
-
61
- package_dir = os.path.abspath(os.path.dirname(__file__))
62
- locale_dir = os.path.join(package_dir, 'locale')
63
- app.add_message_catalog('openapi', locale_dir)
64
-
65
- from sphinxcontrib import httpdomain
66
-
67
- for idx, fieldtype in enumerate(httpdomain.HTTPResource.doc_field_types):
68
- if fieldtype.name == 'requestheader':
69
- httpdomain.HTTPResource.doc_field_types[idx] = httpdomain.TypedField(
70
- fieldtype.name,
71
- label=fieldtype.label,
72
- names=fieldtype.names,
73
- typerolename='header',
74
- typenames=('reqheadertype', ),
75
- )
76
-
77
- if fieldtype.name == 'responseheader':
78
- httpdomain.HTTPResource.doc_field_types[idx] = httpdomain.TypedField(
79
- fieldtype.name,
80
- label=fieldtype.label,
81
- names=fieldtype.names,
82
- typerolename='header',
83
- typenames=('resheadertype', ),
84
- )
85
-
86
- app.setup_extension("sphinxcontrib.httpdomain")
87
- app.add_domain(OpenAPIDomain)
88
- app.add_directive(
89
- "openapi",
90
- directive.create_directive_from_renderer(renderers.HttpdomainOldRenderer)
91
- )
92
-
93
- return {"version": __version__, "parallel_read_safe": True}
1
+ """get_distribution
2
+ sphinxcontrib.openapi
3
+ ---------------------
4
+
5
+ The OpenAPI spec renderer for Sphinx. It's a new way to document your
6
+ RESTful API. Based on ``sphinxcontrib-httpdomain``.
7
+
8
+ :copyright: (c) 2016, Ihor Kalnytskyi.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ import os
13
+ from importlib.metadata import distribution, PackageNotFoundError
14
+ from sphinxcontrib.openapi import renderers, directive
15
+ from sphinx.domains import Domain
16
+ import yaml
17
+ from docutils import nodes
18
+
19
+ try:
20
+ __version__ = distribution(__name__).version
21
+ except PackageNotFoundError:
22
+ # package is not installed
23
+ __version__ = None
24
+
25
+
26
+ _DEFAULT_RENDERER_NAME = "httpdomain:old"
27
+
28
+
29
+ def oasversion_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
30
+ fn = text
31
+ env = inliner.document.settings.env
32
+ rel_fn, fn = env.relfn2path(fn)
33
+ y = yaml.load(open(fn, 'r').read(), Loader=yaml.FullLoader)
34
+ s = y['info']['version']
35
+ retnode = nodes.inline(text=s, role=typ.lower(), classes=[typ])
36
+ return [retnode], []
37
+
38
+
39
+ class OpenAPIDomain(Domain):
40
+ name = 'openapi'
41
+ label = 'OpenAPI Documentation'
42
+
43
+ directives = {
44
+ 'httpdomain:old': directive.create_directive_from_renderer(
45
+ renderers.HttpdomainOldRenderer),
46
+ 'httpdomain': directive.create_directive_from_renderer(renderers.HttpdomainRenderer),
47
+ 'model': directive.create_directive_from_renderer(renderers.ModelRenderer),
48
+ 'toc': directive.create_directive_from_renderer(renderers.TocRenderer),
49
+ 'description': directive.create_directive_from_renderer(renderers.DescriptionRenderer),
50
+ }
51
+
52
+ roles = {
53
+ 'version': oasversion_role
54
+ }
55
+
56
+
57
+ def setup(app):
58
+ app.add_config_value("openapi_default_renderer", _DEFAULT_RENDERER_NAME, "html")
59
+ app.add_config_value("openapi_renderers", {}, "html")
60
+
61
+ package_dir = os.path.abspath(os.path.dirname(__file__))
62
+ locale_dir = os.path.join(package_dir, 'locale')
63
+ app.add_message_catalog('openapi', locale_dir)
64
+
65
+ from sphinxcontrib import httpdomain
66
+
67
+ for idx, fieldtype in enumerate(httpdomain.HTTPResource.doc_field_types):
68
+ if fieldtype.name == 'requestheader':
69
+ httpdomain.HTTPResource.doc_field_types[idx] = httpdomain.TypedField(
70
+ fieldtype.name,
71
+ label=fieldtype.label,
72
+ names=fieldtype.names,
73
+ typerolename='header',
74
+ typenames=('reqheadertype', ),
75
+ )
76
+
77
+ if fieldtype.name == 'responseheader':
78
+ httpdomain.HTTPResource.doc_field_types[idx] = httpdomain.TypedField(
79
+ fieldtype.name,
80
+ label=fieldtype.label,
81
+ names=fieldtype.names,
82
+ typerolename='header',
83
+ typenames=('resheadertype', ),
84
+ )
85
+
86
+ app.setup_extension("sphinxcontrib.httpdomain")
87
+ app.add_domain(OpenAPIDomain)
88
+ app.add_directive(
89
+ "openapi",
90
+ directive.create_directive_from_renderer(renderers.HttpdomainOldRenderer)
91
+ )
92
+
93
+ return {"version": __version__, "parallel_read_safe": True}
@@ -1,86 +1,86 @@
1
- import argparse
2
- import logging
3
-
4
- from sphinxcontrib.openapi import directive, renderers
5
-
6
-
7
- def main():
8
- parser = argparse.ArgumentParser(
9
- prog='oas2rst',
10
- description='Export OpenAPI Specification files to reStructuredText \
11
- files')
12
- parser.add_argument(
13
- "-l", "--level",
14
- action='store',
15
- default=logging.INFO,
16
- dest='level',
17
- help="Logging level")
18
- parser.add_argument(
19
- "-e", "--encoding",
20
- action='store',
21
- default="UTF-8",
22
- dest='encoding',
23
- help="Source file encoding")
24
- parser.add_argument(
25
- "-p", "--paths",
26
- action='append',
27
- dest='paths',
28
- help="Endpoints to be rendered")
29
- parser.add_argument(
30
- "-x", "--examples",
31
- action='store_true',
32
- dest='examples',
33
- help="Include examples")
34
- parser.add_argument(
35
- "--group-examples",
36
- action='store_true',
37
- dest='group_examples',
38
- help="Group examples after the operation description")
39
- parser.add_argument(
40
- "-E", "--entities",
41
- action='store_true',
42
- dest='entities',
43
- help="Include links to entities")
44
- parser.add_argument(
45
- "-g", "--group",
46
- action='store_true',
47
- dest='group',
48
- help="Group paths by tag")
49
- parser.add_argument(
50
- "-i", "--input",
51
- dest='input',
52
- required=True,
53
- help="Input file")
54
- parser.add_argument(
55
- "-o", "--output",
56
- type=argparse.FileType('w'),
57
- required=True,
58
- dest='output',
59
- help="Output file")
60
-
61
- options = parser.parse_args()
62
- logging.getLogger().setLevel(options.level)
63
-
64
- openapi_options = {}
65
- if options.paths:
66
- openapi_options['paths'] = options.paths
67
- if options.examples:
68
- openapi_options['examples'] = True
69
- if options.group_examples:
70
- openapi_options['group_examples'] = True
71
- if options.entities:
72
- openapi_options['entities'] = True
73
- if options.group:
74
- openapi_options['group'] = True
75
-
76
- openapi_options.setdefault('uri', 'file://%s' % options.input)
77
- spec = directive._get_spec(options.input, options.encoding)
78
- renderer = renderers.HttpdomainOldRenderer(None, openapi_options)
79
-
80
- for line in renderer.render_restructuredtext_markup(spec):
81
- options.output.write(line+'\n')
82
- logging.debug(line)
83
-
84
-
85
- if __name__ == '__main__':
86
- main()
1
+ import argparse
2
+ import logging
3
+
4
+ from sphinxcontrib.openapi import directive, renderers
5
+
6
+
7
+ def main():
8
+ parser = argparse.ArgumentParser(
9
+ prog='oas2rst',
10
+ description='Export OpenAPI Specification files to reStructuredText \
11
+ files')
12
+ parser.add_argument(
13
+ "-l", "--level",
14
+ action='store',
15
+ default=logging.INFO,
16
+ dest='level',
17
+ help="Logging level")
18
+ parser.add_argument(
19
+ "-e", "--encoding",
20
+ action='store',
21
+ default="UTF-8",
22
+ dest='encoding',
23
+ help="Source file encoding")
24
+ parser.add_argument(
25
+ "-p", "--paths",
26
+ action='append',
27
+ dest='paths',
28
+ help="Endpoints to be rendered")
29
+ parser.add_argument(
30
+ "-x", "--examples",
31
+ action='store_true',
32
+ dest='examples',
33
+ help="Include examples")
34
+ parser.add_argument(
35
+ "--group-examples",
36
+ action='store_true',
37
+ dest='group_examples',
38
+ help="Group examples after the operation description")
39
+ parser.add_argument(
40
+ "-E", "--entities",
41
+ action='store_true',
42
+ dest='entities',
43
+ help="Include links to entities")
44
+ parser.add_argument(
45
+ "-g", "--group",
46
+ action='store_true',
47
+ dest='group',
48
+ help="Group paths by tag")
49
+ parser.add_argument(
50
+ "-i", "--input",
51
+ dest='input',
52
+ required=True,
53
+ help="Input file")
54
+ parser.add_argument(
55
+ "-o", "--output",
56
+ type=argparse.FileType('w'),
57
+ required=True,
58
+ dest='output',
59
+ help="Output file")
60
+
61
+ options = parser.parse_args()
62
+ logging.getLogger().setLevel(options.level)
63
+
64
+ openapi_options = {}
65
+ if options.paths:
66
+ openapi_options['paths'] = options.paths
67
+ if options.examples:
68
+ openapi_options['examples'] = True
69
+ if options.group_examples:
70
+ openapi_options['group_examples'] = True
71
+ if options.entities:
72
+ openapi_options['entities'] = True
73
+ if options.group:
74
+ openapi_options['group'] = True
75
+
76
+ openapi_options.setdefault('uri', 'file://%s' % options.input)
77
+ spec = directive._get_spec(options.input, options.encoding)
78
+ renderer = renderers.HttpdomainOldRenderer(None, openapi_options)
79
+
80
+ for line in renderer.render_restructuredtext_markup(spec):
81
+ options.output.write(line+'\n')
82
+ logging.debug(line)
83
+
84
+
85
+ if __name__ == '__main__':
86
+ main()