Skip to content

Github Action for creating a pydantic model from Strava's Swagger API definition

License

Notifications You must be signed in to change notification settings

stravalib/strava_swagger2pydantic

Repository files navigation

Strava Swagger to Pydantic

This repo support a Github Action that creates a Pydantic model from Strava's Swagger API definition.

The script is run via a nightly cron job in this GitHub action. The action creates an new module called strava_model.py module that represents the most recent version of Strava's swagger.json file.

How to run this locally

  1. First, make sure you have all of the necessary requirements installed. We are using the datamodel-code-generator package to generate the model.
pip install requirements.txt
  1. Once the requirements are installed, you are ready to run the script.

This module takes one input environment variable - the name of the output module. You can either store this value as an environment variable called MODEL_FILE on your computer. Or you can define it in place as follows:

# Run this in the terminal with your python environment activated
$ MODEL_FILE="output_model.py" python swagger2pydantic.py

In the example above, the script will run, creating a new module called output_model.py in your current working directory.

About

Github Action for creating a pydantic model from Strava's Swagger API definition

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages