Skip to content

Commit

Permalink
standardize response descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarkowsky committed Aug 23, 2024
1 parent e01b1a8 commit e29381b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 50 deletions.
10 changes: 5 additions & 5 deletions express-api/src/routes/administrativeAreas.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ paths:
$ref: '#/components/schemas/AdministrativeAreaPost'
responses:
'201':
description: OK. Returns created Administrative Area.
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/AdministrativeArea'
'409':
description: Given when an administrative area matching that name already exists.
description: Conflict
content:
text/plain:
schema:
Expand All @@ -116,7 +116,7 @@ paths:
required: true
responses:
'200':
description: OK. Returns a single administrative area.
description: OK
content:
application/json:
schema:
Expand All @@ -139,13 +139,13 @@ paths:
$ref: '#/components/schemas/AdministrativeArea'
responses:
'200':
description: OK. Returns the updated administrative area.
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AdministrativeArea'
'404':
description: That administrative area did not exist.
description: Not Found
content:
text/plain:
schema:
Expand Down
20 changes: 10 additions & 10 deletions express-api/src/routes/agencies.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ paths:
$ref: '#/components/schemas/AgencyPost'
responses:
'201':
description: OK. Returns created Agency.
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Agency'
'409':
description: Given when an agency matching that name or code already exists.
description: Conflict
content:
text/plain:
schema:
Expand All @@ -134,7 +134,7 @@ paths:
required: true
responses:
'200':
description: OK.
description: OK
content:
application/json:
schema:
Expand All @@ -157,27 +157,27 @@ paths:
$ref: '#/components/schemas/Agency'
responses:
'200':
description: OK. Returns the updated agency.
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Agency'
'400':
description: Id in query parameters does not match the request body.
description: Bad Request
content:
text/plain:
schema:
type: string
example: The param ID does not match the request body.
'403':
description: Request tried to set an agency as its own parent.
description: Forbidden
content:
text/plain:
schema:
type: string
example: An agency cannot be its own parent.
'404':
description: That agency did not exist.
description: Not Found
content:
text/plain:
schema:
Expand All @@ -196,11 +196,11 @@ paths:
required: true
responses:
'204':
description: Successful deletion
description: No Content
'400':
description: The Id was not parsed succesfully.
description: Bad Request
'404':
description: That agency did not exist.
description: Not Found
content:
text/plain:
schema:
Expand Down
30 changes: 15 additions & 15 deletions express-api/src/routes/buildings.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ paths:
items:
$ref: '#/components/schemas/Building'
'400':
description: Filter supplied did not pass parsing check.
description: Bad Request
content:
text/plain:
schema:
Expand All @@ -95,13 +95,13 @@ paths:
$ref: '#/components/schemas/BuildingPost'
responses:
'201':
description: OK. Returns created Building.
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Building'
'409':
description: Given if the building already exists in PIMS.
description: Conflict
content:
text/plain:
schema:
Expand All @@ -120,25 +120,25 @@ paths:
type: integer
responses:
'200':
description: OK. Returns a single Building.
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Building'
'400':
description: Building ID not a valid number.
description: Bad Request
content:
text/plain:
type: string
example: Building ID was invalid.
'403':
description: Sent when user does not have permission to view this building.
description: Forbidden
content:
text/plain:
type: string
example: You are not authorized to view this building.
'404':
description: Sent when the building is not found.
description: Not Found
content:
text/plain:
type: string
Expand All @@ -160,27 +160,27 @@ paths:
$ref: '#/components/schemas/Building'
responses:
'200':
description: OK. Returns the updated Building.
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Building'
'400':
description: Request included invalid or incomplete data.
description: Bad Request
content:
text/plain:
schema:
type: string
example: The param ID does not match the request body.
'403':
description: Request tried to change the agency, but user wasn't an admin.
description: Forbidden
content:
text/plain:
schema:
type: string
example: Changing agency is not permitted.
'404':
description: That Building did not exist.
description: Not Found
content:
text/plain:
schema:
Expand All @@ -198,23 +198,23 @@ paths:
type: integer
responses:
'200':
description: Successful deletion
description: OK
'400':
description: The Id was not parsed succesfully.
description: Bad Request
content:
text/plain:
schema:
type: string
example: Building ID was invalid.
'403':
description: Building belongs to a project. Cannot be deleted.
description: Forbidden
content:
text/plain:
schema:
type: string
example: Building is involved in one or more projects with ID(s) ...
'404':
description: That Building did not exist.
description: Not Found
content:
text/plain:
schema:
Expand Down
4 changes: 2 additions & 2 deletions express-api/src/routes/notifications.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ paths:
items:
$ref: '#/components/schemas/NotificationQueue'
'400':
description: Filter parsing issue.
description: Bad Request
content:
text/plain:
schema:
type: string
example: Could not parse filter.
'403':
description: Authorization issue.
description: Forbidden
content:
text/plain:
schema:
Expand Down
32 changes: 16 additions & 16 deletions express-api/src/routes/parcels.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ paths:
items:
$ref: '#/components/schemas/Parcel'
'400':
description: Could not parse filter.
description: Bad Request
content:
text/plain:
schema:
Expand All @@ -83,20 +83,20 @@ paths:
$ref: '#/components/schemas/ParcelPost'
responses:
'201':
description: OK. Returns created Parcel.
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Parcel'
'400':
description: Given if the provided PID is not the correct format.
description: Bad Request
content:
text/plain:
schema:
type: string
example: 'PID must be a number and in the format #########'
'409':
description: Given if the parcel already exists in PIMS.
description: Conflict
content:
text/plain:
schema:
Expand All @@ -115,25 +115,25 @@ paths:
type: integer
responses:
'200':
description: OK. Returns a single Parcel.
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Parcel'
'400':
description: Parcel ID not a valid number.
description: Bad Request
content:
text/plain:
type: string
example: Parcel ID was invalid.
'403':
description: Sent when user does not have permission to view this parcel.
description: Forbidden
content:
text/plain:
type: string
example: You are not authorized to view this parcel.
'404':
description: Sent when the parcel is not found.
description: Not Found
content:
text/plain:
type: string
Expand All @@ -150,25 +150,25 @@ paths:
type: integer
responses:
'200':
description: OK. Returns the updated Parcel.
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Parcel'
'400':
description: Request included invalid or incomplete data.
description: Bad Request
content:
text/plain:
type: string
example: Parcel ID was invalid or mismatched with body.
'403':
description: Requested change not possible due to permissions or business logic.
description: Forbidden
content:
text/plain:
type: string
example: This agency change is not permitted.
'404':
description: Sent when the parcel is not found.
description: Not Found
content:
text/plain:
type: string
Expand All @@ -185,23 +185,23 @@ paths:
type: integer
responses:
'200':
description: Successful deletion
description: OK
'400':
description: The Id was not parsed succesfully.
description: Bad Request
content:
text/plain:
schema:
type: string
example: Parcel ID was invalid.
'403':
description: Parcel belongs to a project. Cannot be deleted.
description: Forbidden
content:
text/plain:
schema:
type: string
example: Parcel is involved in one or more projects with ID(s) ...
'404':
description: That Parcel did not exist.
description: Not Found
content:
text/plain:
schema:
Expand Down
4 changes: 2 additions & 2 deletions express-api/src/swagger/common.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ components:
example: null
responses:
400BadRequest:
description: Bad request response.
description: Bad Request
content:
text/plain:
schema:
type: string
example: 'Response could not be processed.'
429TooManyRequests:
description: Express rate limiter reached. Too many requests.
description: Too Many Requests
content:
text/plain:
schema:
Expand Down

0 comments on commit e29381b

Please sign in to comment.