Skip to content
Draft
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
5 changes: 5 additions & 0 deletions .changeset/tidy-response-schemas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@common-grants/core": minor
---

Add non-templated response schemas (`Ok`, `Paginated`, `Sorted`, `Filtered`, `Created`) so they are emitted as standalone JSON schemas, and rename the templated variants with a `T` suffix (`OkT<T>`, `PaginatedT<T>`, `SortedT<T>`, `FilteredT<ItemsT, FilterT>`, `CreatedT<T>`). Routes now use the `T`-suffixed templates; specs consuming the old templated names (e.g. `Responses.Ok<T>`) must switch to the `T`-suffixed equivalents. The wire contract of route responses is unchanged.
115 changes: 100 additions & 15 deletions lib/cli/lib/openapi/openapi.0.1.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ paths:
- $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize'
responses:
'200':
description: A 200 response with a paginated list of items
description: A 200 response with a paginated list of typed items
content:
application/json:
schema:
Expand All @@ -55,7 +55,7 @@ paths:
description: Details about the paginated results
allOf:
- $ref: '#/components/schemas/CommonGrants.Responses.Success'
description: A 200 response with a paginated list of items
description: A 200 response with a paginated list of typed items
tags:
- Opportunities
- required
Expand All @@ -67,16 +67,14 @@ paths:
parameters: []
responses:
'200':
description: A paginated list of items with a filter
description: A paginated list of typed items with a typed filter
content:
application/json:
schema:
type: object
required:
- items
- paginationInfo
- status
- message
- sortInfo
- filterInfo
properties:
Expand All @@ -89,13 +87,6 @@ paths:
allOf:
- $ref: '#/components/schemas/CommonGrants.Pagination.PaginatedResultsInfo'
description: Details about the paginated results
status:
type: integer
format: int32
example: 200
message:
type: string
example: Success
sortInfo:
allOf:
- $ref: '#/components/schemas/CommonGrants.Sorting.SortedResultsInfo'
Expand All @@ -115,7 +106,7 @@ paths:
description: The filters applied to the response items
allOf:
- $ref: '#/components/schemas/CommonGrants.Responses.Success'
description: A paginated list of items with a filter
description: A paginated list of typed items with a typed filter
tags:
- Opportunities
- optional
Expand Down Expand Up @@ -160,7 +151,7 @@ paths:
$ref: '#/components/schemas/CommonGrants.Types.uuid'
responses:
'200':
description: A 200 response with data
description: A 200 response with typed data
content:
application/json:
schema:
Expand All @@ -174,7 +165,7 @@ paths:
description: Response data
allOf:
- $ref: '#/components/schemas/CommonGrants.Responses.Success'
description: A 200 response with data
description: A 200 response with typed data
'404':
description: The server cannot find the requested resource.
content:
Expand Down Expand Up @@ -953,6 +944,16 @@ components:
description: Total number of pages
example: 5
description: Details about the paginated results
CommonGrants.Responses.Created:
type: object
required:
- data
properties:
data:
description: Response data
allOf:
- $ref: '#/components/schemas/CommonGrants.Responses.Success'
description: A 201 response with data
CommonGrants.Responses.Error:
type: object
required:
Expand All @@ -973,6 +974,90 @@ components:
items: {}
description: List of errors
description: A non-2xx response schema
CommonGrants.Responses.Filtered:
type: object
required:
- items
- paginationInfo
- sortInfo
- filterInfo
properties:
items:
type: array
items: {}
description: Items from the current page
paginationInfo:
allOf:
- $ref: '#/components/schemas/CommonGrants.Pagination.PaginatedResultsInfo'
description: Details about the paginated results
sortInfo:
allOf:
- $ref: '#/components/schemas/CommonGrants.Sorting.SortedResultsInfo'
description: The sort order of the items
filterInfo:
type: object
properties:
filters: {}
errors:
type: array
items:
type: string
description: Non-fatal errors that occurred during filtering
required:
- filters
description: The filters applied to the response items
allOf:
- $ref: '#/components/schemas/CommonGrants.Responses.Success'
description: A paginated list of items with a filter
CommonGrants.Responses.Ok:
type: object
required:
- data
properties:
data:
description: Response data
allOf:
- $ref: '#/components/schemas/CommonGrants.Responses.Success'
description: A 200 response with data
CommonGrants.Responses.Paginated:
type: object
required:
- items
- paginationInfo
properties:
items:
type: array
items: {}
description: Items from the current page
paginationInfo:
allOf:
- $ref: '#/components/schemas/CommonGrants.Pagination.PaginatedResultsInfo'
description: Details about the paginated results
allOf:
- $ref: '#/components/schemas/CommonGrants.Responses.Success'
description: A 200 response with a paginated list of items
CommonGrants.Responses.Sorted:
type: object
required:
- items
- paginationInfo
- sortInfo
properties:
items:
type: array
items: {}
description: Items from the current page
paginationInfo:
allOf:
- $ref: '#/components/schemas/CommonGrants.Pagination.PaginatedResultsInfo'
description: Details about the paginated results
sortInfo:
allOf:
- $ref: '#/components/schemas/CommonGrants.Sorting.SortedResultsInfo'
description: The sort order of the items
allOf:
- $ref: '#/components/schemas/CommonGrants.Responses.Success'
description: A paginated list of items with a sort order
CommonGrants.Responses.Success:
type: object
required:
Expand Down
Loading
Loading