The Mojolicious Blog.

A semi-official blog dedicated to the Mojolicious web framework

Day 7: MetaCPAN, Mojolicious and OpenAPI

Contract signing

During this years meta::hack 3, I was extremely fortunate to work with Joel Berger on integrating/documenting OpenAPI with the MetaCPAN API via Mojolicious.

What is it?

OpenAPI is a specification for designing, documenting, validating and driving your RESTful API. It can be used to provide documentation to an existing API, or when creating a new one.

The OpenAPI Specification originated as the Swagger specification and was renamed to separate the API description format (OpenAPI) from the open source tooling (Swagger). The specification moved into a new GitHub repository, but did not change.

In the case of the MetaCPAN API, we set out to provide documentation to the existing API, but quickly moved into supporting validation to API calls as well.

Continue reading Day 7: MetaCPAN, Mojolicious and OpenAPI...

Day 22: A RESTful API with OpenAPI

A hammock on a beach

The OpenAPI Specification (formerly named Swagger) is an API description format for REST APIs. An API specification written using the the rules set by the Open API Initiative can be used to describe:

  • All the available endpoints. An endpoint is a unique resource that can access or modify a given object.
  • Input parameters, such as headers, query parameters and/or body parameters.
  • The structure of the response, including headers status codes and the body - if any.
  • Authentication methods
  • Contact information, license, terms of use and other information

This post look into how to write an API specification and how to use it together with Mojolicious::Plugin::OpenAPI and OpenAPI::Client.

Continue reading Day 22: A RESTful API with OpenAPI...