Defining a Swagger YAML file

The most widely used and supported version of the Swagger spec is swagger: '2.0'. The following example is given using the newer, standards-based, openapi: 3.0.0. The sample code repository contains both examples. However, at the time of publishing, most tooling in the Swagger ecosystem relies on version 2.0.

The sample code repository can be found at github.com/duluca/lemon-mart-swagger-server.
For your mock API server, you should create a separate git repository, so that this contract between your frontend and backend can be maintained separately.
  1. Create a new GitHub repository, called lemon-mart-swagger-server
  2. Start defining a YAML file with general information and target servers:
swagger.oas3.yamlopenapi: ...

Get Angular 6 for Enterprise-Ready Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.