Skip to content

Commit

Permalink
add upstream swagger file, referenced in couper.hcl (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Koch committed Oct 8, 2020
1 parent 60764c7 commit ed65bdf
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 0 deletions.
3 changes: 3 additions & 0 deletions couper.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ server "couperConnect" {
endpoint "/httpbin/**" {
backend "httpbin" {
path = "/**"
swagger_definition = "./upstream/httpbin.yaml"
validate_request = true
validate_response = true

request_headers = {
x-env-user = ["override-user"]
Expand Down
134 changes: 134 additions & 0 deletions upstream/httpbin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
openapi: 3.0.1
info:
title: httpbin.org API
version: "1.0"
servers:
- url: https://httpbin.org:443
paths:
/get:
get:
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/HttpbinGet'
/post:
post:
requestBody:
required: true
content:
application/json:
schema:
type: object
additionalProperties: false
required:
- username
- password
properties:
username:
type: string
password:
type: string
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/HttpbinPost'
/status/{codes}:
get:
parameters:
- name: codes
in: path
required: true
schema:
type: integer
responses:
200:
description: OK
500:
description: Internal Server Error
/headers:
get:
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/HttpbinHeaders'
/anything:
post:
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/HttpbinAnything'
components:
schemas:
HttpbinAnything:
allOf:
- $ref: '#/components/schemas/HttpbinPost'
- type: object
additionalProperties: true
required:
- method
properties:
method:
type: string
enum: [GET, POST]
HttpbinGet:
allOf:
- $ref: '#/components/schemas/HttpbinHeaders'
- type: object
additionalProperties: true
required:
- args
- origin
- url
properties:
args:
type: object
origin:
type: string
url:
type: string
HttpbinHeaders:
type: object
required:
- headers
properties:
headers:
type: object
HttpbinPost:
allOf:
- $ref: '#/components/schemas/HttpbinGet'
- type: object
additionalProperties: true
required:
- data
- files
- form
- json
properties:
data:
type: string
files:
type: object
form:
type: object
json:
$ref: '#/components/schemas/JSON'
JSON:
nullable: true
oneOf:
- type: boolean
- type: number
- type: string
- type: array
- type: object

0 comments on commit ed65bdf

Please sign in to comment.