Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can download the following Open API Specification sample from here.


Code Block
{
  "info": {
    "version": "1.0",
    "description": "This API can be used to Create, Read, Modify & Delete Users",
    "title": "Users"
  },
  "paths": {
    "/createUser": {
      "post": {
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "properties": {
                "userName": {
                  "type": "string"
                }
              }
            }
          }
        },
        "parameters": [],
        "produces": [
          "application/json"
        ]
      }
    },
    "/getUsers": {
      "get": {
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "properties": {
                "users": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "description": "User Tags to filter by",
            "items": {
              "type": "string"
            },
            "default": [
              "basic"
            ],
            "required": true,
            "name": "tags",
            "in": "query",
            "type": "array",
            "collectionFormat": "multi"
          },
          {
            "description": "User Types to filter by",
            "default": [
              "basic"
            ],
            "items": {
              "type": "string"
            },
            "required": true,
            "name": "types",
            "in": "query",
            "type": "array",
            "collectionFormat": "multi"
          },
          {
            "description": "Client Secret to filter by",
            "in": "header",
            "required": false,
            "type": "string",
            "name": "secret"
          }
        ],
        "produces": [
          "application/json"
        ]
      }
    },
    "/getUser/{userId}": {
      "get": {
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "properties": {
                "user": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "description": "ID of user that needs to be fetched",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "produces": [
          "application/json"
        ]
      }
    },
    "/updateUser/{userId}": {
      "patch": {
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "properties": {
                "user": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "description": "ID of user that needs to be fetched",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "produces": [
          "application/json"
        ]
      },
      "put": {
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "properties": {
                "user": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "description": "ID of user that needs to be fetched",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "produces": [
          "application/json"
        ]
      },
      "post": {
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "properties": {
                "user": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "description": "ID of user that needs to be fetched",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "produces": [
          "application/json"
        ]
      }
    },
    "/deleteUser/{userId}": {
      "delete": {
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "description": "ID of user that needs to be fetched",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "produces": [
          "application/json"
        ]
      }
    }
  },
  "schemes": [
    "https"
  ],
  "tags": [
    {
      "externalDocs": {
        "url": "http://users.io",
        "description": "Find out more about our Users"
      },
      "name": "Users",
      "description": "Operations about user"
    }
  ],
  "basePath": "/mock/api/path",
  "securityDefinitions": {
    "basicAuth": {
      "type": "basic"
    }
  },
  "host": "sm-mbp-testSpecification:9503",
  "security": [
    {
      "basicAuth": []
    }
  ],
  "swagger": "2.0"
}



Attachments
patterns.*slp
View file
nameDemoSwagger.json
height250


In this Article

Table of Contents
maxLevel2
absoluteUrltrue


Overview

Specification Requirements


Pipeline Scaffold

The generated Pipeline provides the scaffold for your API with the following construction:

JSON Generator Snap: Provides basic information.

HTTP Router Snap: Sets the HTTP request methods

Mapper Snap: Sets the Status field.

Union Snap: Consolidates all inputs.

Document to Binary Snap: Sends the response.


ABC Snap

Best Practice 1

Answer....

Best Practice 2

Answer.