15
Introducing Swagger AMR ALI SENIOR ARCHITECT

Introducing swagger

  • Upload
    amrali

  • View
    106

  • Download
    8

Embed Size (px)

Citation preview

Page 1: Introducing swagger

Introducing SwaggerAMR ALI

SENIOR ARCHITECT

Page 2: Introducing swagger

What is Swagger

Swagger is a simple yet powerful representation of your RESTful API.

With the largest ecosystem of API tooling on the planet, thousands of developers are supporting Swagger in almost every modern programming language and deployment environment.

With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability.

Swagger helps companies like Apigee, Getty Images, Intuit, LivingSocial, McKesson, Microsoft, Morningstar, and PayPal build the best possible services with RESTful APIs.

Now in version 2.0, Swagger is more enabling than ever. And it's 100% open source software.

Has a formal specifications: http://swagger.io/specification/2

Page 3: Introducing swagger

Why should we use Swagger

Widely accepted standard for defining REST API

Supported by our integration tools IIB (version 10)

SoapUI

Simple, self defining document for REST APIs

3

Page 4: Introducing swagger

Who uses Swagger

Page 5: Introducing swagger

How Does it Work?

Each API declares itself Available operations

Parameters

Type (path, query, body)

Allowable values/data types

Input/output models

Error responses with descriptions

Page 6: Introducing swagger

Authoring Swagger

Swagger can be defined using either JSON notations or YAML notations

YAML: http://yaml.org/ YAML™ (rhymes with “camel”) is a human-friendly, cross

language, Unicode based data serialization language designed around the common native data types of agile programming languages.

It is broadly useful for programming needs ranging from configuration files to Internet messaging to object persistence to data auditing.

Is 1-1 convertible to JSON

Depends on indentation

n YAML block styles, structure is determined by indentation.

Quick Tutorial on YAML

http://learn.getgrav.org/advanced/yaml

Page 7: Introducing swagger

Demo Simple API

We need to host a REST API on www.test.com that displays a product given its id

It should support http get operations

Returns 200 success for successful execution

Returns 404 when the product is not found

Page 8: Introducing swagger

Swagger File

\\wfsrvgbco001003\HomeDriveT\E0650181\UEV

File Attached here

Page 9: Introducing swagger

Swagger Schema Types

Types within Swagger can be defined using JSON Schema http://

json-schema.org/latest/json-schema-core.html

Write the types in YAML format, for example below is a product definition (product has complex type category)

Page 10: Introducing swagger

DemoHTTP://EDITOR.SWAGGER.IO/#/

Page 11: Introducing swagger

Schema Primitive Typesarray

A JSON array.boolean

A JSON boolean.integer

A JSON number without a fraction or exponent part.number

Any JSON number. Number includes integer.null

The JSON null value.object

A JSON object.string

A JSON string.

Some types has extended format to further strict the type, for exampleType: numberFormat: int64

Page 12: Introducing swagger

Tools Support

Page 13: Introducing swagger

IIB Support

In the release of IIB v10, IBM has recognized and closed a gap in terms of support for REST services. 

Previously you were able to create your own REST services using HTTPInput, HTTPRequest, and HTTPReply nodes, but there wasn’t any structure within the tool to manage that, so you had to roll most of that on your own.

IBM has chosen to implement Swagger in IIB v10 and will allow you to import a Swagger configuration and it will build out the flows for you.

leaving a series of subflows in order to implement custom logic. This is like a quick-start to a REST API implementation within IIB which also then gives you access to all other resources in your Integration Node (like schemas, shared and static libraries, etc.)

Page 14: Introducing swagger

IIB 10 Official IBM info centre

Page 15: Introducing swagger

SOAP UI