WarsawJS

We talk about JavaScript. Each month in Warsaw, Poland.

Swagger
the front-end perspective

Piotr Błaszczak @MyFlowPL
myflowpl.github.io/talk-swagger

Piotr Błaszczak

full-stack web developer

9 years of experience in web development


Agenda

  1. Swagger & API contracts
  2. Contract-first development
  3. Tools
  4. Swagger + TypeScript + Angular2 example

API Contracts

Swagger

Endpoint

Parameters

Responses

Model Definitions

More

Contract-first Development

Tools

Editor

UI

UI

SwaggerJS

Swagger-node

Swagger-codegen

Codegen Stubs

Codegen Documentation

Swagger + TypeScript + Angular2

Lets generate some code

java -jar swagger-codegen-cli-2.2.2-SNAPSHOT.jar generate -i swagger-petstore.json -o src/app/api -l typescript-angular2

Generated Code

Endpoints requests

api/api/PetsApi.ts

Model definition

api/model/Pet.ts

Make api call

TS hints

HTML hints

Refactoring

CI Automation

Front-end Job

Center for Information Technology

Centralny Ośrodek Informatyki
coi.gov.pl/kariera.html

Thank You !!!

Piotr Błaszczak

        pedro.blaszczak@gmail.com
        github.com/MyFlowPL
        @MyFlowPL
        FB/piotr.blaszczak

See you next month at WarsawJS

Questions & Comments