Skip to content

Instantly share code, notes, and snippets.

View jerzyn's full-sized avatar

Andrzej jerzyn

View GitHub Profile
@jerzyn
jerzyn / swagger-demo.yaml
Created March 26, 2019 17:28
demo api for spectral test
swagger: '2.0'
info:
version: '1.0.0'
title: "Wishlist API"
description: |
## Affordances
This API affords the following actions:
- Retrieve a list of products
- Retrieve a single product
@jerzyn
jerzyn / auto-fill-swagger-2-0.json
Created October 19, 2015 15:12
Auto-filling of the user keys in Swagger 2.0
"parameters": [
{
"name": "user_key",
"description": "Your access API Key",
"type": "string",
"in": "query",
"x-data-threescale-name": "user_keys",
"required": true
},
// ...
@jerzyn
jerzyn / pathsObjectSchema.json5
Created July 1, 2015 15:58
Paths Object Schema with comments
{
// Path is a relative path to an individual endpoint. The field name MUST begin with a slash. The path is appended to the basePath in order to construct the full URL. Path templating is allowed.
"/pets": {
"get": {
// A definition of a GET operation on this path.
"description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue
@jerzyn
jerzyn / infoObjectSpec.json5
Created July 1, 2015 15:16
Info Object Specification
{
// REQUIRED FIELDS
"title": "Swagger Petstore",
"version": "1.0.0",
// OPTIONAL FIELDS COVERED BY THIS EXAMPLE
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
// A short description of the application. GFM (Github Flavoured Markdown: https://help.github.com/articles/github-flavored-markdown/) syntax can be used for rich text representation.
"termsOfService": "http://swagger.io/terms/",
// The Terms of Service for the API. Link or any String.
@jerzyn
jerzyn / swagger2specSchema1lvl.json5
Last active August 29, 2015 14:24
Swagger 2.0 Spec Schema level 1
{
// REQUIRED FIELDS
"swagger": "2.0",
// Specifies the Swagger Specification version being used. The value MUST be "2.0".
"info": {},
//Provides metadata about the API. The metadata can be used by the clients if needed.
"host": "petstore.swagger.io",
// The host (name) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port.
"paths": {},
// The available paths and operations for the API.
@jerzyn
jerzyn / curl_petstore_example
Created July 1, 2015 14:15
cURL calls to petstore
curl -X GET "http:example.com/api/pets?tags=TAGS&limit=LIMIT" -H "user_key: {user_key}"
curl -X POST "http:example.com/api/pets" -H "user_key: {user_key}" -d "{ "name": "NAME", "tag": "TAG", "id": ID }"
curl -X GET "http:example.com/api/pets/{id}" -H "user_key: {user_key}"
curl -X DELETE "http:example.com/api/pets/{id}" -H "user_key: {user_key}"
@jerzyn
jerzyn / petstore3scale.json
Last active August 29, 2015 14:24
Swagger 2.0 Petstore API with 3scale
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "Swagger API Team",
"email": "foo@example.com",
@jerzyn
jerzyn / TwoSwagger20SpecsOAuth.html
Created June 16, 2015 15:41
Loading two Swagger 2.0 Specs on one page
{% active_docs version: "2.0" services: "oauth" %}
<div class="swagger-section">
<div id="another-swagger-ui-container" class="swagger-ui-wrap"></div>
</div>
<script type="text/javascript">
$(function () {
window.swaggerUi.load(); // <-- loads first swagger-ui
@jerzyn
jerzyn / ADSpecOAuthSentimentAPISwagger20.json
Created June 16, 2015 15:15
This API returns the sentiment value (from 5 to -5) for a given word.
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "Sentiment API",
"description": "This API returns the sentiment value (from 5 to -5) for a given word.",
"contact": {
"name": "3scale Support Team",
"email": "support@3scale.net",
"url": "htpps://support.3scale.net"
@jerzyn
jerzyn / ADSpecOAuthClientCredentialsSwagger20.json
Last active August 29, 2015 14:23
OAuth2.0 Client Credentails Flow for authentication of our Sentiment API.
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "OAuth for Sentiment API",
"description": "OAuth2.0 Client Credentails Flow for authentication of our Sentiment API.",
"contact": {
"name": "3scale Support Team",
"email": "support@3scale.net",
"url": "htpps://support.3scale.net"