Application 2024-01-19

Schema-Driven Development with OpenAPI

Learn OpenAPI schema-driven development, REST API specification, code generation, and mock server benefits.

Read in: ja
Schema-Driven Development with OpenAPI

What is OpenAPI Specification?

A format for defining HTTP API specifications in a language-agnostic way. It is written in YAML or JSON.

The Swagger Specification is the predecessor of the OpenAPI Specification.

Advantages and Disadvantages of Adopting OpenAPI

Advantages

It enables the efficiency of the development process through schema-driven approaches.

Disadvantages

It seems that there are no critical disadvantages.

Trying It Out

Since Docker is available, let's try it with Docker.

cf. github.com - OpenAPITools/openapi-generator

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
    -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml \
    -g go \
    -o /local/out/go

For API specification documentation, the OpenAPI (Swagger) Editor seems to be a good choice if you are using VSCode.

Thoughts

I haven't properly looked at the generation options, so I think I will try using it in a personal development project once I can confirm those.

I felt that effectively adjusting what to auto-generate and what not to auto-generate is a challenge during the introduction phase.

References

Tags: OpenAPI Schema-Driven
Share: 𝕏 Post Facebook Hatena
✏️ View source / Discuss on GitHub
☕ Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles