Skip to content

Instantly share code, notes, and snippets.

@ilackarms
Created May 19, 2020 19:24
Show Gist options
  • Save ilackarms/b24651cc31450e725b9fb0e682a5b0e5 to your computer and use it in GitHub Desktop.
Save ilackarms/b24651cc31450e725b9fb0e682a5b0e5 to your computer and use it in GitHub Desktop.
example swag
components:
schemas:
errorModel:
properties:
code:
format: int32
type: integer
message:
type: string
required:
- code
- message
pet:
properties:
id:
format: int64
type: integer
name:
type: string
tag:
type: string
required:
- id
- name
petInput:
allOf:
- $ref: '#/components/schemas/pet'
- properties:
id:
format: int64
type: integer
required:
- name
info:
contact: {}
description: Publicly accessible APIs for the petstore
license:
name: ""
title: Petstore Public
version: ""
openapi: 3.0.0
paths:
/api/pets:
get:
description: Returns all pets from the system that the user has access to
operationId: external-api-product.petstore-system.petstore-api-spec.petstore-system.findPets
parameters:
- description: tags to filter by
explode: false
in: query
name: tags
schema:
items:
type: string
type: array
style: form
- description: maximum number of results to return
in: query
name: limit
schema:
format: int32
type: integer
responses:
"200":
content:
application/json:
schema:
items:
$ref: '#/components/schemas/pet'
type: array
application/xml:
schema:
items:
$ref: '#/components/schemas/pet'
type: array
text/html:
schema:
items:
$ref: '#/components/schemas/pet'
type: array
text/xml:
schema:
items:
$ref: '#/components/schemas/pet'
type: array
description: pet response
default:
content:
application/json:
schema:
$ref: '#/components/schemas/errorModel'
application/xml:
schema:
$ref: '#/components/schemas/errorModel'
text/html:
schema:
$ref: '#/components/schemas/errorModel'
text/xml:
schema:
$ref: '#/components/schemas/errorModel'
description: unexpected error
summary: Returns all pets from the system that the user has access to
x-solo-portal-router:
inlineRoute:
backends:
- kube:
name: petstore
namespace: default
port: 8080
/api/pets/{id}:
get:
description: Returns a user based on a single ID, if the user does not have
operationId: external-api-product.petstore-system.petstore-api-spec.petstore-system.findPetById
parameters:
- description: ID of pet to fetch
in: path
name: id
required: true
schema:
format: int64
type: integer
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/pet'
application/xml:
schema:
$ref: '#/components/schemas/pet'
text/html:
schema:
$ref: '#/components/schemas/pet'
text/xml:
schema:
$ref: '#/components/schemas/pet'
description: pet response
default:
content:
application/json:
schema:
$ref: '#/components/schemas/errorModel'
application/xml:
schema:
$ref: '#/components/schemas/errorModel'
text/html:
schema:
$ref: '#/components/schemas/errorModel'
text/xml:
schema:
$ref: '#/components/schemas/errorModel'
description: unexpected error
summary: Returns a user based on a single ID, if the user does not have
access to the pet
x-solo-portal-router:
inlineRoute:
backends:
- kube:
name: petstore
namespace: default
port: 8080
servers:
- url: http://external-api-product.petstore.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment