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

Update the OAS to reflect the latest UI changes #422

Open
wants to merge 8 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
6 changes: 3 additions & 3 deletions oas/2.0/agencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ openapi: "3.0.3"
info:
title: "Agencies"
description: "API Description"
version: "0.1.0"
version: "0.7.0"
servers:
- url: "http://dev-api.nationalpolicedata.org/api/v1"
- url: "http://127.0.0.1:5001/api/v1"
description: "Development environment"
- url: "https://stage-api.nationalpolicedata.org/api/v1"
- url: "https://dev.nationalpolicedata.org/api/v1"
description: "Staging environment"
- url: "https://api.nationalpolicedata.org"
description: "Production environment"
Expand Down
194 changes: 194 additions & 0 deletions oas/2.0/authentication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
openapi: "3.0.3"
info:
title: "Authentication"
description: "API Description"
version: "0.7.0"
servers:
- url: "http://dev.nationalpolicedata.org/api/v1"
description: "Development environment"
- url: "https://dev.nationalpolicedata.org/api/v1"
description: "Staging environment"
- url: "https://api.nationalpolicedata.org"
description: "Production environment"
x-readme:
explorer-enabled: true
proxy-enabled: true
samples-enabled: true
security:
- bearerAuth: []
tags:
- name: "Authentication"
description: "API for authenticating and creating user accounts."
paths:
/auth/register:
post:
summary: "register User Account"
operationId: "register"
description: "Create a new user account."
tags:
- Authentication
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/RegisterRequest"
responses:
"200":
description: "Logs in and returns the created user object."
content:
application/json:
schema:
$ref: "#/components/schemas/RegisterResponse"
"400":
$ref: '../common/error.yaml#/components/responses/validationError'
"409":
$ref: '../common/error.yaml#/components/responses/conflictError'
/auth/login:
post:
summary: "Log in"
operationId: "login"
description: "Log in to an existing user account."
tags:
- Authentication
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/LoginRequest"
responses:
'200':
description: 'Returns JWT that may be used to authenticate future API requests.'
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
'400':
$ref: '../common/error.yaml#/components/responses/validationError'
/auth/refresh:
post:
summary: "Refresh Access Token"
operationId: "refreshToken"
description: >
Refreshes the current access token to reset the expiration date.
tags:
- Authentication
responses:
'200':
description: >
Returns the updated employment records. The response also includes
information about any records that could not be added.
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
'401':
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
/auth/logout:
post:
summary: "Log out"
operationId: "logout"
description: "Revokes the access token used to autheticate this request."
tags:
- Authentication
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/LogoutResponse"
'401':
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
/auth/whoami:
get:
summary: "Who Am I"
operationId: "whoami"
description: "Returns the user that matches the access token used to authenticate the request."
tags:
- Authentication
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/CurrentUser"
'401':
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
RegisterRequest:
type: "object"
properties:
email:
type: "string"
description: "The user's email address."
password:
type: "string"
description: "The user's desired password."
first_name:
type: "string"
description: "The user's first name."
last_name:
type: "string"
description: "The user's last name."
phone_number:
type: "string"
description: "The user's phone number."
required:
- email
- first_name
- last_name
- password
- phone_number
RegisterResponse:
type: "object"
properties:
msg:
type: string
description: information about the registration action.
access_token:
type: string
description: The JWT that can be used to authenticate API requests on behalf of the user.
LoginRequest:
type: object
properties:
email:
type: string
description: The user's email address.
password:
type: string
description: The user's password.
required:
- email
- password
LoginResponse:
type: object
properties:
access_token:
type: string
description: The JWT that can be used to authenticate API requests on behalf of the user.
message:
type: string
description: Additional detail aboout the login action.
CurrentUser:
type: object
properties:
first_name:
type: string
description: The user's first name.
last_name:
type: string
description: The user's last name.
LogoutResponse:
type: object
properties:
msg:
type: string
description: A report of the logout action.

