Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

CPS-774 - Getting issue details... STATUS


What Is OpenAPI?

OpenAPI Specification (formerly Swagger Specification) is an API description format for REST APIs. An OpenAPI file allows you to describe your entire API, including:

  • Available endpoints (/users) and operations on each endpoint (GET /users, POST /users)
  • Operation parameters Input and output for each operation
  • Authentication methods
  • Contact information, license, terms of use and other information.

Adding Examples

You can add examples to parameters, properties and objects to make OpenAPI specification of your web service clearer. Examples can be read by tools and libraries that process your API in some way. To specify an example, you use the example or examples keys.

Parameter Examples

Here is an example of a parameter value: 

dataspaceNameInPath:
name: dataspace-name
in: path
description: dataspace-name
required: true
schema:
type: string
example: DataspaceName1

Request Example:

requestBody:
required: true
content:
application/json:
schema:
type: string
examples:
bookstoreData:
value:
test:bookstore:
bookstore-name: Chapters
categories:
- code: 01
name: SciFi
- code: 02
name: kids
requestBody:
required: true
content:
application/json:
schema:
type: string
examples:
objectExample:
$ref: 'components.yml#/components/examples/testBookStoreData'


examples:
testBookStoreData:
value:
test:bookstore:
bookstore-name: Chapters
categories:
- code: 01
name: SciFi
- code: 02
name: kids
summary: A sample data




  • No labels