Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: OpenAPI spec invalid #30

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Patches and Suggestions
- Dave Challis (https://github.com/davechallis)
- Florian Bruhin (https://github.com/The-Compiler)
- Brett Randall (https://github.com/javabrett)
- Harold Ozouf (https://github.com/jspdown)
78 changes: 57 additions & 21 deletions httpbin/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,14 @@ def jsonify(*args, **kwargs):
"<code>$ docker run -p 80:8080 ghcr.io/psf/httpbin</code>"
),
"contact": {
"responsibleOrganization": "Python Software Foundation",
"responsibleDeveloper": "Kenneth Reitz",
"url": "https://github.com/psf/httpbin/",
"url": "https://kennethreitz.org",
},
# "termsOfService": "http://me.com/terms",
"version": version,
},
"host": "httpbin.org", # overrides localhost:5000
"basePath": "/", # base bash for blueprint registration
"schemes": ["https"],
"protocol": "https",
"tags": [
{
"name": "HTTP Methods",
Expand Down Expand Up @@ -550,7 +547,8 @@ def redirect_n_times(n):
parameters:
- in: path
name: n
type: int
type: number
required: true
produces:
- text/html
responses:
Expand Down Expand Up @@ -592,7 +590,7 @@ def redirect_to():
required: true
- in: query
name: status_code
type: int
type: number
post:
consumes:
- application/x-www-form-urlencoded
Expand All @@ -603,7 +601,7 @@ def redirect_to():
required: true
- in: formData
name: status_code
type: int
type: number
required: false
patch:
consumes:
Expand All @@ -615,7 +613,7 @@ def redirect_to():
required: true
- in: formData
name: status_code
type: int
type: number
required: false
put:
consumes:
Expand All @@ -627,7 +625,7 @@ def redirect_to():
required: true
- in: formData
name: status_code
type: int
type: number
required: false
responses:
302:
Expand Down Expand Up @@ -657,7 +655,8 @@ def relative_redirect_n_times(n):
parameters:
- in: path
name: n
type: int
type: number
required: true
produces:
- text/html
responses:
Expand Down Expand Up @@ -687,7 +686,8 @@ def absolute_redirect_n_times(n):
parameters:
- in: path
name: n
type: int
type: number
required: true
produces:
- text/html
responses:
Expand All @@ -712,7 +712,8 @@ def stream_n_messages(n):
parameters:
- in: path
name: n
type: int
type: number
required: true
produces:
- application/json
responses:
Expand Down Expand Up @@ -741,6 +742,8 @@ def view_status_code(codes):
parameters:
- in: path
name: codes
type: string
required: true
produces:
- text/plain
responses:
Expand Down Expand Up @@ -867,9 +870,11 @@ def set_cookie(name, value):
- in: path
name: name
type: string
required: true
- in: path
name: value
type: string
required: true
produces:
- text/plain
responses:
Expand Down Expand Up @@ -955,9 +960,11 @@ def basic_auth(user="user", passwd="passwd"):
- in: path
name: user
type: string
required: true
- in: path
name: passwd
type: string
required: true
produces:
- application/json
responses:
Expand All @@ -983,9 +990,11 @@ def hidden_basic_auth(user="user", passwd="passwd"):
- in: path
name: user
type: string
required: true
- in: path
name: passwd
type: string
required: true
produces:
- application/json
responses:
Expand All @@ -1009,8 +1018,7 @@ def bearer_auth():
parameters:
- in: header
name: Authorization
schema:
type: string
type: string
produces:
- application/json
responses:
Expand Down Expand Up @@ -1042,12 +1050,15 @@ def digest_auth_md5(qop=None, user="user", passwd="passwd"):
name: qop
type: string
description: auth or auth-int
required: true
- in: path
name: user
type: string
required: true
- in: path
name: passwd
type: string
required: true
produces:
- application/json
responses:
Expand All @@ -1070,17 +1081,21 @@ def digest_auth_nostale(qop=None, user="user", passwd="passwd", algorithm="MD5")
name: qop
type: string
description: auth or auth-int
required: true
- in: path
name: user
type: string
required: true
- in: path
name: passwd
type: string
required: true
- in: path
name: algorithm
type: string
description: MD5, SHA-256, SHA-512
default: MD5
required: true
produces:
- application/json
responses:
Expand All @@ -1106,21 +1121,26 @@ def digest_auth(
name: qop
type: string
description: auth or auth-int
required: true
- in: path
name: user
type: string
required: true
- in: path
name: passwd
type: string
required: true
- in: path
name: algorithm
type: string
description: MD5, SHA-256, SHA-512
default: MD5
required: true
- in: path
name: stale_after
type: string
default: never
required: true
produces:
- application/json
responses:
Expand Down Expand Up @@ -1205,7 +1225,8 @@ def delay_response(delay):
parameters:
- in: path
name: delay
type: int
type: number
required: true
produces:
- application/json
responses:
Expand Down Expand Up @@ -1302,6 +1323,7 @@ def decode_base64(value):
name: value
type: string
default: SFRUUEJJTiBpcyBhd2Vzb21l
required: true
produces:
- text/html
responses:
Expand All @@ -1324,8 +1346,10 @@ def cache():
parameters:
- in: header
name: If-Modified-Since
type: string
- in: header
name: If-None-Match
type: string
produces:
- application/json
responses:
Expand Down Expand Up @@ -1355,10 +1379,16 @@ def etag(etag):
tags:
- Response inspection
parameters:
- in: path
name: etag
type: string
required: true
- in: header
name: If-None-Match
type: string
- in: header
name: If-Match
type: string
produces:
- application/json
responses:
Expand Down Expand Up @@ -1395,7 +1425,8 @@ def cache_control(value):
parameters:
- in: path
name: value
type: integer
type: number
required: true
produces:
- application/json
responses:
Expand Down Expand Up @@ -1432,7 +1463,8 @@ def random_bytes(n):
parameters:
- in: path
name: n
type: int
type: number
required: true
produces:
- application/octet-stream
responses:
Expand Down Expand Up @@ -1463,7 +1495,8 @@ def stream_random_bytes(n):
parameters:
- in: path
name: n
type: int
type: number
required: true
produces:
- application/octet-stream
responses:
Expand Down Expand Up @@ -1507,7 +1540,8 @@ def range_request(numbytes):
parameters:
- in: path
name: numbytes
type: int
type: number
required: true
produces:
- application/octet-stream
responses:
Expand Down Expand Up @@ -1597,10 +1631,12 @@ def link_page(n, offset):
parameters:
- in: path
name: n
type: int
type: number
required: true
- in: path
name: offset
type: int
type: number
required: true
produces:
- text/html
responses:
Expand Down