68 changes: 52 additions & 16 deletions oas/2.0/complaints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ openapi: "3.0.3"
info:
title: "Complaints"
description: "API Description"
version: "0.1.0"
version: "0.7.0"
servers:
- url: "http://dev-api.nationalpolicedata.org/api/v1"
- url: "http://127.0.0.1:5001/api/v1"
description: "Development environment"
- url: "https://stage-api.nationalpolicedata.org/api/v1"
- url: "https://dev.nationalpolicedata.org/api/v1"
description: "Staging environment"
- url: "https://api.nationalpolicedata.org"
description: "Production environment"
Expand All @@ -21,13 +21,13 @@ tags:
description: "Complaints API"
paths:
/complaints/{complaint_uid}:
parameters:
- name: complaint_uid
in: path
required: true
schema:
type: string
get:
parameters:
- name: complaint_uid
in: path
required: true
schema:
type: string
tags:
- "Complaints"
summary: "Get Complaint"
Expand All @@ -43,7 +43,15 @@ paths:
$ref: "#/components/schemas/Complaint"
'404':
$ref: '../common/error.yaml#/components/responses/notFoundError'
patch:
'401':
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
patch:
parameters:
- name: complaint_uid
in: path
required: true
schema:
type: string
tags:
- "Complaints"
summary: "Update Complaint"
Expand All @@ -70,7 +78,8 @@ paths:
$ref: '../common/error.yaml#/components/responses/validationError'
'404':
$ref: '../common/error.yaml#/components/responses/notFoundError'

'401':
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
/complaints:
post:
tags:
Expand All @@ -96,6 +105,8 @@ paths:
$ref: "#/components/schemas/Complaint"
'400':
$ref: '../common/error.yaml#/components/responses/validationError'
'401':
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
get:
tags:
- "Complaints"
Expand All @@ -114,6 +125,28 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/ComplaintList"
"401":
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
/complaints/latest:
get:
tags:
- "Complaints"
summary: "Latest Complaint Updates"
operationId: "getLatestComplaints"
description: >
Returns the most recently updated or added complaints.
parameters:
- $ref: '../common/pagination.yaml#/components/parameters/page'
- $ref: '../common/pagination.yaml#/components/parameters/per_page'
responses:
"200":
description: "A JSON array of complaint objects"
content:
application/json:
schema:
$ref: "#/components/schemas/ComplaintList"
"401":
$ref: '../common/error.yaml#/components/responses/unauthorizedError'
components:
securitySchemes:
bearerAuth:
Expand Down Expand Up @@ -481,14 +514,14 @@ components:
description: "A description of the attachment."
SourceDetails:
oneOf:
- $ref: '#/components/schemas/LegalAction'
- $ref: '#/components/schemas/LegalCaseEvent'
- $ref: '#/components/schemas/PersonalAccount'
- $ref: '#/components/schemas/NewsReport'
- $ref: '#/components/schemas/GovernmentRecord'
discriminator:
propertyName: record_type
mapping:
Legal Action: '#/components/schemas/LegalAction'
Legal Case Event: '#/components/schemas/LegalCaseEvent'
Personal Account: '#/components/schemas/PersonalAccount'
News Report: '#/components/schemas/NewsReport'
Government Record: '#/components/schemas/GovernmentRecord'
Expand All @@ -502,14 +535,14 @@ components:
- Personal Account
- News Report
- Government Record
LegalAction:
LegalCaseEvent:
type: "object"
properties:
record_type:
type: "string"
description: "The type of record the complaint is associated with."
enum:
- Legal Action
- Legal Case Event
court:
type: "string"
description: "The court the legal action was filed in."
Expand All @@ -519,7 +552,10 @@ components:
docket_number:
type: "string"
description: "The docket number of the case."
date_of_action:
event_summary:
type: "string"
description: "A summary of the event."
date_of_event:
type: "string"
format: "date-time"
description: "The date the legal action was filed."
Expand Down
Loading
Loading