• Stars
    star
    214
  • Rank 177,919 (Top 4 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Swagger Petstore Sample

Overview

This is the pet store sample hosted at https://petstore3.swagger.io. For other versions, check the branches. We welcome suggestion both the code and the API design. To make changes to the design itself, take a look at https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml.

This is a java project to build a stand-alone server which implements the OpenAPI 3 Spec. You can find out more about both the spec and the framework at http://swagger.io.

This sample is based on swagger-inflector, and provides an example of swagger / OpenAPI 3 petstore.

To run (with Maven)

To run the server, run this task:

mvn package jetty:run

This will start Jetty embedded on port 8080.

To run (via Docker)

Expose port 8080 from the image and access petstore via the exposed port. You can then add and delete pets as you see fit.

Example:

docker build -t swaggerapi/petstore3:unstable .
docker pull swaggerapi/petstore3:unstable
docker run  --name swaggerapi-petstore3 -d -p 8080:8080 swaggerapi/petstore3:unstable

Testing the server

Once started, you can navigate to http://localhost:8080/api/v3/openapi.json to view the Swagger Resource Listing. This tells you that the server is up and ready to demonstrate Swagger.

Using the UI

There is an HTML5-based API tool bundled in this sample--you can view it it at http://localhost:8080. This lets you inspect the API using an interactive UI. You can access the source of this code from here

More Repositories

1

swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
JavaScript
25,331
star
2

swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
Mustache
16,413
star
3

swagger-editor

Swagger Editor
JavaScript
8,614
star
4

swagger-core

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
Java
7,323
star
5

swagger-node

Swagger module for node.js
JavaScript
3,970
star
6

swagger-js

Javascript library to connect to swagger-enabled APIs via browser or nodejs
JavaScript
2,574
star
7

swagger.io

The content of swagger.io
1,548
star
8

swagger-parser

Swagger Spec to Java POJOs
Java
744
star
9

swagger-samples

Samples for the various Swagger projects under swagger-api
JavaScript
536
star
10

swagger-socket

Swagger Socket: A REST over WebSocket
Java
381
star
11

swagger-play

Java
329
star
12

swagger-codegen-generators

Mustache
277
star
13

validator-badge

Validate your Swagger JSON/YAML today!
Java
201
star
14

swagger-inflector

Java
160
star
15

swagger-scala-module

Swagger support for scala
Scala
104
star
16

swagger-converter

OpenAPI/Swagger 2.0 to OpenAPI 3.0 Converter WebService
Python
97
star
17

apidom

Semantic parser for API specifications
TypeScript
55
star
18

swaggerhub-maven-plugin

A simple maven plugin to access SwaggerHub hosting of OpenAPI/Swagger from a maven build process.
Java
30
star
19

swagger-play-sample-app

A sample play app which uses swagger plugin to make the age old pet store swagger compliant.
JavaScript
29
star
20

rails-petstore

Ruby
29
star
21

swagger2

For working out the Swagger 2 working group page
CSS
23
star
22

swaggerhub-gradle-plugin

Gradle plugin for SwaggerHub
Java
20
star
23

scalatra-sample-app

Shell
20
star
24

swagger-scala-sample-app

A fully-functioning, stand-alone Swagger server written in scala which demonstrates how to enable Swagger in your API.
Scala
20
star
25

swagger-form-editor

JavaScript
19
star
26

petstore-kafka

A demo site built on top of Kafka topics
JavaScript
14
star
27

swagger-async-httpclient

Scala
10
star
28

swagger-editor-cra

This is forked Create React App that builds SwaggerEditor@5
JavaScript
9
star
29

swagger-scala

Scala
8
star
30

swagger-play-1.2

Scala
8
star
31

swagger-schema-packaging

6
star
32

apidom-lsp-vscode

ApiDOM VS Code Extension
TypeScript
5
star
33

sway-worker

4
star
34

apidom-ls-client

Demo client for apidom-ls OpenAPI / AsyncAPI ApiDOM validation service
TypeScript
3
star
35

.github

Common Github files for the Swagger projects
3
star
36

swagger-codegen-test

2
star