Skip to content
Daniel Metzner edited this page Jan 17, 2021 · 5 revisions

Welcome to the Catroweb API (CAPI) wiki!

Yes, the creators of this repository are aware that name selection is not their strong suit!

The catroweb.yaml file contains the Open API documentation for our API. If you need to change anything about our API, be it new routes, or updating old ones, do it there. We are currently working on securing a Swagger Hub license to do a push feature to this repository.

Snippets for code generation:

  1. Delete all old auto-generated files to prevent unused files from existing
run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.0.0-beta generate -i local/catroweb.yaml -g php-symfony -p sortParamsByRequiredFlag=true -p skipFormModel=true -p variableNamingConvention=snake_case -p phpLegacySupport=false -o /local
  1. Generate the code (based on catroweb.yml, might need to download the jar file first!)
java -jar ../openapi-generator-cli.jar generate \
    -i catroweb.yaml \
    -g php-symfony \
    -p sortParamsByRequiredFlag=true \
    -p skipFormModel=true \
    -p variableNamingConvention=snake_case \
    -p phpLegacySupport=false && vendor/bin/php-cs-fixer fix --allow-risky=yes --verbose --format=txt
  1. Or with docker (On windows use powershell):
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.0.0-beta generate -i local/catroweb.yaml -g php-symfony -p sortParamsByRequiredFlag=true -p skipFormModel=true -p variableNamingConvention=snake_case -p phpLegacySupport=false -o /local
  1. Additionally, you should run the code style fixer
docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/php-cs-fixer-ga:latest --allow-risky=yes --verbose --format=txt
  1. Create a new branch, commit, push and create the Pull Request

Or let the machines work for you:

We have a workflow to do all this for you automatically.

  1. On Github, go to the Actions tab
  2. Click on "Code Generation Pull Request" workflow
  3. Click on "Run workflow"
  4. Choose branch (develop)
  5. Run the workflow and enjoy the auto-generated code/PR