DPC2022: Use an API contract for testing and development!

Automate API testing and development with an API contract, GitLab pipelines, and OpenAPI. Generate client packages, leverage contract testing, publish to GitLab Composer, and streamline processes with Docker and Swagger UI.

Key takeaways
  • Use an API contract to generate client packages for different languages and frameworks, allowing for easy integration with front-ends and mobile apps.
  • Leverage GitLab pipelines to automate the process of building, testing, and publishing API client packages.
  • Utilize the OpenAPI specification to define the API’s structure, including endpoints, request/response models, and documentation.
  • Implement contract testing using PAX to validate the compatibility of front-end and back-end changes with the API contract.
  • Publish API client packages to a GitLab Composer repository, enabling easy installation and management within front-end projects.
  • Employ Docker containers to streamline the development and testing process, ensuring a consistent environment across different platforms.
  • Take advantage of the Swagger UI to generate interactive API documentation, providing a user-friendly interface for exploring and understanding the API’s functionality.
  • Utilize the OpenAPI Generator CLI to generate server stubs from the OpenAPI specification, facilitating the creation of mock servers for testing purposes.
  • Implement a strategy depends keyword in GitLab pipelines to ensure that downstream pipelines only run when triggered by upstream changes.
  • Utilize the only keyword in GitLab pipelines to specify that a job should only run when the downstream pipeline is called.