Skip to content

Processes a OAS file, recursively downloads and updates its dependencies specified by $ref URLs, and saves the modified Swagger file.

Notifications You must be signed in to change notification settings

valhallac/oas-url-reference-resolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

OAS File Dependency Resolver

This script processes a OAS file, recursively downloads and updates its dependencies specified by $ref URLs, and saves the modified Swagger file.

Prerequisites

  • Python 3
  • requests library (install using pip install requests)

Usage

  1. Clone the repository:

    git clone https://github.com/yourusername/your-repository.git
    cd your-repository
  2. Install the required dependencies:

    pip install requests
  3. Run the script:

    python your_script_name.py
  4. The script will process the main Swagger file and its dependencies, downloading any missing files, updating $ref URLs, and saving the modified Swagger file.

Configuration

  • Input: The main Swagger file should be named swaggerfile.json and placed in the same directory as the script. Update the script if your main file has a different name or location.

  • Output: The modified Swagger file will be saved in the local_dependencies folder. If this folder doesn't exist, it will be created.

Notes

  • The script processes $ref URLs that start with http. If your Swagger file uses a different prefix, modify the process_reference function accordingly.

  • The downloaded files are saved with relative paths in the local_dependencies folder, except for the main Swagger file that uses /local_dependencies prefix.

About

Processes a OAS file, recursively downloads and updates its dependencies specified by $ref URLs, and saves the modified Swagger file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages