Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are mandatory elements in OpenAPI spec

Tags:

openapi

apigee

What are the mandatory elements of OpenAPI spec? my assumption is OpenAPI, Info and Path, Is that correct?

Thanks

like image 285
Pragmatic Avatar asked Sep 18 '25 02:09

Pragmatic


1 Answers

The minimum required fields in OpenAPI definitions are:

  • OpenAPI version identifier, such as openapi: 3.1.0 or swagger: '2.0'
  • info.title
  • info.version
  • For OpenAPI 3.1:
    • One of: paths, components, webhooks. These sections can be empty, e.g. paths: {}.
  • For OpenAPI 3.0.x and 2.0:
    • paths – can be empty, i.e. paths: {}

Sample minimal definition:

openapi: 3.1.0
info:
  title: My API
  version: 1.0.0
paths: {}

Technically info.title and info.version can also be empty strings (such as title: ''), although this wouldn't make sense in practice.

like image 195
Helen Avatar answered Sep 23 '25 09:09

Helen