Skip to content

Commit

Permalink
204 OpenAPI documentation refactor
Browse files Browse the repository at this point in the history
 - Used redocly `split` to create a multi-filer structure by extracting parts into standalone separate `yaml`  files
   - component folder containing:
     - parameters folder: contains all parameters
     - responses folder: contains all responses
     - schema folder: contains all schemas
   - paths folder: contains all paths
     - params in the path are indicated by curly brackets`{ }` and backslashes ` / ` are replaced by underscores ` _ `
        - `boroughs_{boroughId}_community-districts.yaml`

s forgot to commit this
  • Loading branch information
horatiorosa committed Sep 11, 2024
1 parent 93f3572 commit b8d94cd
Show file tree
Hide file tree
Showing 76 changed files with 1,450 additions and 1,394 deletions.
10 changes: 10 additions & 0 deletions openapi/components/parameters/bblParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: bbl
required: true
in: path
schema:
type: string
pattern: ^([0-9]{10})$
example: '1000477501'
description: >-
The ten character code compromised of a one character borough, five character
block, and four character lot codes.
10 changes: 10 additions & 0 deletions openapi/components/parameters/boroughIdParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: boroughId
required: true
in: path
schema:
type: string
pattern: ^([0-9]{1})$
example: '1'
description: >-
A single character numeric string containing the common number used to refer
to the borough. Possible values are 1-5.
8 changes: 8 additions & 0 deletions openapi/components/parameters/bufferParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: buffer
in: query
schema:
type: number
example: 600
description: >-
A buffer around the spatial feature. Units are feet. It is optional when
applying a spatial filter.
9 changes: 9 additions & 0 deletions openapi/components/parameters/capitalProjectIdParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: capitalProjectId
required: true
in: path
schema:
type: string
example: HWPEDSF5
description: >-
The id for the project, which combines with the managing code to make a unique
id
8 changes: 8 additions & 0 deletions openapi/components/parameters/cityCouncilDistrictIdParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: cityCouncilDistrictId
required: true
in: path
schema:
type: string
pattern: ^([0-9]{1,2})$
example: '25'
description: One or two character code to represent city council districts.
10 changes: 10 additions & 0 deletions openapi/components/parameters/communityDistrictIdParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: communityDistrictId
required: true
in: path
schema:
type: string
pattern: ^([0-9]{2})$
example: '01'
description: >-
The two character numeric string containing the number used to refer to the
community district.
16 changes: 16 additions & 0 deletions openapi/components/parameters/geometryParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: geometry
required: false
in: query
schema:
type: string
enum:
- Point
- LineString
- Polygon
example: Polygon
description: >-
The type of geometry used for a spatial filter. It must be provided when
applying a spatial filter; each geometry has its own coordinate requirements.
Point geometries have length of 1. LineString geometries have length of 2 to
5, inclusive. Polygons have length 4 to 5, inclusive; the last coordinate must
match the first coordinate to close the polygon.
17 changes: 17 additions & 0 deletions openapi/components/parameters/latsParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: lats
required: false
in: query
schema:
type: array
items:
type: number
minItems: 1
maxItems: 5
style: form
explode: false
example: 40.708649,40.707800,40.707800,40.708649,40.708649
description: >-
The latitude portion of coordinates. It must be provided when applying a
spatial filter and have the same length as the longitudes. (If using a tool
like axios, serializing the array with brackets is also supported. ex;
lats[]=40.708649&lats[]=40.707800)
11 changes: 11 additions & 0 deletions openapi/components/parameters/limitParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: limit
required: false
in: query
schema:
type: integer
minimum: 1
maximum: 100
example: 100
description: >-
The maximum number of results to be returned in each response. The default
value is 20. It must be between 1 and 100, inclusive.
17 changes: 17 additions & 0 deletions openapi/components/parameters/lonsParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: lons
required: false
in: query
schema:
type: array
items:
type: number
minItems: 1
maxItems: 5
example: '-74.010776,-74.010776,-74.010139,-74.010139,-74.010776'
style: form
explode: false
description: >-
The longitude portion of coordinates. It must be provided when applying a
spatial filter and have the same length as the latitudes. (If using a tool
like axios, serializing the array with brackets is also supported. ex;
lons[]=-74.010776&lons[]=-74.010776)
8 changes: 8 additions & 0 deletions openapi/components/parameters/managingCodeParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: managingCode
required: true
in: path
schema:
type: string
pattern: ^([0-9]{3})$
example: '801'
description: Three character string of numbers representing managing agency
10 changes: 10 additions & 0 deletions openapi/components/parameters/offsetParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: offset
required: false
in: query
schema:
type: integer
minimum: 0
example: 100
description: >-
The position in the full list to begin returning results. Default offset is 0.
If the offset is beyond the end of the list, no results will be returned.
7 changes: 7 additions & 0 deletions openapi/components/parameters/viewportXParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: x
in: path
description: viewport x component
required: true
schema:
type: integer
example: 1000
7 changes: 7 additions & 0 deletions openapi/components/parameters/viewportYParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: 'y'
in: path
description: viewport y component
required: true
schema:
type: integer
example: 1000
7 changes: 7 additions & 0 deletions openapi/components/parameters/viewportZoomParam.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: z
in: path
description: viewport zoom component
required: true
schema:
type: integer
example: 7
5 changes: 5 additions & 0 deletions openapi/components/responses/BadRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Invalid client request
content:
application/json:
schema:
$ref: ../schemas/Error.yaml
5 changes: 5 additions & 0 deletions openapi/components/responses/InternalServerError.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Server side error
content:
application/json:
schema:
$ref: ../schemas/Error.yaml
6 changes: 6 additions & 0 deletions openapi/components/responses/MVT.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: A protobuf file formatted as Mapbox Vector Tile
content:
application/x-protobuf:
schema:
type: string
format: byte
5 changes: 5 additions & 0 deletions openapi/components/responses/NotFound.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Requested resource does not exist or is not available
content:
application/json:
schema:
$ref: ../schemas/Error.yaml
13 changes: 13 additions & 0 deletions openapi/components/schemas/Agency.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: object
properties:
initials:
type: string
description: A string of variable length containing the initials of the agency.
example: DOT
name:
type: string
description: The full name of the agency.
example: Department of Transportation
required:
- initials
- name
23 changes: 23 additions & 0 deletions openapi/components/schemas/Borough.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
type: object
properties:
id:
type: string
description: >-
A single character numeric string containing the common number used to
refer to the borough. Possible values are 1-5.
pattern: ^([0-9])$
example: 1
title:
type: string
description: The full name of the borough.
example: Manhattan
abbr:
type: string
description: The two character abbreviation for the borough.
minLength: 2
maxLength: 2
example: MN
required:
- id
- title
- abbr
51 changes: 51 additions & 0 deletions openapi/components/schemas/CapitalCommitment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
type: object
properties:
id:
type: string
description: A uuid used to refer to the capital commitment.
format: uuid
type:
type: string
description: A four character string used to refer to the commitment type.
pattern: ^([A-z]{4})$
example: DSGN
plannedDate:
type: string
format: date
description: >-
A string used to refer to the date when the commitment is projected to be
committed.
example: '2012-04-23'
budgetLineCode:
type: string
description: A string used to refer to the budget line.
example: HW
budgetLineId:
type: string
description: A string used to refer to the budget line.
example: 0002Q
sponsoringAgency:
type: string
nullable: true
description: >-
A string of variable length containing the initials of the sponsoring
agency.
example: DOT
budgetType:
type: string
nullable: true
description: A string of variable length denoting the type of budget.
example: Highways
totalValue:
type: number
description: A numeric string used to refer to the amount of total planned commitments.
example: 1600000
required:
- id
- type
- plannedDate
- budgetLineCode
- budgetLineId
- sponsoringAgency
- budgetType
- totalValue
15 changes: 15 additions & 0 deletions openapi/components/schemas/CapitalCommitmentType.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type: object
properties:
code:
type: string
description: The four character code to represent the capital commitment type
minLength: 4
maxLength: 4
example: CONS
description:
type: string
description: The description of the capital commitment type.
example: CONSTRUCTION
required:
- code
- description
42 changes: 42 additions & 0 deletions openapi/components/schemas/CapitalProject.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
type: object
properties:
id:
type: string
description: >-
The id for the project, which combines with the managing code to make a
unique id
example: HWPEDSF5
description:
type: string
description: The capital project title.
example: Multi-Site Pedestrian Safety Phase 5
managingCode:
type: string
description: Three character string of numbers representing managing agency
pattern: ^([0-9]{3})$
example: 850
managingAgency:
type: string
description: The managing agency name abbreviation or acronym
example: DOT
minDate:
type: string
format: date
description: The starting date of the capital project
example: '2024-05-15'
maxDate:
type: string
format: date
description: The ending date of the capital project
example: '2024-05-15'
category:
$ref: ./CapitalProjectCategory.yaml
nullable: true
required:
- id
- description
- managingCode
- managingAgency
- minDate
- maxDate
- category
29 changes: 29 additions & 0 deletions openapi/components/schemas/CapitalProjectBudgeted.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
allOf:
- $ref: ./CapitalProject.yaml
- type: object
properties:
commitmentsTotal:
type: number
description: The sum total of commitments for the capital project
example: 200000
sponsoringAgencies:
type: array
items:
type: string
description: >-
An array containing string values representing the sponsoring agencies
initials.
example:
- DOT
budgetTypes:
type: array
items:
type: string
description: An array containing string values representing the budget types.
example:
- Highways
- Highway Bridges
required:
- commitmentsTotal
- sponsoringAgencies
- budgetTypes
21 changes: 21 additions & 0 deletions openapi/components/schemas/CapitalProjectBudgetedGeoJson.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
type: object
properties:
id:
type: string
description: The concatenation of the managing code and capital project id.
example: 806RAMALG
type:
type: string
enum:
- Feature
geometry:
oneOf:
- $ref: ./MultiPoint.yaml
- $ref: ./MultiPolygon.yaml
properties:
$ref: ./CapitalProjectBudgeted.yaml
required:
- id
- type
- geometry
- properties
Loading

0 comments on commit b8d94cd

Please sign in to comment.