sc-oa 0.7.0.12__py3-none-any.whl → 0.7.0.14__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,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.
@@ -1,35 +1,45 @@
1
- Metadata-Version: 2.1
2
- Name: sc-oa
3
- Version: 0.7.0.12
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 (<7.0)
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
-
15
- Olivier Heurtier
16
- Author-email: ihor@kalnytskyi.com
17
- License: BSD
18
- Classifier: Topic :: Documentation
19
- Classifier: Topic :: Documentation :: Sphinx
20
- Classifier: License :: OSI Approved :: BSD License
21
- Classifier: Environment :: Console
22
- Classifier: Intended Audience :: Developers
23
- Classifier: Operating System :: OS Independent
24
- Classifier: Programming Language :: Python
25
- Classifier: Programming Language :: Python :: 3
26
- Classifier: Programming Language :: Python :: 3 :: Only
27
- Classifier: Programming Language :: Python :: 3.8
28
- Classifier: Programming Language :: Python :: 3.9
29
- Classifier: Programming Language :: Python :: 3.10
30
- Classifier: Programming Language :: Python :: 3.11
31
- Classifier: Programming Language :: Python :: Implementation :: CPython
32
- Classifier: Framework :: Sphinx
33
- Classifier: Framework :: Sphinx :: Extension
34
- Requires-Python: >=3.8
35
- License-File: LICENSE
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
@@ -0,0 +1,26 @@
1
+ sphinxcontrib/__init__.py,sha256=Es10gRADmbGSJZnYYmhfgA_2QzHQDmhj0IAft3kS1Og,259
2
+ sphinxcontrib/openapi/__init__.py,sha256=x8cvrnXGqjZSc62nkeZC0KdCcCSXQY8uxv1kFhrPM18,3088
3
+ sphinxcontrib/openapi/__main__.py,sha256=cp8p7qGn8nH2W_aeD9sMTuqPwLV3ys8DtLYZnyF29pY,2436
4
+ sphinxcontrib/openapi/_lib2to3.py,sha256=mU2Dx78xEyiz0cfcj3R9eqiwHbCfspK5cDJ5ZwwQdA4,13624
5
+ sphinxcontrib/openapi/directive.py,sha256=J4T0n_KkM6SB1Mr9GeYCVqWZNp3BMSjEnVvLvwj8CoM,2059
6
+ sphinxcontrib/openapi/openapi20.py,sha256=FDdlcRIYKCynOZUjxQNoE8lCFRrZinmYu1khz8D18ZU,8984
7
+ sphinxcontrib/openapi/openapi30.py,sha256=HzFLza9Z3D7smDYfru0CPWLBK4dle5uuWZgNNqlFqtE,29056
8
+ sphinxcontrib/openapi/schema_utils.py,sha256=pxdB5qSTAtiCFmmF04R0zlOOG-Dxi98qwrA2uLZcNXA,4446
9
+ sphinxcontrib/openapi/utils.py,sha256=oRWNDb_5KWTXOVblFgvrLvmGATae8C7PYvk1xc464vY,4343
10
+ sphinxcontrib/openapi/locale/openapi.pot,sha256=sGo7dIRUUS6Ne4MRIU7PCphOoQG1AORgZhwwpD0nRfo,3831
11
+ sphinxcontrib/openapi/locale/es_ES/LC_MESSAGES/openapi.mo,sha256=qdW6yFaSVB_BsexvwM33U8X12yoHikgaI8N7a4U_gI4,1919
12
+ sphinxcontrib/openapi/locale/es_ES/LC_MESSAGES/openapi.po,sha256=dB6_HK0ubCauj1LZbs-zz0NNcPkm4eqKIuxZtqD71WU,4357
13
+ sphinxcontrib/openapi/locale/fr_FR/LC_MESSAGES/openapi.mo,sha256=YS2uZZZ4bHpDXJmShv33NZhtIWcir9-qERusNDR-vqY,1956
14
+ sphinxcontrib/openapi/locale/fr_FR/LC_MESSAGES/openapi.po,sha256=_rpbU9BhwTI2vXFcgj-BdiC-5LhUphYvHtoU1jPHT4Y,4400
15
+ sphinxcontrib/openapi/renderers/__init__.py,sha256=8hdY-sLK5kDbOL8Tqe55xEBphPFXVCNj6eUA3lTvD8s,408
16
+ sphinxcontrib/openapi/renderers/_description.py,sha256=FAklhEaMksCYU5bno3SO0RuQCcwVTXbqPmPN3PrRlTM,702
17
+ sphinxcontrib/openapi/renderers/_httpdomain.py,sha256=qx6pIVQF2BKWjrL1YOap1_2odtLAqk5SeuktofdOMRQ,24546
18
+ sphinxcontrib/openapi/renderers/_httpdomain_old.py,sha256=aiWafD8LdRmCtG6ewkU3xF-P1oWxxYxUNzdcUFW4hB4,2632
19
+ sphinxcontrib/openapi/renderers/_model.py,sha256=BapmKIHTXpS14huRUicz2rUxilaDau3uBOv-fsQ1mtE,15098
20
+ sphinxcontrib/openapi/renderers/_toc.py,sha256=0cVLyKJBcu4ULkiBdlQ-oMBWV4DVCVM5-BgT07xG0Fc,1478
21
+ sphinxcontrib/openapi/renderers/abc.py,sha256=-irO9yVoHeygaMieq4DZMmWD0B5DkDu2mKuenGYopTI,1485
22
+ sc_oa-0.7.0.14.dist-info/LICENSE,sha256=Fe9eBZy-tUN-UOMSVfcr4c-MWpuWa4gTKTqH-kSeck4,1319
23
+ sc_oa-0.7.0.14.dist-info/METADATA,sha256=0pId_xn_yRypsI3Xww4rGPLlWyZknxn9E0o1xC7f8b0,1551
24
+ sc_oa-0.7.0.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
25
+ sc_oa-0.7.0.14.dist-info/top_level.txt,sha256=VJrV3_vaiKQVgVpR0I1iecxoO0drzGu-M0j40PVP2QQ,14
26
+ sc_oa-0.7.0.14.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +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,93 +1,93 @@
1
- """
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 pkg_resources import get_distribution, DistributionNotFound
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__ = get_distribution(__name__).version
21
- except DistributionNotFound:
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()