Metadata-Version: 2.1
Name: openapi-ext-tools
Version: 0.5.1
Summary: Extended tools for openapi spec
Home-page: https://github.com/t2y/openapi-ext-tools
Author: Tetsuya Morimoto
Author-email: tetsuya.morimoto@gmail.com
License: Apache License 2.0
Description: # openapi-ext-tools
        
        extended tools for openapi spec
        
        ## bundle multiple yaml files into single openapi.yaml
        
        ```bash
        $ openapi-spec-cli --help
        usage: openapi-spec-cli [-h] --spec-path SPEC_PATH
                                [--bundled-spec-path BUNDLED_SPEC_PATH] [--verbose]
        
        optional arguments:
          -h, --help            show this help message and exit
          --spec-path SPEC_PATH
                                set path to openapi spec file
          --bundled-spec-path BUNDLED_SPEC_PATH
                                set path to bundled spec file
          --verbose             set verbose mode
        ```
        
        ### How to use
        
        **Currently, bundling only support components object.**
        
        The `tests/fixtures/simple/openapi.yaml` is openapi specification file and a part of schemas is defined in `tests/fixtures/simple/schemas.yaml`.
        
        ```yaml
        ...
            content:
              application/json:
                schema:
                  $ref: 'schemas.yaml#/components/schemas/User'
        ...
        ```
        
        For example, *User* schema is defined like this.
        
        ```yaml
        components:
          schemas:
            User:
              type: object
              properties:
                id:
                  type: integer
                  format: int64
                username:
                  type: string
                firstName:
                  type: string
                lastName:
                  type: string
                birthday:
                  type: string
                  format: date
                email:
                  type: string
                password:
                  type: string
                phone:
                  type: string
                userStatus:
                  type: integer
                  description: User Status
                  format: int32
        ```
        
        Run `openapi-spec-cli` to bundle yaml files and create single `openapi.yaml`.
        
        ```bash
        $ openapi-spec-cli --spec-path tests/fixtures/simple/openapi.yaml
        2019-05-11 11:56:12,337 openapi.spec.ext INFO wrote bundled spec file to "bundled_openapi.yaml"
        2019-05-11 11:56:12,402 openapi.spec.ext INFO validating bundled spec: OK
        ```
        
        You can confirm `bundled_openapi.yaml` in current directory. Then, all schemas in `schemas.yaml` are moved to `bundled_openapi.yaml` and a `$ref` field also reffers as Local Reference.
        
        ```yaml
        ...
            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/User'
        ...
        ```
        
Platform: any
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Environment :: Console
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Description-Content-Type: text/markdown
