diff --git a/lib/cli/lib/openapi/openapi.0.6.0.yaml b/lib/cli/lib/openapi/openapi.0.6.0.yaml new file mode 100644 index 000000000..16c54ae8d --- /dev/null +++ b/lib/cli/lib/openapi/openapi.0.6.0.yaml @@ -0,0 +1,9407 @@ +openapi: 3.0.0 +info: + title: CommonGrants Base API + description: |- + The base OpenAPI specification for a CommonGrants API + + In order for an API to be "compliant" with the CommonGrants protocol, + it must implement all of the routes with the "required" tag in this specification. + version: 0.6.0 +tags: + - name: Opportunities + description: Endpoints related to funding opportunities + - name: Competitions + description: Endpoints related to competitions, which are distinct application processes for the same funding opportunity + - name: Applications + description: Endpoints related to submitting applications for a given competition + - name: Application Reviews + description: Endpoints related to reviewing applications for a given competition + - name: Organizations + description: Endpoints related to viewing and syncing organization profiles + - name: Awards + description: Endpoints related to grant awards + - name: Forms + description: Endpoints related to forms + - name: Versions + description: Endpoints related to discovering the protocol versions an API serves + - name: required + description: Endpoints that MUST be implemented by all CommonGrants APIs + - name: optional + description: Endpoints that MAY be implemented by CommonGrants APIs + - name: experimental + description: Endpoints that MAY be implemented by CommonGrants APIs, but are not guaranteed to be stable +paths: + /common-grants/applications/search: + post: + operationId: Applications_searchApplications + summary: Search applications + description: 'Search for applications. Note: The search results for a given query will depend on the scopes attached to the API token used to make the request.' + parameters: + - name: filters + in: query + required: true + description: The filters to apply to the search + schema: + $ref: '#/components/schemas/CommonGrants.Models.AppFilters' + explode: false + - name: sorting + in: query + required: true + description: The sorting to apply to the search + schema: + $ref: '#/components/schemas/CommonGrants.Models.AppSorting' + explode: false + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A paginated list of typed items with a typed filter + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + - sortInfo + - filterInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.ApplicationBase' + 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: + $ref: '#/components/schemas/CommonGrants.Models.AppFilters' + 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 typed items with a typed filter + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + - Application Reviews + /common-grants/applications/start: + post: + operationId: Applications_startApplication + summary: Start an application + description: Start a new application for a given competition. + parameters: + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '201': + description: A 201 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.ApplicationBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 201 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + competitionId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The ID of the competition to start an application for + organizationId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The ID of the organization to start an application for, if applying on behalf of an organization + title: + type: string + description: The title of the application + required: + - competitionId + - title + /common-grants/applications/{appId}: + get: + operationId: Applications_getApplication + summary: View an application + description: View an application for a given competition, along with its form responses and validation errors. + parameters: + - name: appId + in: path + required: true + description: The ID of the application to get + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.ApplicationBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + /common-grants/applications/{appId}/forms/{formId}: + put: + operationId: Applications_setFormResponse + summary: Respond to a form + description: Set or update the response to a given form in an application. + parameters: + - name: appId + in: path + required: true + description: The ID of the application to whose form response is being updated + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - name: formId + in: path + required: true + description: The ID of the form whose response is being updated + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppFormResponse' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: {} + description: The response to the form + get: + operationId: Applications_getFormResponse + summary: Get a form response + description: Get the response to a given form in an application. + parameters: + - name: appId + in: path + required: true + description: The ID of the application to whose form response is being retrieved + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - name: formId + in: path + required: true + description: The ID of the form whose response is being retrieved + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppFormResponse' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + /common-grants/applications/{appId}/submit: + put: + operationId: Applications_submitApplication + summary: Submit an application + description: Submit an application to a competition. Applications that have validation errors will be blocked from submitting until the errors are fixed. + parameters: + - name: appId + in: path + required: true + description: The ID of the application to submit + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + default: + description: An unexpected error response. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.ApplicationSubmissionError' + tags: + - Applications + - experimental + /common-grants/awards: + get: + operationId: Awards_list + summary: List awards + description: Get a paginated list of awards, sorted by `lastModifiedAt` with most recent first. + parameters: + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.AwardBase' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Awards + - optional + /common-grants/awards/search: + post: + operationId: Awards_search + summary: Search awards + description: Search for awards based on the provided filters. + parameters: + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A paginated list of typed items with a typed filter + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + - sortInfo + - filterInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.AwardBase' + 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: + $ref: '#/components/schemas/CommonGrants.Models.AwdFilters' + 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 typed items with a typed filter + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Awards + - optional + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + search: + type: string + description: Award search query + example: Community health center + filters: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdFilters' + description: |- + Filters to apply to the award search + + Multiple filter conditions will be combined with AND logic, so that + results only include awards that match all of the provided filters. + sorting: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdSorting' + description: The sort order to apply to the results + pagination: + allOf: + - $ref: '#/components/schemas/CommonGrants.Pagination.PaginatedBodyParams' + description: Pagination instructions for the results + /common-grants/awards/{awdId}: + get: + operationId: Awards_read + summary: View award details + description: View details about an award. + parameters: + - name: awdId + in: path + required: true + description: The ID of the award to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwardBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Awards + - optional + /common-grants/competitions/{compId}: + get: + operationId: Competitions_read + summary: View competition details + description: |- + View details about a competition for a given funding opportunity. + + Each competition may have a distinct set of forms, be limited to a + certain types of applicants, or have a different application period. + parameters: + - name: compId + in: path + required: true + description: The ID of the competition to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Competitions + - experimental + /common-grants/forms: + get: + operationId: Forms_list + summary: List forms + description: Get a paginated list of forms, sorted by `lastModifiedAt` with most recent first. + parameters: + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.FormBase' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Forms + - experimental + /common-grants/forms/{formId}: + get: + operationId: Forms_read + summary: View form details + description: View details about a given form. + parameters: + - name: formId + in: path + required: true + description: The ID of the form to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Forms + - experimental + /common-grants/opportunities: + get: + operationId: Opportunities_list + summary: List opportunities + description: Get a paginated list of opportunities, sorted by `lastModifiedAt` with most recent first. + parameters: + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OpportunityBase' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Opportunities + - required + /common-grants/opportunities/search: + post: + operationId: Opportunities_search + summary: Search opportunities + description: Search for opportunities based on the provided filters. + parameters: + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A paginated list of typed items with a typed filter + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + - sortInfo + - filterInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OpportunityBase' + 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: + $ref: '#/components/schemas/CommonGrants.Models.OppFilters' + 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 typed items with a typed filter + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Opportunities + - optional + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + search: + type: string + description: Opportunity search query + example: Pre-school education + filters: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppFilters' + description: |- + Filters to apply to the opportunity search + + Multiple filter conditions will be combined with AND logic, so that + results only include opportunities that match all of the provided filters. + sorting: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppSorting' + description: The sort order to apply to the results + pagination: + allOf: + - $ref: '#/components/schemas/CommonGrants.Pagination.PaginatedBodyParams' + description: Pagination instructions for the results + /common-grants/opportunities/{oppId}: + get: + operationId: Opportunities_read + summary: View opportunity details + description: View details about an opportunity. + parameters: + - name: oppId + in: path + required: true + description: The ID of the opportunity to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OpportunityDetails' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Opportunities + - required + /common-grants/orgs: + get: + operationId: Organizations_list + summary: List organizations + description: Get a paginated list of organizations. Requires the `org:read` scope. + parameters: + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - name: registry + in: query + required: false + description: Registry code of an external identifier to filter by (e.g. `org:us:ein`) + schema: + type: string + explode: false + - name: id + in: query + required: false + description: Identifier value within the given registry to filter by + schema: + type: string + explode: false + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrganizationBase' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + security: + - OAuth2Auth: + - org:read + /common-grants/orgs/{orgId}: + get: + operationId: Organizations_read + summary: View an organization profile + description: View an organization profile by its UUID. Requires the `org:read` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - name: at + in: query + required: false + description: Return the profile as of the given point in time + schema: + type: string + format: date-time + explode: false + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrganizationBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + security: + - OAuth2Auth: + - org:read + patch: + operationId: Organizations_update + summary: Update an organization profile + description: Apply a direct JSON Merge Patch edit to an organization profile, recorded as an accepted change. Requires the `org:write` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization to update + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRevision' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/CommonGrants.Models.OrgPatchData' + description: JSON Merge Patch body for the organization profile + security: + - OAuth2Auth: + - org:write + /common-grants/orgs/{orgId}/changes: + post: + operationId: Organizations_submitChange + summary: Submit an organization profile change + description: Submit a change to an organization profile, which a receiver may apply immediately or queue for review. Requires the `org.changes:write` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization to change + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '202': + description: A 202 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + Location: + required: false + description: URL where the accepted resource can be retrieved + schema: + type: string + format: uri + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRevision' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 202 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/CommonGrants.Models.OrgPatchData' + description: JSON Merge Patch body for the organization profile + security: + - OAuth2Auth: + - org.changes:write + get: + operationId: Organizations_listChanges + summary: List organization profile changes + description: Get a paginated list of changes to an organization profile, newest first. Requires the `org.changes:read` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization whose changes to list + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgRevision' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + security: + - OAuth2Auth: + - org.changes:read + /common-grants/orgs/{orgId}/changes/{changeId}: + get: + operationId: Organizations_viewChange + summary: View an organization profile change + description: View a single change to an organization profile by its id. Requires the `org.changes:read` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization the change belongs to + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - name: changeId + in: path + required: true + description: The id of the change to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRevision' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + security: + - OAuth2Auth: + - org.changes:read + /common-grants/versions: + get: + operationId: ProtocolVersions_read + summary: List supported versions + description: |- + List the protocol versions this API serves, its default version, and any routes whose versions differ. + + This route is optional, but a server that serves more than one protocol version MUST implement it. + It ignores the `CG-Version` request header, because clients call it before they know which version to request. + Its responses carry neither `CG-Version-Served` nor `Vary: CG-Version`. + It requires no stronger authentication than the API's required routes, and SHOULD be readable without authentication. + Fields are only ever added to `data`; clients ignore fields they don't recognize. + parameters: [] + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.VersionDiscoveryResponse' + tags: + - Versions + - optional +components: + parameters: + CommonGrants.Headers.VersionRequest: + name: CG-Version + in: header + required: false + description: |- + The protocol version the client wants, such as `0.6.0` + + Servers match on major and minor version. When absent, the server responds + in its default version. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + CommonGrants.Pagination.PaginatedQueryParams.page: + name: page + in: query + required: false + description: The page to return + schema: + type: integer + format: int32 + minimum: 1 + default: 1 + explode: false + CommonGrants.Pagination.PaginatedQueryParams.pageSize: + name: pageSize + in: query + required: false + description: The number of items to return per page + schema: + type: integer + format: int32 + minimum: 1 + default: 100 + explode: false + schemas: + CommonGrants.Fields.Address: + type: object + required: + - street1 + - city + - stateOrProvince + - country + - postalCode + properties: + street1: + type: string + description: The primary street address line. + street2: + type: string + description: Additional street address information (e.g., apartment number, suite, etc.). + city: + type: string + description: The city or municipality name. + stateOrProvince: + type: string + description: The state, province, or region name. + country: + type: string + description: The country name or ISO country code. + postalCode: + type: string + description: The postal or ZIP code for the address. + latitude: + type: number + description: The latitude coordinate of the address location. + longitude: + type: number + description: The longitude coordinate of the address location. + geography: + type: object + additionalProperties: {} + description: Additional geospatial data in GeoJSON format. + description: A mailing address. + example: + street1: 123 Main St + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + CommonGrants.Fields.AddressCollection: + type: object + required: + - primary + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Address' + description: The primary address for a person or organization. + otherAddresses: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Address' + description: Additional addresses keyed by a descriptive label (e.g., "work", "home", "international"). + description: A collection of addresses. + example: + primary: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + otherAddresses: + satellite: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + international: + street1: 123 Rue Principale + city: Montreal + stateOrProvince: QC + country: CA + postalCode: H2Y 1C6 + CommonGrants.Fields.CustomField: + type: object + required: + - name + - fieldType + - value + properties: + name: + type: string + description: Name of the custom field + fieldType: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.CustomFieldType' + description: The JSON schema type to use when de-serializing the `value` field + schema: + type: string + format: uri + description: Link to the full JSON schema for this custom field + value: + description: Value of the custom field + description: + type: string + description: Description of the custom field's purpose + description: A custom field on a model + example: + name: eligibilityType + fieldType: array + value: + - nonprofit + - academic + description: Types of eligible organizations + CommonGrants.Fields.CustomFieldType: + type: string + enum: + - string + - number + - integer + - boolean + - object + - array + description: The set of JSON schema types supported by a custom field + CommonGrants.Fields.DateRangeEvent: + type: object + required: + - eventType + - startDate + - endDate + properties: + eventType: + type: string + enum: + - dateRange + description: Type of event + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'Start date of the event in ISO 8601 format: YYYY-MM-DD' + startTime: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoTime' + description: 'Start time of the event in ISO 8601 format: HH:MM:SS' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'End date of the event in ISO 8601 format: YYYY-MM-DD' + endTime: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoTime' + description: 'End time of the event in ISO 8601 format: HH:MM:SS' + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EventBase' + description: Description of an event that has a start and end date (and possible time) associated with it + example: + name: Application period + eventType: dateRange + startDate: '2024-01-01' + endDate: '2024-01-31' + endTime: '17:00:00' + description: Primary application period for the grant opportunity + CommonGrants.Fields.EmailCollection: + type: object + required: + - primary + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.email' + description: The primary email address for a person or organization. + otherEmails: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Types.email' + description: Additional email addresses keyed by a descriptive label (e.g., "work", "personal", "support"). + description: A collection of email addresses. + example: + primary: john.doe@example.com + otherEmails: + work: john.doe@work.com + personal: john.doe@gmail.com + school: john.doe@school.edu + CommonGrants.Fields.Event: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Fields.SingleDateEvent' + - $ref: '#/components/schemas/CommonGrants.Fields.DateRangeEvent' + - $ref: '#/components/schemas/CommonGrants.Fields.OtherEvent' + description: Union of all event types + CommonGrants.Fields.EventBase: + type: object + required: + - name + - eventType + properties: + name: + type: string + description: Human-readable name of the event (e.g., 'Application posted', 'Question deadline') + eventType: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EventType' + description: Type of event + description: + type: string + description: Description of what this event represents + discriminator: + propertyName: eventType + mapping: + dateRange: '#/components/schemas/CommonGrants.Fields.DateRangeEvent' + other: '#/components/schemas/CommonGrants.Fields.OtherEvent' + singleDate: '#/components/schemas/CommonGrants.Fields.SingleDateEvent' + description: Base model for all events + CommonGrants.Fields.EventType: + type: string + enum: + - singleDate + - dateRange + - other + description: |- + Type of event (e.g., a single date, a date range, or a custom event) + + - singleDate: A single date (and possible time) + - dateRange: A period of time with a start and end date + - other: Other event type (e.g., a recurring event) + CommonGrants.Fields.File: + type: object + required: + - downloadUrl + - name + - createdAt + - lastModifiedAt + properties: + downloadUrl: + type: string + format: uri + description: The file's download URL. + name: + type: string + description: The file's name. + description: + type: string + description: The file's description. + sizeInBytes: + type: number + description: The file's size in bytes. + mimeType: + type: string + description: The file's MIME type. + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: A field representing a downloadable file. + example: + downloadUrl: https://example.com/file.pdf + name: example.pdf + description: A PDF file with instructions + sizeInBytes: 1000 + mimeType: application/pdf + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + CommonGrants.Fields.Identifier: + type: object + properties: + registry: + type: object + properties: + code: + type: string + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: |- + An identifier issued to a record by a registry. + + Accepts any string value and any registry code. Model-specific collections use + registry-typed instantiations of `IdentifierT` (e.g. `OrgIdEin`) for their base + identifiers, and this generic form for extension identifiers under `otherIds`. + example: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + allIds: + - id: '123456789' + status: active + - id: '987654321' + status: archived + CommonGrants.Fields.IdentifierCollection: + type: object + properties: + systemId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.SystemId' + description: The hosting system's own identifier for this record. + otherIds: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Identifier' + description: |- + Additional identifiers keyed by their registry code, for registries the + protocol does not define as a base identifier on the model. + description: A collection of identifiers associated with a record. + example: + systemId: + registry: + code: org:grants.gov:system + url: https://commongrants.org/registries/org-grants-gov-system + id: 01912a8b-7c3d-7890-abcd-ef1234567890 + otherIds: + org:candid:bridge: + registry: + code: org:candid:bridge + id: '1234567' + CommonGrants.Fields.IdentifierStatus: + type: string + enum: + - active + - archived + description: The lifecycle status of an identifier value. + CommonGrants.Fields.Money: + type: object + required: + - amount + - currency + properties: + amount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.decimalString' + description: The amount of money + currency: + type: string + description: The ISO 4217 currency code in which the amount is denominated + description: A monetary amount and the currency in which it's denominated + example: + amount: '-50.50' + currency: USD + CommonGrants.Fields.Name: + type: object + required: + - firstName + - lastName + properties: + prefix: + type: string + description: Honorific prefix (e.g., Mr., Mrs., Dr., Prof.). + firstName: + type: string + description: The person's first or given name. + middleName: + type: string + description: The person's middle name or names. + lastName: + type: string + description: The person's last name or family name. + suffix: + type: string + description: Name suffix (e.g., Jr., Sr., III, Ph.D.). + description: A person's name. + example: + prefix: Dr. + firstName: Jane + middleName: Edward + lastName: Doe + suffix: Jr. + CommonGrants.Fields.OrgPatchAddressOrCreate: + type: object + properties: + street1: + type: string + description: The primary street address line. + street2: + type: string + nullable: true + description: Additional street address information (e.g., apartment number, suite, etc.). + city: + type: string + description: The city or municipality name. + stateOrProvince: + type: string + description: The state, province, or region name. + country: + type: string + description: The country name or ISO country code. + postalCode: + type: string + description: The postal or ZIP code for the address. + latitude: + type: number + nullable: true + description: The latitude coordinate of the address location. + longitude: + type: number + nullable: true + description: The longitude coordinate of the address location. + geography: + type: object + additionalProperties: {} + nullable: true + description: Additional geospatial data in GeoJSON format. + description: A mailing address. + example: + street1: 123 Main St + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + CommonGrants.Fields.OrgPatchCustomFieldOrCreate: + type: object + properties: + name: + type: string + description: Name of the custom field + fieldType: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.CustomFieldType' + description: The JSON schema type to use when de-serializing the `value` field + schema: + type: string + format: uri + nullable: true + description: Link to the full JSON schema for this custom field + value: + description: Value of the custom field + description: + type: string + nullable: true + description: Description of the custom field's purpose + description: A custom field on a model + example: + name: eligibilityType + fieldType: array + value: + - nonprofit + - academic + description: Types of eligible organizations + CommonGrants.Fields.OrgPatchIdentifierOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: |- + An identifier issued to a record by a registry. + + Accepts any string value and any registry code. Model-specific collections use + registry-typed instantiations of `IdentifierT` (e.g. `OrgIdEin`) for their base + identifiers, and this generic form for extension identifiers under `otherIds`. + example: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + allIds: + - id: '123456789' + status: active + - id: '987654321' + status: archived + CommonGrants.Fields.OrgPatchPhoneOrCreate: + type: object + properties: + countryCode: + type: string + pattern: ^\+[1-9][0-9]{0,3}$ + description: The international country code (e.g., "+1" for US/Canada). + number: + type: string + description: The local phone number without the country code. + extension: + type: string + nullable: true + description: Optional extension number for the phone line. + isMobile: + type: boolean + nullable: true + description: Indicates whether this is a mobile/cell phone number. + description: A phone number. + example: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + CommonGrants.Fields.OrgPatchSystemIdOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: |- + The hosting system's own identifier for a record. + + The identifier value is the record's UUID within the hosting system; the + registry code names that system (e.g. `org:grants.gov:system`). + example: + registry: + code: org:grants.gov:system + url: https://commongrants.org/registries/org-grants-gov-system + id: 01912a8b-7c3d-7890-abcd-ef1234567890 + CommonGrants.Fields.OtherEvent: + type: object + required: + - eventType + properties: + eventType: + type: string + enum: + - other + description: Type of event + details: + type: string + description: Details of the event's timeline (e.g. "Every other Tuesday") + description: + type: string + description: Description of the event + example: Applications begin being accepted + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EventBase' + description: Description of an event that is not a single date or date range + example: + name: Info sessions + eventType: other + details: Every other Tuesday at 10:00 AM during the application period + description: Info sessions for the opportunity + CommonGrants.Fields.PCSClass: + type: string + enum: + - Organization types + - Subjects + - Population groups + - Transaction types + - Support strategies + description: The class to which the PCS term belongs. + CommonGrants.Fields.PCSOrgType: + type: object + required: + - class + properties: + class: + type: string + enum: + - Organization types + description: The PCS term for the organization type. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for organization types. + + See https://taxonomy.candid.org/organization-type for more information. + CommonGrants.Fields.PCSPopulation: + type: object + required: + - class + properties: + class: + type: string + enum: + - Population groups + description: The PCS term for the population. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for populations served. + + See https://taxonomy.candid.org/populations for more information. + CommonGrants.Fields.PCSSubject: + type: object + required: + - class + properties: + class: + type: string + enum: + - Subjects + description: The PCS term for the subject. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for the subject of the grant. + + See https://taxonomy.candid.org/subjects for more information. + CommonGrants.Fields.PCSSupportStrategy: + type: object + required: + - class + properties: + class: + type: string + enum: + - Support strategies + description: The PCS term for the support strategy. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for support strategies. + + See https://taxonomy.candid.org/support-strategies for more information. + CommonGrants.Fields.PCSTerm: + type: object + required: + - term + - class + - code + properties: + term: + type: string + description: The plain language PCS term. + class: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSClass' + description: The class to which the PCS term belongs. + code: + type: string + pattern: ^[A-Z]{2}[0-9]{6}$ + description: The code for this PCS term. + example: UC000000 + description: + type: string + description: Description of the PCS term + description: |- + A Philanthropy Classification System (PCS) term. + + The PCS is a hierarchical classification system for categorizing data related to + philanthropic activities. It supports the following classes: + - Organization types + - Subjects + - Population groups + - Transaction types + - Support strategies + + See https://taxonomy.candid.org/ for more information. + example: + term: Hospital + class: Organization types + description: Institutions with the primary purpose of providing in-patient physical and mental health services... + code: EO000000 + CommonGrants.Fields.PCSTransactionType: + type: object + required: + - class + properties: + class: + type: string + enum: + - Transaction types + description: The PCS term for the transaction type. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for transaction types. + + See https://taxonomy.candid.org/transaction-types for more information. + CommonGrants.Fields.Phone: + type: object + required: + - countryCode + - number + properties: + countryCode: + type: string + pattern: ^\+[1-9][0-9]{0,3}$ + description: The international country code (e.g., "+1" for US/Canada). + number: + type: string + description: The local phone number without the country code. + extension: + type: string + description: Optional extension number for the phone line. + isMobile: + type: boolean + description: Indicates whether this is a mobile/cell phone number. + default: false + description: A phone number. + example: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + CommonGrants.Fields.PhoneCollection: + type: object + required: + - primary + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Phone' + description: The person's primary phone number. + fax: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Phone' + description: The person's fax number, if applicable. + otherPhones: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Phone' + description: Additional phone numbers not covered by the standard fields. + description: A collection of phone numbers for a person. + example: + primary: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + fax: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + otherPhones: + support: + countryCode: '+1' + number: 333-456-1230 + isMobile: false + marketing: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + CommonGrants.Fields.SingleDateEvent: + type: object + required: + - eventType + - date + properties: + eventType: + type: string + enum: + - singleDate + description: Type of event + date: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'Date of the event in in ISO 8601 format: YYYY-MM-DD' + time: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoTime' + description: 'Time of the event in ISO 8601 format: HH:MM:SS' + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EventBase' + description: Description of an event that has a date (and possible time) associated with it + example: + name: Opportunity close date + eventType: singleDate + date: '2024-12-31' + time: '17:00:00' + description: Opportunity closes for all applications + CommonGrants.Fields.SystemId: + type: object + properties: + registry: + type: object + properties: + code: + type: string + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: |- + The hosting system's own identifier for a record. + + The identifier value is the record's UUID within the hosting system; the + registry code names that system (e.g. `org:grants.gov:system`). + example: + registry: + code: org:grants.gov:system + url: https://commongrants.org/registries/org-grants-gov-system + id: 01912a8b-7c3d-7890-abcd-ef1234567890 + CommonGrants.Filters.AllOperators: + type: string + enum: + - eq + - neq + - gt + - gte + - lt + - lte + - in + - notIn + - between + - outside + - like + - notLike + CommonGrants.Filters.ArrayOperators: + type: string + enum: + - in + - notIn + description: Operators that filter a field based on an array of values + CommonGrants.Filters.ComparisonOperators: + type: string + enum: + - gt + - gte + - lt + - lte + description: Operators that filter a field based on a comparison to a value + CommonGrants.Filters.DateRangeFilter: + type: object + required: + - operator + - value + properties: + operator: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.RangeOperators' + description: The operator to apply to the filter value + value: + type: object + properties: + min: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + - type: string + format: date-time + - type: string + format: date-time + max: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + - type: string + format: date-time + - type: string + format: date-time + required: + - min + - max + description: The value to use for the filter operation + example: + min: '2021-01-01' + max: '2021-01-02' + description: Filters by comparing a field to a range of date values + CommonGrants.Filters.DefaultFilter: + type: object + required: + - operator + - value + properties: + operator: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Filters.EquivalenceOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.ComparisonOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.ArrayOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.StringOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.RangeOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.AllOperators' + description: The operator to apply to the filter value + value: + description: The value to use for the filter operation + description: A base filter model that can be used to create more specific filter models + CommonGrants.Filters.EquivalenceOperators: + type: string + enum: + - eq + - neq + description: Operators that filter a field based on an exact match to a value + CommonGrants.Filters.MoneyRangeFilter: + type: object + required: + - operator + - value + properties: + operator: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.RangeOperators' + description: The operator to apply to the filter value + value: + type: object + properties: + min: + $ref: '#/components/schemas/CommonGrants.Fields.Money' + max: + $ref: '#/components/schemas/CommonGrants.Fields.Money' + required: + - min + - max + description: The value to use for the filter operation + example: + min: + amount: '1000' + currency: USD + max: + amount: '10000' + currency: USD + description: Filters by comparing a field to a range of monetary values + CommonGrants.Filters.RangeOperators: + type: string + enum: + - between + - outside + description: Operators that filter a field based on a range of values + CommonGrants.Filters.StringArrayFilter: + type: object + required: + - operator + - value + properties: + operator: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.ArrayOperators' + description: The operator to apply to the filter value + value: + type: array + items: + type: string + description: The value to use for the filter operation + example: + - value1 + - value2 + description: Filters by comparing a field to an array of string values + CommonGrants.Filters.StringOperators: + type: string + enum: + - like + - notLike + description: Operators that filter a field based on a string value + CommonGrants.Models.AppDefaultFilters: + type: object + properties: + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`opportunityId` matches one of the following values' + example: + operator: in + value: + - ad3b469a-d89a-42d3-c439-6c1234567890 + competitionId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`competitionId` matches one of the following values' + example: + operator: in + value: + - 123e4567-e89b-12d3-a456-426614174000 + submittedAtRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`submittedAt` is between the given range' + example: + operator: between + value: + min: '2025-01-01' + max: '2025-01-30' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - submitted + - accepted + allOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: The standard set of filters supported for application searches + CommonGrants.Models.AppFilters: + type: object + properties: + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`opportunityId` matches one of the following values' + example: + operator: in + value: + - ad3b469a-d89a-42d3-c439-6c1234567890 + competitionId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`competitionId` matches one of the following values' + example: + operator: in + value: + - 123e4567-e89b-12d3-a456-426614174000 + submittedAtRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`submittedAt` is between the given range' + example: + operator: between + value: + min: '2025-01-01' + max: '2025-01-30' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - submitted + - accepted + customFilters: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: Additional implementation-defined filters to apply to the search + description: Filters to apply when searching for applications + CommonGrants.Models.AppFormResponse: + type: object + required: + - applicationId + - id + - formId + - response + - status + - createdAt + - lastModifiedAt + properties: + applicationId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the application + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the form response + formId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The form being responded to + response: + type: object + additionalProperties: {} + description: The response to the form + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormResponseStatus' + description: The status of the form response + validationErrors: + type: array + items: {} + description: The validation errors for the form response + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Custom attributes about the form response + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: The model for a form response included in an application + example: + applicationId: 123e4567-e89b-12d3-a456-426614174000 + id: 123e4567-e89b-12d3-a456-426614174000 + formId: 123e4567-e89b-12d3-a456-426614174000 + response: + firstName: John + lastName: Doe + email: john.doe@example.com + phone: 123-456-7890 + address: + street: 123 Main St + city: Anytown + state: CA + zip: '12345' + country: null + status: + value: inProgress + description: The form response is in progress + validationErrors: + - field: address.country + message: Country is required + createdAt: '2021-01-01T00:00:00Z' + lastModifiedAt: '2021-01-01T00:00:00Z' + CommonGrants.Models.AppRef: + type: object + required: + - id + - title + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the application + readOnly: true + title: + type: string + description: The title of the application + description: |- + A reference to an application, previewing the key fields a consumer needs + to identify it and look it up or join it to another response. Appears + wherever another record points to an application, such as the application + an award resulted from. + example: + id: 123e4567-e89b-12d3-a456-426614174000 + title: My Application + CommonGrants.Models.AppSortBy: + type: string + enum: + - lastModifiedAt + - createdAt + - submittedAt + - status.value + - opportunityId + - competitionId + - custom + description: The fields that can be used to sort applications + CommonGrants.Models.AppSorting: + type: object + required: + - sortBy + properties: + sortBy: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppSortBy' + description: The field to sort by + example: opportunityId + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortBodyParams' + description: Sorting parameters for applications + CommonGrants.Models.AppStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the application + example: + value: submitted + description: The application has been submitted. + CommonGrants.Models.AppStatusOptions: + type: string + enum: + - inProgress + - submitted + - accepted + - rejected + - custom + description: |- + The default set of values accepted for application status: + - `inProgress`: The application is in progress + - `submitted`: The application has been submitted and is being reviewed + - `accepted`: The application has been accepted + - `rejected`: The application has been rejected + - `custom`: A custom status + CommonGrants.Models.ApplicantType: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.ApplicantTypeOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The type of applicant eligible to apply for funding + example: + value: individual + description: An individual applicant + CommonGrants.Models.ApplicantTypeOptions: + type: string + enum: + - individual + - organization + - government_state + - government_county + - government_municipal + - government_special_district + - government_tribal + - organization_tribal_other + - school_district_independent + - higher_education_public + - higher_education_private + - non_profit_with_501c3 + - nonprofit_without_501c3 + - for_profit_small_business + - for_profit_not_small_business + - unrestricted + - custom + description: The set of possible applicant types + CommonGrants.Models.ApplicationBase: + type: object + required: + - id + - title + - competitionId + - opportunityId + - formResponses + - status + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the application + readOnly: true + title: + type: string + description: The title of the application + competitionId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the competition + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the opportunity being applied to + formResponses: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.AppFormResponse' + description: The form responses for the application + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppStatus' + description: The status of the application + submittedAt: + type: string + format: date-time + nullable: true + description: The date and time the application was submitted + validationErrors: + type: array + items: {} + description: The validation errors for the application and form responses + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: The custom fields about the application + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: The base model for an application to a competition for a funding opportunity + example: + id: 123e4567-e89b-12d3-a456-426614174000 + title: My Application + competitionId: 123e4567-e89b-12d3-a456-426614174000 + opportunityId: ad3b469a-d89a-42d3-c439-6c1234567890 + formResponses: + formA: + applicationId: 123e4567-e89b-12d3-a456-426614174000 + id: 123e4567-e89b-12d3-a456-426614174000 + formId: 123e4567-e89b-12d3-a456-426614174000 + response: + firstName: John + lastName: Doe + email: john.doe@example.com + phone: 123-456-7890 + address: + street: 123 Main St + city: Anytown + state: CA + zip: '12345' + country: null + status: + value: inProgress + description: The form response is in progress + validationErrors: + - field: address.country + message: Country is required + createdAt: '2021-01-01T00:00:00Z' + lastModifiedAt: '2021-01-01T00:00:00Z' + status: + value: inProgress + description: The application is in progress. + submittedAt: null + createdAt: '2021-01-01T00:00:00Z' + lastModifiedAt: '2021-01-01T00:00:00Z' + customFields: + attachments: + name: attachments + fieldType: object + value: + contacts: + downloadUrl: https://example.com/file.pdf + name: example.pdf + description: A PDF file with instructions + sizeInBytes: 1000 + mimeType: application/pdf + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + budget: + downloadUrl: https://example.com/excel.xlsx + name: excel.xlsx + description: The excel file for the application + sizeInBytes: 1000 + mimeType: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + description: The attachments for the application + applicationZipFile: + name: applicationZipFile + fieldType: object + value: + downloadUrl: https://example.com/application.zip + name: application.zip + description: The zip file for the application + sizeInBytes: 50000 + mimeType: application/zip + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + description: The zip file for the application + CommonGrants.Models.AwardBase: + type: object + required: + - id + - title + - description + - status + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the award + readOnly: true + title: + type: string + description: Title or name of the award + example: Community Health Center Capital Improvement Grant + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdIds' + description: System and registry-specific identifiers for the award + description: + type: string + description: Description of the award's purpose + example: Supports facility upgrades at federally qualified health centers. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdStatus' + description: Lifecycle status of the award + funding: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdFunding' + description: Requested, awarded, and disbursed amounts + keyDates: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdTimeline' + description: Award date and period of performance + opportunity: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppRef' + description: The opportunity this award resulted from + application: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppRef' + description: The application this award resulted from + funders: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRefCollection' + description: Organization(s) that funded the award + recipientOrganizations: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRefCollection' + description: Organization(s) that received the award, if the recipient is an organization + recipientIndividual: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdRecipientIndividual' + description: The individual who received the award, if the recipient is a person + parent: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdRef' + description: Parent award, for amendments or multi-tranche awards + source: + type: string + format: uri + description: URL for the canonical source record of the award + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: A grant award + example: + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + title: Community Health Center Capital Improvement Grant + identifiers: + systemId: + registry: + code: awd:grants.gov:system + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + awd:us:fain: + registry: + code: awd:us:fain + url: https://commongrants.org/registries/awd-us-fain + id: H80CS00001 + description: Supports facility upgrades at federally qualified health centers. + status: + value: awarded + description: Award has been issued and funds are being disbursed. + funding: + requestedAmount: + amount: '500000.00' + currency: USD + awardedAmount: + amount: '450000.00' + currency: USD + disbursedAmount: + amount: '150000.00' + currency: USD + keyDates: + awardDate: + name: Award date + eventType: singleDate + date: '2026-03-01' + description: The date the award was issued. + periodOfPerformance: + name: Period of performance + eventType: dateRange + startDate: '2026-04-01' + endDate: '2027-03-31' + description: The period during which the funded work is performed. + opportunity: + id: 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + title: Health Center Capital Improvement Program + identifiers: + opp:us:fon: + registry: + code: opp:us:fon + url: https://commongrants.org/registries/opp-us-fon + id: HHS-2026-ACF-OCC-YD-0001 + funders: + primary: + id: 018f2e77-4b5c-7d2e-9f3a-bcdef1234567 + name: Health Resources and Services Administration + identifiers: + otherIds: + org:grants.gov:agency: + registry: + code: org:grants.gov:agency + id: HRSA + recipientOrganizations: + primary: + id: 018f2e77-6d7e-7f4a-9b5c-def123456789 + name: Riverside Community Health Center + identifiers: + org:us:ein: + registry: + code: org:us:ein + id: '582345679' + source: https://www.usaspending.gov/award/ASST_NON_H80CS00001 + createdAt: '2026-03-01T00:00:00Z' + lastModifiedAt: '2026-06-01T00:00:00Z' + CommonGrants.Models.AwdDefaultFilters: + type: object + properties: + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - awarded + - completed + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`opportunity.id` matches one of the following values' + example: + operator: in + value: + - 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + awardDateRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`keyDates.awardDate` is between the given range' + example: + operator: between + value: + min: '2026-01-01' + max: '2026-12-31' + awardedAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.awardedAmount` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '100000' + currency: USD + max: + amount: '500000' + currency: USD + allOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: The standard set of filters supported for award searches + CommonGrants.Models.AwdFilters: + type: object + properties: + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - awarded + - completed + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`opportunity.id` matches one of the following values' + example: + operator: in + value: + - 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + awardDateRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`keyDates.awardDate` is between the given range' + example: + operator: between + value: + min: '2026-01-01' + max: '2026-12-31' + awardedAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.awardedAmount` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '100000' + currency: USD + max: + amount: '500000' + currency: USD + customFilters: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: Additional implementation-defined filters to apply to the search + description: Filters to apply when searching for awards + CommonGrants.Models.AwdFunding: + type: object + properties: + details: + type: string + description: Details about the award's funding that don't fit other fields + requestedAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Amount of funding requested by the recipient + awardedAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Amount of funding awarded to the recipient + disbursedAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Amount of funding disbursed to the recipient so far + description: Financial details about the award, including the amounts requested, awarded, and disbursed + example: + requestedAmount: + amount: '500000.00' + currency: USD + awardedAmount: + amount: '450000.00' + currency: USD + disbursedAmount: + amount: '150000.00' + currency: USD + CommonGrants.Models.AwdIdFain: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - awd:us:fain + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An award's Federal Award Identification Number (FAIN), assigned by the awarding agency. + example: + registry: + code: awd:us:fain + url: https://commongrants.org/registries/awd-us-fain + id: H80CS00001 + CommonGrants.Models.AwdIds: + type: object + properties: + awd:us:fain: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdIdFain' + description: The award's Federal Award Identification Number (FAIN). + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierCollection' + description: |- + A collection of identifiers associated with an award. + + Extends the generic identifier collection with the base identifiers CommonGrants + defines for awards. Additional registries can be published under `otherIds`. + example: + systemId: + registry: + code: awd:grants.gov:system + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + awd:us:fain: + registry: + code: awd:us:fain + url: https://commongrants.org/registries/awd-us-fain + id: H80CS00001 + CommonGrants.Models.AwdRecipientIndividual: + type: object + properties: + name: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Name' + description: The individual's name. + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierCollection' + description: Identifiers associated with the individual, keyed by registry code. + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Custom fields about the individual recipient. + description: An individual who received an award, when the recipient is a person rather than an organization. + CommonGrants.Models.AwdRef: + type: object + required: + - id + - title + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the award + readOnly: true + title: + type: string + description: Title or name of the award + example: Community Health Center Capital Improvement Grant + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdIds' + description: System and registry-specific identifiers for the award + description: |- + A reference to an award, previewing the key fields a consumer needs to + identify it and look it up or join it to another response. Appears wherever + another record points to an award, such as a parent award for an amendment + or tranche. + example: + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + title: Community Health Center Capital Improvement Grant + identifiers: + systemId: + registry: + code: awd:grants.gov:system + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + awd:us:fain: + registry: + code: awd:us:fain + url: https://commongrants.org/registries/awd-us-fain + id: H80CS00001 + CommonGrants.Models.AwdSortBy: + type: string + enum: + - lastModifiedAt + - createdAt + - title + - status.value + - keyDates.awardDate + - funding.awardedAmount + - custom + CommonGrants.Models.AwdSorting: + type: object + required: + - sortBy + properties: + sortBy: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdSortBy' + description: The field to sort by + example: lastModifiedAt + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortBodyParams' + CommonGrants.Models.AwdStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the award + example: + value: awarded + description: Award has been issued and funds are being disbursed. + CommonGrants.Models.AwdStatusOptions: + type: string + enum: + - awarded + - completed + - cancelled + - custom + description: |- + The set of values accepted for award status: + - `awarded`: The award has been issued and funds are being disbursed + - `completed`: The award's period of performance has ended + - `cancelled`: The award was cancelled or terminated + - `custom`: A custom status + CommonGrants.Models.AwdTimeline: + type: object + properties: + awardDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The date (and time) on which the award was issued + periodOfPerformance: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The period during which the funded work is expected to be performed + otherDates: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: |- + An optional map of other key dates or events in the award timeline + + Examples might include a reporting deadline, close-out date, etc. + description: Key dates in the award's timeline, such as the award date and period of performance + example: + awardDate: + name: Award date + eventType: singleDate + date: '2026-03-01' + description: The date the award was issued. + periodOfPerformance: + name: Period of performance + eventType: dateRange + startDate: '2026-04-01' + endDate: '2027-03-31' + description: The period during which the funded work is performed. + CommonGrants.Models.CompetitionBase: + type: object + required: + - id + - opportunity + - title + - status + - forms + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the competition + opportunity: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppRef' + description: The opportunity this competition is for + title: + type: string + description: The title of the competition + description: + type: string + description: The description of the competition + instructions: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/CommonGrants.Fields.File' + description: The instructions for the competition + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionStatus' + description: The status of the competition + keyDates: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionTimeline' + description: The key dates in the competition timeline + forms: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionForms' + description: The forms for the competition + acceptedApplicantTypes: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.ApplicantType' + description: Accepted applicant types for the competition + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: The custom fields for the competition + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: |- + The base model for a competition. + + A competition is an application process for a funding opportunity. It often has a + distinct application period and set of application forms. + example: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + opportunity: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6b + title: Small business grant program + title: Competition 1 + description: Competition 1 description + instructions: Competition 1 instructions + status: + value: open + description: Competition is open for applications + keyDates: + openDate: + name: Open Date + eventType: singleDate + date: '2025-01-01' + closeDate: + name: Close Date + eventType: singleDate + date: '2025-01-30' + otherDates: + reviewPeriod: + name: Application Review Period + eventType: dateRange + startDate: '2025-02-01' + endDate: '2025-02-28' + forms: + forms: + formA: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + formB: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + validation: + required: + - formA + - formB + createdAt: '2025-01-01T00:00:00Z' + lastModifiedAt: '2025-01-01T00:00:00Z' + CommonGrants.Models.CompetitionForms: + type: object + required: + - forms + properties: + forms: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.FormBase' + description: The forms for the competition + validation: + type: object + additionalProperties: {} + description: The validation rules for the competition forms + description: Set of forms that need to be completed to apply to the competition. + example: + forms: + formA: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + formB: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + validation: + required: + - formA + - formB + CommonGrants.Models.CompetitionStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the competition + example: + value: open + description: Competition is open for applications + CommonGrants.Models.CompetitionStatusOptions: + type: string + enum: + - open + - closed + - custom + description: |- + The set of values accepted for competition status + - `open`: The competition is open for applications + - `closed`: The competition is no longer accepting applications + - `custom`: A custom status + CommonGrants.Models.CompetitionTimeline: + type: object + properties: + openDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The start date of the competition + closeDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The end date of the competition + otherDates: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The date the competition was created + description: Key dates in the competition's timeline. + example: + openDate: + name: Open Date + eventType: singleDate + date: '2025-01-01' + closeDate: + name: Close Date + eventType: singleDate + date: '2025-01-30' + otherDates: + reviewPeriod: + name: Application Review Period + eventType: dateRange + startDate: '2025-02-01' + endDate: '2025-02-28' + CommonGrants.Models.FormBase: + type: object + required: + - id + - title + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The form's unique identifier. + title: + type: string + description: The form's title. + description: + type: string + description: The form's description. + version: + type: string + instructions: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/CommonGrants.Fields.File' + description: The form's instructions. + jsonSchema: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormJsonSchema' + description: The form's JSON schema used to render the form and validate responses. + uiSchema: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormUISchema' + description: The form's UI schema used to render the form in the browser. + mappingToCommonGrants: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.MappingSchema' + description: A mapping from form schema to CommonGrants schema. + mappingFromCommonGrants: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.MappingSchema' + description: A mapping from CommonGrants schema to form schema. + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Custom attributes about the form itself, not custom fields within the form. + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: A form for collecting data from a user. + example: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + CommonGrants.Models.FormJsonSchema: + type: object + additionalProperties: {} + description: A JSON schema used to validate form responses. + example: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + CommonGrants.Models.FormResponseStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormResponseStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the form response + example: + value: inProgress + description: The form response is in progress + CommonGrants.Models.FormResponseStatusOptions: + type: string + enum: + - notStarted + - inProgress + - complete + - custom + description: |- + The set of values accepted for form response status: + - `notStarted`: The form response has not been started + - `inProgress`: The form response is in progress + - `complete`: The form response is complete, meaning all required fields have been filled out and there are no validation errors + - `custom`: A custom status + CommonGrants.Models.FormUISchema: + type: object + additionalProperties: {} + description: A UI schema used to render the form in the browser. + example: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + CommonGrants.Models.MappingConstantFunction: + type: object + required: + - const + properties: + const: {} + description: Returns a constant value. + example: + const: '123' + CommonGrants.Models.MappingFieldFunction: + type: object + required: + - field + properties: + field: + type: string + description: Returns the value of a field in the source data. + example: + field: summary.opportunity_amount + CommonGrants.Models.MappingFunction: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Models.MappingConstantFunction' + - $ref: '#/components/schemas/CommonGrants.Models.MappingFieldFunction' + - $ref: '#/components/schemas/CommonGrants.Models.MappingSwitchFunction' + description: The set of supported mapping functions. + example: + switch: + field: summary.opportunity_status + case: + active: open + inactive: closed + default: custom + CommonGrants.Models.MappingSchema: + type: object + additionalProperties: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Models.MappingFunction' + - $ref: '#/components/schemas/CommonGrants.Models.MappingSchema' + description: |- + A mapping format for translating data from one schema to another. + + Example: + + The following mapping: + + ```json + { + "id": { "const": "123" }, + "opportunity": { + "status": { + "switch": { + "field": "summary.opportunity_status", + "case": { "active": "open", "inactive": "closed" }, + "default": "custom", + }, + }, + "amount": { "field": "summary.opportunity_amount" }, + } + } + ``` + + Will translate the following data: + + ```json + { + "id": "123", + "summary": { + "opportunity_status": "active", + "opportunity_amount": 100, + }, + } + ``` + + To the following data: + + ```json + { + "id": "123", + "opportunity": { "status": "open", "amount": 100 }, + } + ``` + example: + id: + const: '123' + opportunity: + status: + switch: + field: summary.opportunity_status + case: + active: open + inactive: closed + default: custom + amount: + field: summary.opportunity_amount + CommonGrants.Models.MappingSwitchFunction: + type: object + required: + - switch + properties: + switch: + type: object + properties: + field: + type: string + description: The field in the source data to switch on. + case: + type: object + additionalProperties: {} + description: An object mapping source field values to desired output values. + default: + description: The default value to output if no case matches the source field value. + required: + - field + - case + description: Returns a new value based on the value of a field in the source data using a switch statement. + example: + switch: + field: summary.opportunity_status + case: + active: open + inactive: closed + default: custom + CommonGrants.Models.OperationVersions: + type: object + required: + - versions + - defaultVersion + properties: + versions: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + minItems: 1 + description: The versions this route serves + defaultVersion: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version this route serves when a request doesn't name one, one of `versions` + upcomingDefault: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.UpcomingDefault' + description: A scheduled change to this route's default version, if any. Its `version` is one of `versions` + deprecated: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.VersionRetirement' + description: |- + Deprecated versions of this route, keyed by version, with their retirement schedule + + Each key is a version from `versions`, written exactly as it appears + there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses + `0.3.1` as the key here. + + To check whether the version you request is deprecated, compare only + the major and minor. A client requesting `0.3.0` is served `0.3.1`, so + its entry is under `0.3.1`. + additionalProperties: {} + description: The versions a single route serves, when they differ from the API-wide values + CommonGrants.Models.OppDefaultFilters: + type: object + properties: + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - forecasted + - open + closeDateRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`keyDates.closeDate` is between the given range' + example: + operator: between + value: + min: '2021-01-01' + max: '2021-01-02' + totalFundingAvailableRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.totalAmountAvailable` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + minAwardAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.minAwardAmount` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + maxAwardAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.maxAwardAmount` is between the given range. + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + allOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: The standard set of filters supported for opportunity searches + CommonGrants.Models.OppFilters: + type: object + properties: + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - forecasted + - open + closeDateRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`keyDates.closeDate` is between the given range' + example: + operator: between + value: + min: '2021-01-01' + max: '2021-01-02' + totalFundingAvailableRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.totalAmountAvailable` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + minAwardAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.minAwardAmount` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + maxAwardAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.maxAwardAmount` is between the given range. + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + customFilters: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: Additional implementation-defined filters to apply to the search + description: Filters to apply when searching for opportunities + CommonGrants.Models.OppFunding: + type: object + properties: + details: + type: string + description: Details about the funding available for this opportunity that don't fit other fields + totalAmountAvailable: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Total amount of funding available for this opportunity + minAwardAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Minimum amount of funding granted per award + maxAwardAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Maximum amount of funding granted per award + minAwardCount: + type: integer + description: Minimum number of awards granted + maxAwardCount: + type: integer + description: Maximum number of awards granted + estimatedAwardCount: + type: integer + description: Estimated number of awards that will be granted + description: Details about the funding available for this opportunity + example: + totalAmountAvailable: + amount: '1000000.00' + currency: USD + minAwardAmount: + amount: '10000.00' + currency: USD + maxAwardAmount: + amount: '50000.00' + currency: USD + minAwardCount: 5 + maxAwardCount: 20 + estimatedAwardCount: 10 + CommonGrants.Models.OppIdAln: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - opp:us:aln + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An opportunity's Assistance Listing Number (ALN), formerly the CFDA number. + example: + registry: + code: opp:us:aln + url: https://commongrants.org/registries/opp-us-aln + id: '93.575' + CommonGrants.Models.OppIdFon: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - opp:us:fon + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An opportunity's Funding Opportunity Number (FON), assigned by the awarding agency. + example: + registry: + code: opp:us:fon + url: https://commongrants.org/registries/opp-us-fon + id: HHS-2026-ACF-OCC-YD-0001 + CommonGrants.Models.OppIds: + type: object + properties: + opp:us:fon: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppIdFon' + description: The opportunity's Funding Opportunity Number (FON). + opp:us:aln: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppIdAln' + description: The opportunity's Assistance Listing Number (ALN). + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierCollection' + description: |- + A collection of identifiers associated with an opportunity. + + Extends the generic identifier collection with the base identifiers CommonGrants + defines for opportunities. Additional registries can be published under `otherIds`. + example: + systemId: + registry: + code: opp:grants.gov:system + id: 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + opp:us:fon: + registry: + code: opp:us:fon + url: https://commongrants.org/registries/opp-us-fon + id: HHS-2026-ACF-OCC-YD-0001 + opp:us:aln: + registry: + code: opp:us:aln + url: https://commongrants.org/registries/opp-us-aln + id: '93.575' + CommonGrants.Models.OppRef: + type: object + required: + - id + - title + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the opportunity + readOnly: true + title: + type: string + description: Title or name of the funding opportunity + example: Small business grant program + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppIds' + description: System and registry-specific identifiers for the opportunity + description: |- + A reference to an opportunity, previewing the key fields a consumer needs + to identify it and look it up or join it to another response. Appears + wherever another record points to an opportunity, such as the opportunity + an award resulted from. + example: + id: 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + title: Health Center Capital Improvement Program + identifiers: + opp:us:fon: + registry: + code: opp:us:fon + url: https://commongrants.org/registries/opp-us-fon + id: HHS-2026-ACF-OCC-YD-0001 + CommonGrants.Models.OppSortBy: + type: string + enum: + - lastModifiedAt + - createdAt + - title + - status.value + - keyDates.closeDate + - funding.maxAwardAmount + - funding.minAwardAmount + - funding.totalAmountAvailable + - funding.estimatedAwardCount + - custom + CommonGrants.Models.OppSorting: + type: object + required: + - sortBy + properties: + sortBy: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppSortBy' + description: The field to sort by + example: lastModifiedAt + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortBodyParams' + CommonGrants.Models.OppStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the opportunity + example: + value: open + description: The opportunity is currently accepting applications + CommonGrants.Models.OppStatusOptions: + type: string + enum: + - forecasted + - open + - closed + - custom + description: |- + The set of values accepted for opportunity status: + - `forecasted`: The opportunity is forecasted and not yet open for applications + - `open`: The opportunity is open for applications + - `closed`: The opportunity is no longer accepting applications + - `custom`: A custom status + CommonGrants.Models.OppTimeline: + type: object + properties: + postDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The date (and time) at which the opportunity is posted + closeDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The date (and time) at which the opportunity closes + otherDates: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: |- + An optional map of other key dates or events in the opportunity timeline + + Examples might include a deadline for questions, anticipated award date, etc. + description: Key dates and events in the opportunity's timeline, such as when the opportunity is posted and closes + example: + postDate: + name: Opportunity posted date + eventType: singleDate + date: '2024-01-15' + description: Opportunity is posted publicly + closeDate: + name: Opportunity close date + eventType: singleDate + date: '2024-12-31' + time: '17:00:00' + description: Opportunity closes for all applications + otherDates: + anticipatedAward: + name: Anticipated award date + eventType: singleDate + date: '2025-03-15' + description: When we expect to announce awards for this opportunity. + applicationPeriod: + name: Application period + eventType: dateRange + startDate: '2024-01-01' + endDate: '2024-01-31' + endTime: '17:00:00' + description: Primary application period for the grant opportunity + performancePeriod: + name: Period of Performance + eventType: dateRange + startDate: '2024-01-01' + endDate: '2024-12-31' + description: Period of performance for the grant + infoSessions: + name: Info sessions + eventType: other + details: Every other Tuesday + description: Info sessions for the opportunity + CommonGrants.Models.OpportunityBase: + type: object + required: + - id + - title + - status + - description + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the opportunity + readOnly: true + title: + type: string + description: Title or name of the funding opportunity + example: Small business grant program + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppIds' + description: System and registry-specific identifiers for the opportunity + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppStatus' + description: Status of the opportunity + description: + type: string + description: Description of the opportunity's purpose and scope + example: This program provides funding to small businesses to help them grow and create jobs + funding: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppFunding' + description: Details about the funding available + funders: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRefCollection' + description: Organization(s) offering the funding for this opportunity + example: + primary: + id: 018f2e77-4b5c-7d2e-9f3a-bcdef1234567 + name: Health Resources and Services Administration + identifiers: + otherIds: + org:grants.gov:agency: + registry: + code: org:grants.gov:agency + id: HRSA + keyDates: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppTimeline' + description: Key dates for the opportunity, such as when the application opens and closes + acceptedApplicantTypes: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.ApplicantType' + description: The type of applicant for the opportunity + source: + type: string + format: uri + description: URL for the original source of the opportunity + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Additional custom fields specific to this opportunity + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: A funding opportunity + CommonGrants.Models.OpportunityDetails: + type: object + properties: + competitions: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.CompetitionBase' + description: The competitions associated with the opportunity + awards: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.AwdRef' + description: |- + Awards that resulted from this opportunity, as references. + + Each entry references an award that resulted from this opportunity; the + award's `opportunity.id`, when it is published, is this record's `id`. + An entry is a reference, not the award record: `GET /awards/` is the + canonical record only where an implementation serves the award routes, + and otherwise the entry's `identifiers`, where the publisher supplies + them, are the key for joining the award in another system. A consumer + must not assume a reference can be dereferenced through this API. + + Absent means the implementation does not publish this link for the + record, and an empty array means the link is published and no awards are + known. Entries carry no ordering guarantee. + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OpportunityBase' + description: A funding opportunity with additional details, like available competitions. + CommonGrants.Models.OrgHierarchyKindOptions: + type: string + enum: + - chapter + - department + - branch + - subsidiary + - fiscalSponsor + - dba + - custom + description: |- + The standard subtypes of a parent or child relationship: + - `chapter`: The child is a chapter of the parent + - `department`: The child is an internal unit of the parent + - `branch`: The child is a branch of the parent + - `subsidiary`: The child is a subsidiary of the parent + - `fiscalSponsor`: The parent fiscally sponsors the child + - `dba`: The child is a record for a name the parent, a legal entity, does business under + - `custom`: Another subtype, named in `customValue` + CommonGrants.Models.OrgHierarchyRelationship: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The other organization. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgHierarchyKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A parent or child relationship. + example: + org: + id: 01912a8b-7c3d-7892-abcd-ef1234567892 + name: Riverside Community Foundation + identifiers: + org:us:ein: + registry: + code: org:us:ein + id: '472345678' + kind: + value: fiscalSponsor + startDate: '2024-07-01' + status: active + CommonGrants.Models.OrgIdDuns: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:xi:duns + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Data Universal Numbering System (DUNS) number. + example: + registry: + code: org:xi:duns + url: https://commongrants.org/registries/org-xi-duns + id: '123456789' + CommonGrants.Models.OrgIdEin: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:ein + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Employer Identification Number (EIN), assigned by the IRS. + example: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + CommonGrants.Models.OrgIdUei: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:uei + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Unique Entity Identifier (UEI) from SAM.gov. + example: + registry: + code: org:us:uei + url: https://commongrants.org/registries/org-us-uei + id: AB0123456789 + CommonGrants.Models.OrgIds: + type: object + properties: + org:us:ein: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIdEin' + description: The organization's Employer Identification Number (EIN), assigned by the IRS. + org:us:uei: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIdUei' + description: The organization's Unique Entity Identifier (UEI) from SAM.gov. + org:xi:duns: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIdDuns' + description: The organization's Data Universal Numbering System (DUNS) number. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierCollection' + description: |- + A collection of identifiers associated with an organization. + + Extends the generic identifier collection with the base identifiers CommonGrants + defines for organizations. Additional registries can be published under `otherIds`. + CommonGrants.Models.OrgOtherKindOptions: + type: string + enum: + - custom + description: Other relationships define no standard subtypes, so a stated subtype is `custom`. + CommonGrants.Models.OrgOtherRelationship: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The other organization. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgOtherKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A relationship outside the named categories, which need not have a direction. + example: + org: + id: 01912a8b-7c3d-7895-abcd-ef1234567895 + name: Riverside Literacy Coalition + CommonGrants.Models.OrgPatchData: + type: object + properties: + name: + type: string + description: The name this organization is known by; for a legal entity, its legal name. + status: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchOrgStatusOrCreate' + nullable: true + description: Whether the organization exists and operates, or has dissolved or ceased operating. + mission: + type: string + nullable: true + description: The organization's mission statement. + yearFounded: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.calendarYear' + nullable: true + description: The calendar year the organization was founded. + aliases: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.nonEmptyString' + nullable: true + uniqueItems: true + description: Other names this organization goes by, such as a trading name or a short form of its legal name. Not a history of former names. Don't list a name that has its own live trading-name record linked to this organization by a `dba` entry in either record; see the organization relationships guide. + identifiers: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgIdsOrCreate' + nullable: true + description: Identifiers associated with the organization, keyed by registry code. + orgType: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchPCSOrgTypeOrCreate' + nullable: true + description: The organization's type within the Philanthropy Classification System (PCS). + addresses: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchAddressCollectionOrCreate' + nullable: true + description: Collection of physical addresses associated with the organization. + phones: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchPhoneCollectionOrCreate' + nullable: true + description: Collection of phone numbers associated with the organization. + emails: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchEmailCollectionOrCreate' + nullable: true + description: Collection of email addresses associated with the organization. + socials: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgSocialLinksOrCreate' + nullable: true + description: Collection of the organization's social media and web presence links. + relationships: + type: object + properties: + parents: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgHierarchyRelationshipReplaceOnly' + nullable: true + description: Organizations above this one, such as a containing organization or a fiscal sponsor. + children: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgHierarchyRelationshipReplaceOnly' + nullable: true + description: Organizations below this one, such as its chapters or sponsored projects. + succeededBy: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgSuccessionRelationshipReplaceOnly' + nullable: true + description: Organizations that carry on all or part of this one. + succeeds: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgSuccessionRelationshipReplaceOnly' + nullable: true + description: Organizations whose work this one carries on in whole or in part. + recordReplacedBy: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgRecordRelationshipReplaceOnly' + nullable: true + description: Records to use instead of this record. + recordReplaces: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgRecordRelationshipReplaceOnly' + nullable: true + description: Records that this record is used instead of. + otherRelationships: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgOtherRelationshipReplaceOnly' + nullable: true + description: Connections outside the categories above, which need not have a direction. + nullable: true + description: The organization's relationships to other organizations. + customFields: + type: object + additionalProperties: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchCustomFieldOrCreate' + nullable: true + nullable: true + description: Custom fields for the organization. + description: |- + A JSON Merge Patch (RFC 7396) body for updating an organization profile. + + Derived from `OrganizationBase`: every field is optional, fields that can + be cleared accept `null` to unset them, record keys can be deleted by + setting them to `null`, and read-only fields like `id` are excluded. + Sent as `application/merge-patch+json`. + example: + name: Example Nonprofit (Renamed) + mission: To expand access to community health resources. + yearFounded: null + socials: + website: null + emails: + primary: info@example.org + customFields: + legacyCode: null + CommonGrants.Models.OrgPatchOrgIdDunsOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:xi:duns + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Data Universal Numbering System (DUNS) number. + example: + registry: + code: org:xi:duns + url: https://commongrants.org/registries/org-xi-duns + id: '123456789' + CommonGrants.Models.OrgPatchOrgIdEinOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:ein + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Employer Identification Number (EIN), assigned by the IRS. + example: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + CommonGrants.Models.OrgPatchOrgIdUeiOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:uei + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Unique Entity Identifier (UEI) from SAM.gov. + example: + registry: + code: org:us:uei + url: https://commongrants.org/registries/org-us-uei + id: AB0123456789 + CommonGrants.Models.OrgPatchOrgStatusOrCreate: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + nullable: true + description: A custom value, used when the selected value is the `custom` option + description: + type: string + nullable: true + description: A human-readable description of the value + description: The status of the organization + example: + value: active + description: The organization exists and operates + CommonGrants.Models.OrgRecordKindOptions: + type: string + enum: + - duplicate + - merged + - custom + description: |- + The standard subtypes of record replacement. A provider's workflow may + treat them alike; they need not be exclusive. + - `duplicate`: The records duplicate each other + - `merged`: The provider combined the records + - `custom`: Another subtype, named in `customValue` + CommonGrants.Models.OrgRecordRelationship: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The other organization. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRecordKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A record replacement relationship. + example: + org: + id: 01912a8b-7c3d-7894-abcd-ef1234567894 + name: Riverside Reading Project + kind: + value: duplicate + CommonGrants.Models.OrgRef: + type: object + required: + - id + - name + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The organization's unique identifier. + readOnly: true + name: + type: string + description: The name this organization is known by; for a legal entity, its legal name. + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIds' + description: Identifiers associated with the organization, keyed by registry code. + description: |- + A reference to an organization, previewing the key fields a consumer needs + to identify it and look it up or join it to another response. Appears + wherever another record points to an organization, such as an award's funder + or recipient. + example: + id: 018f2e77-4b5c-7d2e-9f3a-bcdef1234567 + name: Health Resources and Services Administration + identifiers: + otherIds: + org:grants.gov:agency: + registry: + code: org:grants.gov:agency + id: HRSA + CommonGrants.Models.OrgRefCollection: + type: object + required: + - primary + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The primary organization in the collection. + otherOrgs: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: Other organizations in the collection, keyed by an implementation-defined role. + description: |- + A group of organization references, with a primary organization and + optional others. Appears wherever several organizations share a role on a + record, such as an award's funders or recipient organizations. + example: + primary: + id: 018f2e77-4b5c-7d2e-9f3a-bcdef1234567 + name: Health Resources and Services Administration + identifiers: + otherIds: + org:grants.gov:agency: + registry: + code: org:grants.gov:agency + id: HRSA + CommonGrants.Models.OrgRelationshipStatus: + type: string + enum: + - active + - inactive + description: Whether a relationship is in effect, as stated by the provider. + CommonGrants.Models.OrgRelationships: + type: object + properties: + parents: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgHierarchyRelationship' + description: Organizations above this one, such as a containing organization or a fiscal sponsor. + children: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgHierarchyRelationship' + description: Organizations below this one, such as its chapters or sponsored projects. + succeededBy: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgSuccessionRelationship' + description: Organizations that carry on all or part of this one. + succeeds: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgSuccessionRelationship' + description: Organizations whose work this one carries on in whole or in part. + recordReplacedBy: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgRecordRelationship' + description: Records to use instead of this record. + recordReplaces: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgRecordRelationship' + description: Records that this record is used instead of. + otherRelationships: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgOtherRelationship' + description: Connections outside the categories above, which need not have a direction. + description: |- + An organization's relationships to other organizations. + + Each named list holds relationships of one category and direction; + `otherRelationships` holds connections outside those categories. Every list + is optional, list order carries no meaning, and a provider may state a + relationship from either organization's record. A relationship confers no + authority over the other organization. + example: + parents: + - org: + id: 01912a8b-7c3d-7891-abcd-ef1234567891 + name: National Reading Network + kind: + value: chapter + - org: + id: 01912a8b-7c3d-7892-abcd-ef1234567892 + name: Riverside Community Foundation + identifiers: + org:us:ein: + registry: + code: org:us:ein + id: '472345678' + kind: + value: fiscalSponsor + startDate: '2024-07-01' + status: active + CommonGrants.Models.OrgRevision: + type: object + required: + - id + - status + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the revision + readOnly: true + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.RevisionStatus' + description: The lifecycle status of the change + source: + type: string + description: The source system the change came from + patch: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchData' + description: The merge patch that was submitted + snapshot: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrganizationBase' + description: A full snapshot of the record with the change applied + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: |- + A single change to an organization profile, recorded in the change ledger. + + The `patch` is an `OrgPatchData` merge patch, and the `snapshot` is the + organization profile with that change applied. + example: + id: 01912a8b-7c3d-7890-abcd-ef1234567890 + status: + value: accepted + description: The change was applied. + source: grants.gov + patch: + mission: To provide support and resources to the community. + snapshot: + id: 083b4567-e89d-42c8-a439-6c1234567890 + name: Example Organization + orgType: + term: Hospital + class: Organization types + description: Institutions with the primary purpose of providing in-patient physical and mental health services... + code: EO000000 + status: + value: active + description: The organization exists and operates + identifiers: + org:us:ein: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + org:us:uei: + registry: + code: org:us:uei + url: https://commongrants.org/registries/org-us-uei + id: AB0123456789 + addresses: + primary: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + otherAddresses: + satellite: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + international: + street1: 123 Rue Principale + city: Montreal + stateOrProvince: QC + country: CA + postalCode: H2Y 1C6 + phones: + primary: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + fax: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + otherPhones: + support: + countryCode: '+1' + number: 333-456-1230 + isMobile: false + marketing: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + emails: + primary: info@example.com + otherEmails: + support: support@example.com + marketing: marketing@example.com + mission: To provide support and resources to the community. + yearFounded: '2024' + socials: + website: https://www.example.com + facebook: https://www.facebook.com/example + twitterOrX: https://x.com/example + instagram: https://www.instagram.com/example + linkedin: https://www.linkedin.com/company/example + otherSocials: + youtube: https://www.youtube.com/example + aliases: + - Example Org + relationships: + parents: + - org: + id: 01912a8b-7c3d-7891-abcd-ef1234567891 + name: National Reading Network + kind: + value: chapter + createdAt: '2026-06-20T14:30:00Z' + lastModifiedAt: '2026-06-20T14:30:00Z' + CommonGrants.Models.OrgSocialLinks: + type: object + properties: + website: + type: string + format: uri + description: The organization's primary website URL. + facebook: + type: string + format: uri + description: The organization's Facebook profile URL. + twitterOrX: + type: string + format: uri + description: The organization's Twitter/X profile URL. + bluesky: + type: string + format: uri + description: The organization's BlueSky profile URL. + instagram: + type: string + format: uri + description: The organization's Instagram profile URL. + linkedin: + type: string + format: uri + description: The organization's LinkedIn profile URL. + otherSocials: + type: object + additionalProperties: + type: string + format: uri + description: Additional social media profiles not covered by the standard fields. + description: A collection of social media and web presence links for an organization. + example: + website: https://www.example.com + facebook: https://www.facebook.com/example + twitterOrX: https://x.com/example + instagram: https://www.instagram.com/example + linkedin: https://www.linkedin.com/company/example + otherSocials: + youtube: https://www.youtube.com/example + CommonGrants.Models.OrgStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the organization + example: + value: active + description: The organization exists and operates + CommonGrants.Models.OrgStatusOptions: + type: string + enum: + - active + - inactive + - custom + description: |- + The set of values accepted for organization status: + - `active`: The organization exists and operates + - `inactive`: The organization has dissolved or ceased operating; loss of tax-exempt status alone does not make an organization inactive + - `custom`: A status not covered by the other options, described in `customValue` + CommonGrants.Models.OrgSuccessionKindOptions: + type: string + enum: + - merger + - acquisition + - divestiture + - split + - custom + description: |- + The standard subtypes of organizational succession: + - `merger`: Succession through a merger + - `acquisition`: Succession through an acquisition + - `divestiture`: Succession through a divestiture + - `split`: Succession through a split into several organizations + - `custom`: Another subtype, named in `customValue` + CommonGrants.Models.OrgSuccessionRelationship: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The other organization. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgSuccessionKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A succession relationship. + example: + org: + id: 01912a8b-7c3d-7893-abcd-ef1234567893 + name: Riverside Reading East + kind: + value: split + startDate: '2026-01-01' + CommonGrants.Models.OrganizationBase: + type: object + required: + - id + - name + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The organization's unique identifier. + readOnly: true + name: + type: string + description: The name this organization is known by; for a legal entity, its legal name. + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIds' + description: Identifiers associated with the organization, keyed by registry code. + orgType: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSOrgType' + description: The organization's type within the Philanthropy Classification System (PCS). + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgStatus' + description: Whether the organization exists and operates, or has dissolved or ceased operating. + addresses: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.AddressCollection' + description: Collection of physical addresses associated with the organization. + phones: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PhoneCollection' + description: Collection of phone numbers associated with the organization. + emails: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EmailCollection' + description: Collection of email addresses associated with the organization. + mission: + type: string + description: The organization's mission statement. + yearFounded: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.calendarYear' + description: The calendar year the organization was founded. + socials: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgSocialLinks' + description: Collection of the organization's social media and web presence links. + aliases: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.nonEmptyString' + uniqueItems: true + description: Other names this organization goes by, such as a trading name or a short form of its legal name. Not a history of former names. Don't list a name that has its own live trading-name record linked to this organization by a `dba` entry in either record; see the organization relationships guide. + relationships: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationships' + description: The organization's relationships to other organizations. + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Custom fields for the organization. + description: An organization that can apply for grants. + example: + id: 083b4567-e89d-42c8-a439-6c1234567890 + name: Example Organization + orgType: + term: Hospital + class: Organization types + description: Institutions with the primary purpose of providing in-patient physical and mental health services... + code: EO000000 + status: + value: active + description: The organization exists and operates + identifiers: + org:us:ein: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + org:us:uei: + registry: + code: org:us:uei + url: https://commongrants.org/registries/org-us-uei + id: AB0123456789 + addresses: + primary: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + otherAddresses: + satellite: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + international: + street1: 123 Rue Principale + city: Montreal + stateOrProvince: QC + country: CA + postalCode: H2Y 1C6 + phones: + primary: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + fax: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + otherPhones: + support: + countryCode: '+1' + number: 333-456-1230 + isMobile: false + marketing: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + emails: + primary: info@example.com + otherEmails: + support: support@example.com + marketing: marketing@example.com + mission: To provide support and resources to the community. + yearFounded: '2024' + socials: + website: https://www.example.com + facebook: https://www.facebook.com/example + twitterOrX: https://x.com/example + instagram: https://www.instagram.com/example + linkedin: https://www.linkedin.com/company/example + otherSocials: + youtube: https://www.youtube.com/example + aliases: + - Example Org + relationships: + parents: + - org: + id: 01912a8b-7c3d-7891-abcd-ef1234567891 + name: National Reading Network + kind: + value: chapter + CommonGrants.Models.RevisionStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.RevisionStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: |- + The status of a revision, including its lifecycle state and an optional + human-readable description. + example: + value: custom + customValue: escalated + description: The change was escalated for additional review. + CommonGrants.Models.RevisionStatusOptions: + type: string + enum: + - pending + - accepted + - denied + - superseded + - custom + description: |- + The set of values accepted for a revision's status: + - `pending`: Non-terminal. The change is queued for review. + - `accepted`: Terminal. The change was applied, either immediately via a + direct `PATCH` or after a `pending` change was approved. + - `denied`: Terminal. The change was rejected, with a reason. + - `superseded`: Terminal. A competing change was accepted first, so this + change no longer applies. + - `custom`: An implementation-defined status. The receiver documents whether + it is terminal. + + A revision moves once from `pending` into a terminal state; a terminal + revision is never restated. How a receiver resolves a `pending` change (a + human review, a policy engine, a batch job) is out of scope for this contract. + CommonGrants.Models.UpcomingDefault: + type: object + required: + - version + - date + properties: + version: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version that will become the default + date: + type: string + format: date-time + description: When the new default takes effect + additionalProperties: {} + description: A scheduled change to the version a server serves by default + CommonGrants.Models.VersionDiscovery: + type: object + required: + - versions + - defaultVersion + properties: + versions: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + minItems: 1 + description: The versions every route without an `operations` entry serves + defaultVersion: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version every route without an `operations` entry serves when a request doesn't name one, one of `versions` + upcomingDefault: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.UpcomingDefault' + description: A scheduled change to the API-wide default version, if any. Its `version` is one of `versions` + deprecated: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.VersionRetirement' + description: |- + Deprecated versions, keyed by version, with their retirement schedule + + Each key is a version from `versions`, written exactly as it appears + there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses + `0.3.1` as the key here. + + To check whether the version you request is deprecated, compare only + the major and minor. A client requesting `0.3.0` is served `0.3.1`, so + its entry is under `0.3.1`. + operations: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.OperationVersions' + description: |- + Routes whose versions differ from the API-wide values + + Each key is the HTTP method and the route's published path, separated + by a space, such as `GET /common-grants/forms/{formId}`. Path parameter + names are ignored when matching a key to a route. Omitted when every + route serves the API-wide values. + additionalProperties: {} + description: |- + The protocol versions an API serves + + The top-level fields describe every route that has no entry in + `operations`. Routes that differ from them have an entry in `operations`. + New fields are only ever added to this model; clients ignore fields they + don't recognize. + example: + versions: + - 0.3.0 + - 0.4.0 + - 0.5.0 + defaultVersion: 0.4.0 + upcomingDefault: + version: 0.5.0 + date: '2027-03-01T00:00:00Z' + deprecated: + 0.3.0: + deprecation: '2026-12-01T00:00:00Z' + sunset: '2027-06-01T00:00:00Z' + CommonGrants.Models.VersionRetirement: + type: object + required: + - deprecation + properties: + deprecation: + type: string + format: date-time + description: When the version was or will be deprecated + sunset: + type: string + format: date-time + description: When the server will stop serving the version, if scheduled + additionalProperties: {} + description: The retirement schedule for a deprecated version + CommonGrants.Pagination.PaginatedBodyParams: + type: object + properties: + page: + type: integer + format: int32 + minimum: 1 + description: The page to return + default: 1 + pageSize: + type: integer + format: int32 + minimum: 1 + description: The number of items to return per page + default: 100 + description: Body parameters for paginated routes + CommonGrants.Pagination.PaginatedResultsInfo: + type: object + required: + - page + - pageSize + properties: + page: + type: integer + format: int32 + minimum: 1 + description: Current page number (indexing starts at 1) + example: 1 + pageSize: + type: integer + minimum: 1 + description: Number of items per page + example: 20 + totalItems: + type: integer + description: Total number of items across all pages + example: 100 + totalPages: + type: integer + description: Total number of pages + example: 5 + description: Details about the paginated results + CommonGrants.Patch.OrgPatchAddressCollectionOrCreate: + type: object + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchAddressOrCreate' + description: The primary address for a person or organization. + otherAddresses: + type: object + additionalProperties: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchAddressOrCreate' + nullable: true + nullable: true + description: Additional addresses keyed by a descriptive label (e.g., "work", "home", "international"). + description: A collection of addresses. + CommonGrants.Patch.OrgPatchEmailCollectionOrCreate: + type: object + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.email' + description: The primary email address for a person or organization. + otherEmails: + type: object + additionalProperties: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.email' + nullable: true + nullable: true + description: Additional email addresses keyed by a descriptive label (e.g., "work", "personal", "support"). + description: A collection of email addresses. + CommonGrants.Patch.OrgPatchOrgHierarchyRelationshipReplaceOnly: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly' + description: The other organization, which a writer can name by `id` alone. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgHierarchyKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A parent or child relationship, as written. + CommonGrants.Patch.OrgPatchOrgIdsOrCreate: + type: object + properties: + org:us:ein: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchOrgIdEinOrCreate' + nullable: true + description: The organization's Employer Identification Number (EIN), assigned by the IRS. + org:us:uei: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchOrgIdUeiOrCreate' + nullable: true + description: The organization's Unique Entity Identifier (UEI) from SAM.gov. + org:xi:duns: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchOrgIdDunsOrCreate' + nullable: true + description: The organization's Data Universal Numbering System (DUNS) number. + systemId: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchSystemIdOrCreate' + nullable: true + description: The hosting system's own identifier for this record. + otherIds: + type: object + additionalProperties: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchIdentifierOrCreate' + nullable: true + nullable: true + description: |- + Additional identifiers keyed by their registry code, for registries the + protocol does not define as a base identifier on the model. + description: |- + A collection of identifiers associated with an organization. + + Extends the generic identifier collection with the base identifiers CommonGrants + defines for organizations. Additional registries can be published under `otherIds`. + CommonGrants.Patch.OrgPatchOrgOtherRelationshipReplaceOnly: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly' + description: The other organization, which a writer can name by `id` alone. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgOtherKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A relationship outside the named categories, as written. + CommonGrants.Patch.OrgPatchOrgRecordRelationshipReplaceOnly: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly' + description: The other organization, which a writer can name by `id` alone. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRecordKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A record replacement relationship, as written. + CommonGrants.Patch.OrgPatchOrgSocialLinksOrCreate: + type: object + properties: + website: + type: string + format: uri + nullable: true + description: The organization's primary website URL. + facebook: + type: string + format: uri + nullable: true + description: The organization's Facebook profile URL. + twitterOrX: + type: string + format: uri + nullable: true + description: The organization's Twitter/X profile URL. + bluesky: + type: string + format: uri + nullable: true + description: The organization's BlueSky profile URL. + instagram: + type: string + format: uri + nullable: true + description: The organization's Instagram profile URL. + linkedin: + type: string + format: uri + nullable: true + description: The organization's LinkedIn profile URL. + otherSocials: + type: object + additionalProperties: + type: string + format: uri + nullable: true + nullable: true + description: Additional social media profiles not covered by the standard fields. + description: A collection of social media and web presence links for an organization. + CommonGrants.Patch.OrgPatchOrgSuccessionRelationshipReplaceOnly: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly' + description: The other organization, which a writer can name by `id` alone. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgSuccessionKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A succession relationship, as written. + CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly: + type: object + required: + - id + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The other organization's unique identifier. + name: + type: string + description: "The other organization's name. Ignored if supplied: the receiver fills it in from its own record." + identifiers: + type: object + properties: + org:us:ein: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:ein + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: The organization's Employer Identification Number (EIN), assigned by the IRS. + org:us:uei: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:uei + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: The organization's Unique Entity Identifier (UEI) from SAM.gov. + org:xi:duns: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:xi:duns + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: The organization's Data Universal Numbering System (DUNS) number. + systemId: + type: object + properties: + registry: + type: object + properties: + code: + type: string + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: The hosting system's own identifier for this record. + otherIds: + type: object + additionalProperties: + type: object + properties: + registry: + type: object + properties: + code: + type: string + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: |- + Additional identifiers keyed by their registry code, for registries the + protocol does not define as a base identifier on the model. + description: 'Identifiers associated with the other organization, keyed by registry code. Ignored if supplied: the receiver fills them in from its own record.' + description: |- + A writable reference to a relationship's other organization. + + Unlike `Models.OrgRef`, whose `id` is read-only, `id` is writable here so a + patch can name the other organization, and the rest is optional so it can + be named by `id` alone. The receiver identifies the target by `id` and + rejects an `id` it doesn't recognize. It ignores a supplied `name` and + `identifiers` and fills both in from its own record on reads and revision + snapshots. They stay accepted, rather than read-only, so a writer can + resend entries copied from a read: read-only members would be dropped + from this closed schema, which would then reject them. Schema validation + checks only this shape; it does not look up or fill in the target. + CommonGrants.Patch.OrgPatchPCSOrgTypeOrCreate: + type: object + properties: + class: + type: string + enum: + - Organization types + description: The PCS term for the organization type. + term: + type: string + description: The plain language PCS term. + code: + type: string + pattern: ^[A-Z]{2}[0-9]{6}$ + description: The code for this PCS term. + example: UC000000 + description: + type: string + nullable: true + description: Description of the PCS term + description: |- + A Philanthropy Classification System (PCS) term for organization types. + + See https://taxonomy.candid.org/organization-type for more information. + CommonGrants.Patch.OrgPatchPhoneCollectionOrCreate: + type: object + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchPhoneOrCreate' + description: The person's primary phone number. + fax: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchPhoneOrCreate' + nullable: true + description: The person's fax number, if applicable. + otherPhones: + type: object + additionalProperties: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchPhoneOrCreate' + nullable: true + nullable: true + description: Additional phone numbers not covered by the standard fields. + description: A collection of phone numbers for a person. + CommonGrants.Responses.Accepted: + type: object + required: + - data + properties: + data: + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 202 response with data + CommonGrants.Responses.ApplicationSubmissionError: + type: object + required: + - status + properties: + status: + type: number + enum: + - 400 + example: 400 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A failure to submit an application due to validation errors + example: + status: 400 + message: Application submission failed due to validation errors + errors: + - field: formA.name + message: Name is required + 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: + - status + - message + - errors + properties: + status: + type: integer + format: int32 + example: 400 + message: + type: string + description: Human-readable error message + example: Error + errors: + type: array + 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: + - status + - message + properties: + status: + type: integer + format: int32 + example: 200 + message: + type: string + example: Success + CommonGrants.Responses.VersionConflictDetail: + type: object + required: + - code + properties: + code: + type: string + enum: + - version.conflict + description: Stable error code that clients branch on + additionalProperties: {} + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorDetail' + description: The request sent more than one `CG-Version` value + CommonGrants.Responses.VersionConflictError: + type: object + required: + - status + - errors + properties: + status: + type: number + enum: + - 400 + example: 400 + errors: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictDetail' + minItems: 1 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A request that sent more than one `CG-Version` value, even the same value twice + example: + status: 400 + message: The request sent more than one CG-Version value + errors: + - field: CG-Version + code: version.conflict + message: Received CG-Version values 0.5.0 and 0.6.0 + supported: + - 0.5.0 + - 0.6.0 + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions + CommonGrants.Responses.VersionDiscoveryResponse: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.VersionDiscovery' + description: The protocol versions the API serves + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response listing the protocol versions an API serves + CommonGrants.Responses.VersionErrorDetail: + type: object + required: + - field + - message + - supported + - defaultVersion + properties: + field: + type: string + enum: + - CG-Version + description: The request header the error is about + message: + type: string + description: Human-readable description of the problem + supported: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + minItems: 1 + description: The versions this route serves + defaultVersion: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version this route serves when a request doesn't name one + discovery: + type: string + format: uri + description: |- + The server's version discovery URL + + Omitted by servers that serve one version and don't publish discovery. + description: Details shared by every version error, describing the route that was called + CommonGrants.Responses.VersionErrorScope: + type: string + enum: + - deployment + - operation + description: Whether a version is unavailable on the whole server or only on the route called + CommonGrants.Responses.VersionMalformedDetail: + type: object + required: + - code + - requested + properties: + code: + type: string + enum: + - version.malformed + description: Stable error code that clients branch on + requested: + type: string + description: The value received, as sent + additionalProperties: {} + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorDetail' + description: The `CG-Version` value isn't a full `MAJOR.MINOR.PATCH` version + CommonGrants.Responses.VersionMalformedError: + type: object + required: + - status + - errors + properties: + status: + type: number + enum: + - 400 + example: 400 + errors: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedDetail' + minItems: 1 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A `CG-Version` header that isn't a full `MAJOR.MINOR.PATCH` version + example: + status: 400 + message: The CG-Version header is not a valid CommonGrants version + errors: + - field: CG-Version + code: version.malformed + message: Version 0.5 is not a full MAJOR.MINOR.PATCH version + requested: '0.5' + supported: + - 0.5.0 + - 0.6.0 + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions + CommonGrants.Responses.VersionRetiredDetail: + type: object + required: + - code + - requested + - scope + - sunset + properties: + code: + type: string + enum: + - version.retired + description: Stable error code that clients branch on + requested: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version requested + scope: + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorScope' + description: Whether the server or only this route doesn't serve the version + sunset: + type: string + format: date-time + description: When the version stopped being served + additionalProperties: {} + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorDetail' + description: The requested version was retired from this server or this route + CommonGrants.Responses.VersionRetiredError: + type: object + required: + - status + - errors + properties: + status: + type: number + enum: + - 406 + example: 406 + errors: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredDetail' + minItems: 1 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A requested version that was retired from this server or route + example: + status: 406 + message: The requested CommonGrants version has been retired + errors: + - field: CG-Version + code: version.retired + message: 'Version 0.3.0 was retired on 2027-06-01. Supported versions: 0.4.0, 0.5.0, 0.6.0' + requested: 0.3.0 + supported: + - 0.4.0 + - 0.5.0 + - 0.6.0 + scope: deployment + defaultVersion: 0.4.0 + discovery: https://grants.example.org/common-grants/versions + sunset: '2027-06-01T00:00:00Z' + CommonGrants.Responses.VersionUnsupportedDetail: + type: object + required: + - code + - requested + - scope + properties: + code: + type: string + enum: + - version.unsupported + description: Stable error code that clients branch on + requested: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version requested + scope: + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorScope' + description: Whether the server or only this route doesn't serve the version + additionalProperties: {} + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorDetail' + description: The requested version isn't served by this server or this route + CommonGrants.Responses.VersionUnsupportedError: + type: object + required: + - status + - errors + properties: + status: + type: number + enum: + - 406 + example: 406 + errors: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedDetail' + minItems: 1 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A requested version that this server or route doesn't serve + example: + status: 406 + message: The requested CommonGrants version is not available for this route + errors: + - field: CG-Version + code: version.unsupported + message: 'Version 0.4.0 is not served by GET /common-grants/forms. Supported versions: 0.5.0, 0.6.0' + requested: 0.4.0 + supported: + - 0.5.0 + - 0.6.0 + scope: operation + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions + CommonGrants.Sorting.SortBodyParams: + type: object + required: + - sortBy + properties: + sortBy: + description: The field to sort by + example: lastModifiedAt + customSortBy: + type: string + description: Implementation-defined sort key + example: customField + sortOrder: + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortOrder' + description: The order to sort by + example: asc + description: Sorting parameters included in the request body + CommonGrants.Sorting.SortOrder: + type: string + enum: + - asc + - desc + CommonGrants.Sorting.SortedResultsInfo: + type: object + required: + - sortBy + - sortOrder + properties: + sortBy: + type: string + description: The field results are sorted by, or "custom" if an implementation-defined sort key is used + example: lastModifiedAt + customSortBy: + type: string + description: Implementation-defined sort key used to sort the results, if applicable + example: customField + sortOrder: + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortOrder' + description: The order in which the results are sorted, e.g. ascending or descending + example: asc + errors: + type: array + items: + type: string + description: Non-fatal errors that occurred during sorting + description: Information about the sort order of the items returned + CommonGrants.Types.calendarYear: + type: string + pattern: ^[0-9]{4}$ + description: A calendar year + example: '2025' + CommonGrants.Types.decimalString: + type: string + pattern: ^-?[0-9]+\.?[0-9]*$ + description: A decimal number (with variable scale) encoded as a string, to avoid floating point issues + example: '-100.5' + CommonGrants.Types.duns: + type: string + pattern: ^[0-9]{9}$ + description: A Data Universal Numbering System (DUNS) number, normalized to nine digits + example: '123456789' + CommonGrants.Types.email: + type: string + format: email + description: An email address + example: test@example.com + CommonGrants.Types.employerTaxId: + type: string + pattern: ^[0-9]{9}$ + description: An Employer Identification Number (EIN) issued by the IRS, normalized to nine digits + example: '123456789' + CommonGrants.Types.isoDate: + type: string + format: date + description: A date on a calendar in ISO 8601 format YYYY-MM-DD + example: '2025-01-01' + CommonGrants.Types.isoTime: + type: string + format: time + description: A time on a clock, without a timezone, in ISO 8601 format HH:mm:ss + example: '17:00:00' + CommonGrants.Types.nonEmptyString: + type: string + minLength: 1 + description: A string with at least one character + example: Example + CommonGrants.Types.protocolVersion: + type: string + pattern: ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ + description: |- + A published CommonGrants protocol version, such as `0.6.0` + + A full `MAJOR.MINOR.PATCH` version with no `v` prefix and no leading zeros. + example: 0.6.0 + CommonGrants.Types.samUEI: + type: string + pattern: ^[A-HJ-NP-Z0-9]{12}$ + description: A Unique Entity Identifier (UEI) issued by SAM.gov + example: AB0123456789 + CommonGrants.Types.uuid: + type: string + format: uuid + description: A universally unique identifier + example: 30a12e5e-5940-4c08-921c-17a8960fcf4b + securitySchemes: + OAuth2Auth: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://auth.example.com/oauth/token + scopes: + org:read: '' + org:write: '' + org.changes:write: '' + org.changes:read: '' + authorizationCode: + authorizationUrl: https://auth.example.com/authorize + tokenUrl: https://auth.example.com/oauth/token + scopes: + org:read: '' + org:write: '' + org.changes:write: '' + org.changes:read: '' diff --git a/lib/cli/package.json b/lib/cli/package.json index 052451c7c..97dbf7b56 100644 --- a/lib/cli/package.json +++ b/lib/cli/package.json @@ -67,6 +67,7 @@ "js-yaml": "^4.3.2", "json-schema-merge-allof": "^0.8.1", "openapi-types": "^12.1.3", + "semver": "^7.7.4", "swagger-ui-express": "^5.0.1", "zod": "catalog:" }, @@ -78,6 +79,7 @@ "@types/js-yaml": "^4.0.9", "@types/json-schema-merge-allof": "^0.6.5", "@types/node": "catalog:", + "@types/semver": "^7.7.1", "@types/supertest": "^7.2.1", "@types/swagger-ui-express": "^4.1.8", "@typespec/json-schema": "catalog:", diff --git a/lib/cli/src/__tests__/commands/check/check-args.test.ts b/lib/cli/src/__tests__/commands/check/check-args.test.ts index 144cb7cb5..319077953 100644 --- a/lib/cli/src/__tests__/commands/check/check-args.test.ts +++ b/lib/cli/src/__tests__/commands/check/check-args.test.ts @@ -3,6 +3,7 @@ import { CheckSpecArgsSchema, CheckSpecOptionsSchema, availableVersions, + parseBaseVersions, } from "../../../commands/check/check-args"; describe("Check Args Validation", () => { @@ -91,7 +92,7 @@ describe("Check Args Validation", () => { // ######################################################### describe("CheckSpecOptionsSchema", () => { - it.each(["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0"])( + it.each(["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0", "0.6.0"])( "should accept valid protocolVersion %s", version => { const result = CheckSpecOptionsSchema.safeParse({ @@ -101,8 +102,9 @@ describe("Check Args Validation", () => { } ); - it("should list 0.5.0 as the latest (default) protocolVersion", () => { - expect(availableVersions[0]).toBe("0.5.0"); + it("should default to 0.6.0 when no protocolVersion flag is passed", () => { + // The newest bundled version is the default when no flag is passed + expect(availableVersions[0]).toBe("0.6.0"); }); it("should reject invalid protocolVersion", () => { @@ -125,4 +127,37 @@ describe("Check Args Validation", () => { expect(result.success).toBe(true); }); }); + + // ######################################################### + // # Parse Base Versions + // ######################################################### + + describe("parseBaseVersions", () => { + it("should sort versions newest first by version number, not by string", () => { + // Arrange + const fileNames = ["openapi.0.9.0.yaml", "openapi.0.10.0.yaml", "openapi.0.2.0.yaml"]; + + // Act + const versions = parseBaseVersions(fileNames); + + // Assert + expect(versions).toEqual(["0.10.0", "0.9.0", "0.2.0"]); + }); + + it("should ignore files whose name does not match openapi..yaml", () => { + // Arrange + const fileNames = [ + "openapi.0.5.0.yaml", + "openapi.latest.yaml", + "README.md", + "openapi.0.10.0.yaml", + ]; + + // Act + const versions = parseBaseVersions(fileNames); + + // Assert + expect(versions).toEqual(["0.10.0", "0.5.0"]); + }); + }); }); diff --git a/lib/cli/src/__tests__/commands/check/check-service-file.test.ts b/lib/cli/src/__tests__/commands/check/check-service-file.test.ts index 2c2a1c8a1..cdbddc255 100644 --- a/lib/cli/src/__tests__/commands/check/check-service-file.test.ts +++ b/lib/cli/src/__tests__/commands/check/check-service-file.test.ts @@ -1,25 +1,30 @@ import { vi } from "vitest"; import { DefaultCheckService } from "../../../commands/check/check-service"; +import * as fs from "fs"; +import * as os from "os"; import * as path from "path"; +import * as yaml from "js-yaml"; +import { OpenAPIV3 } from "openapi-types"; + +const mockConsoleLog = vi.spyOn(console, "log").mockImplementation(() => {}); +const mockConsoleWarn = vi.spyOn(console, "warn").mockImplementation(() => {}); +const mockConsoleError = vi.spyOn(console, "error").mockImplementation(() => {}); + +afterAll(() => { + mockConsoleLog.mockRestore(); + mockConsoleWarn.mockRestore(); + mockConsoleError.mockRestore(); +}); // No mocks - we want to test the real behavior describe("DefaultCheckService - Circular References", () => { let service: DefaultCheckService; - const mockConsoleLog = vi.spyOn(console, "log").mockImplementation(() => {}); - const mockConsoleWarn = vi.spyOn(console, "warn").mockImplementation(() => {}); - const mockConsoleError = vi.spyOn(console, "error").mockImplementation(() => {}); beforeEach(() => { service = new DefaultCheckService(); vi.clearAllMocks(); }); - afterAll(() => { - mockConsoleLog.mockRestore(); - mockConsoleWarn.mockRestore(); - mockConsoleError.mockRestore(); - }); - it("should handle circular references gracefully with the fix", async () => { // This test uses the actual test files we created and verified manually const basePath = path.join(__dirname, "test-files/base.yaml"); @@ -53,3 +58,141 @@ describe("DefaultCheckService - Circular References", () => { expect(mockConsoleError).not.toHaveBeenCalled(); }); }); + +describe("DefaultCheckService - Bundled Base Specs", () => { + const VERSION_PARAM_REF = "#/components/parameters/CommonGrants.Headers.VersionRequest"; + let service: DefaultCheckService; + let tmpDir: string; + + beforeEach(() => { + service = new DefaultCheckService(); + tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "cg-check-")); + vi.clearAllMocks(); + }); + + afterEach(() => { + fs.rmSync(tmpDir, { recursive: true, force: true }); + }); + + /** Load a base spec bundled with the CLI, to edit into an implementation spec */ + function loadBundledSpec(version: string): OpenAPIV3.Document { + const specPath = path.resolve(__dirname, `../../../../lib/openapi/openapi.${version}.yaml`); + return yaml.load(fs.readFileSync(specPath, "utf8")) as OpenAPIV3.Document; + } + + /** Write an implementation spec to a temp file and return its path */ + function writeTempSpec(doc: OpenAPIV3.Document): string { + const specPath = path.join(tmpDir, "impl.yaml"); + fs.writeFileSync(specPath, yaml.dump(doc)); + return specPath; + } + + function removeVersionParam(operation: OpenAPIV3.OperationObject): void { + operation.parameters = operation.parameters!.filter( + param => !("$ref" in param) || param.$ref !== VERSION_PARAM_REF + ); + } + + function prefixPaths(doc: OpenAPIV3.Document, prefix: string): OpenAPIV3.Document { + const paths = Object.entries(doc.paths).map(([route, item]) => [`${prefix}${route}`, item]); + return { ...doc, paths: Object.fromEntries(paths) }; + } + + it("should use the bundled 0.6.0 base spec when protocolVersion is 0.6.0", async () => { + // The 0.6.0 base is the simplest spec that is compliant with itself + const implPath = path.resolve(__dirname, "../../../../lib/openapi/openapi.0.6.0.yaml"); + + // Act & Assert - Should resolve without a "Base spec file not found" error + await service.checkSpec(implPath, { protocolVersion: "0.6.0" }); + + // Verify success + expect(mockConsoleLog).toHaveBeenCalledWith("Spec is valid and compliant with base spec"); + }); + + it.each(["0.1.0", "0.2.0", "0.3.0", "0.4.0", "0.5.0"])( + "should leave the output unchanged when checking the bundled %s spec against itself", + async version => { + const implPath = path.resolve(__dirname, `../../../../lib/openapi/openapi.${version}.yaml`); + + // Act & Assert - Pre-0.6.0 specs have no version headers and must be unaffected + await service.checkSpec(implPath, { protocolVersion: version }); + + // Verify the exact success output and no warnings + expect(mockConsoleLog).toHaveBeenCalledWith("Spec is valid and compliant with base spec"); + expect(mockConsoleWarn).not.toHaveBeenCalled(); + } + ); + + it("should report operations missing the CG-Version parameter or CG-Version-Served header", async () => { + const impl = loadBundledSpec("0.6.0"); + removeVersionParam(impl.paths["/common-grants/opportunities"]!.get!); + const read = impl.paths["/common-grants/opportunities/{oppId}"]!.get!; + delete (read.responses["200"] as OpenAPIV3.ResponseObject).headers!["CG-Version-Served"]; + + // Act & Assert - Both operations should be reported end to end + const result = service.checkSpec(writeTempSpec(impl), { protocolVersion: "0.6.0" }); + await expect(result).rejects.toThrow(/GET \/common-grants\/opportunities\b(?!\/)/); + await expect(result).rejects.toThrow("[CG-Version]"); + await expect(result).rejects.toThrow("GET /common-grants/opportunities/{oppId}"); + await expect(result).rejects.toThrow("CG-Version-Served"); + }); + + it("should report missing version headers on an experimental route", async () => { + const impl = loadBundledSpec("0.6.0"); + const list = impl.paths["/common-grants/forms"]!.get!; + expect(list.tags).toContain("experimental"); + removeVersionParam(list); + delete (list.responses["200"] as OpenAPIV3.ResponseObject).headers; + + // Act & Assert - Experimental routes skip the other checks but not the headers + const result = service.checkSpec(writeTempSpec(impl), { protocolVersion: "0.6.0" }); + await expect(result).rejects.toThrow("GET /common-grants/forms"); + await expect(result).rejects.toThrow("[CG-Version]"); + await expect(result).rejects.toThrow("[CG-Version-Served]"); + }); + + it("should accept the CG-Version parameter declared once on the path item", async () => { + const impl = loadBundledSpec("0.6.0"); + const pathItem = impl.paths["/common-grants/opportunities"]!; + removeVersionParam(pathItem.get!); + pathItem.parameters = [{ $ref: VERSION_PARAM_REF }]; + + // Act & Assert - Neither a missing header nor an extra "PARAMETERS" route is reported + await service.checkSpec(writeTempSpec(impl), { protocolVersion: "0.6.0" }); + + // Verify success + expect(mockConsoleLog).toHaveBeenCalledWith("Spec is valid and compliant with base spec"); + }); + + it("should report one error when routes carry a version segment instead of listing missing routes", async () => { + const impl = prefixPaths(loadBundledSpec("0.6.0"), "/v0.6"); + + // Act + const result = service.checkSpec(writeTempSpec(impl), { protocolVersion: "0.6.0" }); + + // Assert - One error points at the CG-Version header; no per-route findings + await expect(result).rejects.toThrow("CG-Version"); + await expect(result).rejects.toThrow("/v0.6/common-grants/"); + await expect(result).rejects.toThrow("1 errors"); + await expect(result).rejects.not.toThrow("Routes missing"); + }); + + it("should not point at the CG-Version header when checking against a version without it", async () => { + const impl = prefixPaths(loadBundledSpec("0.5.0"), "/v0.5"); + + // Act + const result = service.checkSpec(writeTempSpec(impl), { protocolVersion: "0.5.0" }); + + // Assert - Still one error instead of the missing routes, without the header advice + await expect(result).rejects.toThrow("/v0.5/common-grants/"); + await expect(result).rejects.toThrow("1 errors"); + await expect(result).rejects.not.toThrow("CG-Version"); + }); + + it("should default to 0.6.0 when no protocol version is given", async () => { + const implPath = path.resolve(__dirname, "../../../../lib/openapi/openapi.0.5.0.yaml"); + + // Act & Assert - 0.5.0 has no version headers, so the 0.6.0 default must flag them + await expect(service.checkSpec(implPath, {})).rejects.toThrow("[CG-Version]"); + }); +}); diff --git a/lib/cli/src/__tests__/commands/check/utils/check-extra-routes.test.ts b/lib/cli/src/__tests__/commands/check/utils/check-extra-routes.test.ts index aab3ed00c..f7b1226fb 100644 --- a/lib/cli/src/__tests__/commands/check/utils/check-extra-routes.test.ts +++ b/lib/cli/src/__tests__/commands/check/utils/check-extra-routes.test.ts @@ -186,4 +186,48 @@ describe("checkExtraRoutes", () => { // Assert - No errors expect(errors.getErrorCount()).toBe(0); }); + + // ############################################################ + // Ignore path item fields that aren't operations + // ############################################################ + + it("should not flag path-level parameters or summary as extra routes", () => { + // Arrange - Create base spec with one route + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/common-grants/foo": { + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Arrange - Create impl spec that declares a header once for the whole path + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/common-grants/foo": { + summary: "Foo", + parameters: [{ name: "CG-Version", in: "header" }], + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Act + const errors = checkExtraRoutes(baseDoc, implDoc); + + // Assert - No errors + expect(errors.getErrorCount()).toBe(0); + }); }); diff --git a/lib/cli/src/__tests__/commands/check/utils/check-matching-routes.test.ts b/lib/cli/src/__tests__/commands/check/utils/check-matching-routes.test.ts index 3fbd6de2c..c839005d5 100644 --- a/lib/cli/src/__tests__/commands/check/utils/check-matching-routes.test.ts +++ b/lib/cli/src/__tests__/commands/check/utils/check-matching-routes.test.ts @@ -371,6 +371,92 @@ describe("checkMatchingRoutes", () => { expect(errors.getErrorCount()).toBe(0); }); + it("should not treat path-level parameters as a route", () => { + // Arrange - Create base spec with a header declared for the whole path + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/foo/{id}": { + parameters: [{ name: "CG-Version", in: "header" }], + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Arrange - Create impl spec with path-level parameters that lack the header + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/foo/{id}": { + parameters: [{ name: "id", in: "path", required: true }], + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Act + const errors = checkMatchingRoutes(baseDoc, implDoc); + + // Assert - The missing header is reported once, for the real route + expect(errors.getErrorCount()).toBe(1); + expect(errors.get(0)).toEqual(expect.objectContaining({ endpoint: "GET /foo/{id}" })); + }); + + it("should still check headers on experimental routes", () => { + // Arrange - Create base spec with an experimental route that declares the version headers + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/foo": { + get: { + tags: ["experimental"], + parameters: [{ name: "CG-Version", in: "header" }], + responses: { + "200": { + description: "OK", + headers: { "CG-Version-Served": { required: true, schema: { type: "string" } } }, + }, + "404": { description: "Not Found" }, + }, + }, + }, + }, + }; + + // Arrange - Create impl spec missing both headers and the 404 response + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/foo": { + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Act + const errors = checkMatchingRoutes(baseDoc, implDoc); + const subTypes = errors.getAllErrors().map(error => "subType" in error && error.subType); + + // Assert - Only the headers are reported, not the missing status code + expect(subTypes.sort()).toEqual(["MISSING_HEADER_PARAM", "MISSING_RESPONSE_HEADER"]); + }); + // ############################################################ // Query parameter validation - missing query parameters // ############################################################ @@ -1064,4 +1150,252 @@ describe("checkMatchingRoutes", () => { }) ); }); + + // ############################################################ + // Header parameter validation + // ############################################################ + + it("should flag missing header parameter in implementation even when base marks it optional", () => { + // Arrange - Base declares an optional CG-Version header, impl declares no parameters + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/foo": { + get: { + parameters: [ + { + name: "CG-Version", + in: "header", + required: false, + schema: { type: "string" }, + }, + ], + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/foo": { + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Act + const errors = checkMatchingRoutes(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(1); + expect(errors.get(0)).toEqual( + expect.objectContaining({ + type: "ROUTE_CONFLICT", + subType: "MISSING_HEADER_PARAM", + level: "ERROR", + endpoint: "GET /foo", + message: expect.stringMatching(/CG-Version/), + }) + ); + }); + + it("should accept a header parameter declared at the path level", () => { + // Arrange - Base declares CG-Version on the operation, impl declares it on the path item + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/foo": { + get: { + parameters: [{ name: "CG-Version", in: "header" }], + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/foo": { + parameters: [{ name: "CG-Version", in: "header" }], + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Act + const errors = checkMatchingRoutes(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(0); + }); + + it("should flag a header parameter declared at the path level in the base but missing from the impl", () => { + // Arrange - Base declares CG-Version on the path item, impl declares it nowhere + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/foo": { + parameters: [{ name: "CG-Version", in: "header" }], + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/foo": { + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Act + const errors = checkMatchingRoutes(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(1); + expect(errors.get(0)).toEqual( + expect.objectContaining({ + type: "ROUTE_CONFLICT", + subType: "MISSING_HEADER_PARAM", + endpoint: "GET /foo", + }) + ); + }); + + // ############################################################ + // Response header validation + // ############################################################ + + it("should flag a missing required response header and ignore optional ones", () => { + // Arrange - Base 200 declares a required CG-Version-Served and an optional Vary header + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/foo": { + get: { + responses: { + "200": { + description: "OK", + headers: { + "CG-Version-Served": { required: true, schema: { type: "string" } }, + Vary: { required: false, schema: { type: "string" } }, + }, + }, + }, + }, + }, + }, + }; + + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/foo": { + get: { + responses: { + "200": { description: "OK" }, + }, + }, + }, + }, + }; + + // Act + const errors = checkMatchingRoutes(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(1); + expect(errors.get(0)).toEqual( + expect.objectContaining({ + type: "ROUTE_CONFLICT", + subType: "MISSING_RESPONSE_HEADER", + level: "ERROR", + endpoint: "GET /foo", + statusCode: "200", + message: expect.stringMatching(/CG-Version-Served/), + }) + ); + }); + + it("should compare header parameter and response header names case-insensitively", () => { + // Arrange - Base uses CG-Version casing, impl uses lowercase for both header kinds + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/foo": { + get: { + parameters: [{ name: "CG-Version", in: "header", schema: { type: "string" } }], + responses: { + "200": { + description: "OK", + headers: { + "CG-Version-Served": { required: true, schema: { type: "string" } }, + }, + }, + }, + }, + }, + }, + }; + + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/foo": { + get: { + parameters: [{ name: "cg-version", in: "header", schema: { type: "string" } }], + responses: { + "200": { + description: "OK", + headers: { + "cg-version-served": { required: true, schema: { type: "string" } }, + }, + }, + }, + }, + }, + }, + }; + + // Act + const errors = checkMatchingRoutes(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(0); + }); }); diff --git a/lib/cli/src/__tests__/commands/check/utils/check-path-versioning.test.ts b/lib/cli/src/__tests__/commands/check/utils/check-path-versioning.test.ts new file mode 100644 index 000000000..73a13f965 --- /dev/null +++ b/lib/cli/src/__tests__/commands/check/utils/check-path-versioning.test.ts @@ -0,0 +1,248 @@ +import { checkPathVersioning } from "../../../../commands/check/utils/check-path-versioning"; +import { OpenAPIV3 } from "openapi-types"; + +const operation: OpenAPIV3.OperationObject = { + responses: { + "200": { description: "OK" }, + }, +}; + +const versionedOperation: OpenAPIV3.OperationObject = { + ...operation, + parameters: [{ name: "CG-Version", in: "header" }], +}; + +describe("checkPathVersioning", () => { + // ############################################################ + // Flag version segments in the path + // ############################################################ + + it.each([ + { + placement: "prefix", + listPath: "/v0.6/common-grants/opportunities", + itemPath: "/v0.6/common-grants/opportunities/{oppId}", + }, + { + placement: "infix", + listPath: "/common-grants/v0.6/opportunities", + itemPath: "/common-grants/v0.6/opportunities/{oppId}", + }, + ])("should report one error when the version is a path $placement", ({ listPath, itemPath }) => { + // Arrange - Create base spec with unversioned routes that take the version header + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/common-grants/opportunities": { get: versionedOperation }, + "/common-grants/opportunities/{oppId}": { get: versionedOperation }, + }, + }; + + // Arrange - Create impl spec with a version segment in each route + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + [listPath]: { get: operation }, + [itemPath]: { get: operation }, + }, + }; + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + const error = errors.get(0); + + // Assert - One error explains the version belongs in the CG-Version header + expect(errors.getErrorCount()).toBe(1); + expect(error).toEqual( + expect.objectContaining({ + type: "PATH_VERSIONING", + level: "ERROR", + message: expect.stringMatching(/CG-Version/), + }) + ); + }); + + it("should not mention the version header when the base spec has none", () => { + // Arrange - Create base spec from before the version header existed + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/common-grants/opportunities": { get: operation }, + }, + }; + + // Arrange - Create impl spec with a version segment in the route + const implDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: { + "/v0.5/common-grants/opportunities": { get: operation }, + }, + }; + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + const message = errors.get(0)?.message; + + // Assert - The error says where to serve routes, without the header advice + expect(errors.getErrorCount()).toBe(1); + expect(message).toMatch(/\/common-grants\//); + expect(message).not.toMatch(/CG-Version/); + }); + + // ############################################################ + // Leave unversioned and host-versioned paths alone + // ############################################################ + + describe("when the path is not versioned by the protocol", () => { + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/common-grants/opportunities": { get: operation }, + "/common-grants/opportunities/{oppId}": { get: operation }, + }, + }; + + const buildImplDoc = (paths: string[]): OpenAPIV3.Document => ({ + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: Object.fromEntries(paths.map(path => [path, { get: operation }])), + }); + + it("should report no errors when the impl has no version segments", () => { + // Arrange + const implDoc = buildImplDoc([ + "/common-grants/opportunities", + "/common-grants/opportunities/{oppId}", + ]); + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(0); + }); + + it.each([ + { kind: "host API prefix", path: "/api/v2/common-grants/opportunities" }, + { kind: "bare version prefix", path: "/v2/common-grants/opportunities" }, + ])("should allow host-level versioning with a $kind", ({ path }) => { + // Arrange + const implDoc = buildImplDoc([path]); + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(0); + }); + + it("should report no errors when a legacy versioned alias sits next to the base routes", () => { + // Arrange + const implDoc = buildImplDoc([ + "/common-grants/opportunities", + "/common-grants/opportunities/{oppId}", + "/v0.6/common-grants/opportunities", + ]); + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + + // Assert - The base routes exist, so the normal route checks apply instead + expect(errors.getErrorCount()).toBe(0); + }); + + it("should report no errors when stripping the version does not give a base path", () => { + // Arrange + const implDoc = buildImplDoc(["/v0.6/common-grants/unknown"]); + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(0); + }); + }); + + // ############################################################ + // Report at most one error + // ############################################################ + + describe("when several routes are checked", () => { + const baseDoc: OpenAPIV3.Document = { + openapi: "3.0.0", + info: { title: "Base", version: "1.0.0" }, + paths: { + "/common-grants/opportunities": { get: operation }, + "/common-grants/opportunities/{oppId}": { get: operation }, + }, + }; + + const buildImplDoc = (paths: string[]): OpenAPIV3.Document => ({ + openapi: "3.0.0", + info: { title: "Impl", version: "1.0.0" }, + paths: Object.fromEntries(paths.map(path => [path, { get: operation }])), + }); + + it("should report one error when only some routes are versioned", () => { + // Arrange + const implDoc = buildImplDoc([ + "/common-grants/opportunities", + "/v0.6/common-grants/opportunities/{oppId}", + ]); + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(1); + }); + + it("should report one error when the routes use more than one version", () => { + // Arrange + const implDoc = buildImplDoc([ + "/v0.5/common-grants/opportunities", + "/v0.6/common-grants/opportunities", + ]); + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(1); + }); + + it("should report one error when the version segment is upper case", () => { + // Arrange + const implDoc = buildImplDoc([ + "/V0.6/common-grants/opportunities", + "/V0.6/common-grants/opportunities/{oppId}", + ]); + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(1); + expect(errors.get(0)).toEqual(expect.objectContaining({ type: "PATH_VERSIONING" })); + }); + + it.each([ + { form: "patch version infix", path: "/common-grants/v0.6.0/opportunities" }, + { form: "version without a v prefix", path: "/0.6/common-grants/opportunities" }, + ])("should report one error for a $form", ({ path }) => { + // Arrange + const implDoc = buildImplDoc([path]); + + // Act + const errors = checkPathVersioning(baseDoc, implDoc); + + // Assert + expect(errors.getErrorCount()).toBe(1); + }); + }); +}); diff --git a/lib/cli/src/commands/check/README.md b/lib/cli/src/commands/check/README.md index 345801f56..a754bda55 100644 --- a/lib/cli/src/commands/check/README.md +++ b/lib/cli/src/commands/check/README.md @@ -8,6 +8,8 @@ Outcomes below mean: ### Check Routes +Before comparing routes, the checker looks for a protocol version in the path, such as `/v0.6/common-grants/opportunities` or `/common-grants/v0.6/opportunities`. A route counts when it has a dotted version segment directly before or after `/common-grants/`, and removing that segment gives a base route. The run then reports one error and stops there, instead of listing every base route as missing. The error says to serve routes under `/common-grants/` with no version segment. When the base spec declares the `CG-Version` request header (protocol version 0.6.0 and later), it also says to select the version with that header (ADR 0032). A versioned alias served alongside the unversioned route is left to the normal checks, and a host API's own path versioning, such as `/api/v2/common-grants/`, isn't flagged. + - **Case 1:** Extra routes - **Case 1.1:** [Impl prefixed with `/common-grants/`](#route-case-11-extra-route-with-prefix) -> Error - **Case 1.2:** [Not prefixed with `/common-grants/`](#route-case-12-extra-route-without-prefix) -> Ignore @@ -16,8 +18,10 @@ Outcomes below mean: - **Case 2.2:** [Optional in base spec](#route-case-22-missing-optional-route) -> Warning - **Case 3:** Matching routes - Check query params -> [Check query params](#check-query-params) + - Check header params -> [Check header params](#check-header-params) - Check request body -> [Check mime types](#check-mime-types) - Check response body -> [Check status codes](#check-status-codes) + - Check response headers -> [Check response headers](#check-response-headers) ### Check query params @@ -27,6 +31,22 @@ Outcomes below mean: - **Case 2.2:** [Optional in base spec](#query-param-case-22-missing-optional-param) -> Error - **Param case 3:** Matching params -> [Check schemas](#check-schemas) +### Check header params + +A header param counts whether it's declared on the operation or on its path item. Header names match case-insensitively. From protocol version 0.6.0, every base route declares the `CG-Version` request header (ADR 0032). Header params and response headers are checked on every matching route, including routes the base spec tags `experimental`, which skip the other checks. + +- **Case 1:** Extra params -> Ignore +- **Case 2:** [Missing params](#header-param-case-2-missing-param) -> Error, whether or not the base marks the param required + +### Check response headers + +For each status code in both specs. Header names match case-insensitively. From protocol version 0.6.0, base responses declare the `CG-Version-Served` response header (ADR 0032). + +- **Case 1:** Extra headers -> Ignore +- **Case 2:** Missing headers + - **Case 2.1:** [Required in base spec](#response-header-case-21-missing-required-header) -> Error + - **Case 2.2:** Optional in base spec (such as `Vary` or `Sunset`) -> Ignore + ### Check status codes If the routes match, check whether the status codes are compatible between the base and implementation specs. @@ -428,6 +448,106 @@ paths: +### Header param checking cases + +#### Header param case 2: Missing param + +- **Scenario:** A header parameter from the base spec is missing in the implementation spec. +- **Outcome:** Error +- **Reason:** `required: false` on a header means a client MAY omit it, but the server MUST still accept it. A server that doesn't declare `CG-Version` can't show it supports version negotiation. + +
+Base spec example + +```yaml +openapi: 3.0.0 +info: + title: Base spec + version: 1.0.0 +paths: + /common-grants/test: + get: + parameters: + - name: CG-Version + in: header + required: false + schema: + type: string + responses: + "200": + description: OK +``` + +
+ +
+Implementation spec example + +```yaml +openapi: 3.0.0 +info: + title: Implementation spec + version: 1.0.0 +paths: + /common-grants/test: + get: + parameters: [] # missing CG-Version header, will error + responses: + "200": + description: OK +``` + +
+ +### Response header checking cases + +#### Response header case 2.1: Missing required header + +- **Scenario:** A response header marked `required: true` in the base spec is missing from the matching status code in the implementation spec. +- **Outcome:** Error +- **Reason:** Required response headers, such as `CG-Version-Served`, tell clients which protocol version a response was served in. + +
+Base spec example + +```yaml +openapi: 3.0.0 +info: + title: Base spec + version: 1.0.0 +paths: + /common-grants/test: + get: + responses: + "200": + description: OK + headers: + CG-Version-Served: + required: true + schema: + type: string +``` + +
+ +
+Implementation spec example + +```yaml +openapi: 3.0.0 +info: + title: Implementation spec + version: 1.0.0 +paths: + /common-grants/test: + get: + responses: + "200": + description: OK # missing CG-Version-Served header, will error +``` + +
+ ### Status code checking cases #### Status code case 1: Extra status code diff --git a/lib/cli/src/commands/check/check-args.ts b/lib/cli/src/commands/check/check-args.ts index 61b2d53ba..3510dd7cd 100644 --- a/lib/cli/src/commands/check/check-args.ts +++ b/lib/cli/src/commands/check/check-args.ts @@ -1,10 +1,11 @@ import { z } from "zod"; import * as fs from "fs"; import * as path from "path"; +import * as semver from "semver"; /** * Dynamically get available base spec versions from the openapi directory - * Returns versions sorted in reverse order (latest first) + * Returns versions sorted by version number, latest first */ function getAvailableBaseVersions(): string[] { const openapiDir = path.resolve(__dirname, "../../../lib/openapi"); @@ -12,18 +13,25 @@ function getAvailableBaseVersions(): string[] { return []; } - const files = fs.readdirSync(openapiDir); + return parseBaseVersions(fs.readdirSync(openapiDir)); +} + +/** + * Extract the versions from base spec file names like `openapi.0.5.0.yaml` + * Returns versions sorted by version number, latest first, so 0.10.0 comes before 0.9.0 + */ +export function parseBaseVersions(fileNames: string[]): string[] { const versions: string[] = []; - for (const file of files) { - const match = file.match(/^openapi\.(.+)\.yaml$/); - if (match) { + for (const fileName of fileNames) { + const match = fileName.match(/^openapi\.(.+)\.yaml$/); + // semver.valid("v0.5.0") returns "0.5.0", so compare to reject a leading "v" + if (match && semver.valid(match[1]) === match[1]) { versions.push(match[1]); } } - // Sort in reverse order so latest version comes first - return versions.sort().reverse(); + return versions.sort(semver.rcompare); } export const availableVersions = getAvailableBaseVersions(); diff --git a/lib/cli/src/commands/check/check-service.ts b/lib/cli/src/commands/check/check-service.ts index d05cff88d..848032545 100644 --- a/lib/cli/src/commands/check/check-service.ts +++ b/lib/cli/src/commands/check/check-service.ts @@ -2,6 +2,7 @@ import SwaggerParser from "@apidevtools/swagger-parser"; import { checkExtraRoutes } from "./utils/check-extra-routes"; import { checkMatchingRoutes } from "./utils/check-matching-routes"; import { checkMissingRequiredRoutes } from "./utils/check-missing-routes"; +import { checkPathVersioning } from "./utils/check-path-versioning"; import { Document } from "./utils/types"; import { CheckApiOptions, CheckSpecOptions, availableVersions } from "./check-args"; import { ErrorCollection, ErrorFormatter } from "./utils/error-utils"; @@ -22,9 +23,10 @@ export class DefaultCheckService { * * This involves: * 1) Fetching and parsing both specs - * 2) Checking for required routes that are missing - * 3) Checking for unexpected routes prefixed with /common-grants/ - * 4) Checking that matching routes are compatible + * 2) Checking for routes that put the protocol version in the path + * 3) Checking for required routes that are missing + * 4) Checking for unexpected routes prefixed with /common-grants/ + * 5) Checking that matching routes are compatible */ async checkSpec(specPath: string, options: CheckSpecOptions): Promise { // Get the base spec and implementation spec @@ -66,11 +68,18 @@ export class DefaultCheckService { * Validate the specs against the base spec. * * This involves: - * 1) Checking for required routes that are missing - * 2) Checking for unexpected routes prefixed with /common-grants/ - * 3) Checking that matching routes are compatible + * 1) Checking for routes that put the protocol version in the path + * 2) Checking for required routes that are missing + * 3) Checking for unexpected routes prefixed with /common-grants/ + * 4) Checking that matching routes are compatible */ function validateSpecs(baseDoc: Document, implDoc: Document): ErrorCollection { + // A versioned path makes every base route look missing, so report only that + const pathVersioningErrors = checkPathVersioning(baseDoc, implDoc); + if (pathVersioningErrors.getErrorCount() > 0) { + return pathVersioningErrors; + } + const errors: ErrorCollection = new ErrorCollection(); errors.addErrors(checkMissingRequiredRoutes(baseDoc, implDoc).getAllErrors()); errors.addErrors(checkExtraRoutes(baseDoc, implDoc).getAllErrors()); diff --git a/lib/cli/src/commands/check/utils/check-extra-routes.ts b/lib/cli/src/commands/check/utils/check-extra-routes.ts index 26ea22408..64c696ded 100644 --- a/lib/cli/src/commands/check/utils/check-extra-routes.ts +++ b/lib/cli/src/commands/check/utils/check-extra-routes.ts @@ -119,7 +119,10 @@ function createExtraRouteError(method: HttpMethod, path: string): RouteError { /** * Gets all HTTP methods from a path item object + * + * A path item also holds fields like `parameters` and `summary`, which aren't routes. */ function getPathMethods(pathItem: PathItem): HttpMethod[] { - return Object.keys(pathItem) as HttpMethod[]; + const httpMethods = Object.values(OpenAPIV3.HttpMethods); + return httpMethods.filter(method => method in pathItem); } diff --git a/lib/cli/src/commands/check/utils/check-matching-routes.ts b/lib/cli/src/commands/check/utils/check-matching-routes.ts index efafdec40..cb9e216ea 100644 --- a/lib/cli/src/commands/check/utils/check-matching-routes.ts +++ b/lib/cli/src/commands/check/utils/check-matching-routes.ts @@ -3,6 +3,8 @@ import { checkSchemaCompatibility } from "./check-schema-compatibility"; import { deepFlattenAllOf } from "./flatten-schemas"; import { ErrorCollection } from "./error-utils"; +type PathParameters = OpenAPIV3.PathItemObject["parameters"]; + // ############################################################ // Top-level checks // ############################################################ @@ -33,7 +35,8 @@ export function checkMatchingRoutes( const implPathObj = implPathItem as OpenAPIV3.PathItemObject; // For each method in the base path, check if it also exists in the impl path - for (const method of Object.keys(basePathObj) as OpenAPIV3.HttpMethods[]) { + // (a path item also holds fields like `parameters`, which aren't routes) + for (const method of Object.values(OpenAPIV3.HttpMethods)) { // Get base and impl operations (e.g. get, post, put, delete, etc.) const baseOp = basePathObj[method]; const implOp = implPathObj[method]; @@ -42,6 +45,19 @@ export function checkMatchingRoutes( if (!baseOp) continue; if (!implOp) continue; + // Headers are checked even on experimental routes, because the version + // headers are part of the protocol on every route + errors.addErrors( + checkRouteHeaders( + basePathKey, + method, + baseOp, + implOp, + basePathObj.parameters, + implPathObj.parameters + ).getAllErrors() + ); + // If experimental, skip deeper checks if (baseOp.tags?.includes("experimental")) continue; @@ -187,6 +203,116 @@ function checkQueryParameters( return errors; } +// ############################################################ +// Header checks +// ############################################################ + +/** + * Compare the request and response headers of a single route (defined in both base and impl). + */ +function checkRouteHeaders( + path: string, + method: string, + baseOp: OpenAPIV3.OperationObject, + implOp: OpenAPIV3.OperationObject, + basePathParams: PathParameters, + implPathParams: PathParameters +): ErrorCollection { + const errors = new ErrorCollection(); + const endpoint = `${method.toUpperCase()} ${path}`; + + errors.addErrors( + checkHeaderParameters(endpoint, baseOp, implOp, basePathParams, implPathParams).getAllErrors() + ); + + for (const statusCode of Object.keys(baseOp.responses || {})) { + const baseResp = baseOp.responses[statusCode] as OpenAPIV3.ResponseObject; + const implResp = implOp.responses?.[statusCode] as OpenAPIV3.ResponseObject | undefined; + + if (!implResp) continue; // A missing status code is left to checkStatusCodes + + errors.addErrors(checkResponseHeaders(endpoint, statusCode, baseResp, implResp).getAllErrors()); + } + + return errors; +} + +/** + * Check that the implementation declares every header parameter in the base + * + * A base header is flagged even when it isn't required, because `required` + * describes the client: a client MAY omit `CG-Version`, but a server MUST accept it. + */ +function checkHeaderParameters( + endpoint: string, + baseOp: OpenAPIV3.OperationObject, + implOp: OpenAPIV3.OperationObject, + basePathParams: PathParameters, + implPathParams: PathParameters +): ErrorCollection { + const errors = new ErrorCollection(); + const baseParams = getHeaderParams(baseOp, basePathParams); + const implParams = getHeaderParams(implOp, implPathParams); + + for (const baseParam of baseParams) { + // HTTP header names are case-insensitive (RFC 9110) + if (!implParams.some(p => p.name.toLowerCase() === baseParam.name.toLowerCase())) { + errors.addError({ + type: "ROUTE_CONFLICT", + subType: "MISSING_HEADER_PARAM", + level: "ERROR", + endpoint, + message: `Missing header parameter [${baseParam.name}]`, + }); + } + } + + return errors; +} + +/** + * Header params on an operation, including any declared once on its path item + */ +function getHeaderParams( + op: OpenAPIV3.OperationObject, + pathParams: PathParameters +): OpenAPIV3.ParameterObject[] { + return [...(pathParams || []), ...(op.parameters || [])].filter( + (p): p is OpenAPIV3.ParameterObject => "in" in p && p.in === "header" + ); +} + +/** + * Check that the implementation response declares every required base response header + */ +function checkResponseHeaders( + endpoint: string, + statusCode: string, + baseResp: OpenAPIV3.ResponseObject, + implResp: OpenAPIV3.ResponseObject +): ErrorCollection { + const errors = new ErrorCollection(); + // HTTP header names are case-insensitive (RFC 9110) + const implHeaderNames = new Set(Object.keys(implResp.headers || {}).map(n => n.toLowerCase())); + + for (const [name, header] of Object.entries(baseResp.headers || {})) { + if (!("required" in header) || !header.required) continue; + + if (!implHeaderNames.has(name.toLowerCase())) { + errors.addError({ + type: "ROUTE_CONFLICT", + subType: "MISSING_RESPONSE_HEADER", + level: "ERROR", + endpoint, + statusCode, + message: `Missing response header [${name}] for status code [${statusCode}]`, + }); + } + } + + return errors; +} + // ############################################################ // Content schema checks (shared between request and response) // ############################################################ diff --git a/lib/cli/src/commands/check/utils/check-path-versioning.ts b/lib/cli/src/commands/check/utils/check-path-versioning.ts new file mode 100644 index 000000000..4e837e4d1 --- /dev/null +++ b/lib/cli/src/commands/check/utils/check-path-versioning.ts @@ -0,0 +1,87 @@ +import { OpenAPIV3 } from "openapi-types"; +import { ErrorCollection } from "./error-utils"; + +// ############################################################ +// File-scoped constants +// ############################################################ + +const VERSION_HEADER = "CG-Version"; + +// A dotted protocol version such as `v0.6`, `0.6` or `v0.6.0`. A bare `v2` is +// left alone, because a host API MAY version its own paths (ADR 0032). +const VERSION_SEGMENT = String.raw`v?\d+\.\d+(?:\.\d+)?`; +const VERSION_BEFORE = new RegExp(String.raw`/${VERSION_SEGMENT}/common-grants/`, "i"); +const VERSION_AFTER = new RegExp(String.raw`/common-grants/${VERSION_SEGMENT}/`, "i"); + +// ############################################################ +// Public function +// ############################################################ + +/** + * Check for implementation routes that put the protocol version in the path. + * + * Report one error when a route has a version segment directly before or after + * `/common-grants/`, and removing it gives a base route the implementation + * doesn't also serve unversioned. For example, `/v0.6/common-grants/opportunities` + * or `/common-grants/v0.6/opportunities`. + */ +export function checkPathVersioning( + baseDoc: OpenAPIV3.Document, + implDoc: OpenAPIV3.Document +): ErrorCollection { + const errors = new ErrorCollection(); + const basePaths = baseDoc.paths || {}; + const implPaths = implDoc.paths || {}; + + // A versioned alias next to the unversioned route is left to the normal checks + const versionedPath = Object.keys(implPaths).find(implPath => { + const strippedPath = stripVersionSegment(implPath); + return strippedPath !== implPath && strippedPath in basePaths && !(strippedPath in implPaths); + }); + + if (versionedPath) { + // Base specs before 0.6.0 have no version header to point to + const headerAdvice = declaresVersionHeader(baseDoc) + ? ` and select the version with the '${VERSION_HEADER}' request header (ADR 0032)` + : ""; + + errors.addError({ + type: "PATH_VERSIONING", + level: "ERROR", + endpoint: versionedPath, + message: + `Routes put the protocol version in the path, such as '${versionedPath}'. ` + + `Serve CommonGrants routes under '/common-grants/' with no version segment${headerAdvice}.`, + }); + } + + return errors; +} + +// ############################################################ +// Helper functions +// ############################################################ + +/** + * Whether any route in the spec takes the version request header + */ +function declaresVersionHeader(doc: OpenAPIV3.Document): boolean { + return Object.values(doc.paths || {}).some(pathItem => { + const operations = Object.values(OpenAPIV3.HttpMethods).map(method => pathItem?.[method]); + const parameters = [pathItem, ...operations].flatMap(holder => holder?.parameters || []); + + return parameters.some( + param => + "in" in param && + param.in === "header" && + param.name.toLowerCase() === VERSION_HEADER.toLowerCase() + ); + }); +} + +/** + * Remove a version segment next to `/common-grants/`, if there is one + */ +function stripVersionSegment(path: string): string { + return path.replace(VERSION_BEFORE, "/common-grants/").replace(VERSION_AFTER, "/common-grants/"); +} diff --git a/lib/cli/src/commands/check/utils/error-utils.ts b/lib/cli/src/commands/check/utils/error-utils.ts index 43cce5d3e..700b84cac 100644 --- a/lib/cli/src/commands/check/utils/error-utils.ts +++ b/lib/cli/src/commands/check/utils/error-utils.ts @@ -142,6 +142,15 @@ export class ErrorFormatter { ); sections.push("================================="); + // Format the protocol version found in a path + const pathVersioning = this.errors.filterByType("PATH_VERSIONING"); + if (pathVersioning.getErrorCount() > 0) { + sections.push("Version in path"); + for (const error of pathVersioning) { + sections.push(` ${error.message}`); + } + } + // Format missing routes const missingRoutes = this.errors.filterByType("MISSING_ROUTE"); if (missingRoutes.getErrorCount() > 0) { @@ -229,6 +238,10 @@ export class ErrorFormatter { return "Extra query parameter"; case "QUERY_PARAM_CONFLICT": return "Query parameter conflict"; + case "MISSING_HEADER_PARAM": + return "Header parameter missing"; + case "MISSING_RESPONSE_HEADER": + return "Response header missing"; default: return subType; } diff --git a/lib/cli/src/commands/check/utils/types.ts b/lib/cli/src/commands/check/utils/types.ts index 4e43b99ba..3e9611271 100644 --- a/lib/cli/src/commands/check/utils/types.ts +++ b/lib/cli/src/commands/check/utils/types.ts @@ -25,7 +25,7 @@ export interface SchemaContext { // Error types // ######################################################### -export type ErrorType = "MISSING_ROUTE" | "EXTRA_ROUTE" | "ROUTE_CONFLICT"; +export type ErrorType = "MISSING_ROUTE" | "EXTRA_ROUTE" | "ROUTE_CONFLICT" | "PATH_VERSIONING"; export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD"; export interface BaseError { @@ -45,7 +45,9 @@ export type ErrorSubType = | "RESPONSE_BODY_CONFLICT" | "MISSING_QUERY_PARAM" | "EXTRA_QUERY_PARAM" - | "QUERY_PARAM_CONFLICT"; + | "QUERY_PARAM_CONFLICT" + | "MISSING_HEADER_PARAM" + | "MISSING_RESPONSE_HEADER"; export type SchemaConflictType = "TYPE_CONFLICT" | "MISSING_FIELD" | "EXTRA_FIELD" | "ENUM_CONFLICT"; diff --git a/lib/core/lib/api.tsp b/lib/core/lib/api.tsp index 55d868182..d8626375d 100644 --- a/lib/core/lib/api.tsp +++ b/lib/core/lib/api.tsp @@ -30,6 +30,12 @@ using Versioning; description: "Endpoints that MUST be implemented by all CommonGrants APIs", } ) +@tagMetadata( + "Versions", + #{ + description: "Endpoints related to discovering the protocol versions an API serves", + } +) @tagMetadata("Forms", #{ description: "Endpoints related to forms" }) @tagMetadata("Awards", #{ description: "Endpoints related to grant awards" }) @tagMetadata( @@ -246,3 +252,17 @@ namespace Forms { @added(Versions.v0_2) op read is Router.read; } + +// ######################################################### +// Versions +// ######################################################### + +@tag("Versions") +@route("/versions") +namespace ProtocolVersions { + alias Router = Routes.ProtocolVersions; + + @added(Versions.v0_6) + @tag("optional") + op read is Router.read; +} diff --git a/lib/core/lib/core/headers.tsp b/lib/core/lib/core/headers.tsp new file mode 100644 index 000000000..5467e9558 --- /dev/null +++ b/lib/core/lib/core/headers.tsp @@ -0,0 +1,97 @@ +import "@typespec/http"; +import "@typespec/versioning"; +import "./types.tsp"; + +/** Version negotiation headers (ADR 0032), added in protocol version 0.6.0 + * + * @example How to add the version request header to a declared protocol route + * + * ```typespec + * import "@typespec/http"; + * import "@common-grants/core"; + * + * using CommonGrants; // exposes the Headers namespace + * using TypeSpec.Http; + * using TypeSpec.Versioning; + * + * @service + * @useDependency(CommonGrants.Versions.v0_6) + * namespace MyApi; + * + * @route("/common-grants/opportunities") + * @get + * op listOpportunities( + * ...Pagination.PaginatedQueryParams, + * ...Headers.VersionRequest, + * ): Responses.WithVersionErrors>; + * ``` + */ +namespace CommonGrants.Headers; + +/** Request headers a client sends to select a protocol version */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionRequest { + /** The protocol version the client wants, such as `0.6.0` + * + * Servers match on major and minor version. When absent, the server responds + * in its default version. + */ + @Http.header("CG-Version") + // Spreading drops model-level `@added`, so each property repeats it + @Versioning.added(CommonGrants.Versions.v0_6) + cgVersion?: Types.protocolVersion; +} + +/** Response headers that report the protocol version a response was served in */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionResponse { + /** The full protocol version this response was served in, such as `0.5.1` + * + * Can differ from the requested version in the patch number only. + */ + @Http.header("CG-Version-Served") + @Versioning.added(CommonGrants.Versions.v0_6) + cgVersionServed: Types.protocolVersion; + + ...VersionLifecycle; +} + +/** Version headers for 401 and 403 responses */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionResponseAuth { + /** The full protocol version this response was served in, such as `0.5.1` + * + * Optional because authentication can run before a version is selected. + */ + @Http.header("CG-Version-Served") + @Versioning.added(CommonGrants.Versions.v0_6) + cgVersionServed?: Types.protocolVersion; + + ...VersionLifecycle; +} + +/** Caching and retirement headers shared by `VersionResponse` and `VersionResponseAuth` */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionLifecycle { + /** Request headers that caches must key this response on, such as `CG-Version` */ + @Http.header("Vary") + @Versioning.added(CommonGrants.Versions.v0_6) + vary?: string; + + /** When the served version was or will be deprecated (RFC 9745), such as `@1796083200` */ + @pattern("^@-?[0-9]+$") + @Http.header("Deprecation") + @Versioning.added(CommonGrants.Versions.v0_6) + deprecation?: string; + + /** When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` */ + @encode(DateTimeKnownEncoding.rfc7231) + @Http.header("Sunset") + @Versioning.added(CommonGrants.Versions.v0_6) + sunset?: utcDateTime; + + /** Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` */ + @Http.header("Link") + @Versioning.added(CommonGrants.Versions.v0_6) + link?: string; +} diff --git a/lib/core/lib/core/index.tsp b/lib/core/lib/core/index.tsp index f3884c3c1..3b27c6279 100644 --- a/lib/core/lib/core/index.tsp +++ b/lib/core/lib/core/index.tsp @@ -1,4 +1,5 @@ import "./types.tsp"; +import "./headers.tsp"; import "./fields/index.tsp"; import "./models/index.tsp"; import "./routes/index.tsp"; diff --git a/lib/core/lib/core/models/index.tsp b/lib/core/lib/core/models/index.tsp index 028834a10..60e383cbe 100644 --- a/lib/core/lib/core/models/index.tsp +++ b/lib/core/lib/core/models/index.tsp @@ -15,6 +15,7 @@ import "./form.tsp"; import "./form-response.tsp"; import "./mapping.tsp"; import "./applicant-type.tsp"; +import "./version-discovery.tsp"; using TypeSpec.JsonSchema; diff --git a/lib/core/lib/core/models/version-discovery.tsp b/lib/core/lib/core/models/version-discovery.tsp new file mode 100644 index 000000000..ae6b1d834 --- /dev/null +++ b/lib/core/lib/core/models/version-discovery.tsp @@ -0,0 +1,170 @@ +import "../types.tsp"; + +namespace CommonGrants.Models; + +// ######################################################### +// UpcomingDefault +// ######################################################### + +/** A scheduled change to the version a server serves by default */ +@Versioning.added(CommonGrants.Versions.v0_6) +model UpcomingDefault { + /** The version that will become the default */ + version: Types.protocolVersion; + + /** When the new default takes effect */ + date: utcDateTime; + + // Discovery sits outside version selection, so new fields must be tolerated rather than versioned + ...Record; +} + +// ######################################################### +// VersionRetirement +// ######################################################### + +/** The retirement schedule for a deprecated version */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionRetirement { + /** When the version was or will be deprecated */ + deprecation: utcDateTime; + + /** When the server will stop serving the version, if scheduled */ + sunset?: utcDateTime; + + ...Record; +} + +// ######################################################### +// OperationVersions +// ######################################################### + +/** The versions a single route serves, when they differ from the API-wide values */ +@Versioning.added(CommonGrants.Versions.v0_6) +model OperationVersions { + /** The versions this route serves */ + @minItems(1) + versions: Types.protocolVersion[]; + + /** The version this route serves when a request doesn't name one, one of `versions` */ + defaultVersion: Types.protocolVersion; + + /** A scheduled change to this route's default version, if any. Its `version` is one of `versions` */ + upcomingDefault?: UpcomingDefault; + + /** Deprecated versions of this route, keyed by version, with their retirement schedule + * + * Each key is a version from `versions`, written exactly as it appears + * there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses + * `0.3.1` as the key here. + * + * To check whether the version you request is deprecated, compare only + * the major and minor. A client requesting `0.3.0` is served `0.3.1`, so + * its entry is under `0.3.1`. + */ + @TypeSpec.JsonSchema.extension( + "propertyNames", + #{ $ref: "protocolVersion.yaml" } + ) + deprecated?: Record; + + ...Record; +} + +// ######################################################### +// VersionDiscovery +// ######################################################### + +/** The protocol versions an API serves + * + * The top-level fields describe every route that has no entry in + * `operations`. Routes that differ from them have an entry in `operations`. + * New fields are only ever added to this model; clients ignore fields they + * don't recognize. + */ +@example( + Examples.VersionDiscovery.routeEntries, + #{ title: "Baseline with route entries" } +) +@example( + Examples.VersionDiscovery.lifecycle, + #{ title: "Upcoming default and deprecated version" } +) +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionDiscovery { + /** The versions every route without an `operations` entry serves */ + @minItems(1) + versions: Types.protocolVersion[]; + + /** The version every route without an `operations` entry serves when a request doesn't name one, one of `versions` */ + defaultVersion: Types.protocolVersion; + + /** A scheduled change to the API-wide default version, if any. Its `version` is one of `versions` */ + upcomingDefault?: UpcomingDefault; + + /** Deprecated versions, keyed by version, with their retirement schedule + * + * Each key is a version from `versions`, written exactly as it appears + * there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses + * `0.3.1` as the key here. + * + * To check whether the version you request is deprecated, compare only + * the major and minor. A client requesting `0.3.0` is served `0.3.1`, so + * its entry is under `0.3.1`. + */ + @TypeSpec.JsonSchema.extension( + "propertyNames", + #{ $ref: "protocolVersion.yaml" } + ) + deprecated?: Record; + + /** Routes whose versions differ from the API-wide values + * + * Each key is the HTTP method and the route's published path, separated + * by a space, such as `GET /common-grants/forms/{formId}`. Path parameter + * names are ignored when matching a key to a route. Omitted when every + * route serves the API-wide values. + */ + operations?: Record; + + ...Record; +} + +// ######################################################### +// Examples +// ######################################################### + +/** Examples of version discovery responses */ +namespace Examples.VersionDiscovery { + /** A 0.4.0 baseline with routes that serve other versions */ + const routeEntries = #{ + versions: #["0.4.0"], + defaultVersion: "0.4.0", + operations: #{ + `GET /common-grants/forms`: #{ + versions: #["0.5.0"], + defaultVersion: "0.5.0", + }, + `GET /common-grants/forms/{formId}`: #{ + versions: #["0.4.0", "0.5.0"], + defaultVersion: "0.4.0", + }, + }, + }; + + /** A scheduled default change and a deprecated version */ + const lifecycle = #{ + versions: #["0.3.0", "0.4.0", "0.5.0"], + defaultVersion: "0.4.0", + upcomingDefault: #{ + version: "0.5.0", + date: utcDateTime.fromISO("2027-03-01T00:00:00Z"), + }, + deprecated: #{ + `0.3.0`: #{ + deprecation: utcDateTime.fromISO("2026-12-01T00:00:00Z"), + sunset: utcDateTime.fromISO("2027-06-01T00:00:00Z"), + }, + }, + }; +} diff --git a/lib/core/lib/core/responses/error.tsp b/lib/core/lib/core/responses/error.tsp index 57caa364a..7a5a9167c 100644 --- a/lib/core/lib/core/responses/error.tsp +++ b/lib/core/lib/core/responses/error.tsp @@ -1,3 +1,4 @@ +import "../headers.tsp"; import "@typespec/http"; namespace CommonGrants.Responses; @@ -10,6 +11,11 @@ namespace CommonGrants.Responses; * import "@typespec/http" * * alias Unauthorized = Error & Http.UnauthorizedResponse + * + * // From protocol version 0.6.0, also carry the version response headers + * alias VersionedUnauthorized = Error & + * Http.UnauthorizedResponse & + * Headers.VersionResponseAuth * ``` */ @error @@ -27,9 +33,11 @@ model Error { errors: Array; } -alias Unauthorized = Error & Http.UnauthorizedResponse; -alias Forbidden = Error & Http.ForbiddenResponse; -alias NotFound = Error & Http.NotFoundResponse; +alias Unauthorized = Error & + Http.UnauthorizedResponse & + Headers.VersionResponseAuth; +alias Forbidden = Error & Http.ForbiddenResponse & Headers.VersionResponseAuth; +alias NotFound = Error & Http.NotFoundResponse & Headers.VersionResponse; @example(#{ status: 400, diff --git a/lib/core/lib/core/responses/index.tsp b/lib/core/lib/core/responses/index.tsp index 1648d5c0b..6aae3dc8f 100644 --- a/lib/core/lib/core/responses/index.tsp +++ b/lib/core/lib/core/responses/index.tsp @@ -2,6 +2,7 @@ import "@typespec/http"; import "./error.tsp"; import "./success.tsp"; +import "./version-errors.tsp"; using TypeSpec.JsonSchema; @@ -22,6 +23,17 @@ using TypeSpec.JsonSchema; * op getPets(): Responses.OkT | Responses.Unauthorized; * } * ``` + * + * @example How to add the version errors to a protocol route + * + * ```typespec + * @route("/common-grants/opportunities") + * @get + * op listOpportunities( + * ...Pagination.PaginatedQueryParams, + * ...Headers.VersionRequest, + * ): Responses.WithVersionErrors>; + * ``` */ @jsonSchema namespace CommonGrants.Responses; diff --git a/lib/core/lib/core/responses/success.tsp b/lib/core/lib/core/responses/success.tsp index 32a104abb..9c8722a8f 100644 --- a/lib/core/lib/core/responses/success.tsp +++ b/lib/core/lib/core/responses/success.tsp @@ -1,3 +1,4 @@ +import "../headers.tsp"; import "../pagination.tsp"; import "../sorting.tsp"; import "@typespec/http"; @@ -57,10 +58,28 @@ model OkT extends Success { // Inherit the 200 status code ...Http.OkResponse; + ...Headers.VersionResponse; + /** Response data */ data: T; } +// ############################################################################ +// 200 version discovery response +// ############################################################################ + +/** A 200 response listing the protocol versions an API serves + * + * Discovery sits outside version selection, so unlike `OkT` this response + * carries no version headers: neither `CG-Version-Served` nor `Vary`. + */ +@doc("A 200 response listing the protocol versions an API serves") +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionDiscoveryResponse extends Success { + /** The protocol versions the API serves */ + data: Models.VersionDiscovery; +} + // ############################################################################ // 200 paginated response // ############################################################################ @@ -111,6 +130,7 @@ model PaginatedT extends Success { // Inherit the 200 status code ...Http.OkResponse; + ...Headers.VersionResponse; ...PaginatedBase; } @@ -162,6 +182,7 @@ model SortedT extends Success { // Inherit the 200 status code ...Http.OkResponse; + ...Headers.VersionResponse; ...SortedBase; } @@ -225,6 +246,7 @@ model FilteredT extends Success { // Inherit the 200 status code ...Http.OkResponse; + ...Headers.VersionResponse; ...FilteredBase; } @@ -253,6 +275,8 @@ model CreatedT extends Success { // Inherit the 201 status code ...Http.CreatedResponse; + ...Headers.VersionResponse; + /** Response data */ data: T; } @@ -286,6 +310,8 @@ model AcceptedT extends Success { // Inherit the 202 status code ...Http.AcceptedResponse; + ...Headers.VersionResponse; + /** URL where the accepted resource can be retrieved */ @Http.header("Location") location?: url; diff --git a/lib/core/lib/core/responses/version-errors.tsp b/lib/core/lib/core/responses/version-errors.tsp new file mode 100644 index 000000000..0c41f343f --- /dev/null +++ b/lib/core/lib/core/responses/version-errors.tsp @@ -0,0 +1,242 @@ +import "@typespec/http"; +import "../types.tsp"; +import "./error.tsp"; + +namespace CommonGrants.Responses; + +// ############################################################################ +// Version error details +// ############################################################################ + +/** Whether a version is unavailable on the whole server or only on the route called */ +@Versioning.added(CommonGrants.Versions.v0_6) +enum VersionErrorScope { + /** The server doesn't serve the version on any route */ + deployment, + + /** The server serves the version, but not on this route */ + operation, +} + +/** Details shared by every version error, describing the route that was called */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionErrorDetail { + /** The request header the error is about */ + field: "CG-Version"; + + /** Human-readable description of the problem */ + message: string; + + /** The versions this route serves */ + @minItems(1) + supported: Types.protocolVersion[]; + + /** The version this route serves when a request doesn't name one */ + defaultVersion: Types.protocolVersion; + + /** The server's version discovery URL + * + * Omitted by servers that serve one version and don't publish discovery. + */ + discovery?: url; +} + +/** The `CG-Version` value isn't a full `MAJOR.MINOR.PATCH` version */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionMalformedDetail extends VersionErrorDetail { + /** Stable error code that clients branch on */ + code: "version.malformed"; + + /** The value received, as sent */ + requested: string; + + // Version errors are returned outside version selection, so new fields must be tolerated + ...Record; +} + +/** The request sent more than one `CG-Version` value */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionConflictDetail extends VersionErrorDetail { + /** Stable error code that clients branch on */ + code: "version.conflict"; + + ...Record; +} + +/** The requested version isn't served by this server or this route */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionUnsupportedDetail extends VersionErrorDetail { + /** Stable error code that clients branch on */ + code: "version.unsupported"; + + /** The version requested */ + requested: Types.protocolVersion; + + /** Whether the server or only this route doesn't serve the version */ + scope: VersionErrorScope; + + ...Record; +} + +/** The requested version was retired from this server or this route */ +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionRetiredDetail extends VersionErrorDetail { + /** Stable error code that clients branch on */ + code: "version.retired"; + + /** The version requested */ + requested: Types.protocolVersion; + + /** Whether the server or only this route doesn't serve the version */ + scope: VersionErrorScope; + + /** When the version stopped being served */ + sunset: utcDateTime; + + ...Record; +} + +// ############################################################################ +// Version error responses +// ############################################################################ + +@example(#{ + status: 400, + message: "The CG-Version header is not a valid CommonGrants version", + errors: #[ + #{ + field: "CG-Version", + code: "version.malformed", + message: "Version 0.5 is not a full MAJOR.MINOR.PATCH version", + requested: "0.5", + supported: #["0.5.0", "0.6.0"], + defaultVersion: "0.5.0", + discovery: "https://grants.example.org/common-grants/versions", + } + ], +}) +@error +@doc("A `CG-Version` header that isn't a full `MAJOR.MINOR.PATCH` version") +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionMalformedError extends Error { + @example(400) + status: 400; + + @minItems(1) + errors: VersionMalformedDetail[]; +} + +@example(#{ + status: 400, + message: "The request sent more than one CG-Version value", + errors: #[ + #{ + field: "CG-Version", + code: "version.conflict", + message: "Received CG-Version values 0.5.0 and 0.6.0", + supported: #["0.5.0", "0.6.0"], + defaultVersion: "0.5.0", + discovery: "https://grants.example.org/common-grants/versions", + } + ], +}) +@error +@doc("A request that sent more than one `CG-Version` value, even the same value twice") +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionConflictError extends Error { + @example(400) + status: 400; + + @minItems(1) + errors: VersionConflictDetail[]; +} + +@example(#{ + status: 406, + message: "The requested CommonGrants version is not available for this route", + errors: #[ + #{ + field: "CG-Version", + code: "version.unsupported", + message: "Version 0.4.0 is not served by GET /common-grants/forms. Supported versions: 0.5.0, 0.6.0", + requested: "0.4.0", + supported: #["0.5.0", "0.6.0"], + scope: VersionErrorScope.operation, + defaultVersion: "0.5.0", + discovery: "https://grants.example.org/common-grants/versions", + } + ], +}) +@error +@doc("A requested version that this server or route doesn't serve") +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionUnsupportedError extends Error { + @example(406) + status: 406; + + @minItems(1) + errors: VersionUnsupportedDetail[]; +} + +@example(#{ + status: 406, + message: "The requested CommonGrants version has been retired", + errors: #[ + #{ + field: "CG-Version", + code: "version.retired", + message: "Version 0.3.0 was retired on 2027-06-01. Supported versions: 0.4.0, 0.5.0, 0.6.0", + requested: "0.3.0", + supported: #["0.4.0", "0.5.0", "0.6.0"], + scope: VersionErrorScope.deployment, + defaultVersion: "0.4.0", + discovery: "https://grants.example.org/common-grants/versions", + sunset: utcDateTime.fromISO("2027-06-01T00:00:00Z"), + } + ], +}) +@error +@doc("A requested version that was retired from this server or route") +@Versioning.added(CommonGrants.Versions.v0_6) +model VersionRetiredError extends Error { + @example(406) + status: 406; + + @minItems(1) + errors: VersionRetiredDetail[]; +} + +// Status codes live on these aliases, not the models, so they stay out of the +// JSON Schemas. Version errors carry no version response headers (ADR 0032). +alias VersionMalformed = VersionMalformedError & Http.BadRequestResponse; +alias VersionConflict = VersionConflictError & Http.BadRequestResponse; +alias VersionUnsupported = VersionUnsupportedError & Http.Response<406>; +alias VersionRetired = VersionRetiredError & Http.Response<406>; + +// Any other 400, such as a body that fails validation in the requested version. +// The served version is optional because version errors share this status. +alias BadRequest = Error & + Http.BadRequestResponse & { + /** The full protocol version this response was served in, such as `0.5.1` + * + * Sent on every 400 except the version errors. + */ + @Http.header("CG-Version-Served") + cgVersionServed?: Types.protocolVersion; + + ...Headers.VersionLifecycle; + }; + +// Adds the version errors to a route's responses from protocol version 0.6.0. +// Docs go on the variants: a union-level doc would replace every response description. +union WithVersionErrors { + response: R, + + /** The request is invalid, or its `CG-Version` value is malformed or was sent more than once */ + @Versioning.added(CommonGrants.Versions.v0_6) + badRequest: VersionMalformed | VersionConflict | BadRequest, + + /** The requested version isn't served by this server or this route */ + @Versioning.added(CommonGrants.Versions.v0_6) + notAcceptable: VersionUnsupported | VersionRetired, +} diff --git a/lib/core/lib/core/routes/applications.tsp b/lib/core/lib/core/routes/applications.tsp index 52dcbb500..4a9a2bbdd 100644 --- a/lib/core/lib/core/routes/applications.tsp +++ b/lib/core/lib/core/routes/applications.tsp @@ -33,7 +33,11 @@ interface Applications { /** The title of the application */ @Versioning.renamedFrom(Versions.v0_4, "name") title: string, - ): Responses.CreatedT | Responses.Unauthorized; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< + | Responses.CreatedT + | Responses.Unauthorized>; // ############################### // Get an application @@ -46,10 +50,12 @@ interface Applications { getApplication( /** The ID of the application to get */ @path appId: Types.uuid, - ): + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< | Responses.OkT | Responses.NotFound - | Responses.Unauthorized; + | Responses.Unauthorized>; // ############################### // Submit an application @@ -62,11 +68,13 @@ interface Applications { submitApplication( /** The ID of the application to submit */ @path appId: Types.uuid, - ): + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< | Responses.OkT - | Responses.ApplicationSubmissionError + | ApplicationSubmissionErrorResponse | Responses.NotFound - | Responses.Unauthorized; + | Responses.Unauthorized>; // ############################### // Search applications @@ -82,5 +90,19 @@ interface Applications { /** The sorting to apply to the search */ @query sorting: Models.AppSorting, - ): Responses.FilteredT; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; +} + +// Lives here, not in `Responses`, so the headers stay out of the JSON Schemas +@error +model ApplicationSubmissionErrorResponse { + ...Headers.VersionResponse; + + /** The submission error */ + @body body: Responses.ApplicationSubmissionError; } diff --git a/lib/core/lib/core/routes/awards.tsp b/lib/core/lib/core/routes/awards.tsp index 5ceb453db..b90c215c9 100644 --- a/lib/core/lib/core/routes/awards.tsp +++ b/lib/core/lib/core/routes/awards.tsp @@ -51,7 +51,8 @@ interface Awards { @list list( ...Pagination.PaginatedQueryParams, - ): Responses.PaginatedT; + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; // ############################## // View an award @@ -69,7 +70,9 @@ interface Awards { /** The ID of the award to view */ @path awdId: Types.uuid, - ): Responses.OkT | Responses.NotFound; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors | Responses.NotFound>; // ############################### // Search awards @@ -101,5 +104,7 @@ interface Awards { /** Pagination instructions for the results */ pagination?: Pagination.PaginatedBodyParams, - ): Responses.FilteredT; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; } diff --git a/lib/core/lib/core/routes/competitions.tsp b/lib/core/lib/core/routes/competitions.tsp index 69b42b848..442ad94fd 100644 --- a/lib/core/lib/core/routes/competitions.tsp +++ b/lib/core/lib/core/routes/competitions.tsp @@ -30,7 +30,11 @@ interface Competitions { read( /** The ID of the competition to view */ @path compId: Types.uuid, - ): Responses.OkT | Responses.NotFound; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< + | Responses.OkT + | Responses.NotFound>; // ############################### // Apply to a competition @@ -46,8 +50,10 @@ interface Competitions { /** The application to apply to the competition */ @body application: Models.ApplicationBase, - ): + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< | Responses.CreatedT | Responses.NotFound - | Responses.Unauthorized; + | Responses.Unauthorized>; } diff --git a/lib/core/lib/core/routes/form-responses.tsp b/lib/core/lib/core/routes/form-responses.tsp index fba2dd948..fe0db0e51 100644 --- a/lib/core/lib/core/routes/form-responses.tsp +++ b/lib/core/lib/core/routes/form-responses.tsp @@ -32,7 +32,9 @@ interface FormResponses { /** The response to the form */ @body response: Record, - ): Responses.OkT; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; // ############################### // Get form response @@ -48,5 +50,7 @@ interface FormResponses { /** The ID of the form whose response is being retrieved */ @path formId: Types.uuid, - ): Responses.OkT; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; } diff --git a/lib/core/lib/core/routes/forms.tsp b/lib/core/lib/core/routes/forms.tsp index 55d20f4dc..4e7a0ea09 100644 --- a/lib/core/lib/core/routes/forms.tsp +++ b/lib/core/lib/core/routes/forms.tsp @@ -24,7 +24,8 @@ interface Forms { @get list( ...Pagination.PaginatedQueryParams, - ): Responses.PaginatedT; + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; // ############################### // View form details @@ -36,5 +37,7 @@ interface Forms { read( /** The ID of the form to view */ @path formId: Types.uuid, - ): Responses.OkT; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; } diff --git a/lib/core/lib/core/routes/index.tsp b/lib/core/lib/core/routes/index.tsp index 8f4e4f8f7..bdcba2661 100644 --- a/lib/core/lib/core/routes/index.tsp +++ b/lib/core/lib/core/routes/index.tsp @@ -9,6 +9,7 @@ import "./applications.tsp"; import "./form-responses.tsp"; import "./forms.tsp"; import "./competitions.tsp"; +import "./version-discovery.tsp"; /** A series of routing interfaces for CommonGrants API endpoints * diff --git a/lib/core/lib/core/routes/opportunities.tsp b/lib/core/lib/core/routes/opportunities.tsp index 86b99411e..a934312d3 100644 --- a/lib/core/lib/core/routes/opportunities.tsp +++ b/lib/core/lib/core/routes/opportunities.tsp @@ -50,7 +50,8 @@ interface Opportunities { @list list( ...Pagination.PaginatedQueryParams, - ): Responses.PaginatedT; + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; // ############################## // View an opportunity (v0.1.0) @@ -74,7 +75,9 @@ interface Opportunities { @path @added(Versions.v0_2) oppId: Types.uuid, - ): Responses.OkT | Responses.NotFound; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors | Responses.NotFound>; // ############################### // Search opportunities @@ -106,5 +109,7 @@ interface Opportunities { /** Pagination instructions for the results */ pagination?: Pagination.PaginatedBodyParams, - ): Responses.FilteredT; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors>; } diff --git a/lib/core/lib/core/routes/orgs.tsp b/lib/core/lib/core/routes/orgs.tsp index ba93ae04b..e83263845 100644 --- a/lib/core/lib/core/routes/orgs.tsp +++ b/lib/core/lib/core/routes/orgs.tsp @@ -61,7 +61,12 @@ interface Organizations { /** Identifier value within the given registry to filter by */ @query id?: string, - ): Responses.PaginatedT | Responses.Unauthorized | Responses.Forbidden; + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< + | Responses.PaginatedT + | Responses.Unauthorized + | Responses.Forbidden>; // ############################## // View an organization @@ -85,11 +90,13 @@ interface Organizations { /** Return the profile as of the given point in time */ @query at?: utcDateTime, - ): + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< | Responses.OkT | Responses.NotFound | Responses.Unauthorized - | Responses.Forbidden; + | Responses.Forbidden>; // ############################### // Update an organization @@ -112,11 +119,13 @@ interface Organizations { /** JSON Merge Patch body for the organization profile */ @body patch: Models.OrgPatchData, - ): + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< | Responses.OkT | Responses.NotFound | Responses.Unauthorized - | Responses.Forbidden; + | Responses.Forbidden>; // ############################### // Submit a change @@ -141,11 +150,13 @@ interface Organizations { /** JSON Merge Patch body for the organization profile */ @body patch: Models.OrgPatchData, - ): + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< | Responses.AcceptedT | Responses.NotFound | Responses.Unauthorized - | Responses.Forbidden; + | Responses.Forbidden>; // ############################### // List changes @@ -168,11 +179,12 @@ interface Organizations { orgId: Types.uuid, ...Pagination.PaginatedQueryParams, - ): + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< | Responses.PaginatedT | Responses.NotFound | Responses.Unauthorized - | Responses.Forbidden; + | Responses.Forbidden>; // ############################### // View a change @@ -197,9 +209,11 @@ interface Organizations { /** The id of the change to view */ @path changeId: Types.uuid, - ): + + ...Headers.VersionRequest, + ): Responses.WithVersionErrors< | Responses.OkT | Responses.NotFound | Responses.Unauthorized - | Responses.Forbidden; + | Responses.Forbidden>; } diff --git a/lib/core/lib/core/routes/version-discovery.tsp b/lib/core/lib/core/routes/version-discovery.tsp new file mode 100644 index 000000000..e5bba00f3 --- /dev/null +++ b/lib/core/lib/core/routes/version-discovery.tsp @@ -0,0 +1,50 @@ +import "../models/index.tsp"; +import "../responses/index.tsp"; + +// Define the top-level namespace for CommonGrants routes +namespace CommonGrants.Routes; + +// Expose the contents of the Http and Rest namespaces +// these include the decorators @route, @get, etc. +using TypeSpec.Http; +using TypeSpec.Versioning; + +/** A re-usable interface for the versions discovery router + * + * Unlike the other routers, `read` is deliberately not templated: adopters + * don't type-parameterize the discovery response. Routes that differ from the API-wide + * versions are described in the response's `operations` field instead. + * + * @example Declaring the versions discovery route: + * ```typespec + * using TypeSpec.Http; + * + * @tag("Versions") + * @route("/versions") + * namespace ProtocolVersions { + * alias Router = Routes.ProtocolVersions; + * + * op read is Router.read; + * } + * ``` + */ +@added(CommonGrants.Versions.v0_6) +interface ProtocolVersions { + // ############################### + // List supported versions + // ############################### + + /** `GET /versions` List the protocol versions this API serves */ + @summary("List supported versions") + @doc(""" + List the protocol versions this API serves, its default version, and any routes whose versions differ. + + This route is optional, but a server that serves more than one protocol version MUST implement it. + It ignores the `CG-Version` request header, because clients call it before they know which version to request. + Its responses carry neither `CG-Version-Served` nor `Vary: CG-Version`. + It requires no stronger authentication than the API's required routes, and SHOULD be readable without authentication. + Fields are only ever added to `data`; clients ignore fields they don't recognize. + """) + @get + read(): Responses.VersionDiscoveryResponse; +} diff --git a/lib/core/lib/core/types.tsp b/lib/core/lib/core/types.tsp index 006fec8c4..e94ac965f 100644 --- a/lib/core/lib/core/types.tsp +++ b/lib/core/lib/core/types.tsp @@ -61,6 +61,15 @@ scalar duns extends string; @Versioning.added(CommonGrants.Versions.v0_5) scalar nonEmptyString extends string; +/** A published CommonGrants protocol version, such as `0.6.0` + * + * A full `MAJOR.MINOR.PATCH` version with no `v` prefix and no leading zeros. + */ +@example("0.6.0") +@pattern("^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$") +@Versioning.added(CommonGrants.Versions.v0_6) +scalar protocolVersion extends string; + // ######################################## // Numeric types // ######################################## diff --git a/lib/core/lib/main.tsp b/lib/core/lib/main.tsp index 364e20f1e..853625b5b 100644 --- a/lib/core/lib/main.tsp +++ b/lib/core/lib/main.tsp @@ -21,4 +21,5 @@ enum Versions { v0_3: "0.3.0", v0_4: "0.4.0", v0_5: "0.5.0", + v0_6: "0.6.0", } diff --git a/lib/python-sdk/tests/schemas/test_award_inventory.py b/lib/python-sdk/tests/schemas/test_award_inventory.py index 0206da88a..3e7e5dff7 100644 --- a/lib/python-sdk/tests/schemas/test_award_inventory.py +++ b/lib/python-sdk/tests/schemas/test_award_inventory.py @@ -195,9 +195,9 @@ def wire_shape(model: type[BaseModel]) -> tuple[set[str], set[str]]: return keys, required -def test_core_baseline_is_v0_5(): - assert (SCHEMA_DIR.parents[1] / "openapi" / "openapi.0.5.0.yaml").exists() - assert not list((SCHEMA_DIR.parents[1] / "openapi").glob("openapi.0.[6-9]*.yaml")) +def test_core_baseline_is_v0_6(): + assert (SCHEMA_DIR.parents[1] / "openapi" / "openapi.0.6.0.yaml").exists() + assert not list((SCHEMA_DIR.parents[1] / "openapi").glob("openapi.0.[7-9]*.yaml")) def test_inventory_classifies_the_whole_award_closure(): diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 67498fd42..77f4fe15e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -120,7 +120,7 @@ importers: version: 8.70.1(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3) vitest: specifier: 'catalog:' - version: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) lib/cli: dependencies: @@ -151,6 +151,9 @@ importers: openapi-types: specifier: ^12.1.3 version: 12.1.3 + semver: + specifier: ^7.7.4 + version: 7.8.5 swagger-ui-express: specifier: ^5.0.1 version: 5.0.1(express@4.22.3(supports-color@10.2.2)) @@ -179,6 +182,9 @@ importers: '@types/node': specifier: 'catalog:' version: 22.20.4 + '@types/semver': + specifier: ^7.7.1 + version: 7.8.0 '@types/supertest': specifier: ^7.2.1 version: 7.2.1 @@ -229,7 +235,7 @@ importers: version: 8.70.1(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3) vitest: specifier: 'catalog:' - version: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) lib/core: devDependencies: @@ -362,7 +368,7 @@ importers: version: 8.70.1(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3) vitest: specifier: 'catalog:' - version: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) website: dependencies: @@ -371,13 +377,13 @@ importers: version: 15.5.2(@types/json-schema@7.0.15) '@astrojs/cloudflare': specifier: ^14.4.0 - version: 14.4.0(@types/node@22.20.4)(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(esbuild@0.28.2)(tsx@4.23.15)(wrangler@4.152.0(@types/node@22.20.4))(yaml@2.9.1) + version: 14.4.0(@types/node@22.20.4)(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(esbuild@0.28.2)(tsx@4.23.15)(wrangler@4.152.0(@types/node@22.20.4))(yaml@2.9.1) '@astrojs/react': specifier: ^6.0.6 version: 6.0.6(@types/node@22.20.4)(@types/react-dom@18.3.7(@types/react@18.3.28))(@types/react@18.3.28)(esbuild@0.28.2)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(supports-color@10.2.2)(tsx@4.23.15)(yaml@2.9.1) '@astrojs/starlight': specifier: ^0.42.6 - version: 0.42.6(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3) + version: 0.42.6(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3) '@jsonforms/core': specifier: ^3.8.0 version: 3.8.0 @@ -397,8 +403,8 @@ importers: specifier: ^8.20.0 version: 8.20.0 astro: - specifier: ~7.4.0 - version: 7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + specifier: ~7.4.12 + version: 7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) js-yaml: specifier: ^4.3.2 version: 4.3.2 @@ -434,8 +440,8 @@ importers: version: 4.6.7 devDependencies: '@astrojs/check': - specifier: ^0.9.10 - version: 0.9.10(@emnapi/runtime@1.11.3)(prettier-plugin-astro@0.14.1)(prettier@3.9.9)(typescript@6.0.3) + specifier: ^0.9.12 + version: 0.9.12(prettier-plugin-astro@0.14.1)(prettier@3.9.9)(typescript@6.0.3) '@axe-core/playwright': specifier: ^4.14.0 version: 4.14.0(playwright-core@1.64.1) @@ -507,13 +513,13 @@ importers: version: 0.14.1 starlight-links-validator: specifier: ^0.27.0 - version: 0.27.0(@astrojs/starlight@0.42.6(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3))(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2) + version: 0.27.0(@astrojs/starlight@0.42.6(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3))(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2) typescript-eslint: specifier: 'catalog:' version: 8.70.1(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3) vitest: specifier: catalog:website - version: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + version: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) wrangler: specifier: ^4.152.0 version: 4.152.0(@types/node@22.20.4) @@ -542,12 +548,12 @@ packages: peerDependencies: openapi-types: '>=7' - '@astrojs/astro2tsx@0.1.2': - resolution: {integrity: sha512-Uj/M9zbrhu5cIZEvWAGTbQJRKSxXWJ/E59BZwt7F+chrKhbfttW+9rkS/l+1QxoJP1KU3UnpM62M7yszfAI0WA==} + '@astrojs/astro2tsx@0.1.4': + resolution: {integrity: sha512-5dJqY4i1AlXxcsSFHkaegnrgdVs9J4U93y/YF0xmvmSOcNYVQnf4db3IhvqHZ5v8biLPlPlFmlYsqHj0c4/ZSA==} engines: {node: ^20.19.0 || >=22.12.0} - '@astrojs/check@0.9.10': - resolution: {integrity: sha512-zgx/UQMozdjOa3bOxjgeCFdtpE3c9rRX6xHwa+2QXvy8z8Akifu2AtubHyv/zzC2znO8dl8fFWL4K+Ba9kS8HQ==} + '@astrojs/check@0.9.12': + resolution: {integrity: sha512-hazpqxIfZWj2VhyPyR0pOEQ/IhFDM/2nIApL96zMXABdD8NrUKYDmhxTy7h+drTDl9MQG/Sd1ET/4amadVJUUA==} hasBin: true peerDependencies: typescript: ^5.0.0 || ^6.0.0 @@ -638,14 +644,14 @@ packages: '@astrojs/internal-helpers@0.11.0': resolution: {integrity: sha512-3rzxJ+xbo0+8YyqOzLziIN32wmsHdCjEVz2sGOpRxJ+Ben/KiLph4ItxBy1abEL+E8fkRzqjg0rfXmaHJGw9JA==} - '@astrojs/internal-helpers@0.12.0': - resolution: {integrity: sha512-pKPuwCDtO0L7zgmt1JGd9X4Aes1+0SX3IEBSqBNPHsScYdPMlfmed3Y7DTbXyF7E+8ylnb563o/0OzGQPOFehw==} - '@astrojs/internal-helpers@0.13.0': resolution: {integrity: sha512-20jxQqnSmpskcGyad7N5l6Xf1gz0UCa6lNde44bEBdaXGpncEYfAZJ142r2ZgzBaG4dUyzGmhqZWv1INU2eiHQ==} - '@astrojs/language-server@2.17.2': - resolution: {integrity: sha512-WzqCBYo0RtKrkPLPMnTz2+UOQPosaFhoG/PvoSyPIgBU0BKeS6qeaYv7Rscq7P1LxJdoN0VosQF2h2TZTsIGHg==} + '@astrojs/internal-helpers@0.13.2': + resolution: {integrity: sha512-SWiNS+OMrhwWYzJENTekHUyUCMKB+tdU6D4v1ZNIU1ZHh2mScQ8WIs0J6AJ8KPXkIrs9+EZU7Rm2CstfThyVnw==} + + '@astrojs/language-server@2.17.3': + resolution: {integrity: sha512-QIAFu1e/4quJMTPdmBOm+ZPXc5NDGZE4/YQjgR3EgjhGLl/tdidaWJDr5WmO2lesVc+BW1qN/xNBURmuePDG2A==} hasBin: true peerDependencies: prettier: ^3.0.0 @@ -656,15 +662,12 @@ packages: prettier-plugin-astro: optional: true - '@astrojs/markdown-satteri@0.4.3': - resolution: {integrity: sha512-PFbEHPnwUlLvpXd7RXrrKM+j12akF4bG+DSuNuoN+3eiwjOwp4HaPi+QQdbkBV7QEYXmzyKca50OJsmGxhNIUA==} + '@astrojs/markdown-satteri@0.4.10': + resolution: {integrity: sha512-3h/wheVjZIcP/m295nkiUjOvCsCs6QpvZ3l4BfDU4ghNQcrcFrNVu1+K+I+YT61hH9tuCDQiGdF8QDzfDoG42w==} - '@astrojs/markdown-satteri@0.4.4': - resolution: {integrity: sha512-Byhe9CAiGFJrhMACKpgN/FPf4lcwapqwFQAB7E1sPELTEJINfBIpgnEYOBTXzr//fvSSNhfp/X3AqN4mUV9p+A==} - - '@astrojs/mdx@8.0.3': - resolution: {integrity: sha512-SmwnVrGZSohDG0B9LXiAPbR6fe9TOumli9Vw/9zo815xGTeB1T3Fqt6HEClmBsVwIKFg/ccos4TgjZAedvg7zA==} - engines: {node: '>=22.12.0'} + '@astrojs/mdx@8.1.6': + resolution: {integrity: sha512-Zq4iblpzpboFbmdLhPy8Pd9z6yGDpSXkTO+KCeV8Ugr5pDBxoFD0LJqw7MKHMEzw/0Y7Id8jIpNlm7pQhT118g==} + engines: {node: '>=22.23.4'} peerDependencies: '@astrojs/markdown-remark': ^7.3.0 '@astrojs/markdown-satteri': ^0.4.0 @@ -673,13 +676,9 @@ packages: '@astrojs/markdown-remark': optional: true - '@astrojs/prism@4.0.2': - resolution: {integrity: sha512-KTivpmnz6lDsC6o9H4+DNm2SrE/GHzw8cNAvEJwAvUT+eoaEnn/4NtbDNfRRaxaJHdp15gf+tfHAWiXR4wB3BA==} - engines: {node: '>=22.12.0'} - - '@astrojs/prism@4.1.0': - resolution: {integrity: sha512-zvRaL3MKTAXWfVQrHAlYtocRZWXBM6ruF3Bl7Lc7QgFHLRTfwMKo33KczlkvkXDY+qcytKhAWOT9dwUUYLUxAw==} - engines: {node: '>=22.22.0'} + '@astrojs/prism@4.1.2': + resolution: {integrity: sha512-jMrUEpFDarDO1KWPvVc9eSa8DSfwBlwEOHwX+8zvZQpiqXRGDxFnOXHsYqV6DP7w+0qIgTr98gS1GdQlm8ypWg==} + engines: {node: '>=22.23.4'} '@astrojs/react@6.0.6': resolution: {integrity: sha512-TQ9G2m2tIx9c105GmvjRAcTk+kV0QER5MsEPKUbK1Jm8SBYKzIzR89xh4L2vXAxI2zMfTMmsR7vln1TOLZpckw==} @@ -690,6 +689,9 @@ packages: react: ^17.0.2 || ^18.0.0 || ^19.0.0 react-dom: ^17.0.2 || ^18.0.0 || ^19.0.0 + '@astrojs/runtime@0.1.1': + resolution: {integrity: sha512-2Tr9IJ4aQBPDFzlSLq139eWS9OZnuhL0yU2al8cCpnTE/RszygSyGIP8piBmEio1zDUaItb/+YxxsrmldUCBmg==} + '@astrojs/sitemap@3.7.4': resolution: {integrity: sha512-LbKNC24bdUWcQf/pThB6qLlSqHojxGjZDURIzFocY8rlWnAn2t74nnhnK6S5x0NHriHoAduLEpVjRykmeGiVvA==} @@ -702,13 +704,18 @@ packages: '@astrojs/markdown-remark': optional: true - '@astrojs/telemetry@3.4.0': - resolution: {integrity: sha512-Qt2T6RGtYacyV8OZU3IcyFbsp69s6qIcnWvQvn7/p9MKebPCpEswP5Ji4RhifG3DfeBX7e07Pjj5smkd+Tfp7Q==} - engines: {node: '>=22.22.0'} + '@astrojs/telemetry@3.4.2': + resolution: {integrity: sha512-2JOMRUxJrBSfiVDfeKLv1wBmvSIx1Y6u2YEO8awZ9qSq3u/rNAiUyFdOYi8dHv91kHrmYEQX7pRDw0J4xyj3UA==} + engines: {node: '>=22.23.4'} '@astrojs/underscore-redirects@1.0.4': resolution: {integrity: sha512-sD3bn7i2yC+ocxlhCTshdg3gUM471Nag3wgyHilA+kpmufokvmUu1p5Mw5GT5Xp8SPC1Nlq0BJAgV/lslnWvRw==} + '@astrojs/vite-plugin-astro@0.1.3': + resolution: {integrity: sha512-yj+xGnr3HeHUtIdra/tWizJuisBoxAuWlBTElMlf22FpSxinrTwTl/dqftG0D2BsQTcn4/shgCCUwcnkcZ8buA==} + peerDependencies: + vite: ^8.3.3 + '@astrojs/yaml2ts@0.2.4': resolution: {integrity: sha512-8oddpOae35pJsXPQXhTkM0ypfKPskVsh2bCxRtbf7e+/Epw2nReakFYpLKjZMEr75CsoF203PMnCocpfz0s69A==} @@ -813,55 +820,114 @@ packages: resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==} engines: {node: '>=18'} + '@bruits/satteri-android-arm64@0.11.7': + resolution: {integrity: sha512-ej+1rIKs+yb6/OtcIe1SO22OXjJV0qqUopl5VNZF8Sqc/Pj4m1DXoqBQsPxW5OUYYiDUymIy6hnnn8M78VYk2w==} + cpu: [arm64] + os: [android] + '@bruits/satteri-darwin-arm64@0.10.5': resolution: {integrity: sha512-27KTVl4TJkVahMy/ohyA7qd4938G5UNneFUz/PsScYfpIhj0IVAS23mpcJXdPF44sa6nva198lmV/cKIb2YPyA==} cpu: [arm64] os: [darwin] + '@bruits/satteri-darwin-arm64@0.11.7': + resolution: {integrity: sha512-yllQOX1kVWrwqL7tamQlp4NP0loIb4KuadjuNrAe4JEOerHpgYISPRDb8DqLipgvP7Ks4e87LydZpdakMR1rhQ==} + cpu: [arm64] + os: [darwin] + '@bruits/satteri-darwin-x64@0.10.5': resolution: {integrity: sha512-IjnLe3nKspq6qaeqGgjT7MT8VrTV74yWRlaag7ZdNsI8TDAYZ0iPxMCo+9KQZHUk5EyVB+reBI/PFWL5KuFw9Q==} cpu: [x64] os: [darwin] + '@bruits/satteri-darwin-x64@0.11.7': + resolution: {integrity: sha512-RMQrKzEZRZSiYyLFifiSuk0nBH6uAY1TVMNR/h/aE4rr2OS6l82e4MJTpC6H/tqSMoE+3CwbkUKBQGLHIweYlg==} + cpu: [x64] + os: [darwin] + + '@bruits/satteri-freebsd-x64@0.11.7': + resolution: {integrity: sha512-EFlqw+RDRo3wYdy1ZSR/dNYhfWjuZL86PYwRcpLWWEZskjfpNnhIdxS13Xw2QJE1hSjTGVq4aZaVvlUjoj8p5A==} + cpu: [x64] + os: [freebsd] + '@bruits/satteri-linux-arm64-gnu@0.10.5': resolution: {integrity: sha512-glkYXZCJywjP13v67eAyAMSJdF+ncvEbYvgi/wOtffL9tQ27lr/zsyzUfgs+ovjJ9d8JNQKiXeiArJcX8PJL9w==} cpu: [arm64] os: [linux] libc: [glibc] + '@bruits/satteri-linux-arm64-gnu@0.11.7': + resolution: {integrity: sha512-aeH365GHaqv01wRSiHaGUlpL28U8e9UnV9LxjIF6BOyTj71/M5bop4HKomcis4VxFZjd68fDqNyU22yFkF/h7A==} + cpu: [arm64] + os: [linux] + libc: [glibc] + '@bruits/satteri-linux-arm64-musl@0.10.5': resolution: {integrity: sha512-yWdgG1g17Nh2QyGVlFUxGRa3FEFwiMcpZEyMNWkbM3deC94cmVc+/i9OuyFpdKuWo3GkgoCtYVOoxk1uCnCZIA==} cpu: [arm64] os: [linux] libc: [musl] + '@bruits/satteri-linux-arm64-musl@0.11.7': + resolution: {integrity: sha512-72WlBhuwOHm+2Nv4Qf1WzfS75PHOLz81sYkDJnmj0Rm2C4Xax5faSiTDt7vWo1IcK6rDlkuRDNnWIw8uIKWuVQ==} + cpu: [arm64] + os: [linux] + libc: [musl] + '@bruits/satteri-linux-x64-gnu@0.10.5': resolution: {integrity: sha512-FVaLoPT1fBgGl0J+AYebyyXJYBachGl8Oyyrf1lye4RTqCB4S0Gwkj1uM9RJyThUOvx5VUmAT1CnNh1SFHA+kw==} cpu: [x64] os: [linux] libc: [glibc] + '@bruits/satteri-linux-x64-gnu@0.11.7': + resolution: {integrity: sha512-gDp4v1jjckeNCetLtrMUfDV4CKGYL6fayDPdoaQq09nkDCSrclxEFK7kAmRuHhoalgsao4bZMFqQr3HQtN2NEQ==} + cpu: [x64] + os: [linux] + libc: [glibc] + '@bruits/satteri-linux-x64-musl@0.10.5': resolution: {integrity: sha512-EHpVAx2bqW3GINHTKkljtxVfQmVDGWIuwOYOP5YghTj+0PkBa2o8oKPRtQ9Kbsr1Fye8jtUcDjhwj2jMNugZKg==} cpu: [x64] os: [linux] libc: [musl] + '@bruits/satteri-linux-x64-musl@0.11.7': + resolution: {integrity: sha512-zqzSpQLA6V3J/TO2Vjuc1VRQPIQQdoSYmzKKFL+3GwGlbXiFQP2ZUDSLw9xlm0tTKXkCM9ANr4jMiDASZ+JGUw==} + cpu: [x64] + os: [linux] + libc: [musl] + '@bruits/satteri-wasm32-wasi@0.10.5': resolution: {integrity: sha512-ypz8c/Zmipxp4IoeDa228Gstv6TLzVmNs3yC6wKCoNSOjx1iwpgzu87Y3hTkXFdwChVGU85qeUDuOIarGUZQLw==} engines: {node: '>=14.0.0'} cpu: [wasm32] + '@bruits/satteri-wasm32-wasi@0.11.7': + resolution: {integrity: sha512-L46f6rtlaBR4fsTWGCTFcXtbtka2GyM3l9TsmE0FgTxjXGq+sndYg5X3hzlhWDkNvJpRtCHCmgTRJ5+cIi4o3A==} + engines: {node: '>=14.0.0'} + cpu: [wasm32] + '@bruits/satteri-win32-arm64-msvc@0.10.5': resolution: {integrity: sha512-siTV88nb0LRqNpkL2gXboqCwVdq95sLtzMHS1/3eONV2gLbB3NAK46wmSMvCO/yquBvI2lvaFIfd8P12ecsxBw==} cpu: [arm64] os: [win32] + '@bruits/satteri-win32-arm64-msvc@0.11.7': + resolution: {integrity: sha512-R2+o6EbJK4pqbd086H9BGUVYAyZ5F6FnShfoyRIu0Zu9DTE3H6EU/Z+ua7p9dmYf6JQQbE9DCwwavi4xiaGAhQ==} + cpu: [arm64] + os: [win32] + '@bruits/satteri-win32-x64-msvc@0.10.5': resolution: {integrity: sha512-C3IfPvfvMXmlzBxaMPKFS1XiuV9pu2mC7YqkPk7PSvTgPZ8gbdASIpHpztDLvTTQjqZ0z1Ol8tK5X+V6XXC0wQ==} cpu: [x64] os: [win32] + '@bruits/satteri-win32-x64-msvc@0.11.7': + resolution: {integrity: sha512-OIyBFJ35uMu5CH5RWnIR3bKsZwScKZ7vXmhCohZ+qonT1SkxmHCEf4H8YRWThRL2EXdVDjkjhfOsaiA4O24Vvw==} + cpu: [x64] + os: [win32] + '@cacheable/memory@2.2.0': resolution: {integrity: sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==} @@ -1223,18 +1289,27 @@ packages: '@emnapi/core@1.11.3': resolution: {integrity: sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==} + '@emnapi/core@2.0.0-beta.2': + resolution: {integrity: sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==} + '@emnapi/runtime@1.11.1': resolution: {integrity: sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==} '@emnapi/runtime@1.11.3': resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==} + '@emnapi/runtime@2.0.0-beta.2': + resolution: {integrity: sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==} + '@emnapi/wasi-threads@1.2.2': resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==} '@emnapi/wasi-threads@1.2.3': resolution: {integrity: sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==} + '@emnapi/wasi-threads@2.2.0': + resolution: {integrity: sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==} + '@esbuild/aix-ppc64@0.28.2': resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} engines: {node: '>=18'} @@ -1773,6 +1848,20 @@ packages: '@emnapi/core': ^1.7.1 || ^2.0.0-alpha.4 '@emnapi/runtime': ^1.7.1 || ^2.0.0-alpha.4 + '@napi-rs/wasm-runtime@1.2.6': + resolution: {integrity: sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} + peerDependencies: + '@emnapi/core': ^1.7.1 || 2.0.0-beta.2 + '@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2 + + '@napi-rs/wasm-runtime@1.2.7': + resolution: {integrity: sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} + peerDependencies: + '@emnapi/core': ^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3 + '@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3 + '@noble/hashes@1.8.0': resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} engines: {node: ^14.21.3 || >=16} @@ -1786,6 +1875,9 @@ packages: '@oxc-project/types@0.154.0': resolution: {integrity: sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==} + '@oxc-project/types@0.156.0': + resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==} + '@pagefind/darwin-arm64@1.5.2': resolution: {integrity: sha512-MXpI+7HsAdPkvJ0gk9xj9g541BCqBZOBbdwj9g6lB5LCj6kSV6nqDSjzcAJwvOsfu0fjwvC8hQU+ecfhp+MpiQ==} cpu: [arm64] @@ -1846,36 +1938,72 @@ packages: cpu: [arm] os: [android] + '@rolldown/binding-android-arm-eabi@1.2.19': + resolution: {integrity: sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + '@rolldown/binding-android-arm64@1.2.14': resolution: {integrity: sha512-QiVxHofl6A8lQU7WAtOUY4QMVZXohxwz7WJJoeh8NBEUyKfIkMRKhYyq8az/1RypNiIXzNTtiS6KwHz0erxYRQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [android] + '@rolldown/binding-android-arm64@1.2.19': + resolution: {integrity: sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + '@rolldown/binding-darwin-arm64@1.2.14': resolution: {integrity: sha512-lTQOzHuBIooh3jIr5XINQkjPGEuGy+Dsy0meXDr6Sjty0b99kYgGh4uBC/8mJX1T0kC8d6S0aPP1Y+bHkh6aBw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [darwin] + '@rolldown/binding-darwin-arm64@1.2.19': + resolution: {integrity: sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + '@rolldown/binding-darwin-x64@1.2.14': resolution: {integrity: sha512-hyMKEGatjmBYCs/Q4sbIcL/GqpFEqsX3wc+HYVQ/85A4rxc1o7rPm4DUI4GV4k/h0ITddwFSGpqQunI14GXjTA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [darwin] + '@rolldown/binding-darwin-x64@1.2.19': + resolution: {integrity: sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + '@rolldown/binding-freebsd-x64@1.2.14': resolution: {integrity: sha512-u371GbXoVXrEgP20PwzoGNOdAOqAMhzo19JzzY+V4YmmnC+DTOoqdbMu+O+54emM59Mik/UdrtWgcuEDKWRPKA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [freebsd] + '@rolldown/binding-freebsd-x64@1.2.19': + resolution: {integrity: sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + '@rolldown/binding-linux-arm-gnueabihf@1.2.14': resolution: {integrity: sha512-BqwKsdZQf6EqVWr8fv2MrDYzAvOZ7+NYFSJESRGs87fkseEhs0TU9TXgRJTkZoRRkxTizyEg1LKUXfU3/78uqg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm] os: [linux] + '@rolldown/binding-linux-arm-gnueabihf@1.2.19': + resolution: {integrity: sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + '@rolldown/binding-linux-arm64-gnu@1.2.14': resolution: {integrity: sha512-SD9kY8M009x/7s57Z1dgUVlP5+uYBgKQK0Tkr1WIWngrtUJmRCW1RJFMY7QDla2khXhmg2i5Io7MUjcmZNZ/KQ==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1883,6 +2011,13 @@ packages: os: [linux] libc: [glibc] + '@rolldown/binding-linux-arm64-gnu@1.2.19': + resolution: {integrity: sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + '@rolldown/binding-linux-arm64-musl@1.2.14': resolution: {integrity: sha512-BJ2CL19M6uuWesMgnqJzgxoI+N+eV7b0A9O9vLV42y+gitC41fNa8KElau1tHVzuLWX5GzEuxMPhAO0tQXQMkg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1890,6 +2025,13 @@ packages: os: [linux] libc: [musl] + '@rolldown/binding-linux-arm64-musl@1.2.19': + resolution: {integrity: sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + '@rolldown/binding-linux-ppc64-gnu@1.2.14': resolution: {integrity: sha512-4+Kl8daPV8NDHaD7mfCcc1pRM+Qg7ab8DyMm5FG5WoZgv4h2i3KFN1CybYBNbQqmuYm7ftJLvmMI1eHYJ22S/Q==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1897,6 +2039,13 @@ packages: os: [linux] libc: [glibc] + '@rolldown/binding-linux-ppc64-gnu@1.2.19': + resolution: {integrity: sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + '@rolldown/binding-linux-s390x-gnu@1.2.14': resolution: {integrity: sha512-V/h8ePq1fKDrmtFMz6xcCN3DKvuvMRrwwD1q0PkBeeo4DpK64biaKvqWGVxqCeYKqeRk7gE7/iKPxLCn08O97A==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1904,6 +2053,13 @@ packages: os: [linux] libc: [glibc] + '@rolldown/binding-linux-s390x-gnu@1.2.19': + resolution: {integrity: sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + '@rolldown/binding-linux-x64-gnu@1.2.14': resolution: {integrity: sha512-WxalXzgrLVpKC93xfpaJ3gCXUWzeCr+FRCbDVD2mUAy4L6Vo3lNVz0epUEUpxPWJkLNYUwM4OSIikv36OJ9mLg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1911,6 +2067,13 @@ packages: os: [linux] libc: [glibc] + '@rolldown/binding-linux-x64-gnu@1.2.19': + resolution: {integrity: sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + '@rolldown/binding-linux-x64-musl@1.2.14': resolution: {integrity: sha512-3G3tnAmTpdk9jO3GQtyHXqeFD2SlecfTws/Y3M2mmj9nMBwwuLT4kur8sZKeu7ENUHSpVO3cIsm5A52LEWWwlg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1918,24 +2081,54 @@ packages: os: [linux] libc: [musl] + '@rolldown/binding-linux-x64-musl@1.2.19': + resolution: {integrity: sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + '@rolldown/binding-openharmony-arm64@1.2.14': resolution: {integrity: sha512-qyr5XiNGxm2ytx17vvtcJ9nXn6v1gENETi503bJx3OGwZ1tSonj7BosxbMa/xeAfSl5iS9X6KjEWYXLu6v1L7Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [openharmony] + '@rolldown/binding-openharmony-arm64@1.2.19': + resolution: {integrity: sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@rolldown/binding-wasm32-wasi@1.2.19': + resolution: {integrity: sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==} + engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} + cpu: [wasm32] + '@rolldown/binding-win32-arm64-msvc@1.2.14': resolution: {integrity: sha512-oA4o5o0S2yB199YyYXDzKUv1Z56Rc+mgOjwm7Z/vJ9Z8igiDPYvoOuDyo6g7AK/ZaF09nPhDKVnGBcYHO11GXA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [win32] + '@rolldown/binding-win32-arm64-msvc@1.2.19': + resolution: {integrity: sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + '@rolldown/binding-win32-x64-msvc@1.2.14': resolution: {integrity: sha512-9mE94bf2GZUaR/fUSXCMpBoWkctu421Mi0ORpm4zqfbkjKep7RxzPFa5etcGs5h+2KApoWBOA/hAJa/7saGgEQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [win32] + '@rolldown/binding-win32-x64-msvc@1.2.19': + resolution: {integrity: sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@rolldown/pluginutils@1.0.0-rc.3': resolution: {integrity: sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q==} @@ -2001,33 +2194,64 @@ packages: resolution: {integrity: sha512-6CIgwq+bt2JZ3OSjb/nBkkwEf/CfpHcbam+Mg5Pllco7HAGRQ2/EFhZrrJtbyNTgKwknfVS+llsXGygiDGwJWw==} engines: {node: '>=20'} + '@shikijs/core@4.6.0': + resolution: {integrity: sha512-bfd4OKgvoyXYiYmMRuleA656P4V7M/Du9lcTl38Ngm6KszMj7bq4J1IGZwSYR4c95Tv5UQALtYNWUwaI9UT3xw==} + engines: {node: '>=20'} + '@shikijs/engine-javascript@4.5.0': resolution: {integrity: sha512-Ed6UdEj84LyYkwnxM5CvSMWAD+id9ExTYri0/+x41U9zrgNifPSS9lZm0JqBP0VfYI8yr8tY5nbNq9+p9R0kFA==} engines: {node: '>=20'} + '@shikijs/engine-javascript@4.6.0': + resolution: {integrity: sha512-K0oqxFoL+kEMdz89mHLFO15Tsbv3kFZ6WR1cXZKMvLSc+oqaM00A6pyga1qSeXB22dP0tTiSApRcGBaKWsEccg==} + engines: {node: '>=20'} + '@shikijs/engine-oniguruma@4.5.0': resolution: {integrity: sha512-dKVmbJecVdB9recl8a/CU4jdpNXyjJQrIcesIkpS70s5HS02ohpnCSpMUbotPnEUzbAcLQ+S4hwZYbkBBiTcJw==} engines: {node: '>=20'} + '@shikijs/engine-oniguruma@4.6.0': + resolution: {integrity: sha512-aggd6Q7SuJOXNnsUbfG2XesxBJKBMAw/PDTUo9PyRjMaaJJ2dNrI+q0C+25ARXAK9yLHAlwxc9oRT2u68YKZ7w==} + engines: {node: '>=20'} + '@shikijs/langs@4.5.0': resolution: {integrity: sha512-wwBTqwduXSz0X4v9Qa2EWeFaYJEw1clCncWjoRNQRbVDu3SPRTRWucnouYapKj3b8Q+sk/41Vbc4B5c8nuYzLA==} engines: {node: '>=20'} + '@shikijs/langs@4.6.0': + resolution: {integrity: sha512-1yMEX3oCVV54LUq/ovfpRkDQoYDkcvjSWFFa/YLUDMiSoRzMi2uxLJYbv41ahT8Lu9lFMaa7hecd3Q39trqUyg==} + engines: {node: '>=20'} + '@shikijs/primitive@4.5.0': resolution: {integrity: sha512-UM7ShlA8oz0OWxLLO8BmO9Ip6fVqdkt8yF0EH7nOCqHfrx1eEAzF0ZUVK7L+I8NEgeu1PEWSRlxaiPPeCb4iDg==} engines: {node: '>=20'} + '@shikijs/primitive@4.6.0': + resolution: {integrity: sha512-c54+TQEo9ToqgfL/AU8FpjnV09+GA9Oa7M5ROkkXteZfp5XzpAJGXjjvZQFQioJOwm/w/6Z3lIzQstAkl8coag==} + engines: {node: '>=20'} + '@shikijs/themes@4.5.0': resolution: {integrity: sha512-zGb87H3UBbpuI4yoh5UguB1XbU+2BDU3kflM7UfZ+Cy2hWo9lBtqjSVK20gmLY6ukYl040hAypGXMgud9vul8Q==} engines: {node: '>=20'} + '@shikijs/themes@4.6.0': + resolution: {integrity: sha512-qHAVAs80RiGD+IRuH9G+JPDOEc9A/kHsng4EzCUCwB9bLzW6Z0y9WETh2YyCcADJBmfrIaJ1Jp7KBNP6FHkgtQ==} + engines: {node: '>=20'} + '@shikijs/types@4.5.0': resolution: {integrity: sha512-drtPrtD8N0DENyD2cyt6Ajy+IWsiCLgMxODwLTpvH1UsN6a9jf90tNTPjqwHvA+0Lzu9e0txk8DjfqH1p9UJRw==} engines: {node: '>=20'} + '@shikijs/types@4.6.0': + resolution: {integrity: sha512-+ENG1adsKt/X7cRYw1Nl7BEpBmPOjmQ7bR/eGmHuMlT8gtOFf3KEi5l31DJYyAWhW6Y6bjP1plU7FmaxWGENFw==} + engines: {node: '>=20'} + '@shikijs/vscode-textmate@10.0.2': resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==} + '@shikijs/vscode-textmate@10.1.0': + resolution: {integrity: sha512-cVBuhDQjBZaNMTwBquYfPydrUP+E3hE6oYGasx8h6ZrODIM7/r+gxLDXdd66oszbrggZHEntdE6j+5gYIVyMWQ==} + '@sindresorhus/is@7.2.0': resolution: {integrity: sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==} engines: {node: '>=18'} @@ -2166,6 +2390,9 @@ packages: '@types/sax@1.2.7': resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==} + '@types/semver@7.8.0': + resolution: {integrity: sha512-1mAINjtQCXXeLkJ9ehXkwOcBpqtLxiVtKhpUf83DdRNdQKV0iXZpaHYqRr7nj+wvxuJzoAmAwXI+sCNMv1CzLQ==} + '@types/send@0.17.6': resolution: {integrity: sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==} @@ -2619,9 +2846,9 @@ packages: peerDependencies: astro: ^4.0.0-beta || ^5.0.0-beta || ^3.3.0 || ^6.0.0-beta || ^7.0.0 - astro@7.4.0: - resolution: {integrity: sha512-6ThZU2bp7asGSceVcnh3r23dE88HpYN5vxtnCWYYrjr8lpQjx4eDW6/W8WgNlcc+T/b8zHmQ/EcS4DpQG4ZoOg==} - engines: {node: '>=22.22.0', npm: '>=9.6.5', pnpm: '>=7.1.0'} + astro@7.4.12: + resolution: {integrity: sha512-DKX+Ds0rqV49HrLwEB9JFrCyfvQeC16FCe1HrPK8S3osiJH/e2vQ22CHIDOpI48UaeiPbxPT26peXgGTy6w0ig==} + engines: {node: '>=22.23.4', npm: '>=9.6.5', pnpm: '>=7.1.0'} hasBin: true peerDependencies: '@astrojs/markdown-remark': ^7.3.0 @@ -2757,10 +2984,6 @@ packages: chardet@2.2.0: resolution: {integrity: sha512-rddelWYNPRrXq6PtNEN2S3f6t9ILzvqaN5pVgi4kqt9jHQaXIial9PznB5iSPVlQSLNaaH22ItWz3EJtQ10+OA==} - chokidar@4.0.3: - resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} - engines: {node: '>= 14.16.0'} - chokidar@5.0.0: resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==} engines: {node: '>= 20.19.0'} @@ -2873,8 +3096,8 @@ packages: resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==} engines: {node: '>=18'} - cookie@2.0.1: - resolution: {integrity: sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w==} + cookie@2.0.2: + resolution: {integrity: sha512-SL0cVuEdETEp7pN0FuZb01toc3vnODEfVUCooxG1SJN0yIirh7JMb9X9bvfCFf0vzzbT68RdbKDHYTiWy7a7iw==} engines: {node: '>=22'} cookiejar@2.1.4: @@ -3114,9 +3337,6 @@ packages: es-module-lexer@2.1.0: resolution: {integrity: sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==} - es-module-lexer@3.0.3: - resolution: {integrity: sha512-yWGe1O/j+almnV4hOYrmZo8u58JdnmXEMneRQAYkWtqSiT86yoMIEKF4rpqEDj52tbYl3xceBD3DQIBwcsC9Pw==} - es-module-lexer@3.0.4: resolution: {integrity: sha512-BldNY5mwkVu+cQ5Ymn3e6hB9Sx8XHx4ZevWbiUyZbfKxJxYO27Hf0wfzkxIaD5CAJMaGl3YspKELj0ff/7nCMA==} @@ -3231,9 +3451,6 @@ packages: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} - eventemitter3@5.0.4: - resolution: {integrity: sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==} - expect-type@1.3.0: resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==} engines: {node: '>=12.0.0'} @@ -3282,8 +3499,8 @@ packages: fast-xml-builder@1.3.1: resolution: {integrity: sha512-pIM/1n3ntFXKYrUZwW7QCK0gAW7XY+wzj1YMIV3tLDvPj/V+zTGJK5e3/4WJfwj0qWw2ElNXiTixda/R+3YSug==} - fast-xml-parser@5.11.2: - resolution: {integrity: sha512-R9iDuNrQYeQut46cn2r2wHKn4HYzVDvDm5J1wW+koZewykv0yuO2HChTYeZtrULyHIDM9cj9TUXloCsueCQUog==} + fast-xml-parser@5.12.0: + resolution: {integrity: sha512-/pXxRBtwxY9w8z7YbgsvIPPcPvFDsTbIkWwTQJhzNJPokj+TbN6ftmcv4j/pEQDvOCNnKGDzuk5Bo2oogIOiFg==} hasBin: true fdir@6.5.0: @@ -3479,6 +3696,9 @@ packages: hast-util-to-html@9.0.5: resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==} + hast-util-to-html@9.0.6: + resolution: {integrity: sha512-1SZUxCN3TtJAE7e2BQN2MBHsoZ1gnmi9GoCP5Di59CSWptIezSAW09yDZyVbanb78V9eCwrKqdQsjtfVTxYHWA==} + hast-util-to-string@3.0.1: resolution: {integrity: sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A==} @@ -3625,8 +3845,8 @@ packages: resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==} engines: {node: '>=18'} - is-unsafe@2.0.2: - resolution: {integrity: sha512-HgbIHPBH0KHHCcjLfGsCvhtPTVxjaAZlXjwdz7/GQC40SjSe4sfQsar8J5VFo8JOSbarkpV0OLG95bbaNd9aAQ==} + is-unsafe@2.0.3: + resolution: {integrity: sha512-ZBllczCCO267vgdFb6Tq3pv+LhHaCiGMdr+ZsuL+OopruAg7S+3ZDs1vD0RPC0uSrkjzbraxaGjtX1YBxjPeFQ==} isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -3822,6 +4042,9 @@ packages: magic-string@1.4.3: resolution: {integrity: sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==} + magic-string@1.4.5: + resolution: {integrity: sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==} + magicast@0.5.5: resolution: {integrity: sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==} @@ -3985,6 +4208,10 @@ packages: resolution: {integrity: sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==} engines: {node: '>= 18'} + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + mrmime@2.0.1: resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} engines: {node: '>=10'} @@ -4109,13 +4336,9 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} - p-queue@9.3.5: - resolution: {integrity: sha512-Lki/zhXFVmDhesBUn/yHRLW9Bte7mE7xoFHzTR8sIomV7a2z+LxYAPkGvdfidNiu4fKSfjtawixxSHcZci5QcQ==} - engines: {node: '>=20'} - - p-timeout@7.0.2: - resolution: {integrity: sha512-prbX4Z3YszrFNgH+MW5Zoeq3baXrMtP/MQnFeET90UB/GtGcGDQ5Usg9OCy6ETjTTntOw1SL2z9fMPUppN3Guw==} - engines: {node: '>=20'} + p-queue@10.0.0: + resolution: {integrity: sha512-P2wrCri3bhGLPo3kX7qYVXbo/5GvaVATU0DpO24CbeT53Y4z35t8JUWku04ERpXHUYB5rPMi3TkWE3fmJgx5rA==} + engines: {node: '>=22'} package-manager-detector@1.9.0: resolution: {integrity: sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA==} @@ -4207,6 +4430,10 @@ packages: resolution: {integrity: sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ==} engines: {node: ^10 || ^12 || >=14} + postcss@8.5.33: + resolution: {integrity: sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==} + engines: {node: ^10 || ^12 || >=14} + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -4293,10 +4520,6 @@ packages: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} engines: {node: '>= 6'} - readdirp@4.1.2: - resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} - engines: {node: '>= 14.18.0'} - readdirp@5.1.1: resolution: {integrity: sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==} engines: {node: '>= 20.19.0'} @@ -4349,6 +4572,11 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} hasBin: true + rolldown@1.2.19: + resolution: {integrity: sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + run-async@3.0.0: resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==} engines: {node: '>=0.12.0'} @@ -4371,6 +4599,9 @@ packages: satteri@0.10.5: resolution: {integrity: sha512-Ao1LKpAEa9Wdg0otgbVKViZHEq9ebdXe4DMrp3s9vQAU0HNIuHnFEuMuOcm0ZIXyV0Yzxj91NvhLpvXZJO/5ZQ==} + satteri@0.11.7: + resolution: {integrity: sha512-xDOSxkc1ew3z3IovIjmsqJaVHRXTGYJkPvx0LL/U6o90km8kSU+pmrZVvnWd5creJeE0UnvMEienlkPuYQdJaA==} + sax@1.6.1: resolution: {integrity: sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==} engines: {node: '>=11.0.0'} @@ -4382,11 +4613,6 @@ packages: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true - semver@7.7.4: - resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==} - engines: {node: '>=10'} - hasBin: true - semver@7.8.5: resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} engines: {node: '>=10'} @@ -4424,6 +4650,10 @@ packages: resolution: {integrity: sha512-OcRW72ngQvc+MSVWBRIovC/BTW589iUE/Vxav7VeM4RcY9MUjqB+IR6ILG1k9nuW6LiG/nct9uma4/MBtnZbmQ==} engines: {node: '>=20'} + shiki@4.6.0: + resolution: {integrity: sha512-imjLsVHgPuWhvpU3P+zOekvMYqnel7QmKsFC4Sn0fCuAvaaalBsxwKEsrU8Ko5BdFnZA6Go/8a0RzahS634UgA==} + engines: {node: '>=20'} + side-channel-list@1.0.1: resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==} engines: {node: '>= 0.4'} @@ -4612,8 +4842,8 @@ packages: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} - tinyps@0.5.0: - resolution: {integrity: sha512-Llu7nEtVOGHh7jok32l6+udlu+4Np5vsYVB7zeTK614coSsro2qjwte7MFt/ouLM/h4kXqbGXktSMMvMsttSDw==} + tinyps@0.5.2: + resolution: {integrity: sha512-sYhvdbpuo2rGE7u/jPUMiZz4H2LCaOodUtRD9ot4DLNFQbr884g9zozoJnxLI+1r4hXqWkmdHUl8Yig2Rllxxw==} tinyrainbow@3.1.0: resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==} @@ -4915,6 +5145,49 @@ packages: yaml: optional: true + vite@8.3.8: + resolution: {integrity: sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + '@vitejs/devtools': ^0.7.1 || ^0.8.0 + esbuild: ^0.27.0 || ^0.28.0 + jiti: '>=1.21.0' + less: ^4.0.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + '@vitejs/devtools': + optional: true + esbuild: + optional: true + jiti: + optional: true + less: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + vitefu@1.1.3: resolution: {integrity: sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==} peerDependencies: @@ -5265,31 +5538,29 @@ snapshots: call-me-maybe: 1.0.2 openapi-types: 12.1.3 - '@astrojs/astro2tsx@0.1.2(@emnapi/runtime@1.11.3)': + '@astrojs/astro2tsx@0.1.4': dependencies: '@emnapi/core': 1.11.3 + '@emnapi/runtime': 1.11.3 '@napi-rs/wasm-runtime': 1.2.4(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3) - transitivePeerDependencies: - - '@emnapi/runtime' - '@astrojs/check@0.9.10(@emnapi/runtime@1.11.3)(prettier-plugin-astro@0.14.1)(prettier@3.9.9)(typescript@6.0.3)': + '@astrojs/check@0.9.12(prettier-plugin-astro@0.14.1)(prettier@3.9.9)(typescript@6.0.3)': dependencies: - '@astrojs/language-server': 2.17.2(@emnapi/runtime@1.11.3)(prettier-plugin-astro@0.14.1)(prettier@3.9.9)(typescript@6.0.3) - chokidar: 4.0.3 + '@astrojs/language-server': 2.17.3(prettier-plugin-astro@0.14.1)(prettier@3.9.9)(typescript@6.0.3) + chokidar: 5.0.0 kleur: 4.1.5 typescript: 6.0.3 yargs: 18.2.0 transitivePeerDependencies: - - '@emnapi/runtime' - prettier - prettier-plugin-astro - '@astrojs/cloudflare@14.4.0(@types/node@22.20.4)(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(esbuild@0.28.2)(tsx@4.23.15)(wrangler@4.152.0(@types/node@22.20.4))(yaml@2.9.1)': + '@astrojs/cloudflare@14.4.0(@types/node@22.20.4)(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(esbuild@0.28.2)(tsx@4.23.15)(wrangler@4.152.0(@types/node@22.20.4))(yaml@2.9.1)': dependencies: '@astrojs/internal-helpers': 0.13.0 '@astrojs/underscore-redirects': 1.0.4 '@cloudflare/vite-plugin': 1.64.0(@types/node@22.20.4)(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(wrangler@4.152.0(@types/node@22.20.4)) - astro: 7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + astro: 7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) piccolore: 0.1.3 vite: 8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) wrangler: 4.152.0(@types/node@22.20.4) @@ -5334,7 +5605,7 @@ snapshots: dependencies: '@emnapi/core': 1.11.3 '@emnapi/runtime': 1.11.3 - '@napi-rs/wasm-runtime': 1.2.5(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3) + '@napi-rs/wasm-runtime': 1.2.7(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3) optional: true '@astrojs/compiler-binding-win32-arm64-msvc@0.5.2': @@ -5375,7 +5646,7 @@ snapshots: smol-toml: 1.9.1 unified: 11.0.5 - '@astrojs/internal-helpers@0.12.0': + '@astrojs/internal-helpers@0.13.0': dependencies: '@types/hast': 3.0.5 '@types/mdast': 4.0.4 @@ -5386,20 +5657,20 @@ snapshots: unified: 11.0.5 yaml: 2.9.1 - '@astrojs/internal-helpers@0.13.0': + '@astrojs/internal-helpers@0.13.2': dependencies: '@types/hast': 3.0.5 '@types/mdast': 4.0.4 picomatch: 4.0.7 retext-smartypants: 6.2.0 - shiki: 4.5.0 + shiki: 4.6.0 smol-toml: 1.9.1 unified: 11.0.5 yaml: 2.9.1 - '@astrojs/language-server@2.17.2(@emnapi/runtime@1.11.3)(prettier-plugin-astro@0.14.1)(prettier@3.9.9)(typescript@6.0.3)': + '@astrojs/language-server@2.17.3(prettier-plugin-astro@0.14.1)(prettier@3.9.9)(typescript@6.0.3)': dependencies: - '@astrojs/astro2tsx': 0.1.2(@emnapi/runtime@1.11.3) + '@astrojs/astro2tsx': 0.1.4 '@astrojs/yaml2ts': 0.2.4 '@volar/kit': 2.4.28(typescript@6.0.3) '@volar/language-core': 2.4.28 @@ -5420,35 +5691,23 @@ snapshots: prettier: 3.9.9 prettier-plugin-astro: 0.14.1 transitivePeerDependencies: - - '@emnapi/runtime' - typescript - '@astrojs/markdown-satteri@0.4.3': - dependencies: - '@astrojs/internal-helpers': 0.12.0 - '@astrojs/prism': 4.0.2 - github-slugger: 2.0.0 - satteri: 0.10.5 - - '@astrojs/markdown-satteri@0.4.4': + '@astrojs/markdown-satteri@0.4.10': dependencies: - '@astrojs/internal-helpers': 0.13.0 - '@astrojs/prism': 4.1.0 + '@astrojs/internal-helpers': 0.13.2 + '@astrojs/prism': 4.1.2 github-slugger: 2.0.0 - satteri: 0.10.5 - - '@astrojs/mdx@8.0.3(@astrojs/markdown-satteri@0.4.3)(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))': - dependencies: - '@astrojs/internal-helpers': 0.12.0 - '@astrojs/markdown-satteri': 0.4.3 - astro: 7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) - es-module-lexer: 3.0.3 + satteri: 0.11.7 - '@astrojs/prism@4.0.2': + '@astrojs/mdx@8.1.6(@astrojs/markdown-satteri@0.4.10)(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))': dependencies: - prismjs: 1.30.0 + '@astrojs/internal-helpers': 0.13.2 + '@astrojs/markdown-satteri': 0.4.10 + astro: 7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + es-module-lexer: 3.0.4 - '@astrojs/prism@4.1.0': + '@astrojs/prism@4.1.2': dependencies: prismjs: 1.30.0 @@ -5478,22 +5737,27 @@ snapshots: - tsx - yaml + '@astrojs/runtime@0.1.1': + dependencies: + '@oslojs/encoding': 1.1.0 + clsx: 2.1.1 + '@astrojs/sitemap@3.7.4': dependencies: sitemap: 9.0.1 zod: 4.6.7 - '@astrojs/starlight@0.42.6(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3)': + '@astrojs/starlight@0.42.6(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3)': dependencies: - '@astrojs/markdown-satteri': 0.4.3 - '@astrojs/mdx': 8.0.3(@astrojs/markdown-satteri@0.4.3)(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + '@astrojs/markdown-satteri': 0.4.10 + '@astrojs/mdx': 8.1.6(@astrojs/markdown-satteri@0.4.10)(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) '@astrojs/sitemap': 3.7.4 '@pagefind/default-ui': 1.5.2 '@types/hast': 3.0.5 '@types/js-yaml': 4.0.9 '@types/mdast': 4.0.4 - astro: 7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) - astro-expressive-code: 0.44.2(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + astro: 7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + astro-expressive-code: 0.44.2(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) bcp-47: 2.1.1 hast-util-format: 1.1.0 hast-util-select: 6.0.4 @@ -5518,7 +5782,7 @@ snapshots: - supports-color - typescript - '@astrojs/telemetry@3.4.0': + '@astrojs/telemetry@3.4.2': dependencies: ci-info: 4.4.0 dset: 3.1.4 @@ -5527,6 +5791,19 @@ snapshots: '@astrojs/underscore-redirects@1.0.4': {} + '@astrojs/vite-plugin-astro@0.1.3(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))': + dependencies: + '@astrojs/compiler-rs': 0.5.2 + '@astrojs/internal-helpers': 0.13.2 + '@astrojs/runtime': 0.1.1 + common-ancestor-path: 2.0.0 + devalue: 6.0.3 + magic-string: 1.4.3 + rolldown: 1.2.19 + smol-toml: 1.9.1 + vite: 8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + zod: 4.6.7 + '@astrojs/yaml2ts@0.2.4': dependencies: yaml: 2.9.1 @@ -5657,36 +5934,73 @@ snapshots: '@bcoe/v8-coverage@1.0.2': {} + '@bruits/satteri-android-arm64@0.11.7': + optional: true + '@bruits/satteri-darwin-arm64@0.10.5': optional: true + '@bruits/satteri-darwin-arm64@0.11.7': + optional: true + '@bruits/satteri-darwin-x64@0.10.5': optional: true + '@bruits/satteri-darwin-x64@0.11.7': + optional: true + + '@bruits/satteri-freebsd-x64@0.11.7': + optional: true + '@bruits/satteri-linux-arm64-gnu@0.10.5': optional: true + '@bruits/satteri-linux-arm64-gnu@0.11.7': + optional: true + '@bruits/satteri-linux-arm64-musl@0.10.5': optional: true + '@bruits/satteri-linux-arm64-musl@0.11.7': + optional: true + '@bruits/satteri-linux-x64-gnu@0.10.5': optional: true + '@bruits/satteri-linux-x64-gnu@0.11.7': + optional: true + '@bruits/satteri-linux-x64-musl@0.10.5': optional: true + '@bruits/satteri-linux-x64-musl@0.11.7': + optional: true + '@bruits/satteri-wasm32-wasi@0.10.5': dependencies: '@emnapi/core': 1.11.1 '@emnapi/runtime': 1.11.1 '@napi-rs/wasm-runtime': 1.2.5(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1) + '@bruits/satteri-wasm32-wasi@0.11.7': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@napi-rs/wasm-runtime': 1.2.7(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1) + optional: true + '@bruits/satteri-win32-arm64-msvc@0.10.5': optional: true + '@bruits/satteri-win32-arm64-msvc@0.11.7': + optional: true + '@bruits/satteri-win32-x64-msvc@0.10.5': optional: true + '@bruits/satteri-win32-x64-msvc@0.11.7': + optional: true + '@cacheable/memory@2.2.0': dependencies: '@cacheable/utils': 2.5.0 @@ -6032,6 +6346,12 @@ snapshots: '@emnapi/wasi-threads': 1.2.3 tslib: 2.8.1 + '@emnapi/core@2.0.0-beta.2': + dependencies: + '@emnapi/wasi-threads': 2.2.0 + tslib: 2.8.1 + optional: true + '@emnapi/runtime@1.11.1': dependencies: tslib: 2.8.1 @@ -6040,6 +6360,11 @@ snapshots: dependencies: tslib: 2.8.1 + '@emnapi/runtime@2.0.0-beta.2': + dependencies: + tslib: 2.8.1 + optional: true + '@emnapi/wasi-threads@1.2.2': dependencies: tslib: 2.8.1 @@ -6048,6 +6373,11 @@ snapshots: dependencies: tslib: 2.8.1 + '@emnapi/wasi-threads@2.2.0': + dependencies: + tslib: 2.8.1 + optional: true + '@esbuild/aix-ppc64@0.28.2': optional: true @@ -6445,7 +6775,21 @@ snapshots: '@emnapi/runtime': 1.11.1 '@tybys/wasm-util': 0.10.4 - '@napi-rs/wasm-runtime@1.2.5(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3)': + '@napi-rs/wasm-runtime@1.2.6(@emnapi/core@2.0.0-beta.2)(@emnapi/runtime@2.0.0-beta.2)': + dependencies: + '@emnapi/core': 2.0.0-beta.2 + '@emnapi/runtime': 2.0.0-beta.2 + '@tybys/wasm-util': 0.10.4 + optional: true + + '@napi-rs/wasm-runtime@1.2.7(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@tybys/wasm-util': 0.10.4 + optional: true + + '@napi-rs/wasm-runtime@1.2.7(@emnapi/core@1.11.3)(@emnapi/runtime@1.11.3)': dependencies: '@emnapi/core': 1.11.3 '@emnapi/runtime': 1.11.3 @@ -6460,6 +6804,8 @@ snapshots: '@oxc-project/types@0.154.0': {} + '@oxc-project/types@0.156.0': {} + '@pagefind/darwin-arm64@1.5.2': optional: true @@ -6504,48 +6850,100 @@ snapshots: '@rolldown/binding-android-arm-eabi@1.2.14': optional: true + '@rolldown/binding-android-arm-eabi@1.2.19': + optional: true + '@rolldown/binding-android-arm64@1.2.14': optional: true + '@rolldown/binding-android-arm64@1.2.19': + optional: true + '@rolldown/binding-darwin-arm64@1.2.14': optional: true + '@rolldown/binding-darwin-arm64@1.2.19': + optional: true + '@rolldown/binding-darwin-x64@1.2.14': optional: true + '@rolldown/binding-darwin-x64@1.2.19': + optional: true + '@rolldown/binding-freebsd-x64@1.2.14': optional: true + '@rolldown/binding-freebsd-x64@1.2.19': + optional: true + '@rolldown/binding-linux-arm-gnueabihf@1.2.14': optional: true + '@rolldown/binding-linux-arm-gnueabihf@1.2.19': + optional: true + '@rolldown/binding-linux-arm64-gnu@1.2.14': optional: true + '@rolldown/binding-linux-arm64-gnu@1.2.19': + optional: true + '@rolldown/binding-linux-arm64-musl@1.2.14': optional: true + '@rolldown/binding-linux-arm64-musl@1.2.19': + optional: true + '@rolldown/binding-linux-ppc64-gnu@1.2.14': optional: true + '@rolldown/binding-linux-ppc64-gnu@1.2.19': + optional: true + '@rolldown/binding-linux-s390x-gnu@1.2.14': optional: true + '@rolldown/binding-linux-s390x-gnu@1.2.19': + optional: true + '@rolldown/binding-linux-x64-gnu@1.2.14': optional: true + '@rolldown/binding-linux-x64-gnu@1.2.19': + optional: true + '@rolldown/binding-linux-x64-musl@1.2.14': optional: true + '@rolldown/binding-linux-x64-musl@1.2.19': + optional: true + '@rolldown/binding-openharmony-arm64@1.2.14': optional: true + '@rolldown/binding-openharmony-arm64@1.2.19': + optional: true + + '@rolldown/binding-wasm32-wasi@1.2.19': + dependencies: + '@emnapi/core': 2.0.0-beta.2 + '@emnapi/runtime': 2.0.0-beta.2 + '@napi-rs/wasm-runtime': 1.2.6(@emnapi/core@2.0.0-beta.2)(@emnapi/runtime@2.0.0-beta.2) + optional: true + '@rolldown/binding-win32-arm64-msvc@1.2.14': optional: true + '@rolldown/binding-win32-arm64-msvc@1.2.19': + optional: true + '@rolldown/binding-win32-x64-msvc@1.2.14': optional: true + '@rolldown/binding-win32-x64-msvc@1.2.19': + optional: true + '@rolldown/pluginutils@1.0.0-rc.3': {} '@rolldown/pluginutils@1.0.1': {} @@ -6629,38 +7027,78 @@ snapshots: '@types/hast': 3.0.5 hast-util-to-html: 9.0.5 + '@shikijs/core@4.6.0': + dependencies: + '@shikijs/primitive': 4.6.0 + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + '@types/hast': 3.0.5 + hast-util-to-html: 9.0.6 + '@shikijs/engine-javascript@4.5.0': dependencies: '@shikijs/types': 4.5.0 '@shikijs/vscode-textmate': 10.0.2 oniguruma-to-es: 4.3.6 + '@shikijs/engine-javascript@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + oniguruma-to-es: 4.3.6 + '@shikijs/engine-oniguruma@4.5.0': dependencies: '@shikijs/types': 4.5.0 '@shikijs/vscode-textmate': 10.0.2 + '@shikijs/engine-oniguruma@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + '@shikijs/langs@4.5.0': dependencies: '@shikijs/types': 4.5.0 + '@shikijs/langs@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + '@shikijs/primitive@4.5.0': dependencies: '@shikijs/types': 4.5.0 '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.5 + '@shikijs/primitive@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + '@types/hast': 3.0.5 + '@shikijs/themes@4.5.0': dependencies: '@shikijs/types': 4.5.0 + '@shikijs/themes@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + '@shikijs/types@4.5.0': dependencies: '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.5 + '@shikijs/types@4.6.0': + dependencies: + '@shikijs/vscode-textmate': 10.1.0 + '@types/hast': 3.0.5 + '@shikijs/vscode-textmate@10.0.2': {} + '@shikijs/vscode-textmate@10.1.0': {} + '@sindresorhus/is@7.2.0': {} '@speed-highlight/core@1.2.24': {} @@ -6814,6 +7252,8 @@ snapshots: dependencies: '@types/node': 24.19.2 + '@types/semver@7.8.0': {} + '@types/send@0.17.6': dependencies: '@types/mime': 1.3.5 @@ -6901,7 +7341,7 @@ snapshots: '@typescript-eslint/project-service@8.70.1(supports-color@10.2.2)(typescript@6.0.3)': dependencies: '@typescript-eslint/tsconfig-utils': 8.70.1(typescript@6.0.3) - '@typescript-eslint/types': 8.70.1 + '@typescript-eslint/types': 8.71.1 debug: 4.4.3(supports-color@10.2.2) typescript: 6.0.3 transitivePeerDependencies: @@ -7112,7 +7552,7 @@ snapshots: obug: 2.1.2 std-env: 4.3.0 tinyrainbow: 3.1.0 - vitest: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + vitest: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) '@vitest/eslint-plugin@1.6.27(@typescript-eslint/eslint-plugin@8.70.1(@typescript-eslint/parser@8.70.1(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3))(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3))(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3)(vitest@4.1.12)': dependencies: @@ -7122,7 +7562,7 @@ snapshots: optionalDependencies: '@typescript-eslint/eslint-plugin': 8.70.1(@typescript-eslint/parser@8.70.1(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3))(eslint@10.11.0(supports-color@10.2.2))(supports-color@10.2.2)(typescript@6.0.3) typescript: 6.0.3 - vitest: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + vitest: 4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) transitivePeerDependencies: - supports-color @@ -7135,13 +7575,13 @@ snapshots: chai: 6.2.2 tinyrainbow: 3.1.0 - '@vitest/mocker@4.1.12(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))': + '@vitest/mocker@4.1.12(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))': dependencies: '@vitest/spy': 4.1.12 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + vite: 8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) '@vitest/pretty-format@4.1.12': dependencies: @@ -7346,18 +7786,20 @@ snapshots: transitivePeerDependencies: - supports-color - astro-expressive-code@0.44.2(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)): + astro-expressive-code@0.44.2(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)): dependencies: - astro: 7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + astro: 7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) rehype-expressive-code: 0.44.2 url-extras: 0.1.0 - astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1): + astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1): dependencies: '@astrojs/compiler-rs': 0.5.2 - '@astrojs/internal-helpers': 0.13.0 - '@astrojs/markdown-satteri': 0.4.4 - '@astrojs/telemetry': 3.4.0 + '@astrojs/internal-helpers': 0.13.2 + '@astrojs/markdown-satteri': 0.4.10 + '@astrojs/runtime': 0.1.1 + '@astrojs/telemetry': 3.4.2 + '@astrojs/vite-plugin-astro': 0.1.3(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) '@capsizecss/unpack': 4.0.1 '@clack/prompts': 1.8.1 '@oslojs/encoding': 1.1.0 @@ -7365,9 +7807,7 @@ snapshots: aria-query: 5.3.2 axobject-query: 4.1.0 ci-info: 4.4.0 - clsx: 2.1.1 - common-ancestor-path: 2.0.0 - cookie: 2.0.1 + cookie: 2.0.2 devalue: 6.0.3 diff: 9.0.0 dset: 3.1.4 @@ -7379,32 +7819,32 @@ snapshots: html-escaper: 3.0.3 http-cache-semantics: 4.3.0 jsonc-parser: 3.3.1 - magic-string: 1.4.3 + magic-string: 1.4.5 magicast: 0.5.5 + mri: 1.2.0 mrmime: 2.0.1 neotraverse: 1.0.1 obug: 3.0.0 p-limit: 7.3.3 - p-queue: 9.3.5 + p-queue: 10.0.0 package-manager-detector: 1.9.0 piccolore: 0.1.3 picomatch: 4.0.7 - rolldown: 1.2.14 - shiki: 4.5.0 + rolldown: 1.2.19 + shiki: 4.6.0 smol-toml: 1.9.1 svgo: 4.1.0 tinyclip: 1.0.3 tinyexec: 1.3.1 tinyglobby: 0.2.17 - tinyps: 0.5.0 + tinyps: 0.5.2 ultrahtml: 1.7.0 unifont: 1.0.3 unstorage: 1.17.6 verkit: 0.5.0 - vite: 8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) - vitefu: 1.1.3(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + vite: 8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + vitefu: 1.1.3(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) xxhash-wasm: 1.1.0 - yargs-parser: 22.0.0 zod: 4.6.7 optionalDependencies: sharp: 0.35.5(@types/node@22.20.4) @@ -7567,10 +8007,6 @@ snapshots: chardet@2.2.0: {} - chokidar@4.0.3: - dependencies: - readdirp: 4.1.2 - chokidar@5.0.0: dependencies: readdirp: 5.1.1 @@ -7660,7 +8096,7 @@ snapshots: cookie@1.1.1: {} - cookie@2.0.1: {} + cookie@2.0.2: {} cookiejar@2.1.4: {} @@ -7760,7 +8196,7 @@ snapshots: cspell-lib: 8.19.4 fast-json-stable-stringify: 2.1.0 file-entry-cache: 9.1.0 - semver: 7.7.4 + semver: 7.8.5 tinyglobby: 0.2.15 css-select@6.0.0: @@ -7911,8 +8347,6 @@ snapshots: es-module-lexer@2.1.0: {} - es-module-lexer@3.0.3: {} - es-module-lexer@3.0.4: {} es-object-atoms@1.1.2: @@ -8063,8 +8497,6 @@ snapshots: etag@1.8.1: {} - eventemitter3@5.0.4: {} - expect-type@1.3.0: {} express@4.22.3(supports-color@10.2.2): @@ -8141,11 +8573,11 @@ snapshots: path-expression-matcher: 1.6.2 xml-naming: 0.3.0 - fast-xml-parser@5.11.2: + fast-xml-parser@5.12.0: dependencies: '@nodable/entities': 3.1.0 fast-xml-builder: 1.3.1 - is-unsafe: 2.0.2 + is-unsafe: 2.0.3 path-expression-matcher: 1.6.2 strnum: 2.5.1 xml-naming: 0.3.0 @@ -8406,6 +8838,20 @@ snapshots: stringify-entities: 4.0.4 zwitch: 2.0.4 + hast-util-to-html@9.0.6: + dependencies: + '@types/hast': 3.0.5 + '@types/unist': 3.0.3 + ccount: 2.0.1 + comma-separated-tokens: 2.0.3 + hast-util-whitespace: 3.0.0 + html-void-elements: 3.0.0 + mdast-util-to-hast: 13.2.1 + property-information: 7.2.0 + space-separated-tokens: 2.0.2 + stringify-entities: 4.0.4 + zwitch: 2.0.4 + hast-util-to-string@3.0.1: dependencies: '@types/hast': 3.0.5 @@ -8536,7 +8982,7 @@ snapshots: is-unicode-supported@2.1.0: {} - is-unsafe@2.0.2: {} + is-unsafe@2.0.3: {} isexe@2.0.0: {} @@ -8694,6 +9140,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.6.0 + magic-string@1.4.5: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + magicast@0.5.5: dependencies: '@babel/parser': 7.29.9 @@ -9000,6 +9450,8 @@ snapshots: dependencies: minipass: 7.1.3 + mri@1.2.0: {} + mrmime@2.0.1: {} ms@2.0.0: {} @@ -9075,7 +9527,7 @@ snapshots: openapi-sampler@1.7.9: dependencies: '@types/json-schema': 7.0.15 - fast-xml-parser: 5.11.2 + fast-xml-parser: 5.12.0 json-pointer: 0.6.2 openapi-types@12.1.3: {} @@ -9113,12 +9565,7 @@ snapshots: dependencies: p-limit: 3.1.0 - p-queue@9.3.5: - dependencies: - eventemitter3: 5.0.4 - p-timeout: 7.0.2 - - p-timeout@7.0.2: {} + p-queue@10.0.0: {} package-manager-detector@1.9.0: {} @@ -9204,6 +9651,12 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.2 + postcss@8.5.33: + dependencies: + nanoid: 3.3.20 + picocolors: 1.1.1 + source-map-js: 1.2.2 + prelude-ls@1.2.1: {} prettier-linter-helpers@1.0.1: @@ -9278,8 +9731,6 @@ snapshots: string_decoder: 1.3.0 util-deprecate: 1.0.2 - readdirp@4.1.2: {} - readdirp@5.1.1: {} regex-recursion@6.0.2: @@ -9349,6 +9800,28 @@ snapshots: '@rolldown/binding-win32-arm64-msvc': 1.2.14 '@rolldown/binding-win32-x64-msvc': 1.2.14 + rolldown@1.2.19: + dependencies: + '@oxc-project/types': 0.156.0 + '@rolldown/pluginutils': 1.0.1 + optionalDependencies: + '@rolldown/binding-android-arm-eabi': 1.2.19 + '@rolldown/binding-android-arm64': 1.2.19 + '@rolldown/binding-darwin-arm64': 1.2.19 + '@rolldown/binding-darwin-x64': 1.2.19 + '@rolldown/binding-freebsd-x64': 1.2.19 + '@rolldown/binding-linux-arm-gnueabihf': 1.2.19 + '@rolldown/binding-linux-arm64-gnu': 1.2.19 + '@rolldown/binding-linux-arm64-musl': 1.2.19 + '@rolldown/binding-linux-ppc64-gnu': 1.2.19 + '@rolldown/binding-linux-s390x-gnu': 1.2.19 + '@rolldown/binding-linux-x64-gnu': 1.2.19 + '@rolldown/binding-linux-x64-musl': 1.2.19 + '@rolldown/binding-openharmony-arm64': 1.2.19 + '@rolldown/binding-wasm32-wasi': 1.2.19 + '@rolldown/binding-win32-arm64-msvc': 1.2.19 + '@rolldown/binding-win32-x64-msvc': 1.2.19 + run-async@3.0.0: {} rxjs@7.8.2: @@ -9382,6 +9855,25 @@ snapshots: '@bruits/satteri-win32-arm64-msvc': 0.10.5 '@bruits/satteri-win32-x64-msvc': 0.10.5 + satteri@0.11.7: + dependencies: + '@types/estree-jsx': 1.0.5 + '@types/hast': 3.0.5 + '@types/mdast': 4.0.4 + '@types/unist': 3.0.3 + optionalDependencies: + '@bruits/satteri-android-arm64': 0.11.7 + '@bruits/satteri-darwin-arm64': 0.11.7 + '@bruits/satteri-darwin-x64': 0.11.7 + '@bruits/satteri-freebsd-x64': 0.11.7 + '@bruits/satteri-linux-arm64-gnu': 0.11.7 + '@bruits/satteri-linux-arm64-musl': 0.11.7 + '@bruits/satteri-linux-x64-gnu': 0.11.7 + '@bruits/satteri-linux-x64-musl': 0.11.7 + '@bruits/satteri-wasm32-wasi': 0.11.7 + '@bruits/satteri-win32-arm64-msvc': 0.11.7 + '@bruits/satteri-win32-x64-msvc': 0.11.7 + sax@1.6.1: {} scheduler@0.23.2: @@ -9390,8 +9882,6 @@ snapshots: semver@6.3.1: {} - semver@7.7.4: {} - semver@7.8.5: {} send@0.19.2(supports-color@10.2.2): @@ -9473,6 +9963,17 @@ snapshots: '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.5 + shiki@4.6.0: + dependencies: + '@shikijs/core': 4.6.0 + '@shikijs/engine-javascript': 4.6.0 + '@shikijs/engine-oniguruma': 4.6.0 + '@shikijs/langs': 4.6.0 + '@shikijs/themes': 4.6.0 + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + '@types/hast': 3.0.5 + side-channel-list@1.0.1: dependencies: es-errors: 1.3.0 @@ -9531,11 +10032,11 @@ snapshots: stackback@0.0.2: {} - starlight-links-validator@0.27.0(@astrojs/starlight@0.42.6(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3))(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2): + starlight-links-validator@0.27.0(@astrojs/starlight@0.42.6(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3))(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2): dependencies: - '@astrojs/markdown-satteri': 0.4.3 - '@astrojs/starlight': 0.42.6(astro@7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3) - astro: 7.4.0(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + '@astrojs/markdown-satteri': 0.4.10 + '@astrojs/starlight': 0.42.6(astro@7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1))(supports-color@10.2.2)(typescript@6.0.3) + astro: 7.4.12(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) github-slugger: 2.0.0 hast-util-from-html: 2.0.3 is-absolute-url: 5.0.0 @@ -9702,7 +10203,7 @@ snapshots: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 - tinyps@0.5.0: {} + tinyps@0.5.2: {} tinyrainbow@3.1.0: {} @@ -9924,14 +10425,28 @@ snapshots: tsx: 4.23.15 yaml: 2.9.1 - vitefu@1.1.3(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)): + vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1): + dependencies: + lightningcss: 1.33.0 + picomatch: 4.0.7 + postcss: 8.5.33 + rolldown: 1.2.19 + tinyglobby: 0.2.17 optionalDependencies: - vite: 8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + '@types/node': 22.20.4 + esbuild: 0.28.2 + fsevents: 2.3.3 + tsx: 4.23.15 + yaml: 2.9.1 - vitest@4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)): + vitefu@1.1.3(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)): + optionalDependencies: + vite: 8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + + vitest@4.1.12(@types/node@22.20.4)(@vitest/coverage-v8@4.1.12)(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)): dependencies: '@vitest/expect': 4.1.12 - '@vitest/mocker': 4.1.12(vite@8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) + '@vitest/mocker': 4.1.12(vite@8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1)) '@vitest/pretty-format': 4.1.12 '@vitest/runner': 4.1.12 '@vitest/snapshot': 4.1.12 @@ -9948,7 +10463,7 @@ snapshots: tinyexec: 1.3.1 tinyglobby: 0.2.17 tinyrainbow: 3.1.0 - vite: 8.3.4(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) + vite: 8.3.8(@types/node@22.20.4)(esbuild@0.28.2)(tsx@4.23.15)(yaml@2.9.1) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 22.20.4 diff --git a/website/__tests__/lib/api-docs-version.spec.ts b/website/__tests__/lib/api-docs-version.spec.ts new file mode 100644 index 000000000..907bdd48f --- /dev/null +++ b/website/__tests__/lib/api-docs-version.spec.ts @@ -0,0 +1,97 @@ +/** + * Tests for `withVersionHeader` in `src/lib/api-docs-version.ts` (ADR 0032): + * Swagger UI sends the selected version as the `CG-Version` header on mock + * API requests only. + */ + +import { describe, it, expect } from "vitest"; +import { withVersionHeader } from "@/lib/api-docs-version"; + +/** Swagger UI requests carry string headers keyed by name. */ +const noHeaders = (): Record => ({}); + +const options = { + version: "0.5.0", + basePath: "/api", + header: "CG-Version", + origin: "https://docs.example", +}; + +describe("withVersionHeader", () => { + it("sets the version header on a same-origin mock API request", () => { + const result = withVersionHeader( + { + url: "https://docs.example/api/common-grants/opportunities", + headers: noHeaders(), + }, + options, + ); + + expect(result.headers["CG-Version"]).toBe("0.5.0"); + }); + + it("resolves a relative URL against the origin", () => { + const result = withVersionHeader( + { url: "/api/common-grants/opportunities", headers: noHeaders() }, + options, + ); + + expect(result.headers["CG-Version"]).toBe("0.5.0"); + }); + + it.each(["CG-Version", "cg-version"])( + "keeps a user-entered %s value without adding a second key", + (key) => { + const result = withVersionHeader( + { + url: "https://docs.example/api/common-grants/opportunities", + headers: { [key]: "0.1.0" }, + }, + options, + ); + + expect(result.headers).toEqual({ [key]: "0.1.0" }); + }, + ); + + it("treats an empty existing value as missing", () => { + const result = withVersionHeader( + { + url: "https://docs.example/api/common-grants/opportunities", + headers: { "CG-Version": "" }, + }, + options, + ); + + expect(result.headers["CG-Version"]).toBe("0.5.0"); + }); + + it.each([ + "https://docs.example/openapi-mock/openapi.0.5.0.yaml", + "https://other.example/api/common-grants/opportunities", + "https://docs.example/apiary", + ])("does not add the header to non-mock URL %s", (url) => { + const result = withVersionHeader({ url, headers: noHeaders() }, options); + + expect(result.headers).toEqual({}); + }); + + it("returns the request with every other field unchanged", () => { + const result = withVersionHeader( + { + url: "https://docs.example/api/common-grants/opportunities", + headers: { Accept: "application/json" }, + method: "POST", + body: '{"a":1}', + }, + options, + ); + + expect(result).toEqual({ + url: "https://docs.example/api/common-grants/opportunities", + headers: { Accept: "application/json", "CG-Version": "0.5.0" }, + method: "POST", + body: '{"a":1}', + }); + }); +}); diff --git a/website/__tests__/lib/mock/__fixtures__/golden-envelopes.json b/website/__tests__/lib/mock/__fixtures__/golden-envelopes.json index c6ee0b3ab..689f27679 100644 --- a/website/__tests__/lib/mock/__fixtures__/golden-envelopes.json +++ b/website/__tests__/lib/mock/__fixtures__/golden-envelopes.json @@ -137,12 +137,12 @@ "version-unsupported": { "status": 404, "contentType": "application/json", - "body": "{\"status\":404,\"message\":\"Unsupported protocol version\",\"errors\":[{\"field\":\"version\",\"message\":\"Version 9.9.9 is not served by this mock; supported versions are 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0\"}]}" + "body": "{\"status\":404,\"message\":\"Unsupported protocol version\",\"errors\":[{\"field\":\"version\",\"message\":\"Version 9.9.9 is not served by this mock; supported versions are 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0\"}]}" }, "version-malformed": { "status": 404, "contentType": "application/json", - "body": "{\"status\":404,\"message\":\"Unsupported protocol version\",\"errors\":[{\"field\":\"version\",\"message\":\"Version abc is not served by this mock; supported versions are 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0\"}]}" + "body": "{\"status\":404,\"message\":\"Unsupported protocol version\",\"errors\":[{\"field\":\"version\",\"message\":\"Version abc is not served by this mock; supported versions are 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0\"}]}" }, "route-miss-unsupported-method": { "status": 404, diff --git a/website/__tests__/lib/mock/__fixtures__/mock-request.ts b/website/__tests__/lib/mock/__fixtures__/mock-request.ts new file mode 100644 index 000000000..9c9ef9120 --- /dev/null +++ b/website/__tests__/lib/mock/__fixtures__/mock-request.ts @@ -0,0 +1,35 @@ +/** + * Builds requests for the mock as a client would send them under ADR 0032: + * the path carries no version, and `CG-Version` selects one. + */ + +import { MOCK_API_BASE_PATH } from "@/lib/mock/router"; +import { VERSION_HEADER } from "@/lib/mock/http/version"; + +/** `https://docs.example/api/common-grants{path}`; the host is a placeholder. */ +export function mockUrl(path: string): string { + return `https://docs.example${MOCK_API_BASE_PATH}/common-grants${path}`; +} + +/** + * A request for `path` (below `/common-grants`) that sends `version` as + * `CG-Version`, or no header when `version` is `undefined`. + */ +export function mockRequest( + path: string, + version: string | undefined, + init: RequestInit = {}, +): Request { + const headers = new Headers(init.headers); + if (version !== undefined) headers.set(VERSION_HEADER, version); + return new Request(mockUrl(path), { ...init, headers }); +} + +/** A request for `/opportunities{suffix}` served in `version`. */ +export function opportunitiesRequest( + version: string | undefined, + suffix = "", + init?: RequestInit, +): Request { + return mockRequest(`/opportunities${suffix}`, version, init); +} diff --git a/website/__tests__/lib/mock/__fixtures__/request-matrix.ts b/website/__tests__/lib/mock/__fixtures__/request-matrix.ts index 9156556db..1e8e1cdd5 100644 --- a/website/__tests__/lib/mock/__fixtures__/request-matrix.ts +++ b/website/__tests__/lib/mock/__fixtures__/request-matrix.ts @@ -25,6 +25,12 @@ export interface MatrixCase { * do). The spec re-inserts the `/api` base into the golden text for those. */ pathEchoing?: boolean; + /** + * Set when this site answers differently on purpose: the Worker's 404 for a + * bad path version became a version error under ADR 0032 (#1393). The golden + * spec checks the status instead of the bytes; the Worker capture ignores it. + */ + siteStatus?: number; } /** `/v{version}/common-grants/opportunities` + optional suffix. */ @@ -55,7 +61,7 @@ const REPRESENTATIVE_SEARCH = JSON.stringify({ * once the Worker serves every entry in `SUPPORTED_VERSIONS` again. */ const GOLDEN_VERSIONS = SUPPORTED_VERSIONS.filter( - (version) => version !== "0.5.0", + (version) => version !== "0.5.0" && version !== "0.6.0", ); /** The three endpoints across every version the golden corpus covers. */ @@ -187,11 +193,13 @@ const edgeCases: MatrixCase[] = [ name: "version-unsupported", method: "GET", path: opportunities("9.9.9"), + siteStatus: 406, }, { name: "version-malformed", method: "GET", path: "/vabc/common-grants/opportunities", + siteStatus: 400, }, // --- route misses (these quote the request path back; see `pathEchoing`) --- diff --git a/website/__tests__/lib/mock/conformance/applications-vs-openapi.spec.ts b/website/__tests__/lib/mock/conformance/applications-vs-openapi.spec.ts index ef7a62e70..8c0081584 100644 --- a/website/__tests__/lib/mock/conformance/applications-vs-openapi.spec.ts +++ b/website/__tests__/lib/mock/conformance/applications-vs-openapi.spec.ts @@ -115,6 +115,7 @@ describe("shaped applications against the per-version OpenAPI documents", () => "0.3.0": "name", "0.4.0": "title", "0.5.0": "title", + "0.6.0": "title", }); const hasOpportunityId = Object.fromEntries( @@ -132,6 +133,7 @@ describe("shaped applications against the per-version OpenAPI documents", () => "0.3.0": true, "0.4.0": true, "0.5.0": true, + "0.6.0": true, }); }); }); diff --git a/website/__tests__/lib/mock/data/fixtures.spec.ts b/website/__tests__/lib/mock/data/fixtures.spec.ts index a68123380..dae83b64a 100644 --- a/website/__tests__/lib/mock/data/fixtures.spec.ts +++ b/website/__tests__/lib/mock/data/fixtures.spec.ts @@ -14,6 +14,7 @@ import { allForVersion, type Opportunity, } from "@/lib/mock/data/fixtures"; +import { isAtLeastVersion } from "@/lib/mock/data/availability"; const STATUS_VALUES = ["forecasted", "open", "closed", "custom"]; @@ -296,7 +297,7 @@ describe("shapeOpportunityForVersion", () => { it("strips identifiers for every version below 0.5.0, both variants", () => { const olderVersions = SUPPORTED_VERSIONS.filter( - (version) => version !== "0.5.0", + (version) => !isAtLeastVersion(version, "0.5.0"), ); for (const version of olderVersions) { @@ -340,7 +341,7 @@ describe("shapeOpportunityForVersion", () => { it("strips funders for every version below 0.5.0, both variants", () => { const olderVersions = SUPPORTED_VERSIONS.filter( - (version) => version !== "0.5.0", + (version) => !isAtLeastVersion(version, "0.5.0"), ); for (const version of olderVersions) { @@ -388,7 +389,7 @@ describe("shapeOpportunityForVersion", () => { it("strips awards for every version below 0.5.0, both variants", () => { const olderVersions = SUPPORTED_VERSIONS.filter( - (version) => version !== "0.5.0", + (version) => !isAtLeastVersion(version, "0.5.0"), ); for (const version of olderVersions) { @@ -432,6 +433,6 @@ describe("isSupportedVersion", () => { }); it("rejects a version the fixture cannot shape", () => { - expect(isSupportedVersion("0.6.0")).toBe(false); + expect(isSupportedVersion("0.7.0")).toBe(false); }); }); diff --git a/website/__tests__/lib/mock/golden-envelopes.spec.ts b/website/__tests__/lib/mock/golden-envelopes.spec.ts index d108fcf6a..0423c5060 100644 --- a/website/__tests__/lib/mock/golden-envelopes.spec.ts +++ b/website/__tests__/lib/mock/golden-envelopes.spec.ts @@ -1,6 +1,7 @@ import { describe, it, expect } from "vitest"; import { MOCK_API_BASE_PATH, handleMockRequest } from "@/lib/mock/router"; -import { REQUEST_MATRIX } from "./__fixtures__/request-matrix"; +import { VERSION_HEADER } from "@/lib/mock/http/version"; +import { REQUEST_MATRIX, type MatrixCase } from "./__fixtures__/request-matrix"; import goldenEnvelopesJson from "./__fixtures__/golden-envelopes.json"; import type { GoldenEnvelope } from "./__fixtures__/capture-golden"; @@ -19,6 +20,36 @@ import type { GoldenEnvelope } from "./__fixtures__/capture-golden"; const GOLDEN_ENVELOPES: Record = goldenEnvelopesJson; +const PINNED_CASES = REQUEST_MATRIX.filter((c) => c.siteStatus === undefined); +const DIVERGENT_CASES = REQUEST_MATRIX.filter( + (c) => c.siteStatus !== undefined, +); + +/** Matrix paths carry `/v{version}`; this site takes it as `CG-Version`. */ +const PATH_VERSION = /^\/v([^/]+)(\/common-grants.*)$/; + +function siteRequest(testCase: MatrixCase): { + request: Request; + unversionedPath: string; +} { + const match = PATH_VERSION.exec(testCase.path); + if (!match) throw new Error(`Matrix path has no version: ${testCase.path}`); + const [, version, unversionedPath] = match; + + const headers = new Headers({ [VERSION_HEADER]: version }); + if (testCase.body !== undefined) { + headers.set("Content-Type", "application/json"); + } + + return { + unversionedPath, + request: new Request( + `https://docs.example${MOCK_API_BASE_PATH}${unversionedPath}`, + { method: testCase.method, body: testCase.body, headers }, + ), + }; +} + describe("golden envelope byte-identity", () => { it("has a golden entry for every REQUEST_MATRIX case", () => { const missing = REQUEST_MATRIX.map((testCase) => testCase.name).filter( @@ -39,22 +70,11 @@ describe("golden envelope byte-identity", () => { expect(orphans).toEqual([]); }); - it.each(REQUEST_MATRIX)( + it.each(PINNED_CASES)( "matches the 3A Worker's response for $name", async (testCase) => { const golden = GOLDEN_ENVELOPES[testCase.name]; - - const request = new Request( - `https://docs.example${MOCK_API_BASE_PATH}${testCase.path}`, - { - method: testCase.method, - body: testCase.body, - headers: - testCase.body === undefined - ? undefined - : { "Content-Type": "application/json" }, - }, - ); + const { request, unversionedPath } = siteRequest(testCase); const response = await handleMockRequest(request); const text = await response.text(); @@ -63,11 +83,12 @@ describe("golden envelope byte-identity", () => { expect(response.headers.get("Content-Type")).toBe(golden.contentType); if (testCase.pathEchoing) { - // Route-miss 404s quote the request path, which lacks the `/api` base - // here — re-insert it. Every other case compares with no normalization. + // Route-miss 404s quote the request path. The Worker's carried the + // version and lacked the `/api` base; this site's has the base and no + // version, so rewrite the golden text to match. const expected = golden.body.replace( `${testCase.method} ${testCase.path}`, - `${testCase.method} ${MOCK_API_BASE_PATH}${testCase.path}`, + `${testCase.method} ${MOCK_API_BASE_PATH}${unversionedPath}`, ); expect(text).toBe(expected); } else { @@ -75,4 +96,15 @@ describe("golden envelope byte-identity", () => { } }, ); + + it.each(DIVERGENT_CASES)( + "answers $name with a version error where the Worker answered 404", + async (testCase) => { + const { request } = siteRequest(testCase); + + const response = await handleMockRequest(request); + + expect(response.status).toBe(testCase.siteStatus); + }, + ); }); diff --git a/website/__tests__/lib/mock/handlers/applications.spec.ts b/website/__tests__/lib/mock/handlers/applications.spec.ts index d49fcd62f..47682efb0 100644 --- a/website/__tests__/lib/mock/handlers/applications.spec.ts +++ b/website/__tests__/lib/mock/handlers/applications.spec.ts @@ -31,18 +31,19 @@ import { } from "@/lib/mock/handlers/applications"; import { getCompetition } from "@/lib/mock/handlers/competitions"; import { getForm } from "@/lib/mock/handlers/forms"; +import { mockUrl } from "../__fixtures__/mock-request"; const VERSION: Version = "0.4.0"; -/** Builds `https://docs.example/api/v{version}/common-grants/applications{suffix}`. */ -function applicationsUrl(version: string, suffix = ""): string { - return `https://docs.example/api/v${version}/common-grants/applications${suffix}`; +/** Builds `https://docs.example/api/common-grants/applications{suffix}`. */ +function applicationsUrl(suffix = ""): string { + return mockUrl(`/applications${suffix}`); } /** POSTs a JSON body to `/applications/start` and returns the raw `Response`. */ function runStart(version: Version, body: unknown): Promise { return startApplication( - new Request(applicationsUrl(version, "/start"), { + new Request(applicationsUrl("/start"), { method: "POST", body: JSON.stringify(body), headers: { "Content-Type": "application/json" }, @@ -54,7 +55,7 @@ function runStart(version: Version, body: unknown): Promise { /** POSTs a JSON body to `/applications/search` and returns the parsed 200 body. */ async function runSearchBody(version: Version, body: unknown) { const response = await searchApplications( - new Request(applicationsUrl(version, "/search"), { + new Request(applicationsUrl("/search"), { method: "POST", body: JSON.stringify(body), headers: { "Content-Type": "application/json" }, @@ -80,7 +81,7 @@ async function runSearchBody(version: Version, body: unknown) { }; } -describe("POST /v{version}/common-grants/applications/start", () => { +describe("POST /common-grants/applications/start", () => { it("returns 201 with the created application echoing the submitted competitionId, title, and the competition's own opportunityId", async () => { const competition = COMPETITION_FIXTURES.find( (c) => c.id === CANONICAL_COMPETITION_ID, @@ -243,7 +244,7 @@ describe("POST /v{version}/common-grants/applications/start", () => { it("returns 400 'Malformed JSON body' for a malformed JSON body", async () => { const response = await startApplication( - new Request(applicationsUrl(VERSION, "/start"), { + new Request(applicationsUrl("/start"), { method: "POST", body: "{not valid json", headers: { "Content-Type": "application/json" }, @@ -259,7 +260,7 @@ describe("POST /v{version}/common-grants/applications/start", () => { }); }); -describe("GET /v{version}/common-grants/applications/{appId} (detail)", () => { +describe("GET /common-grants/applications/{appId} (detail)", () => { it("returns 200 for the id Swagger UI pre-fills into every path parameter box", async () => { const response = getApplication(CANONICAL_APPLICATION_ID, VERSION); @@ -300,7 +301,7 @@ describe("GET /v{version}/common-grants/applications/{appId} (detail)", () => { }); }); -describe("PUT /v{version}/common-grants/applications/{appId}/submit", () => { +describe("PUT /common-grants/applications/{appId}/submit", () => { it("returns 200 for an application with no validation errors", async () => { const response = await submitApplication(CANONICAL_APPLICATION_ID, VERSION); @@ -387,7 +388,7 @@ describe("PUT /v{version}/common-grants/applications/{appId}/submit", () => { }); }); -describe("POST /v{version}/common-grants/applications/search", () => { +describe("POST /common-grants/applications/search", () => { it("returns 200 with items, paginationInfo, sortInfo, and filterInfo for an empty body", async () => { const body = await runSearchBody(VERSION, {}); @@ -447,7 +448,7 @@ describe("POST /v{version}/common-grants/applications/search", () => { it("returns 400 with a sorting.sortBy field error for an unknown sortBy value", async () => { const response = await searchApplications( - new Request(applicationsUrl(VERSION, "/search"), { + new Request(applicationsUrl("/search"), { method: "POST", body: JSON.stringify({ sorting: { sortBy: "not_a_real_sort_field" }, @@ -475,7 +476,6 @@ describe("POST /v{version}/common-grants/applications/search", () => { const viaQueryResponse = await searchApplications( new Request( applicationsUrl( - VERSION, `/search?filters=${encodeURIComponent(JSON.stringify(filters))}`, ), { method: "POST" }, @@ -503,7 +503,7 @@ describe("POST /v{version}/common-grants/applications/search", () => { /** POSTs to `/search?{query}` with no body and returns the raw response. */ function runSearchQuery(query: string): Promise { return searchApplications( - new Request(applicationsUrl(VERSION, `/search?${query}`), { + new Request(applicationsUrl(`/search?${query}`), { method: "POST", }), VERSION, @@ -543,7 +543,6 @@ describe("POST /v{version}/common-grants/applications/search", () => { const response = await searchApplications( new Request( applicationsUrl( - VERSION, `/search?filters=${encodeURIComponent(JSON.stringify(fromQuery))}`, ), { @@ -582,31 +581,9 @@ describe("POST /v{version}/common-grants/applications/search", () => { expect(body.items.length).toBeLessThan(APPLICATION_FIXTURES.length); }); }); - - it("returns 404 with the protocol Error shape at v0.2, since searchApplications is v0.3+ while its siblings are v0.2+", async () => { - const response = await searchApplications( - new Request(applicationsUrl("0.2.0", "/search"), { - method: "POST", - body: JSON.stringify({}), - headers: { "Content-Type": "application/json" }, - }), - "0.2.0", - ); - - expect(response.status).toBe(404); - - const body = (await response.json()) as { - status: number; - message: string; - errors: unknown[]; - }; - expect(body.status).toBe(404); - expect(typeof body.message).toBe("string"); - expect(Array.isArray(body.errors)).toBe(true); - }); }); -describe("GET /v{version}/common-grants/applications/{appId}/forms/{formId} (read)", () => { +describe("GET /common-grants/applications/{appId}/forms/{formId} (read)", () => { it("resolves the doubly pre-filled (appId, formId) pair Swagger UI arrives with", async () => { expect(canonicalPrefillResolves()).toBe(true); @@ -697,7 +674,7 @@ describe("form answers across the v0.5 form title", () => { }); }); -describe("PUT /v{version}/common-grants/applications/{appId}/forms/{formId} (write)", () => { +describe("PUT /common-grants/applications/{appId}/forms/{formId} (write)", () => { it("echoes the submitted response body under data.response, with formId/applicationId set from the path", async () => { const responseBody = { name: { first: "Taylor", last: "Reyes" }, @@ -709,7 +686,6 @@ describe("PUT /v{version}/common-grants/applications/{appId}/forms/{formId} (wri CANONICAL_FORM_ID, new Request( applicationsUrl( - VERSION, `/${CANONICAL_APPLICATION_ID}/forms/${CANONICAL_FORM_ID}`, ), { @@ -745,7 +721,6 @@ describe("PUT /v{version}/common-grants/applications/{appId}/forms/{formId} (wri CANONICAL_FORM_ID, new Request( applicationsUrl( - VERSION, `/${CANONICAL_APPLICATION_ID}/forms/${CANONICAL_FORM_ID}`, ), { @@ -779,7 +754,6 @@ describe("PUT /v{version}/common-grants/applications/{appId}/forms/{formId} (wri const buildRequest = () => new Request( applicationsUrl( - VERSION, `/${CANONICAL_APPLICATION_ID}/forms/${CANONICAL_FORM_ID}`, ), { @@ -815,7 +789,6 @@ describe("PUT /v{version}/common-grants/applications/{appId}/forms/{formId} (wri CANONICAL_FORM_ID, new Request( applicationsUrl( - VERSION, `/${CANONICAL_APPLICATION_ID}/forms/${CANONICAL_FORM_ID}`, ), { @@ -839,10 +812,7 @@ describe("PUT /v{version}/common-grants/applications/{appId}/forms/{formId} (wri RESERVED_MISSING_ID, CANONICAL_FORM_ID, new Request( - applicationsUrl( - VERSION, - `/${RESERVED_MISSING_ID}/forms/${CANONICAL_FORM_ID}`, - ), + applicationsUrl(`/${RESERVED_MISSING_ID}/forms/${CANONICAL_FORM_ID}`), { method: "PUT", body: JSON.stringify({}), @@ -871,6 +841,7 @@ describe("per-version application response shape", () => { "0.3.0": "name", "0.4.0": "title", "0.5.0": "title", + "0.6.0": "title", }; /** Versions whose `ApplicationBase` declares `opportunityId`. */ @@ -880,6 +851,7 @@ describe("per-version application response shape", () => { "0.3.0": true, "0.4.0": true, "0.5.0": true, + "0.6.0": true, }; /** The applications routes start at v0.2; v0.1 never reaches a handler. */ diff --git a/website/__tests__/lib/mock/handlers/awards.spec.ts b/website/__tests__/lib/mock/handlers/awards.spec.ts index d7501088f..b1694d347 100644 --- a/website/__tests__/lib/mock/handlers/awards.spec.ts +++ b/website/__tests__/lib/mock/handlers/awards.spec.ts @@ -13,13 +13,14 @@ import { import { listAwards, getAward, searchAwards } from "@/lib/mock/handlers/awards"; import { CANONICAL_RECORD_ID, RESERVED_MISSING_ID } from "@/lib/mock/data/ids"; import { OPPORTUNITY_FIXTURES } from "@/lib/mock/data/fixtures"; +import { mockUrl } from "../__fixtures__/mock-request"; const VERSION = "0.4.0"; const STATUS_VALUES = ["awarded", "completed", "cancelled", "custom"]; /** Builds a request URL; the host/base path are placeholders. */ function awardsUrl(suffix = ""): string { - return `https://docs.example/api/v${VERSION}/common-grants/awards${suffix}`; + return mockUrl(`/awards${suffix}`); } describe("AWARD_FIXTURES", () => { @@ -85,7 +86,7 @@ describe("getAwardById", () => { }); }); -describe("GET /v{version}/common-grants/awards (list)", () => { +describe("GET /common-grants/awards (list)", () => { it("returns a 200 with the protocol paginated envelope, ordered by lastModifiedAt descending by default", async () => { const response = listAwards(new Request(awardsUrl()), VERSION); @@ -153,7 +154,7 @@ describe("GET /v{version}/common-grants/awards (list)", () => { }); }); -describe("GET /v{version}/common-grants/awards/{awdId} (detail)", () => { +describe("GET /common-grants/awards/{awdId} (detail)", () => { it("returns 200 for the id Swagger UI pre-fills into every path parameter box", async () => { const response = getAward(CANONICAL_AWARD_ID, VERSION); @@ -233,7 +234,7 @@ describe("GET /v{version}/common-grants/awards/{awdId} (detail)", () => { }); }); -describe("POST /v{version}/common-grants/awards/search", () => { +describe("POST /common-grants/awards/search", () => { async function runSearch(body: unknown) { const response = await searchAwards( new Request(awardsUrl("/search"), { diff --git a/website/__tests__/lib/mock/handlers/competitions.spec.ts b/website/__tests__/lib/mock/handlers/competitions.spec.ts index e0b27373f..54d8cff6c 100644 --- a/website/__tests__/lib/mock/handlers/competitions.spec.ts +++ b/website/__tests__/lib/mock/handlers/competitions.spec.ts @@ -50,7 +50,7 @@ describe("COMPETITION_FIXTURES", () => { }); }); -describe("GET /v{version}/common-grants/competitions/{compId} (detail)", () => { +describe("GET /common-grants/competitions/{compId} (detail)", () => { it("returns 200 for the id Swagger UI pre-fills into every path parameter box", async () => { const response = getCompetition(CANONICAL_COMPETITION_ID, VERSION); diff --git a/website/__tests__/lib/mock/handlers/forms.spec.ts b/website/__tests__/lib/mock/handlers/forms.spec.ts index 4be0eaea2..d9dc49d77 100644 --- a/website/__tests__/lib/mock/handlers/forms.spec.ts +++ b/website/__tests__/lib/mock/handlers/forms.spec.ts @@ -12,12 +12,13 @@ import { import { listForms, getForm } from "@/lib/mock/handlers/forms"; import { RESERVED_MISSING_ID } from "@/lib/mock/data/ids"; import type { Version } from "@/lib/mock/data/fixtures"; +import { mockUrl } from "../__fixtures__/mock-request"; const VERSION: Version = "0.4.0"; /** Builds a request URL; the host/base path are placeholders. */ function formsUrl(suffix = ""): string { - return `https://docs.example/api/v${VERSION}/common-grants/forms${suffix}`; + return mockUrl(`/forms${suffix}`); } describe("FORM_FIXTURES", () => { @@ -45,7 +46,7 @@ describe("FORM_FIXTURES", () => { }); }); -describe("GET /v{version}/common-grants/forms (list)", () => { +describe("GET /common-grants/forms (list)", () => { it("returns a 200 with the protocol paginated envelope, ordered by lastModifiedAt descending by default", async () => { const response = listForms(new Request(formsUrl()), VERSION); @@ -148,7 +149,7 @@ describe("GET /v{version}/common-grants/forms (list)", () => { }); }); -describe("GET /v{version}/common-grants/forms/{formId} (detail)", () => { +describe("GET /common-grants/forms/{formId} (detail)", () => { it("returns 200 for the id Swagger UI pre-fills into every path parameter box", async () => { const response = getForm(CANONICAL_FORM_ID, VERSION); @@ -215,10 +216,7 @@ describe("forms per protocol version", () => { const pristine = structuredClone(FORM_FIXTURES); async function listAt(version: Version) { - const response = listForms( - new Request(`https://docs.example/api/v${version}/common-grants/forms`), - version, - ); + const response = listForms(new Request(mockUrl("/forms")), version); expect(response.status).toBe(200); return ((await response.json()) as { items: Record[] }) .items; diff --git a/website/__tests__/lib/mock/handlers/opportunities.spec.ts b/website/__tests__/lib/mock/handlers/opportunities.spec.ts index 65d990fb3..5ef0cdb78 100644 --- a/website/__tests__/lib/mock/handlers/opportunities.spec.ts +++ b/website/__tests__/lib/mock/handlers/opportunities.spec.ts @@ -11,20 +11,14 @@ import { RESERVED_MISSING_OPPORTUNITY_ID, type Version, } from "@/lib/mock/data/fixtures"; +import { opportunitiesRequest } from "../__fixtures__/mock-request"; const VERSIONS: Version[] = ["0.1.0", "0.2.0", "0.3.0", "0.4.0"]; -/** Builds `https://docs.example/api/v{version}/common-grants/opportunities{suffix}`. */ -function opportunitiesUrl(version: string, suffix = ""): string { - return `https://docs.example/api/v${version}/common-grants/opportunities${suffix}`; -} - describe("opportunities routes", () => { - describe("GET /v{version}/common-grants/opportunities (list)", () => { + describe("GET /common-grants/opportunities (list)", () => { it("returns a 200 with all fixtures sorted by lastModifiedAt descending and default pagination", async () => { - const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0")), - ); + const response = await handleMockRequest(opportunitiesRequest("0.3.0")); expect(response.status).toBe(200); @@ -64,7 +58,7 @@ describe("opportunities routes", () => { it("returns an empty items array with valid paginationInfo when page is past the end", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "?page=999")), + opportunitiesRequest("0.3.0", "?page=999"), ); expect(response.status).toBe(200); @@ -92,7 +86,7 @@ describe("opportunities routes", () => { it("honors a pageSize above the default, since the spec declares no maximum", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "?pageSize=9999")), + opportunitiesRequest("0.3.0", "?pageSize=9999"), ); expect(response.status).toBe(200); @@ -113,7 +107,7 @@ describe("opportunities routes", () => { "returns 400 with the protocol Error shape when %s=%s falls below the spec minimum", async (param, value) => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", `?${param}=${value}`)), + opportunitiesRequest("0.3.0", `?${param}=${value}`), ); expect(response.status).toBe(400); @@ -134,7 +128,7 @@ describe("opportunities routes", () => { it("returns 400 when a pagination param is present but not an integer", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "?pageSize=abc")), + opportunitiesRequest("0.3.0", "?pageSize=abc"), ); expect(response.status).toBe(400); @@ -149,9 +143,7 @@ describe("opportunities routes", () => { }); it("applies both spec defaults when the pagination params are omitted entirely", async () => { - const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0")), - ); + const response = await handleMockRequest(opportunitiesRequest("0.3.0")); expect(response.status).toBe(200); @@ -164,7 +156,7 @@ describe("opportunities routes", () => { }); }); - describe("GET /v{version}/common-grants/opportunities/{oppId} (detail)", () => { + describe("GET /common-grants/opportunities/{oppId} (detail)", () => { // A fixture that carries `competitions` (detail-only field), so the // list/detail shape tests can't pass by accident. const STEM_ID = "573525f2-8e15-4405-83fb-e6523511d893"; @@ -175,9 +167,7 @@ describe("opportunities routes", () => { "answers 200 for the id Swagger UI pre-fills, for v%s", async (version) => { const response = await handleMockRequest( - new Request( - opportunitiesUrl(version, `/${CANONICAL_OPPORTUNITY_ID}`), - ), + opportunitiesRequest(version, `/${CANONICAL_OPPORTUNITY_ID}`), ); expect(response.status).toBe(200); @@ -196,11 +186,9 @@ describe("opportunities routes", () => { // regard to case, so the uppercase form must reach the same record. it("answers 200 for the uppercase form of a stored id", async () => { const response = await handleMockRequest( - new Request( - opportunitiesUrl( - "0.3.0", - `/${CANONICAL_OPPORTUNITY_ID.toUpperCase()}`, - ), + opportunitiesRequest( + "0.3.0", + `/${CANONICAL_OPPORTUNITY_ID.toUpperCase()}`, ), ); @@ -213,7 +201,7 @@ describe("opportunities routes", () => { it("echoes the requested oppId and matches the list item's shared fields, while adding the detail-only competitions field", async () => { const listResponse = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0")), + opportunitiesRequest("0.3.0"), ); const listBody = (await listResponse.json()) as { @@ -225,7 +213,7 @@ describe("opportunities routes", () => { expect(listItem).not.toHaveProperty("competitions"); const detailResponse = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", `/${STEM_ID}`)), + opportunitiesRequest("0.3.0", `/${STEM_ID}`), ); expect(detailResponse.status).toBe(200); @@ -249,9 +237,7 @@ describe("opportunities routes", () => { "returns 404 with the protocol Error shape for a well-formed but unknown UUID, for v%s", async (version) => { const response = await handleMockRequest( - new Request( - opportunitiesUrl(version, `/${RESERVED_MISSING_OPPORTUNITY_ID}`), - ), + opportunitiesRequest(version, `/${RESERVED_MISSING_OPPORTUNITY_ID}`), ); expect(response.status).toBe(404); @@ -274,7 +260,7 @@ describe("opportunities routes", () => { "returns 400 with a field-level validation error for a malformed (non-UUID) oppId, for v%s", async (version) => { const response = await handleMockRequest( - new Request(opportunitiesUrl(version, "/not-a-uuid")), + opportunitiesRequest(version, "/not-a-uuid"), ); expect(response.status).toBe(400); @@ -300,7 +286,7 @@ describe("opportunities routes", () => { it("omits competitions and acceptedApplicantTypes from a v0.1 detail response", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.1.0", `/${STEM_ID}`)), + opportunitiesRequest("0.1.0", `/${STEM_ID}`), ); expect(response.status).toBe(200); @@ -319,7 +305,7 @@ describe("opportunities routes", () => { // #1220-T4: `OpportunityBase.funders` is `@added(v0_5)`. it("includes funders in the 0.5.0 list and detail responses for a record known to have it, and omits it at 0.4.0", async () => { const listResponse050 = await handleMockRequest( - new Request(opportunitiesUrl("0.5.0")), + opportunitiesRequest("0.5.0"), ); const listBody050 = (await listResponse050.json()) as { items: Array & { id: string }>; @@ -331,7 +317,7 @@ describe("opportunities routes", () => { expect(listItem050).toHaveProperty("funders"); const detailResponse050 = await handleMockRequest( - new Request(opportunitiesUrl("0.5.0", `/${CANONICAL_OPPORTUNITY_ID}`)), + opportunitiesRequest("0.5.0", `/${CANONICAL_OPPORTUNITY_ID}`), ); const detailBody050 = (await detailResponse050.json()) as { data: Record & { id: string }; @@ -339,7 +325,7 @@ describe("opportunities routes", () => { expect(detailBody050.data).toHaveProperty("funders"); const listResponse040 = await handleMockRequest( - new Request(opportunitiesUrl("0.4.0")), + opportunitiesRequest("0.4.0"), ); const listBody040 = (await listResponse040.json()) as { items: Array & { id: string }>; @@ -351,7 +337,7 @@ describe("opportunities routes", () => { expect(listItem040).not.toHaveProperty("funders"); const detailResponse040 = await handleMockRequest( - new Request(opportunitiesUrl("0.4.0", `/${CANONICAL_OPPORTUNITY_ID}`)), + opportunitiesRequest("0.4.0", `/${CANONICAL_OPPORTUNITY_ID}`), ); const detailBody040 = (await detailResponse040.json()) as { data: Record & { id: string }; @@ -363,7 +349,7 @@ describe("opportunities routes", () => { // and `@added(v0_5)` (like `funders`). it("includes awards in the 0.5.0 detail response only, omitting it from the 0.5.0 list and from 0.4.0 entirely", async () => { const detailResponse050 = await handleMockRequest( - new Request(opportunitiesUrl("0.5.0", `/${CANONICAL_OPPORTUNITY_ID}`)), + opportunitiesRequest("0.5.0", `/${CANONICAL_OPPORTUNITY_ID}`), ); const detailBody050 = (await detailResponse050.json()) as { data: Record & { id: string }; @@ -371,7 +357,7 @@ describe("opportunities routes", () => { expect(detailBody050.data).toHaveProperty("awards"); const listResponse050 = await handleMockRequest( - new Request(opportunitiesUrl("0.5.0")), + opportunitiesRequest("0.5.0"), ); const listBody050 = (await listResponse050.json()) as { items: Array & { id: string }>; @@ -386,7 +372,7 @@ describe("opportunities routes", () => { // Search shapes through the same list variant today, so this pins that // a future handler cannot shape it independently and regress. const searchResponse050 = await handleMockRequest( - new Request(opportunitiesUrl("0.5.0", "/search"), { + opportunitiesRequest("0.5.0", "/search", { method: "POST", body: JSON.stringify({}), headers: { "Content-Type": "application/json" }, @@ -402,7 +388,7 @@ describe("opportunities routes", () => { expect(searchItem050).not.toHaveProperty("awards"); const detailResponse040 = await handleMockRequest( - new Request(opportunitiesUrl("0.4.0", `/${CANONICAL_OPPORTUNITY_ID}`)), + opportunitiesRequest("0.4.0", `/${CANONICAL_OPPORTUNITY_ID}`), ); const detailBody040 = (await detailResponse040.json()) as { data: Record & { id: string }; @@ -410,7 +396,7 @@ describe("opportunities routes", () => { expect(detailBody040.data).not.toHaveProperty("awards"); const listResponse040 = await handleMockRequest( - new Request(opportunitiesUrl("0.4.0")), + opportunitiesRequest("0.4.0"), ); const listBody040 = (await listResponse040.json()) as { items: Array & { id: string }>; @@ -428,10 +414,10 @@ describe("opportunities routes", () => { "returns identical bodies across two calls to the list endpoint for v%s", async (version) => { const responseA = await handleMockRequest( - new Request(opportunitiesUrl(version)), + opportunitiesRequest(version), ); const responseB = await handleMockRequest( - new Request(opportunitiesUrl(version)), + opportunitiesRequest(version), ); const bodyA = await responseA.json(); @@ -447,10 +433,10 @@ describe("opportunities routes", () => { const STEM_ID = "573525f2-8e15-4405-83fb-e6523511d893"; const responseA = await handleMockRequest( - new Request(opportunitiesUrl(version, `/${STEM_ID}`)), + opportunitiesRequest(version, `/${STEM_ID}`), ); const responseB = await handleMockRequest( - new Request(opportunitiesUrl(version, `/${STEM_ID}`)), + opportunitiesRequest(version, `/${STEM_ID}`), ); const bodyA = await responseA.json(); @@ -466,7 +452,7 @@ describe("opportunities routes", () => { const STEM_ID = "573525f2-8e15-4405-83fb-e6523511d893"; const listResponse = await handleMockRequest( - new Request(opportunitiesUrl(version)), + opportunitiesRequest(version), ); const listBody = (await listResponse.json()) as { @@ -476,7 +462,7 @@ describe("opportunities routes", () => { expect(listItem).toBeDefined(); const detailResponse = await handleMockRequest( - new Request(opportunitiesUrl(version, `/${STEM_ID}`)), + opportunitiesRequest(version, `/${STEM_ID}`), ); expect(detailResponse.status).toBe(200); @@ -497,10 +483,10 @@ describe("opportunities routes", () => { ); }); - describe("POST /v{version}/common-grants/opportunities/search", () => { + describe("POST /common-grants/opportunities/search", () => { async function runSearch(version: string, body: unknown) { const response = await handleMockRequest( - new Request(opportunitiesUrl(version, "/search"), { + opportunitiesRequest(version, "/search", { method: "POST", body: JSON.stringify(body), headers: { "Content-Type": "application/json" }, @@ -576,7 +562,7 @@ describe("opportunities routes", () => { "returns 400 with the protocol Error shape for an unknown sortBy value, for v%s", async (version) => { const response = await handleMockRequest( - new Request(opportunitiesUrl(version, "/search"), { + opportunitiesRequest(version, "/search", { method: "POST", body: JSON.stringify({ sorting: { sortBy: "not_a_real_sort_field" }, @@ -630,7 +616,7 @@ describe("opportunities routes", () => { it("returns 400 with the protocol Error shape for a malformed JSON body", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: "{not valid json", headers: { "Content-Type": "application/json" }, @@ -658,7 +644,7 @@ describe("opportunities routes", () => { "returns 400 with the protocol Error shape for the valid-JSON-but-not-an-object body %s", async (rawBody) => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: rawBody, headers: { "Content-Type": "application/json" }, @@ -690,7 +676,7 @@ describe("opportunities routes", () => { "returns 400 with the protocol Error shape when search is %s", async (_label, search) => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({ search }), headers: { "Content-Type": "application/json" }, @@ -713,7 +699,7 @@ describe("opportunities routes", () => { // "search" as a non-UUID oppId — same as the #1049 spike. it("answers GET on the search path with the detail handler's 400, as the spike's :oppId pattern did", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search")), + opportunitiesRequest("0.3.0", "/search"), ); expect(response.status).toBe(400); @@ -840,7 +826,7 @@ describe("opportunities routes", () => { it("returns 400 with the protocol Error shape for an unknown filter operator", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({ filters: { status: { operator: "contains", value: ["open"] } }, @@ -866,7 +852,7 @@ describe("opportunities routes", () => { it("returns 400 with the protocol Error shape for a status filter whose value is not an array", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({ filters: { status: { operator: "in", value: 5 } }, @@ -892,7 +878,7 @@ describe("opportunities routes", () => { it("returns 400 with the protocol Error shape for a range filter with no value", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({ filters: { closeDateRange: { operator: "between" } }, @@ -975,7 +961,7 @@ describe("opportunities routes", () => { "returns 400 rather than silently dropping a malformed %s bound", async (field, filter, expectedErrorField) => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({ filters: { [field]: filter } }), headers: { "Content-Type": "application/json" }, @@ -1028,7 +1014,7 @@ describe("opportunities routes", () => { it("returns 400 for a body pagination value below the spec minimum", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({ pagination: { page: 0, pageSize: -1 } }), headers: { "Content-Type": "application/json" }, @@ -1049,22 +1035,22 @@ describe("opportunities routes", () => { }); }); -describe("version path prefix", () => { +describe("CG-Version header", () => { it.each(VERSIONS)( "resolves the list, detail, and search routes for v%s", async (version) => { const listResponse = await handleMockRequest( - new Request(opportunitiesUrl(version)), + opportunitiesRequest(version), ); expect(listResponse.status).toBe(200); const detailResponse = await handleMockRequest( - new Request(opportunitiesUrl(version, `/${CANONICAL_OPPORTUNITY_ID}`)), + opportunitiesRequest(version, `/${CANONICAL_OPPORTUNITY_ID}`), ); expect(detailResponse.status).toBe(200); const searchResponse = await handleMockRequest( - new Request(opportunitiesUrl(version, "/search"), { + opportunitiesRequest(version, "/search", { method: "POST", body: JSON.stringify({}), headers: { "Content-Type": "application/json" }, @@ -1074,59 +1060,32 @@ describe("version path prefix", () => { }, ); - it("returns 404 with the protocol error envelope for an unsupported version prefix", async () => { - const response = await handleMockRequest( - new Request( - "https://docs.example/api/v9.9.9/common-grants/opportunities", - ), - ); - - expect(response.status).toBe(404); + it("serves the default version when no CG-Version header is sent", async () => { + const response = await handleMockRequest(opportunitiesRequest(undefined)); - const body = (await response.json()) as { - status: number; - message: string; - errors: unknown[]; - }; - - expect(body.status).toBe(404); - expect(typeof body.message).toBe("string"); - expect(Array.isArray(body.errors)).toBe(true); + expect(response.status).toBe(200); + expect(response.headers.get("CG-Version-Served")).toBe("0.6.0"); }); - it("returns 404 with the protocol error envelope when the version prefix is missing entirely", async () => { - const response = await handleMockRequest( - new Request("https://docs.example/api/common-grants/opportunities"), - ); - - expect(response.status).toBe(404); + it.each([ + ["9.9.9", 406], + ["abc", 400], + ])( + "returns a protocol error envelope for the CG-Version value %j (status %i)", + async (version, status) => { + const response = await handleMockRequest(opportunitiesRequest(version)); - const body = (await response.json()) as { - status: number; - message: string; - errors: unknown[]; - }; + expect(response.status).toBe(status); - expect(body.status).toBe(404); - expect(typeof body.message).toBe("string"); - expect(Array.isArray(body.errors)).toBe(true); - }); - - it("returns 404 with the protocol error envelope for a malformed version prefix", async () => { - const response = await handleMockRequest( - new Request("https://docs.example/api/vabc/common-grants/opportunities"), - ); - - expect(response.status).toBe(404); - - const body = (await response.json()) as { - status: number; - message: string; - errors: unknown[]; - }; + const body = (await response.json()) as { + status: number; + message: string; + errors: unknown[]; + }; - expect(body.status).toBe(404); - expect(typeof body.message).toBe("string"); - expect(Array.isArray(body.errors)).toBe(true); - }); + expect(body.status).toBe(status); + expect(typeof body.message).toBe("string"); + expect(Array.isArray(body.errors)).toBe(true); + }, + ); }); diff --git a/website/__tests__/lib/mock/handlers/organizations.spec.ts b/website/__tests__/lib/mock/handlers/organizations.spec.ts index d851e62ba..14b10a926 100644 --- a/website/__tests__/lib/mock/handlers/organizations.spec.ts +++ b/website/__tests__/lib/mock/handlers/organizations.spec.ts @@ -24,15 +24,16 @@ import { } from "@/lib/mock/data/organizations"; import { RESERVED_MISSING_ID } from "@/lib/mock/data/ids"; import type { Version } from "@/lib/mock/data/fixtures"; +import { mockUrl } from "../__fixtures__/mock-request"; const VERSION: Version = "0.4.0"; /** Builds a request URL; the host/base path are placeholders. */ function orgsUrl(suffix = ""): string { - return `https://docs.example/api/v${VERSION}/common-grants/orgs${suffix}`; + return mockUrl(`/orgs${suffix}`); } -describe("GET /v{version}/common-grants/orgs (list)", () => { +describe("GET /common-grants/orgs (list)", () => { it("returns a 200 with the protocol paginated envelope, ordered by name ascending", async () => { const response = listOrganizations(new Request(orgsUrl()), VERSION); @@ -172,7 +173,7 @@ describe("GET /v{version}/common-grants/orgs (list)", () => { }); }); -describe("GET /v{version}/common-grants/orgs/{orgId} (read)", () => { +describe("GET /common-grants/orgs/{orgId} (read)", () => { it("returns 200 for the id Swagger UI pre-fills", async () => { const response = getOrganization( CANONICAL_ORGANIZATION_ID, @@ -281,7 +282,7 @@ describe("GET /v{version}/common-grants/orgs/{orgId} (read)", () => { }); }); -describe("PATCH /v{version}/common-grants/orgs/{orgId} (update)", () => { +describe("PATCH /common-grants/orgs/{orgId} (update)", () => { async function runUpdate(orgId: string, body: unknown) { return updateOrganization( orgId, @@ -492,7 +493,7 @@ describe("PATCH /v{version}/common-grants/orgs/{orgId} (update)", () => { }); }); -describe("POST /v{version}/common-grants/orgs/{orgId}/changes (submit)", () => { +describe("POST /common-grants/orgs/{orgId}/changes (submit)", () => { it("returns 202 with a pending revision and a Location header pointing at the new change", async () => { const response = await submitOrgChange( CANONICAL_ORGANIZATION_ID, @@ -585,7 +586,7 @@ describe("POST /v{version}/common-grants/orgs/{orgId}/changes (submit)", () => { }); }); -describe("GET /v{version}/common-grants/orgs/{orgId}/changes (list changes)", () => { +describe("GET /common-grants/orgs/{orgId}/changes (list changes)", () => { it("returns a 200 paginated envelope of the org's revisions, newest createdAt first", async () => { const expected = revisionsForOrg(CANONICAL_ORGANIZATION_ID); @@ -642,7 +643,7 @@ describe("GET /v{version}/common-grants/orgs/{orgId}/changes (list changes)", () }); }); -describe("GET /v{version}/common-grants/orgs/{orgId}/changes/{changeId} (view change)", () => { +describe("GET /common-grants/orgs/{orgId}/changes/{changeId} (view change)", () => { it("returns 200 echoing the id Swagger UI pre-fills into both path parameter boxes", async () => { const response = getOrgChange( CANONICAL_ORGANIZATION_ID, diff --git a/website/__tests__/lib/mock/handlers/sdk-envelope.spec.ts b/website/__tests__/lib/mock/handlers/sdk-envelope.spec.ts index 6ce80045d..e3819f685 100644 --- a/website/__tests__/lib/mock/handlers/sdk-envelope.spec.ts +++ b/website/__tests__/lib/mock/handlers/sdk-envelope.spec.ts @@ -8,16 +8,12 @@ import { describe, it, expect } from "vitest"; import { handleMockRequest } from "@/lib/mock/router"; import { OPPORTUNITY_FIXTURES } from "@/lib/mock/data/fixtures"; - -/** Builds `https://docs.example/api/v{version}/common-grants/opportunities{suffix}`. */ -function opportunitiesUrl(version: string, suffix = ""): string { - return `https://docs.example/api/v${version}/common-grants/opportunities${suffix}`; -} +import { opportunitiesRequest } from "../__fixtures__/mock-request"; /** Runs a search POST and returns the parsed envelope, asserting a 200 first. */ async function runSearch(body: unknown) { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify(body), headers: { "Content-Type": "application/json" }, @@ -141,7 +137,7 @@ describe("search/list envelope shapes the TS SDK's strict zod schemas depend on" "derives totalPages via Math.ceil(totalItems / pageSize) for pageSize=%i", async (pageSize) => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", `?pageSize=${pageSize}`)), + opportunitiesRequest("0.3.0", `?pageSize=${pageSize}`), ); expect(response.status).toBe(200); @@ -171,7 +167,7 @@ describe("search/list envelope shapes the TS SDK's strict zod schemas depend on" describe("top-level envelope key sets", () => { it("search envelope carries exactly status/message/items/paginationInfo/sortInfo/filterInfo", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({}), headers: { "Content-Type": "application/json" }, @@ -195,9 +191,7 @@ describe("search/list envelope shapes the TS SDK's strict zod schemas depend on" }); it("list envelope carries exactly status/message/items/paginationInfo", async () => { - const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0")), - ); + const response = await handleMockRequest(opportunitiesRequest("0.3.0")); expect(response.status).toBe(200); diff --git a/website/__tests__/lib/mock/http/cors.spec.ts b/website/__tests__/lib/mock/http/cors.spec.ts index fae256d08..25fe4bc86 100644 --- a/website/__tests__/lib/mock/http/cors.spec.ts +++ b/website/__tests__/lib/mock/http/cors.spec.ts @@ -12,18 +12,37 @@ import { } from "@/lib/mock/data/fixtures"; import { withCors } from "@/lib/mock/http/cors"; import { withErrorBoundary } from "@/lib/mock/http/envelope"; +import { VERSION_HEADER, VERSION_SERVED_HEADER } from "@/lib/mock/http/version"; +import { + mockRequest, + mockUrl, + opportunitiesRequest, +} from "../__fixtures__/mock-request"; + +const EXPOSED_VERSION_HEADERS = [ + VERSION_SERVED_HEADER, + "Deprecation", + "Sunset", + "Link", +]; + +function exposedHeaders(response: Response): string[] { + return (response.headers.get("Access-Control-Expose-Headers") ?? "") + .split(",") + .map((name) => name.trim().toLowerCase()); +} -/** Builds `https://docs.example/api/v{version}/common-grants/opportunities{suffix}`. */ -function opportunitiesUrl(version: string, suffix = ""): string { - return `https://docs.example/api/v${version}/common-grants/opportunities${suffix}`; +function expectExposesVersionHeaders(response: Response) { + const exposed = exposedHeaders(response); + for (const name of EXPOSED_VERSION_HEADERS) { + expect(exposed).toContain(name.toLowerCase()); + } } describe("CORS", () => { describe("success responses carry Access-Control-Allow-Origin: *", () => { it.each(SUPPORTED_VERSIONS)("list route, for v%s", async (version) => { - const response = await handleMockRequest( - new Request(opportunitiesUrl(version)), - ); + const response = await handleMockRequest(opportunitiesRequest(version)); expect(response.status).toBe(200); expect(response.headers.get("Access-Control-Allow-Origin")).toBe("*"); @@ -31,7 +50,7 @@ describe("CORS", () => { it("detail route", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", `/${CANONICAL_OPPORTUNITY_ID}`)), + opportunitiesRequest("0.3.0", `/${CANONICAL_OPPORTUNITY_ID}`), ); expect(response.status).toBe(200); @@ -40,7 +59,7 @@ describe("CORS", () => { it("search route", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({}), headers: { "Content-Type": "application/json" }, @@ -55,7 +74,7 @@ describe("CORS", () => { describe("error responses carry Access-Control-Allow-Origin: * too", () => { it("400 for a malformed (non-UUID) detail oppId", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/not-a-uuid")), + opportunitiesRequest("0.3.0", "/not-a-uuid"), ); expect(response.status).toBe(400); @@ -64,9 +83,7 @@ describe("CORS", () => { it("404 for a well-formed but unknown detail oppId", async () => { const response = await handleMockRequest( - new Request( - opportunitiesUrl("0.3.0", `/${RESERVED_MISSING_OPPORTUNITY_ID}`), - ), + opportunitiesRequest("0.3.0", `/${RESERVED_MISSING_OPPORTUNITY_ID}`), ); expect(response.status).toBe(404); @@ -75,7 +92,7 @@ describe("CORS", () => { it("400 for a malformed search request body", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: "{not valid json", headers: { "Content-Type": "application/json" }, @@ -118,9 +135,9 @@ describe("CORS", () => { describe("OPTIONS preflight", () => { const preflightTargets: Array<[string, string]> = [ - ["list", opportunitiesUrl("0.3.0")], - ["detail", opportunitiesUrl("0.3.0", `/${CANONICAL_OPPORTUNITY_ID}`)], - ["search", opportunitiesUrl("0.3.0", "/search")], + ["list", mockUrl("/opportunities")], + ["detail", mockUrl(`/opportunities/${CANONICAL_OPPORTUNITY_ID}`)], + ["search", mockUrl("/opportunities/search")], ["health", "https://docs.example/api/"], ["an unmatched path", "https://docs.example/api/nonexistent"], ]; @@ -150,6 +167,7 @@ describe("CORS", () => { expect(allowHeaders).toContain("content-type"); expect(allowHeaders).toContain("x-api-key"); expect(allowHeaders).toContain("authorization"); + expect(allowHeaders).toContain(VERSION_HEADER.toLowerCase()); const text = await response.text(); expect(text).toBe(""); @@ -158,12 +176,12 @@ describe("CORS", () => { it("answers a browser-shaped preflight (Origin + Access-Control-Request-Method/Headers) the same way", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "OPTIONS", headers: { Origin: "https://commongrants.org", "Access-Control-Request-Method": "POST", - "Access-Control-Request-Headers": "content-type,x-api-key", + "Access-Control-Request-Headers": "content-type,cg-version", }, }), ); @@ -184,16 +202,88 @@ describe("CORS", () => { expect(allowHeaders).toContain("content-type"); expect(allowHeaders).toContain("x-api-key"); expect(allowHeaders).toContain("authorization"); + expect(allowHeaders).toContain(VERSION_HEADER.toLowerCase()); const text = await response.text(); expect(text).toBe(""); }); }); + describe("non-preflight responses expose the version headers", () => { + it("200 opportunities list", async () => { + const response = await handleMockRequest(opportunitiesRequest("0.3.0")); + + expect(response.status).toBe(200); + expectExposesVersionHeaders(response); + }); + + it("404 route miss", async () => { + const response = await handleMockRequest( + new Request("https://docs.example/api/nonexistent"), + ); + + expect(response.status).toBe(404); + expectExposesVersionHeaders(response); + }); + + it("400 for a malformed version", async () => { + const response = await handleMockRequest( + mockRequest("/opportunities", "v1"), + ); + + expect(response.status).toBe(400); + expectExposesVersionHeaders(response); + }); + + it("406 for an unsupported version", async () => { + const response = await handleMockRequest(mockRequest("/awards", "0.2.0")); + + expect(response.status).toBe(406); + expectExposesVersionHeaders(response); + }); + + it("200 versions discovery route", async () => { + const response = await handleMockRequest( + new Request(mockUrl("/versions")), + ); + + expect(response.status).toBe(200); + expectExposesVersionHeaders(response); + }); + + it("200 health route", async () => { + const response = await handleMockRequest( + new Request("https://docs.example/api/"), + ); + + expect(response.status).toBe(200); + expectExposesVersionHeaders(response); + }); + + it("500 from the error boundary", async () => { + const consoleError = vi + .spyOn(console, "error") + .mockImplementation(() => {}); + + try { + const response = withCors( + await withErrorBoundary(() => { + throw new Error("boom"); + }), + ); + + expect(response.status).toBe(500); + expectExposesVersionHeaders(response); + } finally { + consoleError.mockRestore(); + } + }); + }); + describe("SDK auth headers on an actual (non-preflight) request", () => { it("a search request carrying X-API-Key and Authorization still returns 200 with the CORS header", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({}), headers: { @@ -210,7 +300,7 @@ describe("CORS", () => { it("a search request with no auth headers (Auth.none()) still returns 200 with the CORS header", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: JSON.stringify({}), headers: { "Content-Type": "application/json" }, @@ -227,7 +317,7 @@ describe("CORS", () => { describe("unexpected failures stay on the CORS path", () => { it("answers a JSON body that is valid but not an object without throwing, and with the CORS header", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/search"), { + opportunitiesRequest("0.3.0", "/search", { method: "POST", body: "null", headers: { "Content-Type": "application/json" }, diff --git a/website/__tests__/lib/mock/http/version.spec.ts b/website/__tests__/lib/mock/http/version.spec.ts new file mode 100644 index 000000000..07dc2e198 --- /dev/null +++ b/website/__tests__/lib/mock/http/version.spec.ts @@ -0,0 +1,170 @@ +/** + * `CG-Version` resolution (ADR 0032, #1393): which version a route serves for a + * request header, and the 0.6.0 version errors rendered for a bad one. + */ +import { describe, it, expect } from "vitest"; +import { + DEFAULT_VERSION, + VERSION_HEADER, + resolveRequestedVersion, + type RouteVersions, + type VersionError, +} from "@/lib/mock/http/version"; +import { versionErrorResponse } from "@/lib/mock/http/envelope"; +import { SUPPORTED_VERSIONS } from "@/lib/mock/data/fixtures"; +import { getValidator } from "../conformance/schema-validator"; + +const DISCOVERY = "https://docs.example/api/common-grants/versions"; + +const FULL_ROUTE: RouteVersions = { + label: "GET /common-grants/opportunities", + versions: SUPPORTED_VERSIONS, + defaultVersion: "0.6.0", +}; + +const NARROW_ROUTE: RouteVersions = { + label: "GET /common-grants/awards", + versions: ["0.4.0", "0.5.0", "0.6.0"], + defaultVersion: "0.6.0", +}; + +/** Resolves and returns the error, failing the test if resolution succeeded. */ +function errorFor(header: string | null, route = NARROW_ROUTE): VersionError { + const resolution = resolveRequestedVersion(header, route); + if (!("error" in resolution)) { + throw new Error(`Expected an error for ${JSON.stringify(header)}`); + } + return resolution.error; +} + +describe("resolveRequestedVersion", () => { + it("serves the default version when no header is sent", () => { + expect(resolveRequestedVersion(null, FULL_ROUTE)).toEqual({ + version: DEFAULT_VERSION, + }); + expect(DEFAULT_VERSION).toBe("0.6.0"); + }); + + it("serves the route's own default when no header is sent", () => { + const route = { ...NARROW_ROUTE, defaultVersion: "0.5.0" } as const; + + expect(resolveRequestedVersion(null, route)).toEqual({ version: "0.5.0" }); + }); + + it.each([ + ["0.5.1", "0.5.0"], + [" 0.5.0 ", "0.5.0"], + ["0.6.0", "0.6.0"], + ])("serves the hosted version for %j", (header, expected) => { + expect(resolveRequestedVersion(header, NARROW_ROUTE)).toEqual({ + version: expected, + }); + }); + + describe("version.conflict", () => { + it.each(["0.5.0, 0.6.0", "0.5.0, 0.5.0", "banana, 0.5.0", "0.5.0, "])( + "rejects multiple values %j with 400 and names each value", + (header) => { + const error = errorFor(header); + + expect(error.status).toBe(400); + expect(error.detail.code).toBe("version.conflict"); + for (const value of header.split(",").map((v) => v.trim())) { + expect(error.detail.message).toContain(JSON.stringify(value)); + } + expect(error.detail.field).toBe(VERSION_HEADER); + expect(error.detail).not.toHaveProperty("requested"); + expect(error.detail).not.toHaveProperty("scope"); + expect(error.detail.supported).toEqual(NARROW_ROUTE.versions); + expect(error.detail.defaultVersion).toBe(NARROW_ROUTE.defaultVersion); + }, + ); + }); + + describe("version.malformed", () => { + it.each(["banana", "0.5", "v0.5.0", "00.5.0", ""])( + "rejects %j with 400 and echoes it as sent", + (header) => { + const error = errorFor(header); + + expect(error.status).toBe(400); + expect(error.detail).toMatchObject({ + code: "version.malformed", + requested: header, + }); + expect(error.detail.message).toContain(header); + expect(error.detail.field).toBe(VERSION_HEADER); + expect(error.detail).not.toHaveProperty("scope"); + expect(error.detail.supported).toEqual(NARROW_ROUTE.versions); + expect(error.detail.defaultVersion).toBe(NARROW_ROUTE.defaultVersion); + }, + ); + + it("echoes the value untrimmed", () => { + expect(errorFor(" 0.5 ").detail).toMatchObject({ requested: " 0.5 " }); + }); + }); + + describe("version.unsupported", () => { + it.each(["0.9.0", "1.5.0"])( + "rejects %s with 406 at deployment scope", + (header) => { + const error = errorFor(header); + + expect(error.status).toBe(406); + expect(error.detail).toMatchObject({ + code: "version.unsupported", + scope: "deployment", + requested: header, + }); + expect(error.detail.message).toContain(header); + expect(error.detail.field).toBe(VERSION_HEADER); + expect(error.detail.supported).toEqual(NARROW_ROUTE.versions); + expect(error.detail.defaultVersion).toBe(NARROW_ROUTE.defaultVersion); + }, + ); + + it("rejects a version the mock serves but the route does not, at operation scope", () => { + const error = errorFor("0.2.0"); + + expect(error.status).toBe(406); + expect(error.detail).toMatchObject({ + code: "version.unsupported", + scope: "operation", + requested: "0.2.0", + }); + expect(error.detail.message).toContain("0.2.0"); + expect(error.detail.supported).toEqual(NARROW_ROUTE.versions); + expect(error.detail.defaultVersion).toBe(NARROW_ROUTE.defaultVersion); + }); + }); +}); + +describe("versionErrorResponse for version errors", () => { + it.each([ + ["version.malformed", "banana", "VersionMalformedError.yaml"], + ["version.conflict", "0.5.0, 0.6.0", "VersionConflictError.yaml"], + ["version.unsupported", "0.9.0", "VersionUnsupportedError.yaml"], + ])("renders %s as a schema-valid body", async (code, header, schemaName) => { + const error = errorFor(header); + expect(error.detail.code).toBe(code); + + const response = versionErrorResponse(error, DISCOVERY); + const body = await response.json(); + const { validate, errorText } = getValidator("0.6.0", schemaName, { + requireVersioned: true, + }); + + expect(response.status).toBe(error.status); + expect(body.status).toBe(error.status); + expect(body.errors[0].discovery).toBe(DISCOVERY); + expect(validate(body), errorText()).toBe(true); + }); + + it("omits discovery when no discovery URL is given", async () => { + const response = versionErrorResponse(errorFor("banana")); + const body = await response.json(); + + expect(body.errors[0]).not.toHaveProperty("discovery"); + }); +}); diff --git a/website/__tests__/lib/mock/router.spec.ts b/website/__tests__/lib/mock/router.spec.ts index 350f1de04..051f3eb0b 100644 --- a/website/__tests__/lib/mock/router.spec.ts +++ b/website/__tests__/lib/mock/router.spec.ts @@ -8,16 +8,12 @@ import { describe, it, expect } from "vitest"; import type { APIContext } from "astro"; import { handleMockRequest, MOCK_API_BASE_PATH } from "@/lib/mock/router"; import { SUPPORTED_METHODS } from "@/lib/mock/http/methods"; -import { CANONICAL_OPPORTUNITY_ID } from "@/lib/mock/data/fixtures"; +import { VERSION_SERVED_HEADER } from "@/lib/mock/http/version"; import { CANONICAL_APPLICATION_ID } from "@/lib/mock/data/applications"; import { CANONICAL_FORM_ID } from "@/lib/mock/data/forms"; import { CANONICAL_ORGANIZATION_ID } from "@/lib/mock/data/organizations"; import * as apiRoute from "@/pages/api/[...path]"; - -/** Builds `https://docs.example/api/v{version}/common-grants/opportunities{suffix}`. */ -function opportunitiesUrl(version: string, suffix = ""): string { - return `https://docs.example/api/v${version}/common-grants/opportunities${suffix}`; -} +import { mockRequest, opportunitiesRequest } from "./__fixtures__/mock-request"; describe("MOCK_API_BASE_PATH", () => { it("is the fixed base the router strips off the pathname before matching the Worker's route regex", () => { @@ -33,13 +29,11 @@ describe("Astro route wiring (src/pages/api/[...path].ts)", () => { it("delegates ALL to handleMockRequest untouched, for a real opportunities request", async () => { // The ALL handler only needs `request`; the rest of APIContext is cast away. const context = { - request: new Request(opportunitiesUrl("0.3.0")), + request: opportunitiesRequest("0.3.0"), } as unknown as APIContext; const routed = await apiRoute.ALL(context); - const direct = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0")), - ); + const direct = await handleMockRequest(opportunitiesRequest("0.3.0")); expect(routed.status).toBe(direct.status); expect(await routed.json()).toEqual(await direct.json()); @@ -47,8 +41,7 @@ describe("Astro route wiring (src/pages/api/[...path].ts)", () => { }); describe("method allowlist", () => { - const V = "0.4.0"; - const ORG = `/api/v${V}/common-grants/orgs/${CANONICAL_ORGANIZATION_ID}`; + const ORG = `/api/common-grants/orgs/${CANONICAL_ORGANIZATION_ID}`; /** * One route per supported verb, each chosen because it actually serves that @@ -58,8 +51,8 @@ describe("method allowlist", () => { */ const ROUTE_SERVING: Record = { GET: ORG, - POST: `/api/v${V}/common-grants/opportunities/search`, - PUT: `/api/v${V}/common-grants/applications/${CANONICAL_APPLICATION_ID}/forms/${CANONICAL_FORM_ID}`, + POST: "/api/common-grants/opportunities/search", + PUT: `/api/common-grants/applications/${CANONICAL_APPLICATION_ID}/forms/${CANONICAL_FORM_ID}`, PATCH: ORG, }; @@ -119,6 +112,8 @@ describe("method allowlist", () => { const response = await call(method, ROUTE_SERVING[method]); expect(response.status).not.toBe(404); + // Proves dispatch ran rather than a version error answering first. + expect(response.headers.get(VERSION_SERVED_HEADER)).not.toBeNull(); }, ); @@ -162,7 +157,7 @@ describe("base-path handling (new in the website port, no Worker analogue)", () it("treats a path missing the /api base as a route miss, not the opportunities list", async () => { const response = await handleMockRequest( - new Request("https://docs.example/v0.3.0/common-grants/opportunities"), + new Request("https://docs.example/common-grants/opportunities"), ); expect(response.status).toBe(404); @@ -177,7 +172,7 @@ describe("base-path handling (new in the website port, no Worker analogue)", () // alternative — not re-decided here. it("treats a trailing slash on an opportunities path as a route miss, same as the Worker", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0", "/")), + opportunitiesRequest("0.3.0", "/"), ); expect(response.status).toBe(404); @@ -189,73 +184,12 @@ describe("base-path handling (new in the website port, no Worker analogue)", () }); }); -describe("the requested version actually reaches the handler, not merely 200", () => { - it("omits acceptedApplicantTypes from the v0.1.0 list record that carries it in v0.3.0", async () => { - const v01Response = await handleMockRequest( - new Request(opportunitiesUrl("0.1.0")), - ); - const v03Response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0")), - ); - - expect(v01Response.status).toBe(200); - expect(v03Response.status).toBe(200); - - const v01Body = (await v01Response.json()) as { - items: Array & { id: string }>; - }; - const v03Body = (await v03Response.json()) as { - items: Array & { id: string }>; - }; - - const v01Item = v01Body.items.find( - (item) => item.id === CANONICAL_OPPORTUNITY_ID, - ); - const v03Item = v03Body.items.find( - (item) => item.id === CANONICAL_OPPORTUNITY_ID, - ); - - expect(v01Item).toBeDefined(); - expect(v03Item).toBeDefined(); - // If the router dropped `version` and always shaped for one of them, - // this pair would collapse. - expect(v01Item).not.toHaveProperty("acceptedApplicantTypes"); - expect(v03Item).toHaveProperty("acceptedApplicantTypes"); - }); -}); - describe("404 discrimination the ported handler/CORS specs leave at status-level only", () => { - it("flags an unsupported version prefix with field: 'version'", async () => { - const response = await handleMockRequest( - new Request(opportunitiesUrl("9.9.9")), - ); - - expect(response.status).toBe(404); - - const body = (await response.json()) as { - errors: Array<{ field: string; message: string }>; - }; - expect(body.errors[0].field).toBe("version"); - }); - - it("flags a malformed version prefix with field: 'version' too", async () => { - const response = await handleMockRequest( - new Request(opportunitiesUrl("abc")), - ); - - expect(response.status).toBe(404); - - const body = (await response.json()) as { - errors: Array<{ field: string; message: string }>; - }; - expect(body.errors[0].field).toBe("version"); - }); - // `field: "path"` lets a caller tell "this is not a route" from "this // record does not exist". it("flags a path outside the served surface with field: 'path'", async () => { const response = await handleMockRequest( - new Request("https://docs.example/api/v0.4.0/common-grants/proposals"), + new Request("https://docs.example/api/common-grants/proposals"), ); expect(response.status).toBe(404); @@ -267,43 +201,30 @@ describe("404 discrimination the ported handler/CORS specs leave at status-level expect(body.errors[0].message).toContain("No route matches"); }); - it("names the adding version for a resource absent from the requested version", async () => { - const response = await handleMockRequest( - new Request("https://docs.example/api/v0.2.0/common-grants/awards"), - ); - - expect(response.status).toBe(404); - - const body = (await response.json()) as { - errors: Array<{ field: string; message: string }>; - }; - expect(body.errors[0].field).toBe("path"); - expect(body.errors[0].message).toContain("added in v0.4.0"); - }); - - // The gate is driven by the RESOURCE_MIN_VERSION table, so every entry - // should behave alike; only awards was covered. + // Driven by the RESOURCE_MIN_VERSION table, so every entry should behave alike. it.each([ + { resource: "awards", version: "0.2.0", addedIn: "0.4.0" }, { resource: "orgs", version: "0.3.0", addedIn: "0.4.0" }, { resource: "competitions", version: "0.1.0", addedIn: "0.2.0" }, { resource: "applications", version: "0.1.0", addedIn: "0.2.0" }, { resource: "forms", version: "0.1.0", addedIn: "0.2.0" }, ])( - "404s $resource at v$version, naming v$addedIn as the version that added it", + "answers $resource at v$version with an operation-scope version.unsupported listing v$addedIn first", async ({ resource, version, addedIn }) => { const response = await handleMockRequest( - new Request( - `https://docs.example/api/v${version}/common-grants/${resource}`, - ), + mockRequest(`/${resource}`, version), ); - expect(response.status).toBe(404); + expect(response.status).toBe(406); const body = (await response.json()) as { - errors: Array<{ field: string; message: string }>; + errors: Array<{ code: string; scope: string; supported: string[] }>; }; - expect(body.errors[0].field).toBe("path"); - expect(body.errors[0].message).toContain(`added in v${addedIn}`); + expect(body.errors[0]).toMatchObject({ + code: "version.unsupported", + scope: "operation", + }); + expect(body.errors[0].supported[0]).toBe(addedIn); }, ); @@ -320,9 +241,7 @@ describe("404 discrimination the ported handler/CORS specs leave at status-level "answers a bare trailing slash on /%s with a route miss, not a 400", async (resource) => { const response = await handleMockRequest( - new Request( - `https://docs.example/api/v0.4.0/common-grants/${resource}/`, - ), + new Request(`https://docs.example/api/common-grants/${resource}/`), ); expect(response.status).toBe(404); @@ -337,7 +256,7 @@ describe("404 discrimination the ported handler/CORS specs leave at status-level it("answers a path nested deeper than any route with a route miss", async () => { const response = await handleMockRequest( new Request( - "https://docs.example/api/v0.4.0/common-grants/opportunities/foo/bar", + "https://docs.example/api/common-grants/opportunities/foo/bar", ), ); @@ -351,7 +270,7 @@ describe("404 discrimination the ported handler/CORS specs leave at status-level it("flags an unsupported method on an otherwise-valid path with field: 'path'", async () => { const response = await handleMockRequest( - new Request(opportunitiesUrl("0.3.0"), { method: "PUT" }), + mockRequest("/opportunities", "0.3.0", { method: "PUT" }), ); expect(response.status).toBe(404); diff --git a/website/__tests__/lib/mock/version-routing.spec.ts b/website/__tests__/lib/mock/version-routing.spec.ts new file mode 100644 index 000000000..4dc9f2541 --- /dev/null +++ b/website/__tests__/lib/mock/version-routing.spec.ts @@ -0,0 +1,259 @@ +/** + * Pins header-based version selection in the router (#1393-T2, ADR 0032): + * `CG-Version` picks the version, the path never does, and each outcome + * carries (or omits) the served/vary headers as the ADR requires. + */ + +import { describe, it, expect } from "vitest"; +import { handleMockRequest } from "@/lib/mock/router"; +import { + SUPPORTED_VERSIONS, + CANONICAL_OPPORTUNITY_ID, + RESERVED_MISSING_OPPORTUNITY_ID, +} from "@/lib/mock/data/fixtures"; +import { + VERSION_HEADER, + VERSION_SERVED_HEADER, + DEFAULT_VERSION, +} from "@/lib/mock/http/version"; +import { mockRequest } from "./__fixtures__/mock-request"; + +interface ErrorBody { + status: number; + message: string; + errors: Array>; +} + +const JSON_HEADERS = { "Content-Type": "application/json" }; + +describe("version selected by the CG-Version header", () => { + it.each(SUPPORTED_VERSIONS)( + "serves GET /opportunities in %s with the served and Vary headers", + async (version) => { + const response = await handleMockRequest( + mockRequest("/opportunities", version), + ); + + expect(response.status).toBe(200); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBe(version); + expect(response.headers.get("Vary")).toContain(VERSION_HEADER); + }, + ); + + it("serves the default version when no header is sent", async () => { + const response = await handleMockRequest( + mockRequest("/opportunities", undefined), + ); + + expect(response.status).toBe(200); + expect(DEFAULT_VERSION).toBe("0.6.0"); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBe("0.6.0"); + expect(response.headers.get("Vary")).toContain(VERSION_HEADER); + }); + + it("serves the hosted version for a patch that isn't hosted", async () => { + const response = await handleMockRequest( + mockRequest("/opportunities", "0.5.9"), + ); + + expect(response.status).toBe(200); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBe("0.5.0"); + }); + + it("ignores a cg-version query parameter", async () => { + const response = await handleMockRequest( + mockRequest("/opportunities?cg-version=0.5.0", undefined), + ); + + expect(response.status).toBe(200); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBe("0.6.0"); + }); + + it("passes the version to the handler, not merely the header", async () => { + const find = async (version: string) => { + const response = await handleMockRequest( + mockRequest("/opportunities", version), + ); + const body = (await response.json()) as { + items: Array & { id: string }>; + }; + return body.items.find((item) => item.id === CANONICAL_OPPORTUNITY_ID); + }; + + const v01Item = await find("0.1.0"); + const v03Item = await find("0.3.0"); + + expect(v01Item).toBeDefined(); + expect(v03Item).toBeDefined(); + expect(v01Item).not.toHaveProperty("acceptedApplicantTypes"); + expect(v03Item).toHaveProperty("acceptedApplicantTypes"); + }); + + it("marks a record 404 with the served version", async () => { + const response = await handleMockRequest( + mockRequest(`/opportunities/${RESERVED_MISSING_OPPORTUNITY_ID}`, "0.3.0"), + ); + + expect(response.status).toBe(404); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBe("0.3.0"); + expect(response.headers.get("Vary")).toContain(VERSION_HEADER); + }); + + it("marks a body validation 400 with the served version", async () => { + const response = await handleMockRequest( + mockRequest("/opportunities/search", "0.3.0", { + method: "POST", + headers: JSON_HEADERS, + body: "{not json", + }), + ); + + expect(response.status).toBe(400); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBe("0.3.0"); + }); +}); + +describe("a version in the path is not a selector", () => { + it("answers /api/v{x}/common-grants/... with the plain route-miss 404", async () => { + const response = await handleMockRequest( + new Request( + "https://docs.example/api/v0.5.0/common-grants/opportunities", + ), + ); + + expect(response.status).toBe(404); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBeNull(); + + const body = (await response.json()) as ErrorBody; + expect(body.status).toBe(404); + expect(body.message).toBe("Not found"); + expect(body.errors[0].field).toBe("path"); + }); +}); + +describe("a route requested in a version that predates it", () => { + it.each([ + { + name: "awards in 0.2.0", + path: "/awards", + init: {}, + supported: ["0.4.0", "0.5.0", "0.6.0"], + }, + { + name: "application search in 0.2.0", + path: "/applications/search", + init: { method: "POST", headers: JSON_HEADERS, body: "{}" }, + supported: ["0.3.0", "0.4.0", "0.5.0", "0.6.0"], + }, + ])("returns 406 version.unsupported (operation) for $name", async (c) => { + const response = await handleMockRequest( + mockRequest(c.path, "0.2.0", c.init), + ); + + expect(response.status).toBe(406); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBeNull(); + + const body = (await response.json()) as ErrorBody; + expect(body.errors[0]).toMatchObject({ + code: "version.unsupported", + scope: "operation", + requested: "0.2.0", + supported: c.supported, + defaultVersion: "0.6.0", + field: "CG-Version", + }); + }); +}); + +describe("route matching comes before version resolution", () => { + it("returns the plain route-miss 404 for an unknown resource even with a malformed header", async () => { + const response = await handleMockRequest( + mockRequest("/proposals", "banana"), + ); + + expect(response.status).toBe(404); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBeNull(); + + const body = (await response.json()) as ErrorBody; + expect(body.message).toBe("Not found"); + expect(body.errors[0].field).toBe("path"); + }); +}); + +describe("a route miss inside a known resource", () => { + it.each([ + ["/awards", { method: "DELETE" }], + ["/opportunities/foo/bar", {}], + ])( + "answers %s with a 404 that carries the served version and Vary", + async (path, init) => { + const response = await handleMockRequest( + mockRequest(path, "0.5.0", init), + ); + + expect(response.status).toBe(404); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBe("0.5.0"); + expect(response.headers.get("Vary")).toContain(VERSION_HEADER); + }, + ); + + // The accepted gap (PLAN-1393 T2): the version is resolved before the + // router knows the sub-route is missing, so a bad header wins over the 404. + it("answers a malformed header with 400 rather than 404", async () => { + const response = await handleMockRequest( + mockRequest("/awards", "banana", { method: "DELETE" }), + ); + + expect(response.status).toBe(400); + }); +}); + +describe("version errors through the router", () => { + it.each([ + { + header: "banana", + status: 400, + code: "version.malformed", + scope: undefined, + }, + { + header: "0.9.0", + status: 406, + code: "version.unsupported", + scope: "deployment", + }, + { + header: "0.5.0, 0.6.0", + status: 400, + code: "version.conflict", + scope: undefined, + }, + ])( + "answers CG-Version: $header with $status $code", + async ({ header, status, code, scope }) => { + const response = await handleMockRequest( + mockRequest("/opportunities", header), + ); + + expect(response.status).toBe(status); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBeNull(); + expect(response.headers.get("Vary")).toContain(VERSION_HEADER); + expect(response.headers.get("Access-Control-Allow-Origin")).toBe("*"); + + const body = (await response.json()) as ErrorBody; + expect(body.errors[0].code).toBe(code); + if (scope) expect(body.errors[0].scope).toBe(scope); + }, + ); +}); + +describe("health route", () => { + it("stays 200 and unversioned", async () => { + const response = await handleMockRequest( + new Request("https://docs.example/api"), + ); + + expect(response.status).toBe(200); + expect(response.headers.get(VERSION_SERVED_HEADER)).toBeNull(); + }); +}); diff --git a/website/__tests__/lib/mock/versions-discovery.spec.ts b/website/__tests__/lib/mock/versions-discovery.spec.ts new file mode 100644 index 000000000..897f7ff64 --- /dev/null +++ b/website/__tests__/lib/mock/versions-discovery.spec.ts @@ -0,0 +1,193 @@ +/** + * The versions discovery route (ADR 0032, #1393-T3): `GET /common-grants/versions` + * lists what the mock serves, ignores `CG-Version`, and is the target of the + * `discovery` URL on every version error. + */ +import { readFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { describe, it, expect } from "vitest"; +import yaml from "js-yaml"; +import { handleMockRequest } from "@/lib/mock/router"; +import { VERSION_HEADER, VERSION_SERVED_HEADER } from "@/lib/mock/http/version"; +import { SUPPORTED_VERSIONS } from "@/lib/mock/data/fixtures"; +import { getValidator } from "./conformance/schema-validator"; +import { mockRequest, mockUrl } from "./__fixtures__/mock-request"; + +const DISCOVERY = "https://docs.example/api/common-grants/versions"; + +interface OperationEntry { + versions: string[]; + defaultVersion: string; +} + +interface Discovery { + versions: string[]; + defaultVersion: string; + operations: Record; +} + +async function fetchDiscovery(version?: string) { + const response = await handleMockRequest(mockRequest("/versions", version)); + return { response, body: await response.json() }; +} + +describe("GET /common-grants/versions", () => { + it("returns the success envelope with a VersionDiscovery", async () => { + const { response, body } = await fetchDiscovery(); + + expect(response.status).toBe(200); + expect(body).toMatchObject({ status: 200, message: "Success" }); + const data: Discovery = body.data; + expect(data.versions).toEqual(SUPPORTED_VERSIONS); + expect(data.defaultVersion).toBe("0.6.0"); + expect(typeof data.operations).toBe("object"); + }); + + it("validates against the 0.6.0 VersionDiscovery schema", async () => { + const { body } = await fetchDiscovery(); + const { validate, errorText } = getValidator( + "0.6.0", + "VersionDiscovery.yaml", + { requireVersioned: true }, + ); + + expect(validate(body.data), errorText()).toBe(true); + }); + + it("lists each operation's default inside its own versions", async () => { + const { body } = await fetchDiscovery(); + const entries = Object.values( + body.data.operations as Record, + ); + + expect(entries.length).toBeGreaterThan(0); + for (const entry of entries) { + expect(entry.versions).toContain(entry.defaultVersion); + } + }); + + it("omits upcomingDefault and deprecated", async () => { + const { body } = await fetchDiscovery(); + const levels = [ + body.data, + ...Object.values(body.data.operations ?? {}), + ] as object[]; + + expect(levels.length).toBeGreaterThan(1); + for (const level of levels) { + expect(level).not.toHaveProperty("upcomingDefault"); + expect(level).not.toHaveProperty("deprecated"); + } + }); + + describe("CG-Version", () => { + it.each([undefined, "0.3.0", "v1", "0.5.0, 0.4.0", "9.9.0"])( + "is ignored when the header is %j", + async (header) => { + const baseline = await fetchDiscovery(); + const { response, body } = await fetchDiscovery(header); + + expect(response.status).toBe(200); + expect(body).toEqual(baseline.body); + expect(body.data.versions).toEqual(SUPPORTED_VERSIONS); + expect(response.headers.has(VERSION_SERVED_HEADER)).toBe(false); + expect(response.headers.get("Vary") ?? "").not.toContain( + VERSION_HEADER, + ); + }, + ); + }); + + it("serves only GET", async () => { + const response = await handleMockRequest( + mockRequest("/versions", undefined, { method: "POST" }), + ); + const body = await response.json(); + + expect(response.status).toBe(404); + expect(body.errors[0].field).toBe("path"); + expect(response.headers.has(VERSION_SERVED_HEADER)).toBe(false); + }); +}); + +describe("version errors link to discovery", () => { + it.each([ + ["/awards", "0.2.0", 406, "VersionUnsupportedError.yaml"], + ["/opportunities", "v1", 400, "VersionMalformedError.yaml"], + ["/opportunities", "0.5.0, 0.4.0", 400, "VersionConflictError.yaml"], + ["/opportunities", "9.9.0", 406, "VersionUnsupportedError.yaml"], + ])("%s with %j", async (route, header, status, schemaName) => { + const response = await handleMockRequest(mockRequest(route, header)); + const body = await response.json(); + const { validate, errorText } = getValidator("0.6.0", schemaName, { + requireVersioned: true, + }); + + expect(response.status).toBe(status); + expect(body.errors[0].discovery).toBe(DISCOVERY); + expect(new URL(body.errors[0].discovery).origin).toBe( + new URL(mockUrl("")).origin, + ); + expect(validate(body), errorText()).toBe(true); + }); +}); + +describe("discovery operations vs published OpenAPI", () => { + const HERE = path.dirname(fileURLToPath(import.meta.url)); + const OPENAPI_DIR = path.resolve(HERE, "../../../public/openapi"); + const METHODS = ["get", "post", "put", "patch", "delete"]; + const SELF = "GET /common-grants/versions"; + + /** `" "` keys with exact published paths, per version. */ + function routesFor(version: string): string[] { + const doc = yaml.load( + readFileSync(path.join(OPENAPI_DIR, `openapi.${version}.yaml`), "utf8"), + ) as { paths: Record> }; + return Object.entries(doc.paths).flatMap(([p, item]) => + METHODS.filter((m) => m in item).map((m) => `${m.toUpperCase()} ${p}`), + ); + } + + const normalize = (key: string) => key.replace(/\{[^}]*\}/g, "{}"); + + const byVersion = new Map( + SUPPORTED_VERSIONS.map((v) => [v, routesFor(v).map(normalize)]), + ); + const latest = routesFor("0.6.0").filter((r) => r !== SELF); + + it("has one entry per route that appeared after 0.1.0", async () => { + const { body } = await fetchDiscovery(); + const operations = body.data.operations as Record; + const normalized = new Map( + Object.entries(operations).map(([k, v]) => [normalize(k), v]), + ); + + for (const route of latest) { + const key = normalize(route); + const first = SUPPORTED_VERSIONS.find((v) => + byVersion.get(v)?.includes(key), + ); + if (first === "0.1.0") { + expect(normalized.has(key), `${route} is in 0.1.0`).toBe(false); + continue; + } + const entry = normalized.get(key); + expect(entry, `missing ${route}`).toBeDefined(); + expect(entry?.versions, route).toEqual( + SUPPORTED_VERSIONS.slice(SUPPORTED_VERSIONS.indexOf(first!)), + ); + expect(entry?.defaultVersion, route).toBe("0.6.0"); + } + }); + + it("names only routes published in 0.6.0, with their exact paths", async () => { + const { body } = await fetchDiscovery(); + const keys = Object.keys(body.data.operations); + + expect(keys).toHaveLength(18); + for (const key of keys) { + expect(latest, key).toContain(key); + } + }); +}); diff --git a/website/__tests__/scripts/inject-mock-server.spec.ts b/website/__tests__/scripts/inject-mock-server.spec.ts index 27eef52f4..1c820da17 100644 --- a/website/__tests__/scripts/inject-mock-server.spec.ts +++ b/website/__tests__/scripts/inject-mock-server.spec.ts @@ -13,7 +13,7 @@ import { versionFromSpecFilename, MockServerInjector, } from "@/scripts/inject-mock-server"; -import { MOCK_SPEC_DIR_NAME, serverUrlFor } from "@/lib/mock/docs-wiring"; +import { MOCK_SERVER_URL, MOCK_SPEC_DIR_NAME } from "@/lib/mock/docs-wiring"; import { MOCK_API_BASE_PATH } from "@/lib/mock/router"; import { SUPPORTED_VERSIONS } from "@/lib/mock/data/fixtures"; import { Paths } from "@/lib/schema/paths"; @@ -37,9 +37,9 @@ paths: - url: https://not-a-real-top-level-key.example.com `; -describe("serverUrlFor", () => { - it("builds the version-prefixed server URL relative to MOCK_API_BASE_PATH", () => { - expect(serverUrlFor("0.4.0")).toBe(`${MOCK_API_BASE_PATH}/v0.4.0`); +describe("MOCK_SERVER_URL", () => { + it("equals MOCK_API_BASE_PATH, since the version rides in the CG-Version header", () => { + expect(MOCK_SERVER_URL).toBe(MOCK_API_BASE_PATH); }); }); @@ -56,7 +56,7 @@ describe("versionFromSpecFilename", () => { }); describe("injectServers", () => { - const serverUrl = `${MOCK_API_BASE_PATH}/v0.4.0`; + const serverUrl = MOCK_SERVER_URL; it("inserts a top-level servers block immediately before the top-level paths line", () => { const result = injectServers(FIXTURE_YAML, serverUrl); @@ -93,7 +93,7 @@ describe("injectServers", () => { it("is idempotent: replaces an existing top-level servers block rather than duplicating it", () => { const firstPass = injectServers(FIXTURE_YAML, serverUrl); - const newerServerUrl = `${MOCK_API_BASE_PATH}/v0.5.0`; + const newerServerUrl = "/other-api"; const secondPass = injectServers(firstPass, newerServerUrl); const topLevelServersMatches = secondPass.match(/^servers:/gm) ?? []; @@ -118,8 +118,14 @@ describe("assertMockServesVersion", () => { // docs page whose every Execute answers 404. it("throws for a spec version the router does not serve", () => { expect(() => - assertMockServesVersion("0.6.0", "openapi.0.6.0.yaml"), - ).toThrow(/openapi\.0\.6\.0\.yaml.*does not serve/s); + assertMockServesVersion("0.7.0", "openapi.0.7.0.yaml"), + ).toThrow(/openapi\.0\.7\.0\.yaml.*does not serve/s); + }); + + it("names the unserved version in the error", () => { + expect(() => + assertMockServesVersion("9.9.9", "openapi.9.9.9.yaml"), + ).toThrow(/v9\.9\.9/); }); }); @@ -138,16 +144,17 @@ describe("MockServerInjector", () => { expect(written).toEqual(emittedSpecs.map(({ filename }) => filename)); }); - it("points each copy's servers block at that spec's version of the mock", () => { + it("points each copy's servers block at the unversioned mock base path", () => { MockServerInjector.inject(); - for (const { filename, version } of emittedSpecs) { + for (const { filename } of emittedSpecs) { const copy = readFileSync( join(Paths.PUBLIC_DIR, MOCK_SPEC_DIR_NAME, filename), "utf-8", ); - expect(copy).toContain(`servers:\n - url: ${serverUrlFor(version)}`); + expect(copy).toContain(`servers:\n - url: ${MOCK_SERVER_URL}`); + expect(copy).not.toMatch(/servers:\n\s+- url: \/api\/v/); } }); }); diff --git a/website/package.json b/website/package.json index 80e93bd22..7114c77ed 100644 --- a/website/package.json +++ b/website/package.json @@ -48,7 +48,7 @@ "@types/react": "^18.3.28", "@types/react-dom": "^18.3.7", "ajv": "^8.20.0", - "astro": "~7.4.0", + "astro": "~7.4.12", "js-yaml": "^4.3.2", "json-schema-merge-allof": "^0.8.1", "openapi-sampler": "^1.7.9", @@ -62,7 +62,7 @@ "zod": "catalog:" }, "devDependencies": { - "@astrojs/check": "^0.9.10", + "@astrojs/check": "^0.9.12", "@axe-core/playwright": "^4.14.0", "@bruits/satteri-wasm32-wasi": "0.10.5", "@common-grants/core": "workspace:*", diff --git a/website/public/openapi/openapi.0.6.0.yaml b/website/public/openapi/openapi.0.6.0.yaml new file mode 100644 index 000000000..16c54ae8d --- /dev/null +++ b/website/public/openapi/openapi.0.6.0.yaml @@ -0,0 +1,9407 @@ +openapi: 3.0.0 +info: + title: CommonGrants Base API + description: |- + The base OpenAPI specification for a CommonGrants API + + In order for an API to be "compliant" with the CommonGrants protocol, + it must implement all of the routes with the "required" tag in this specification. + version: 0.6.0 +tags: + - name: Opportunities + description: Endpoints related to funding opportunities + - name: Competitions + description: Endpoints related to competitions, which are distinct application processes for the same funding opportunity + - name: Applications + description: Endpoints related to submitting applications for a given competition + - name: Application Reviews + description: Endpoints related to reviewing applications for a given competition + - name: Organizations + description: Endpoints related to viewing and syncing organization profiles + - name: Awards + description: Endpoints related to grant awards + - name: Forms + description: Endpoints related to forms + - name: Versions + description: Endpoints related to discovering the protocol versions an API serves + - name: required + description: Endpoints that MUST be implemented by all CommonGrants APIs + - name: optional + description: Endpoints that MAY be implemented by CommonGrants APIs + - name: experimental + description: Endpoints that MAY be implemented by CommonGrants APIs, but are not guaranteed to be stable +paths: + /common-grants/applications/search: + post: + operationId: Applications_searchApplications + summary: Search applications + description: 'Search for applications. Note: The search results for a given query will depend on the scopes attached to the API token used to make the request.' + parameters: + - name: filters + in: query + required: true + description: The filters to apply to the search + schema: + $ref: '#/components/schemas/CommonGrants.Models.AppFilters' + explode: false + - name: sorting + in: query + required: true + description: The sorting to apply to the search + schema: + $ref: '#/components/schemas/CommonGrants.Models.AppSorting' + explode: false + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A paginated list of typed items with a typed filter + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + - sortInfo + - filterInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.ApplicationBase' + 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: + $ref: '#/components/schemas/CommonGrants.Models.AppFilters' + 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 typed items with a typed filter + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + - Application Reviews + /common-grants/applications/start: + post: + operationId: Applications_startApplication + summary: Start an application + description: Start a new application for a given competition. + parameters: + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '201': + description: A 201 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.ApplicationBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 201 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + competitionId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The ID of the competition to start an application for + organizationId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The ID of the organization to start an application for, if applying on behalf of an organization + title: + type: string + description: The title of the application + required: + - competitionId + - title + /common-grants/applications/{appId}: + get: + operationId: Applications_getApplication + summary: View an application + description: View an application for a given competition, along with its form responses and validation errors. + parameters: + - name: appId + in: path + required: true + description: The ID of the application to get + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.ApplicationBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + /common-grants/applications/{appId}/forms/{formId}: + put: + operationId: Applications_setFormResponse + summary: Respond to a form + description: Set or update the response to a given form in an application. + parameters: + - name: appId + in: path + required: true + description: The ID of the application to whose form response is being updated + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - name: formId + in: path + required: true + description: The ID of the form whose response is being updated + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppFormResponse' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + requestBody: + required: true + content: + application/json: + schema: + type: object + additionalProperties: {} + description: The response to the form + get: + operationId: Applications_getFormResponse + summary: Get a form response + description: Get the response to a given form in an application. + parameters: + - name: appId + in: path + required: true + description: The ID of the application to whose form response is being retrieved + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - name: formId + in: path + required: true + description: The ID of the form whose response is being retrieved + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppFormResponse' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Applications + - experimental + /common-grants/applications/{appId}/submit: + put: + operationId: Applications_submitApplication + summary: Submit an application + description: Submit an application to a competition. Applications that have validation errors will be blocked from submitting until the errors are fixed. + parameters: + - name: appId + in: path + required: true + description: The ID of the application to submit + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + default: + description: An unexpected error response. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.ApplicationSubmissionError' + tags: + - Applications + - experimental + /common-grants/awards: + get: + operationId: Awards_list + summary: List awards + description: Get a paginated list of awards, sorted by `lastModifiedAt` with most recent first. + parameters: + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.AwardBase' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Awards + - optional + /common-grants/awards/search: + post: + operationId: Awards_search + summary: Search awards + description: Search for awards based on the provided filters. + parameters: + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A paginated list of typed items with a typed filter + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + - sortInfo + - filterInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.AwardBase' + 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: + $ref: '#/components/schemas/CommonGrants.Models.AwdFilters' + 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 typed items with a typed filter + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Awards + - optional + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + search: + type: string + description: Award search query + example: Community health center + filters: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdFilters' + description: |- + Filters to apply to the award search + + Multiple filter conditions will be combined with AND logic, so that + results only include awards that match all of the provided filters. + sorting: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdSorting' + description: The sort order to apply to the results + pagination: + allOf: + - $ref: '#/components/schemas/CommonGrants.Pagination.PaginatedBodyParams' + description: Pagination instructions for the results + /common-grants/awards/{awdId}: + get: + operationId: Awards_read + summary: View award details + description: View details about an award. + parameters: + - name: awdId + in: path + required: true + description: The ID of the award to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwardBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Awards + - optional + /common-grants/competitions/{compId}: + get: + operationId: Competitions_read + summary: View competition details + description: |- + View details about a competition for a given funding opportunity. + + Each competition may have a distinct set of forms, be limited to a + certain types of applicants, or have a different application period. + parameters: + - name: compId + in: path + required: true + description: The ID of the competition to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Competitions + - experimental + /common-grants/forms: + get: + operationId: Forms_list + summary: List forms + description: Get a paginated list of forms, sorted by `lastModifiedAt` with most recent first. + parameters: + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.FormBase' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Forms + - experimental + /common-grants/forms/{formId}: + get: + operationId: Forms_read + summary: View form details + description: View details about a given form. + parameters: + - name: formId + in: path + required: true + description: The ID of the form to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Forms + - experimental + /common-grants/opportunities: + get: + operationId: Opportunities_list + summary: List opportunities + description: Get a paginated list of opportunities, sorted by `lastModifiedAt` with most recent first. + parameters: + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OpportunityBase' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Opportunities + - required + /common-grants/opportunities/search: + post: + operationId: Opportunities_search + summary: Search opportunities + description: Search for opportunities based on the provided filters. + parameters: + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A paginated list of typed items with a typed filter + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + - sortInfo + - filterInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OpportunityBase' + 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: + $ref: '#/components/schemas/CommonGrants.Models.OppFilters' + 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 typed items with a typed filter + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Opportunities + - optional + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + search: + type: string + description: Opportunity search query + example: Pre-school education + filters: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppFilters' + description: |- + Filters to apply to the opportunity search + + Multiple filter conditions will be combined with AND logic, so that + results only include opportunities that match all of the provided filters. + sorting: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppSorting' + description: The sort order to apply to the results + pagination: + allOf: + - $ref: '#/components/schemas/CommonGrants.Pagination.PaginatedBodyParams' + description: Pagination instructions for the results + /common-grants/opportunities/{oppId}: + get: + operationId: Opportunities_read + summary: View opportunity details + description: View details about an opportunity. + parameters: + - name: oppId + in: path + required: true + description: The ID of the opportunity to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OpportunityDetails' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Opportunities + - required + /common-grants/orgs: + get: + operationId: Organizations_list + summary: List organizations + description: Get a paginated list of organizations. Requires the `org:read` scope. + parameters: + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - name: registry + in: query + required: false + description: Registry code of an external identifier to filter by (e.g. `org:us:ein`) + schema: + type: string + explode: false + - name: id + in: query + required: false + description: Identifier value within the given registry to filter by + schema: + type: string + explode: false + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrganizationBase' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + security: + - OAuth2Auth: + - org:read + /common-grants/orgs/{orgId}: + get: + operationId: Organizations_read + summary: View an organization profile + description: View an organization profile by its UUID. Requires the `org:read` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - name: at + in: query + required: false + description: Return the profile as of the given point in time + schema: + type: string + format: date-time + explode: false + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrganizationBase' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + security: + - OAuth2Auth: + - org:read + patch: + operationId: Organizations_update + summary: Update an organization profile + description: Apply a direct JSON Merge Patch edit to an organization profile, recorded as an accepted change. Requires the `org:write` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization to update + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRevision' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/CommonGrants.Models.OrgPatchData' + description: JSON Merge Patch body for the organization profile + security: + - OAuth2Auth: + - org:write + /common-grants/orgs/{orgId}/changes: + post: + operationId: Organizations_submitChange + summary: Submit an organization profile change + description: Submit a change to an organization profile, which a receiver may apply immediately or queue for review. Requires the `org.changes:write` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization to change + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '202': + description: A 202 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + Location: + required: false + description: URL where the accepted resource can be retrieved + schema: + type: string + format: uri + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRevision' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 202 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + requestBody: + required: true + content: + application/merge-patch+json: + schema: + $ref: '#/components/schemas/CommonGrants.Models.OrgPatchData' + description: JSON Merge Patch body for the organization profile + security: + - OAuth2Auth: + - org.changes:write + get: + operationId: Organizations_listChanges + summary: List organization profile changes + description: Get a paginated list of changes to an organization profile, newest first. Requires the `org.changes:read` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization whose changes to list + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.page' + - $ref: '#/components/parameters/CommonGrants.Pagination.PaginatedQueryParams.pageSize' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with a paginated list of typed items + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - items + - paginationInfo + properties: + items: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgRevision' + 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 typed items + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + security: + - OAuth2Auth: + - org.changes:read + /common-grants/orgs/{orgId}/changes/{changeId}: + get: + operationId: Organizations_viewChange + summary: View an organization profile change + description: View a single change to an organization profile by its id. Requires the `org.changes:read` scope. + parameters: + - name: orgId + in: path + required: true + description: The UUID of the organization the change belongs to + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - name: changeId + in: path + required: true + description: The id of the change to view + schema: + $ref: '#/components/schemas/CommonGrants.Types.uuid' + - $ref: '#/components/parameters/CommonGrants.Headers.VersionRequest' + responses: + '200': + description: A 200 response with typed data + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRevision' + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response with typed data + '400': + description: The request is invalid, or its `CG-Version` value is malformed or was sent more than once + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Sent on every 400 except the version errors. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictError' + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + '401': + description: Access is unauthorized. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '403': + description: Access is forbidden. + headers: + CG-Version-Served: + required: false + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Optional because authentication can run before a version is selected. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '404': + description: The server cannot find the requested resource. + headers: + CG-Version-Served: + required: true + description: |- + The full protocol version this response was served in, such as `0.5.1` + + Can differ from the requested version in the patch number only. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + Vary: + required: false + description: Request headers that caches must key this response on, such as `CG-Version` + schema: + type: string + Deprecation: + required: false + description: When the served version was or will be deprecated (RFC 9745), such as `@1796083200` + schema: + type: string + pattern: ^@-?[0-9]+$ + Sunset: + required: false + description: When the served version stops responding (RFC 8594), such as `Tue, 01 Jun 2027 00:00:00 GMT` + schema: + type: string + format: http-date + Link: + required: false + description: Links about the served version's lifecycle (RFC 8288), such as `rel="sunset"` + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.Error' + '406': + description: The requested version isn't served by this server or this route + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedError' + - $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredError' + tags: + - Organizations + - experimental + security: + - OAuth2Auth: + - org.changes:read + /common-grants/versions: + get: + operationId: ProtocolVersions_read + summary: List supported versions + description: |- + List the protocol versions this API serves, its default version, and any routes whose versions differ. + + This route is optional, but a server that serves more than one protocol version MUST implement it. + It ignores the `CG-Version` request header, because clients call it before they know which version to request. + Its responses carry neither `CG-Version-Served` nor `Vary: CG-Version`. + It requires no stronger authentication than the API's required routes, and SHOULD be readable without authentication. + Fields are only ever added to `data`; clients ignore fields they don't recognize. + parameters: [] + responses: + '200': + description: The request has succeeded. + content: + application/json: + schema: + $ref: '#/components/schemas/CommonGrants.Responses.VersionDiscoveryResponse' + tags: + - Versions + - optional +components: + parameters: + CommonGrants.Headers.VersionRequest: + name: CG-Version + in: header + required: false + description: |- + The protocol version the client wants, such as `0.6.0` + + Servers match on major and minor version. When absent, the server responds + in its default version. + schema: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + CommonGrants.Pagination.PaginatedQueryParams.page: + name: page + in: query + required: false + description: The page to return + schema: + type: integer + format: int32 + minimum: 1 + default: 1 + explode: false + CommonGrants.Pagination.PaginatedQueryParams.pageSize: + name: pageSize + in: query + required: false + description: The number of items to return per page + schema: + type: integer + format: int32 + minimum: 1 + default: 100 + explode: false + schemas: + CommonGrants.Fields.Address: + type: object + required: + - street1 + - city + - stateOrProvince + - country + - postalCode + properties: + street1: + type: string + description: The primary street address line. + street2: + type: string + description: Additional street address information (e.g., apartment number, suite, etc.). + city: + type: string + description: The city or municipality name. + stateOrProvince: + type: string + description: The state, province, or region name. + country: + type: string + description: The country name or ISO country code. + postalCode: + type: string + description: The postal or ZIP code for the address. + latitude: + type: number + description: The latitude coordinate of the address location. + longitude: + type: number + description: The longitude coordinate of the address location. + geography: + type: object + additionalProperties: {} + description: Additional geospatial data in GeoJSON format. + description: A mailing address. + example: + street1: 123 Main St + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + CommonGrants.Fields.AddressCollection: + type: object + required: + - primary + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Address' + description: The primary address for a person or organization. + otherAddresses: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Address' + description: Additional addresses keyed by a descriptive label (e.g., "work", "home", "international"). + description: A collection of addresses. + example: + primary: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + otherAddresses: + satellite: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + international: + street1: 123 Rue Principale + city: Montreal + stateOrProvince: QC + country: CA + postalCode: H2Y 1C6 + CommonGrants.Fields.CustomField: + type: object + required: + - name + - fieldType + - value + properties: + name: + type: string + description: Name of the custom field + fieldType: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.CustomFieldType' + description: The JSON schema type to use when de-serializing the `value` field + schema: + type: string + format: uri + description: Link to the full JSON schema for this custom field + value: + description: Value of the custom field + description: + type: string + description: Description of the custom field's purpose + description: A custom field on a model + example: + name: eligibilityType + fieldType: array + value: + - nonprofit + - academic + description: Types of eligible organizations + CommonGrants.Fields.CustomFieldType: + type: string + enum: + - string + - number + - integer + - boolean + - object + - array + description: The set of JSON schema types supported by a custom field + CommonGrants.Fields.DateRangeEvent: + type: object + required: + - eventType + - startDate + - endDate + properties: + eventType: + type: string + enum: + - dateRange + description: Type of event + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'Start date of the event in ISO 8601 format: YYYY-MM-DD' + startTime: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoTime' + description: 'Start time of the event in ISO 8601 format: HH:MM:SS' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'End date of the event in ISO 8601 format: YYYY-MM-DD' + endTime: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoTime' + description: 'End time of the event in ISO 8601 format: HH:MM:SS' + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EventBase' + description: Description of an event that has a start and end date (and possible time) associated with it + example: + name: Application period + eventType: dateRange + startDate: '2024-01-01' + endDate: '2024-01-31' + endTime: '17:00:00' + description: Primary application period for the grant opportunity + CommonGrants.Fields.EmailCollection: + type: object + required: + - primary + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.email' + description: The primary email address for a person or organization. + otherEmails: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Types.email' + description: Additional email addresses keyed by a descriptive label (e.g., "work", "personal", "support"). + description: A collection of email addresses. + example: + primary: john.doe@example.com + otherEmails: + work: john.doe@work.com + personal: john.doe@gmail.com + school: john.doe@school.edu + CommonGrants.Fields.Event: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Fields.SingleDateEvent' + - $ref: '#/components/schemas/CommonGrants.Fields.DateRangeEvent' + - $ref: '#/components/schemas/CommonGrants.Fields.OtherEvent' + description: Union of all event types + CommonGrants.Fields.EventBase: + type: object + required: + - name + - eventType + properties: + name: + type: string + description: Human-readable name of the event (e.g., 'Application posted', 'Question deadline') + eventType: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EventType' + description: Type of event + description: + type: string + description: Description of what this event represents + discriminator: + propertyName: eventType + mapping: + dateRange: '#/components/schemas/CommonGrants.Fields.DateRangeEvent' + other: '#/components/schemas/CommonGrants.Fields.OtherEvent' + singleDate: '#/components/schemas/CommonGrants.Fields.SingleDateEvent' + description: Base model for all events + CommonGrants.Fields.EventType: + type: string + enum: + - singleDate + - dateRange + - other + description: |- + Type of event (e.g., a single date, a date range, or a custom event) + + - singleDate: A single date (and possible time) + - dateRange: A period of time with a start and end date + - other: Other event type (e.g., a recurring event) + CommonGrants.Fields.File: + type: object + required: + - downloadUrl + - name + - createdAt + - lastModifiedAt + properties: + downloadUrl: + type: string + format: uri + description: The file's download URL. + name: + type: string + description: The file's name. + description: + type: string + description: The file's description. + sizeInBytes: + type: number + description: The file's size in bytes. + mimeType: + type: string + description: The file's MIME type. + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: A field representing a downloadable file. + example: + downloadUrl: https://example.com/file.pdf + name: example.pdf + description: A PDF file with instructions + sizeInBytes: 1000 + mimeType: application/pdf + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + CommonGrants.Fields.Identifier: + type: object + properties: + registry: + type: object + properties: + code: + type: string + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: |- + An identifier issued to a record by a registry. + + Accepts any string value and any registry code. Model-specific collections use + registry-typed instantiations of `IdentifierT` (e.g. `OrgIdEin`) for their base + identifiers, and this generic form for extension identifiers under `otherIds`. + example: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + allIds: + - id: '123456789' + status: active + - id: '987654321' + status: archived + CommonGrants.Fields.IdentifierCollection: + type: object + properties: + systemId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.SystemId' + description: The hosting system's own identifier for this record. + otherIds: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Identifier' + description: |- + Additional identifiers keyed by their registry code, for registries the + protocol does not define as a base identifier on the model. + description: A collection of identifiers associated with a record. + example: + systemId: + registry: + code: org:grants.gov:system + url: https://commongrants.org/registries/org-grants-gov-system + id: 01912a8b-7c3d-7890-abcd-ef1234567890 + otherIds: + org:candid:bridge: + registry: + code: org:candid:bridge + id: '1234567' + CommonGrants.Fields.IdentifierStatus: + type: string + enum: + - active + - archived + description: The lifecycle status of an identifier value. + CommonGrants.Fields.Money: + type: object + required: + - amount + - currency + properties: + amount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.decimalString' + description: The amount of money + currency: + type: string + description: The ISO 4217 currency code in which the amount is denominated + description: A monetary amount and the currency in which it's denominated + example: + amount: '-50.50' + currency: USD + CommonGrants.Fields.Name: + type: object + required: + - firstName + - lastName + properties: + prefix: + type: string + description: Honorific prefix (e.g., Mr., Mrs., Dr., Prof.). + firstName: + type: string + description: The person's first or given name. + middleName: + type: string + description: The person's middle name or names. + lastName: + type: string + description: The person's last name or family name. + suffix: + type: string + description: Name suffix (e.g., Jr., Sr., III, Ph.D.). + description: A person's name. + example: + prefix: Dr. + firstName: Jane + middleName: Edward + lastName: Doe + suffix: Jr. + CommonGrants.Fields.OrgPatchAddressOrCreate: + type: object + properties: + street1: + type: string + description: The primary street address line. + street2: + type: string + nullable: true + description: Additional street address information (e.g., apartment number, suite, etc.). + city: + type: string + description: The city or municipality name. + stateOrProvince: + type: string + description: The state, province, or region name. + country: + type: string + description: The country name or ISO country code. + postalCode: + type: string + description: The postal or ZIP code for the address. + latitude: + type: number + nullable: true + description: The latitude coordinate of the address location. + longitude: + type: number + nullable: true + description: The longitude coordinate of the address location. + geography: + type: object + additionalProperties: {} + nullable: true + description: Additional geospatial data in GeoJSON format. + description: A mailing address. + example: + street1: 123 Main St + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + CommonGrants.Fields.OrgPatchCustomFieldOrCreate: + type: object + properties: + name: + type: string + description: Name of the custom field + fieldType: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.CustomFieldType' + description: The JSON schema type to use when de-serializing the `value` field + schema: + type: string + format: uri + nullable: true + description: Link to the full JSON schema for this custom field + value: + description: Value of the custom field + description: + type: string + nullable: true + description: Description of the custom field's purpose + description: A custom field on a model + example: + name: eligibilityType + fieldType: array + value: + - nonprofit + - academic + description: Types of eligible organizations + CommonGrants.Fields.OrgPatchIdentifierOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: |- + An identifier issued to a record by a registry. + + Accepts any string value and any registry code. Model-specific collections use + registry-typed instantiations of `IdentifierT` (e.g. `OrgIdEin`) for their base + identifiers, and this generic form for extension identifiers under `otherIds`. + example: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + allIds: + - id: '123456789' + status: active + - id: '987654321' + status: archived + CommonGrants.Fields.OrgPatchPhoneOrCreate: + type: object + properties: + countryCode: + type: string + pattern: ^\+[1-9][0-9]{0,3}$ + description: The international country code (e.g., "+1" for US/Canada). + number: + type: string + description: The local phone number without the country code. + extension: + type: string + nullable: true + description: Optional extension number for the phone line. + isMobile: + type: boolean + nullable: true + description: Indicates whether this is a mobile/cell phone number. + description: A phone number. + example: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + CommonGrants.Fields.OrgPatchSystemIdOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: |- + The hosting system's own identifier for a record. + + The identifier value is the record's UUID within the hosting system; the + registry code names that system (e.g. `org:grants.gov:system`). + example: + registry: + code: org:grants.gov:system + url: https://commongrants.org/registries/org-grants-gov-system + id: 01912a8b-7c3d-7890-abcd-ef1234567890 + CommonGrants.Fields.OtherEvent: + type: object + required: + - eventType + properties: + eventType: + type: string + enum: + - other + description: Type of event + details: + type: string + description: Details of the event's timeline (e.g. "Every other Tuesday") + description: + type: string + description: Description of the event + example: Applications begin being accepted + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EventBase' + description: Description of an event that is not a single date or date range + example: + name: Info sessions + eventType: other + details: Every other Tuesday at 10:00 AM during the application period + description: Info sessions for the opportunity + CommonGrants.Fields.PCSClass: + type: string + enum: + - Organization types + - Subjects + - Population groups + - Transaction types + - Support strategies + description: The class to which the PCS term belongs. + CommonGrants.Fields.PCSOrgType: + type: object + required: + - class + properties: + class: + type: string + enum: + - Organization types + description: The PCS term for the organization type. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for organization types. + + See https://taxonomy.candid.org/organization-type for more information. + CommonGrants.Fields.PCSPopulation: + type: object + required: + - class + properties: + class: + type: string + enum: + - Population groups + description: The PCS term for the population. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for populations served. + + See https://taxonomy.candid.org/populations for more information. + CommonGrants.Fields.PCSSubject: + type: object + required: + - class + properties: + class: + type: string + enum: + - Subjects + description: The PCS term for the subject. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for the subject of the grant. + + See https://taxonomy.candid.org/subjects for more information. + CommonGrants.Fields.PCSSupportStrategy: + type: object + required: + - class + properties: + class: + type: string + enum: + - Support strategies + description: The PCS term for the support strategy. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for support strategies. + + See https://taxonomy.candid.org/support-strategies for more information. + CommonGrants.Fields.PCSTerm: + type: object + required: + - term + - class + - code + properties: + term: + type: string + description: The plain language PCS term. + class: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSClass' + description: The class to which the PCS term belongs. + code: + type: string + pattern: ^[A-Z]{2}[0-9]{6}$ + description: The code for this PCS term. + example: UC000000 + description: + type: string + description: Description of the PCS term + description: |- + A Philanthropy Classification System (PCS) term. + + The PCS is a hierarchical classification system for categorizing data related to + philanthropic activities. It supports the following classes: + - Organization types + - Subjects + - Population groups + - Transaction types + - Support strategies + + See https://taxonomy.candid.org/ for more information. + example: + term: Hospital + class: Organization types + description: Institutions with the primary purpose of providing in-patient physical and mental health services... + code: EO000000 + CommonGrants.Fields.PCSTransactionType: + type: object + required: + - class + properties: + class: + type: string + enum: + - Transaction types + description: The PCS term for the transaction type. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSTerm' + description: |- + A Philanthropy Classification System (PCS) term for transaction types. + + See https://taxonomy.candid.org/transaction-types for more information. + CommonGrants.Fields.Phone: + type: object + required: + - countryCode + - number + properties: + countryCode: + type: string + pattern: ^\+[1-9][0-9]{0,3}$ + description: The international country code (e.g., "+1" for US/Canada). + number: + type: string + description: The local phone number without the country code. + extension: + type: string + description: Optional extension number for the phone line. + isMobile: + type: boolean + description: Indicates whether this is a mobile/cell phone number. + default: false + description: A phone number. + example: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + CommonGrants.Fields.PhoneCollection: + type: object + required: + - primary + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Phone' + description: The person's primary phone number. + fax: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Phone' + description: The person's fax number, if applicable. + otherPhones: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Phone' + description: Additional phone numbers not covered by the standard fields. + description: A collection of phone numbers for a person. + example: + primary: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + fax: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + otherPhones: + support: + countryCode: '+1' + number: 333-456-1230 + isMobile: false + marketing: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + CommonGrants.Fields.SingleDateEvent: + type: object + required: + - eventType + - date + properties: + eventType: + type: string + enum: + - singleDate + description: Type of event + date: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'Date of the event in in ISO 8601 format: YYYY-MM-DD' + time: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoTime' + description: 'Time of the event in ISO 8601 format: HH:MM:SS' + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EventBase' + description: Description of an event that has a date (and possible time) associated with it + example: + name: Opportunity close date + eventType: singleDate + date: '2024-12-31' + time: '17:00:00' + description: Opportunity closes for all applications + CommonGrants.Fields.SystemId: + type: object + properties: + registry: + type: object + properties: + code: + type: string + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: |- + The hosting system's own identifier for a record. + + The identifier value is the record's UUID within the hosting system; the + registry code names that system (e.g. `org:grants.gov:system`). + example: + registry: + code: org:grants.gov:system + url: https://commongrants.org/registries/org-grants-gov-system + id: 01912a8b-7c3d-7890-abcd-ef1234567890 + CommonGrants.Filters.AllOperators: + type: string + enum: + - eq + - neq + - gt + - gte + - lt + - lte + - in + - notIn + - between + - outside + - like + - notLike + CommonGrants.Filters.ArrayOperators: + type: string + enum: + - in + - notIn + description: Operators that filter a field based on an array of values + CommonGrants.Filters.ComparisonOperators: + type: string + enum: + - gt + - gte + - lt + - lte + description: Operators that filter a field based on a comparison to a value + CommonGrants.Filters.DateRangeFilter: + type: object + required: + - operator + - value + properties: + operator: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.RangeOperators' + description: The operator to apply to the filter value + value: + type: object + properties: + min: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + - type: string + format: date-time + - type: string + format: date-time + max: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + - type: string + format: date-time + - type: string + format: date-time + required: + - min + - max + description: The value to use for the filter operation + example: + min: '2021-01-01' + max: '2021-01-02' + description: Filters by comparing a field to a range of date values + CommonGrants.Filters.DefaultFilter: + type: object + required: + - operator + - value + properties: + operator: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Filters.EquivalenceOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.ComparisonOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.ArrayOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.StringOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.RangeOperators' + - $ref: '#/components/schemas/CommonGrants.Filters.AllOperators' + description: The operator to apply to the filter value + value: + description: The value to use for the filter operation + description: A base filter model that can be used to create more specific filter models + CommonGrants.Filters.EquivalenceOperators: + type: string + enum: + - eq + - neq + description: Operators that filter a field based on an exact match to a value + CommonGrants.Filters.MoneyRangeFilter: + type: object + required: + - operator + - value + properties: + operator: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.RangeOperators' + description: The operator to apply to the filter value + value: + type: object + properties: + min: + $ref: '#/components/schemas/CommonGrants.Fields.Money' + max: + $ref: '#/components/schemas/CommonGrants.Fields.Money' + required: + - min + - max + description: The value to use for the filter operation + example: + min: + amount: '1000' + currency: USD + max: + amount: '10000' + currency: USD + description: Filters by comparing a field to a range of monetary values + CommonGrants.Filters.RangeOperators: + type: string + enum: + - between + - outside + description: Operators that filter a field based on a range of values + CommonGrants.Filters.StringArrayFilter: + type: object + required: + - operator + - value + properties: + operator: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.ArrayOperators' + description: The operator to apply to the filter value + value: + type: array + items: + type: string + description: The value to use for the filter operation + example: + - value1 + - value2 + description: Filters by comparing a field to an array of string values + CommonGrants.Filters.StringOperators: + type: string + enum: + - like + - notLike + description: Operators that filter a field based on a string value + CommonGrants.Models.AppDefaultFilters: + type: object + properties: + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`opportunityId` matches one of the following values' + example: + operator: in + value: + - ad3b469a-d89a-42d3-c439-6c1234567890 + competitionId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`competitionId` matches one of the following values' + example: + operator: in + value: + - 123e4567-e89b-12d3-a456-426614174000 + submittedAtRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`submittedAt` is between the given range' + example: + operator: between + value: + min: '2025-01-01' + max: '2025-01-30' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - submitted + - accepted + allOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: The standard set of filters supported for application searches + CommonGrants.Models.AppFilters: + type: object + properties: + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`opportunityId` matches one of the following values' + example: + operator: in + value: + - ad3b469a-d89a-42d3-c439-6c1234567890 + competitionId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`competitionId` matches one of the following values' + example: + operator: in + value: + - 123e4567-e89b-12d3-a456-426614174000 + submittedAtRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`submittedAt` is between the given range' + example: + operator: between + value: + min: '2025-01-01' + max: '2025-01-30' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - submitted + - accepted + customFilters: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: Additional implementation-defined filters to apply to the search + description: Filters to apply when searching for applications + CommonGrants.Models.AppFormResponse: + type: object + required: + - applicationId + - id + - formId + - response + - status + - createdAt + - lastModifiedAt + properties: + applicationId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the application + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the form response + formId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The form being responded to + response: + type: object + additionalProperties: {} + description: The response to the form + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormResponseStatus' + description: The status of the form response + validationErrors: + type: array + items: {} + description: The validation errors for the form response + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Custom attributes about the form response + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: The model for a form response included in an application + example: + applicationId: 123e4567-e89b-12d3-a456-426614174000 + id: 123e4567-e89b-12d3-a456-426614174000 + formId: 123e4567-e89b-12d3-a456-426614174000 + response: + firstName: John + lastName: Doe + email: john.doe@example.com + phone: 123-456-7890 + address: + street: 123 Main St + city: Anytown + state: CA + zip: '12345' + country: null + status: + value: inProgress + description: The form response is in progress + validationErrors: + - field: address.country + message: Country is required + createdAt: '2021-01-01T00:00:00Z' + lastModifiedAt: '2021-01-01T00:00:00Z' + CommonGrants.Models.AppRef: + type: object + required: + - id + - title + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the application + readOnly: true + title: + type: string + description: The title of the application + description: |- + A reference to an application, previewing the key fields a consumer needs + to identify it and look it up or join it to another response. Appears + wherever another record points to an application, such as the application + an award resulted from. + example: + id: 123e4567-e89b-12d3-a456-426614174000 + title: My Application + CommonGrants.Models.AppSortBy: + type: string + enum: + - lastModifiedAt + - createdAt + - submittedAt + - status.value + - opportunityId + - competitionId + - custom + description: The fields that can be used to sort applications + CommonGrants.Models.AppSorting: + type: object + required: + - sortBy + properties: + sortBy: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppSortBy' + description: The field to sort by + example: opportunityId + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortBodyParams' + description: Sorting parameters for applications + CommonGrants.Models.AppStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the application + example: + value: submitted + description: The application has been submitted. + CommonGrants.Models.AppStatusOptions: + type: string + enum: + - inProgress + - submitted + - accepted + - rejected + - custom + description: |- + The default set of values accepted for application status: + - `inProgress`: The application is in progress + - `submitted`: The application has been submitted and is being reviewed + - `accepted`: The application has been accepted + - `rejected`: The application has been rejected + - `custom`: A custom status + CommonGrants.Models.ApplicantType: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.ApplicantTypeOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The type of applicant eligible to apply for funding + example: + value: individual + description: An individual applicant + CommonGrants.Models.ApplicantTypeOptions: + type: string + enum: + - individual + - organization + - government_state + - government_county + - government_municipal + - government_special_district + - government_tribal + - organization_tribal_other + - school_district_independent + - higher_education_public + - higher_education_private + - non_profit_with_501c3 + - nonprofit_without_501c3 + - for_profit_small_business + - for_profit_not_small_business + - unrestricted + - custom + description: The set of possible applicant types + CommonGrants.Models.ApplicationBase: + type: object + required: + - id + - title + - competitionId + - opportunityId + - formResponses + - status + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the application + readOnly: true + title: + type: string + description: The title of the application + competitionId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the competition + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The unique identifier for the opportunity being applied to + formResponses: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.AppFormResponse' + description: The form responses for the application + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppStatus' + description: The status of the application + submittedAt: + type: string + format: date-time + nullable: true + description: The date and time the application was submitted + validationErrors: + type: array + items: {} + description: The validation errors for the application and form responses + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: The custom fields about the application + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: The base model for an application to a competition for a funding opportunity + example: + id: 123e4567-e89b-12d3-a456-426614174000 + title: My Application + competitionId: 123e4567-e89b-12d3-a456-426614174000 + opportunityId: ad3b469a-d89a-42d3-c439-6c1234567890 + formResponses: + formA: + applicationId: 123e4567-e89b-12d3-a456-426614174000 + id: 123e4567-e89b-12d3-a456-426614174000 + formId: 123e4567-e89b-12d3-a456-426614174000 + response: + firstName: John + lastName: Doe + email: john.doe@example.com + phone: 123-456-7890 + address: + street: 123 Main St + city: Anytown + state: CA + zip: '12345' + country: null + status: + value: inProgress + description: The form response is in progress + validationErrors: + - field: address.country + message: Country is required + createdAt: '2021-01-01T00:00:00Z' + lastModifiedAt: '2021-01-01T00:00:00Z' + status: + value: inProgress + description: The application is in progress. + submittedAt: null + createdAt: '2021-01-01T00:00:00Z' + lastModifiedAt: '2021-01-01T00:00:00Z' + customFields: + attachments: + name: attachments + fieldType: object + value: + contacts: + downloadUrl: https://example.com/file.pdf + name: example.pdf + description: A PDF file with instructions + sizeInBytes: 1000 + mimeType: application/pdf + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + budget: + downloadUrl: https://example.com/excel.xlsx + name: excel.xlsx + description: The excel file for the application + sizeInBytes: 1000 + mimeType: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + description: The attachments for the application + applicationZipFile: + name: applicationZipFile + fieldType: object + value: + downloadUrl: https://example.com/application.zip + name: application.zip + description: The zip file for the application + sizeInBytes: 50000 + mimeType: application/zip + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + description: The zip file for the application + CommonGrants.Models.AwardBase: + type: object + required: + - id + - title + - description + - status + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the award + readOnly: true + title: + type: string + description: Title or name of the award + example: Community Health Center Capital Improvement Grant + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdIds' + description: System and registry-specific identifiers for the award + description: + type: string + description: Description of the award's purpose + example: Supports facility upgrades at federally qualified health centers. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdStatus' + description: Lifecycle status of the award + funding: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdFunding' + description: Requested, awarded, and disbursed amounts + keyDates: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdTimeline' + description: Award date and period of performance + opportunity: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppRef' + description: The opportunity this award resulted from + application: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AppRef' + description: The application this award resulted from + funders: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRefCollection' + description: Organization(s) that funded the award + recipientOrganizations: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRefCollection' + description: Organization(s) that received the award, if the recipient is an organization + recipientIndividual: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdRecipientIndividual' + description: The individual who received the award, if the recipient is a person + parent: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdRef' + description: Parent award, for amendments or multi-tranche awards + source: + type: string + format: uri + description: URL for the canonical source record of the award + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: A grant award + example: + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + title: Community Health Center Capital Improvement Grant + identifiers: + systemId: + registry: + code: awd:grants.gov:system + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + awd:us:fain: + registry: + code: awd:us:fain + url: https://commongrants.org/registries/awd-us-fain + id: H80CS00001 + description: Supports facility upgrades at federally qualified health centers. + status: + value: awarded + description: Award has been issued and funds are being disbursed. + funding: + requestedAmount: + amount: '500000.00' + currency: USD + awardedAmount: + amount: '450000.00' + currency: USD + disbursedAmount: + amount: '150000.00' + currency: USD + keyDates: + awardDate: + name: Award date + eventType: singleDate + date: '2026-03-01' + description: The date the award was issued. + periodOfPerformance: + name: Period of performance + eventType: dateRange + startDate: '2026-04-01' + endDate: '2027-03-31' + description: The period during which the funded work is performed. + opportunity: + id: 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + title: Health Center Capital Improvement Program + identifiers: + opp:us:fon: + registry: + code: opp:us:fon + url: https://commongrants.org/registries/opp-us-fon + id: HHS-2026-ACF-OCC-YD-0001 + funders: + primary: + id: 018f2e77-4b5c-7d2e-9f3a-bcdef1234567 + name: Health Resources and Services Administration + identifiers: + otherIds: + org:grants.gov:agency: + registry: + code: org:grants.gov:agency + id: HRSA + recipientOrganizations: + primary: + id: 018f2e77-6d7e-7f4a-9b5c-def123456789 + name: Riverside Community Health Center + identifiers: + org:us:ein: + registry: + code: org:us:ein + id: '582345679' + source: https://www.usaspending.gov/award/ASST_NON_H80CS00001 + createdAt: '2026-03-01T00:00:00Z' + lastModifiedAt: '2026-06-01T00:00:00Z' + CommonGrants.Models.AwdDefaultFilters: + type: object + properties: + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - awarded + - completed + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`opportunity.id` matches one of the following values' + example: + operator: in + value: + - 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + awardDateRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`keyDates.awardDate` is between the given range' + example: + operator: between + value: + min: '2026-01-01' + max: '2026-12-31' + awardedAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.awardedAmount` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '100000' + currency: USD + max: + amount: '500000' + currency: USD + allOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: The standard set of filters supported for award searches + CommonGrants.Models.AwdFilters: + type: object + properties: + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - awarded + - completed + opportunityId: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`opportunity.id` matches one of the following values' + example: + operator: in + value: + - 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + awardDateRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`keyDates.awardDate` is between the given range' + example: + operator: between + value: + min: '2026-01-01' + max: '2026-12-31' + awardedAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.awardedAmount` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '100000' + currency: USD + max: + amount: '500000' + currency: USD + customFilters: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: Additional implementation-defined filters to apply to the search + description: Filters to apply when searching for awards + CommonGrants.Models.AwdFunding: + type: object + properties: + details: + type: string + description: Details about the award's funding that don't fit other fields + requestedAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Amount of funding requested by the recipient + awardedAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Amount of funding awarded to the recipient + disbursedAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Amount of funding disbursed to the recipient so far + description: Financial details about the award, including the amounts requested, awarded, and disbursed + example: + requestedAmount: + amount: '500000.00' + currency: USD + awardedAmount: + amount: '450000.00' + currency: USD + disbursedAmount: + amount: '150000.00' + currency: USD + CommonGrants.Models.AwdIdFain: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - awd:us:fain + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An award's Federal Award Identification Number (FAIN), assigned by the awarding agency. + example: + registry: + code: awd:us:fain + url: https://commongrants.org/registries/awd-us-fain + id: H80CS00001 + CommonGrants.Models.AwdIds: + type: object + properties: + awd:us:fain: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdIdFain' + description: The award's Federal Award Identification Number (FAIN). + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierCollection' + description: |- + A collection of identifiers associated with an award. + + Extends the generic identifier collection with the base identifiers CommonGrants + defines for awards. Additional registries can be published under `otherIds`. + example: + systemId: + registry: + code: awd:grants.gov:system + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + awd:us:fain: + registry: + code: awd:us:fain + url: https://commongrants.org/registries/awd-us-fain + id: H80CS00001 + CommonGrants.Models.AwdRecipientIndividual: + type: object + properties: + name: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Name' + description: The individual's name. + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierCollection' + description: Identifiers associated with the individual, keyed by registry code. + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Custom fields about the individual recipient. + description: An individual who received an award, when the recipient is a person rather than an organization. + CommonGrants.Models.AwdRef: + type: object + required: + - id + - title + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the award + readOnly: true + title: + type: string + description: Title or name of the award + example: Community Health Center Capital Improvement Grant + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdIds' + description: System and registry-specific identifiers for the award + description: |- + A reference to an award, previewing the key fields a consumer needs to + identify it and look it up or join it to another response. Appears wherever + another record points to an award, such as a parent award for an amendment + or tranche. + example: + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + title: Community Health Center Capital Improvement Grant + identifiers: + systemId: + registry: + code: awd:grants.gov:system + id: 01912a8b-7c3d-7894-abcd-ef1234567890 + awd:us:fain: + registry: + code: awd:us:fain + url: https://commongrants.org/registries/awd-us-fain + id: H80CS00001 + CommonGrants.Models.AwdSortBy: + type: string + enum: + - lastModifiedAt + - createdAt + - title + - status.value + - keyDates.awardDate + - funding.awardedAmount + - custom + CommonGrants.Models.AwdSorting: + type: object + required: + - sortBy + properties: + sortBy: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdSortBy' + description: The field to sort by + example: lastModifiedAt + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortBodyParams' + CommonGrants.Models.AwdStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.AwdStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the award + example: + value: awarded + description: Award has been issued and funds are being disbursed. + CommonGrants.Models.AwdStatusOptions: + type: string + enum: + - awarded + - completed + - cancelled + - custom + description: |- + The set of values accepted for award status: + - `awarded`: The award has been issued and funds are being disbursed + - `completed`: The award's period of performance has ended + - `cancelled`: The award was cancelled or terminated + - `custom`: A custom status + CommonGrants.Models.AwdTimeline: + type: object + properties: + awardDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The date (and time) on which the award was issued + periodOfPerformance: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The period during which the funded work is expected to be performed + otherDates: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: |- + An optional map of other key dates or events in the award timeline + + Examples might include a reporting deadline, close-out date, etc. + description: Key dates in the award's timeline, such as the award date and period of performance + example: + awardDate: + name: Award date + eventType: singleDate + date: '2026-03-01' + description: The date the award was issued. + periodOfPerformance: + name: Period of performance + eventType: dateRange + startDate: '2026-04-01' + endDate: '2027-03-31' + description: The period during which the funded work is performed. + CommonGrants.Models.CompetitionBase: + type: object + required: + - id + - opportunity + - title + - status + - forms + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the competition + opportunity: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppRef' + description: The opportunity this competition is for + title: + type: string + description: The title of the competition + description: + type: string + description: The description of the competition + instructions: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/CommonGrants.Fields.File' + description: The instructions for the competition + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionStatus' + description: The status of the competition + keyDates: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionTimeline' + description: The key dates in the competition timeline + forms: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionForms' + description: The forms for the competition + acceptedApplicantTypes: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.ApplicantType' + description: Accepted applicant types for the competition + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: The custom fields for the competition + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: |- + The base model for a competition. + + A competition is an application process for a funding opportunity. It often has a + distinct application period and set of application forms. + example: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + opportunity: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6b + title: Small business grant program + title: Competition 1 + description: Competition 1 description + instructions: Competition 1 instructions + status: + value: open + description: Competition is open for applications + keyDates: + openDate: + name: Open Date + eventType: singleDate + date: '2025-01-01' + closeDate: + name: Close Date + eventType: singleDate + date: '2025-01-30' + otherDates: + reviewPeriod: + name: Application Review Period + eventType: dateRange + startDate: '2025-02-01' + endDate: '2025-02-28' + forms: + forms: + formA: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + formB: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + validation: + required: + - formA + - formB + createdAt: '2025-01-01T00:00:00Z' + lastModifiedAt: '2025-01-01T00:00:00Z' + CommonGrants.Models.CompetitionForms: + type: object + required: + - forms + properties: + forms: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.FormBase' + description: The forms for the competition + validation: + type: object + additionalProperties: {} + description: The validation rules for the competition forms + description: Set of forms that need to be completed to apply to the competition. + example: + forms: + formA: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + formB: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + validation: + required: + - formA + - formB + CommonGrants.Models.CompetitionStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.CompetitionStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the competition + example: + value: open + description: Competition is open for applications + CommonGrants.Models.CompetitionStatusOptions: + type: string + enum: + - open + - closed + - custom + description: |- + The set of values accepted for competition status + - `open`: The competition is open for applications + - `closed`: The competition is no longer accepting applications + - `custom`: A custom status + CommonGrants.Models.CompetitionTimeline: + type: object + properties: + openDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The start date of the competition + closeDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The end date of the competition + otherDates: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The date the competition was created + description: Key dates in the competition's timeline. + example: + openDate: + name: Open Date + eventType: singleDate + date: '2025-01-01' + closeDate: + name: Close Date + eventType: singleDate + date: '2025-01-30' + otherDates: + reviewPeriod: + name: Application Review Period + eventType: dateRange + startDate: '2025-02-01' + endDate: '2025-02-28' + CommonGrants.Models.FormBase: + type: object + required: + - id + - title + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The form's unique identifier. + title: + type: string + description: The form's title. + description: + type: string + description: The form's description. + version: + type: string + instructions: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/CommonGrants.Fields.File' + description: The form's instructions. + jsonSchema: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormJsonSchema' + description: The form's JSON schema used to render the form and validate responses. + uiSchema: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormUISchema' + description: The form's UI schema used to render the form in the browser. + mappingToCommonGrants: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.MappingSchema' + description: A mapping from form schema to CommonGrants schema. + mappingFromCommonGrants: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.MappingSchema' + description: A mapping from CommonGrants schema to form schema. + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Custom attributes about the form itself, not custom fields within the form. + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: A form for collecting data from a user. + example: + id: b7c1e2f4-8a3d-4e2a-9c5b-1f2e3d4c5b6a + title: Form A + description: Form A description + instructions: Form A instructions + jsonSchema: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + uiSchema: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + mappingToCommonGrants: + name: + firstName: + field: name.first + lastName: + field: name.last + emails: + primary: + field: email + phones: + primary: + field: phone + mappingFromCommonGrants: + name: + first: + field: name.firstName + last: + field: name.lastName + email: + field: emails.primary + phone: + field: phones.primary + createdAt: '2025-01-01T17:01:01Z' + lastModifiedAt: '2025-01-02T17:30:00Z' + CommonGrants.Models.FormJsonSchema: + type: object + additionalProperties: {} + description: A JSON schema used to validate form responses. + example: + $id: formA.json + type: object + properties: + name: + first: + type: string + last: + type: string + email: + type: string + phone: + type: string + CommonGrants.Models.FormResponseStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.FormResponseStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the form response + example: + value: inProgress + description: The form response is in progress + CommonGrants.Models.FormResponseStatusOptions: + type: string + enum: + - notStarted + - inProgress + - complete + - custom + description: |- + The set of values accepted for form response status: + - `notStarted`: The form response has not been started + - `inProgress`: The form response is in progress + - `complete`: The form response is complete, meaning all required fields have been filled out and there are no validation errors + - `custom`: A custom status + CommonGrants.Models.FormUISchema: + type: object + additionalProperties: {} + description: A UI schema used to render the form in the browser. + example: + type: VerticalLayout + elements: + - type: Group + label: Name + elements: + - type: Control + scope: '#/properties/name/first' + - type: Control + scope: '#/properties/name/last' + - type: Control + scope: '#/properties/email' + - type: Control + scope: '#/properties/phone' + CommonGrants.Models.MappingConstantFunction: + type: object + required: + - const + properties: + const: {} + description: Returns a constant value. + example: + const: '123' + CommonGrants.Models.MappingFieldFunction: + type: object + required: + - field + properties: + field: + type: string + description: Returns the value of a field in the source data. + example: + field: summary.opportunity_amount + CommonGrants.Models.MappingFunction: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Models.MappingConstantFunction' + - $ref: '#/components/schemas/CommonGrants.Models.MappingFieldFunction' + - $ref: '#/components/schemas/CommonGrants.Models.MappingSwitchFunction' + description: The set of supported mapping functions. + example: + switch: + field: summary.opportunity_status + case: + active: open + inactive: closed + default: custom + CommonGrants.Models.MappingSchema: + type: object + additionalProperties: + anyOf: + - $ref: '#/components/schemas/CommonGrants.Models.MappingFunction' + - $ref: '#/components/schemas/CommonGrants.Models.MappingSchema' + description: |- + A mapping format for translating data from one schema to another. + + Example: + + The following mapping: + + ```json + { + "id": { "const": "123" }, + "opportunity": { + "status": { + "switch": { + "field": "summary.opportunity_status", + "case": { "active": "open", "inactive": "closed" }, + "default": "custom", + }, + }, + "amount": { "field": "summary.opportunity_amount" }, + } + } + ``` + + Will translate the following data: + + ```json + { + "id": "123", + "summary": { + "opportunity_status": "active", + "opportunity_amount": 100, + }, + } + ``` + + To the following data: + + ```json + { + "id": "123", + "opportunity": { "status": "open", "amount": 100 }, + } + ``` + example: + id: + const: '123' + opportunity: + status: + switch: + field: summary.opportunity_status + case: + active: open + inactive: closed + default: custom + amount: + field: summary.opportunity_amount + CommonGrants.Models.MappingSwitchFunction: + type: object + required: + - switch + properties: + switch: + type: object + properties: + field: + type: string + description: The field in the source data to switch on. + case: + type: object + additionalProperties: {} + description: An object mapping source field values to desired output values. + default: + description: The default value to output if no case matches the source field value. + required: + - field + - case + description: Returns a new value based on the value of a field in the source data using a switch statement. + example: + switch: + field: summary.opportunity_status + case: + active: open + inactive: closed + default: custom + CommonGrants.Models.OperationVersions: + type: object + required: + - versions + - defaultVersion + properties: + versions: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + minItems: 1 + description: The versions this route serves + defaultVersion: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version this route serves when a request doesn't name one, one of `versions` + upcomingDefault: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.UpcomingDefault' + description: A scheduled change to this route's default version, if any. Its `version` is one of `versions` + deprecated: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.VersionRetirement' + description: |- + Deprecated versions of this route, keyed by version, with their retirement schedule + + Each key is a version from `versions`, written exactly as it appears + there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses + `0.3.1` as the key here. + + To check whether the version you request is deprecated, compare only + the major and minor. A client requesting `0.3.0` is served `0.3.1`, so + its entry is under `0.3.1`. + additionalProperties: {} + description: The versions a single route serves, when they differ from the API-wide values + CommonGrants.Models.OppDefaultFilters: + type: object + properties: + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - forecasted + - open + closeDateRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`keyDates.closeDate` is between the given range' + example: + operator: between + value: + min: '2021-01-01' + max: '2021-01-02' + totalFundingAvailableRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.totalAmountAvailable` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + minAwardAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.minAwardAmount` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + maxAwardAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.maxAwardAmount` is between the given range. + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + allOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: The standard set of filters supported for opportunity searches + CommonGrants.Models.OppFilters: + type: object + properties: + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.StringArrayFilter' + description: '`status.value` matches one of the following values' + example: + operator: in + value: + - forecasted + - open + closeDateRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.DateRangeFilter' + description: '`keyDates.closeDate` is between the given range' + example: + operator: between + value: + min: '2021-01-01' + max: '2021-01-02' + totalFundingAvailableRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.totalAmountAvailable` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + minAwardAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.minAwardAmount` is between the given range + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + maxAwardAmountRange: + allOf: + - $ref: '#/components/schemas/CommonGrants.Filters.MoneyRangeFilter' + description: |- + `funding.maxAwardAmount` is between the given range. + + Funding amounts that are denominated in a different currency will + be excluded from the search. + example: + operator: between + value: + min: + amount: '1000000' + currency: USD + max: + amount: '2000000' + currency: USD + customFilters: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Filters.DefaultFilter' + description: Additional implementation-defined filters to apply to the search + description: Filters to apply when searching for opportunities + CommonGrants.Models.OppFunding: + type: object + properties: + details: + type: string + description: Details about the funding available for this opportunity that don't fit other fields + totalAmountAvailable: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Total amount of funding available for this opportunity + minAwardAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Minimum amount of funding granted per award + maxAwardAmount: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Money' + description: Maximum amount of funding granted per award + minAwardCount: + type: integer + description: Minimum number of awards granted + maxAwardCount: + type: integer + description: Maximum number of awards granted + estimatedAwardCount: + type: integer + description: Estimated number of awards that will be granted + description: Details about the funding available for this opportunity + example: + totalAmountAvailable: + amount: '1000000.00' + currency: USD + minAwardAmount: + amount: '10000.00' + currency: USD + maxAwardAmount: + amount: '50000.00' + currency: USD + minAwardCount: 5 + maxAwardCount: 20 + estimatedAwardCount: 10 + CommonGrants.Models.OppIdAln: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - opp:us:aln + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An opportunity's Assistance Listing Number (ALN), formerly the CFDA number. + example: + registry: + code: opp:us:aln + url: https://commongrants.org/registries/opp-us-aln + id: '93.575' + CommonGrants.Models.OppIdFon: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - opp:us:fon + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An opportunity's Funding Opportunity Number (FON), assigned by the awarding agency. + example: + registry: + code: opp:us:fon + url: https://commongrants.org/registries/opp-us-fon + id: HHS-2026-ACF-OCC-YD-0001 + CommonGrants.Models.OppIds: + type: object + properties: + opp:us:fon: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppIdFon' + description: The opportunity's Funding Opportunity Number (FON). + opp:us:aln: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppIdAln' + description: The opportunity's Assistance Listing Number (ALN). + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierCollection' + description: |- + A collection of identifiers associated with an opportunity. + + Extends the generic identifier collection with the base identifiers CommonGrants + defines for opportunities. Additional registries can be published under `otherIds`. + example: + systemId: + registry: + code: opp:grants.gov:system + id: 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + opp:us:fon: + registry: + code: opp:us:fon + url: https://commongrants.org/registries/opp-us-fon + id: HHS-2026-ACF-OCC-YD-0001 + opp:us:aln: + registry: + code: opp:us:aln + url: https://commongrants.org/registries/opp-us-aln + id: '93.575' + CommonGrants.Models.OppRef: + type: object + required: + - id + - title + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the opportunity + readOnly: true + title: + type: string + description: Title or name of the funding opportunity + example: Small business grant program + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppIds' + description: System and registry-specific identifiers for the opportunity + description: |- + A reference to an opportunity, previewing the key fields a consumer needs + to identify it and look it up or join it to another response. Appears + wherever another record points to an opportunity, such as the opportunity + an award resulted from. + example: + id: 018f2e77-3a4b-7c1d-9e2f-abcdef123456 + title: Health Center Capital Improvement Program + identifiers: + opp:us:fon: + registry: + code: opp:us:fon + url: https://commongrants.org/registries/opp-us-fon + id: HHS-2026-ACF-OCC-YD-0001 + CommonGrants.Models.OppSortBy: + type: string + enum: + - lastModifiedAt + - createdAt + - title + - status.value + - keyDates.closeDate + - funding.maxAwardAmount + - funding.minAwardAmount + - funding.totalAmountAvailable + - funding.estimatedAwardCount + - custom + CommonGrants.Models.OppSorting: + type: object + required: + - sortBy + properties: + sortBy: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppSortBy' + description: The field to sort by + example: lastModifiedAt + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortBodyParams' + CommonGrants.Models.OppStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the opportunity + example: + value: open + description: The opportunity is currently accepting applications + CommonGrants.Models.OppStatusOptions: + type: string + enum: + - forecasted + - open + - closed + - custom + description: |- + The set of values accepted for opportunity status: + - `forecasted`: The opportunity is forecasted and not yet open for applications + - `open`: The opportunity is open for applications + - `closed`: The opportunity is no longer accepting applications + - `custom`: A custom status + CommonGrants.Models.OppTimeline: + type: object + properties: + postDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The date (and time) at which the opportunity is posted + closeDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: The date (and time) at which the opportunity closes + otherDates: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.Event' + description: |- + An optional map of other key dates or events in the opportunity timeline + + Examples might include a deadline for questions, anticipated award date, etc. + description: Key dates and events in the opportunity's timeline, such as when the opportunity is posted and closes + example: + postDate: + name: Opportunity posted date + eventType: singleDate + date: '2024-01-15' + description: Opportunity is posted publicly + closeDate: + name: Opportunity close date + eventType: singleDate + date: '2024-12-31' + time: '17:00:00' + description: Opportunity closes for all applications + otherDates: + anticipatedAward: + name: Anticipated award date + eventType: singleDate + date: '2025-03-15' + description: When we expect to announce awards for this opportunity. + applicationPeriod: + name: Application period + eventType: dateRange + startDate: '2024-01-01' + endDate: '2024-01-31' + endTime: '17:00:00' + description: Primary application period for the grant opportunity + performancePeriod: + name: Period of Performance + eventType: dateRange + startDate: '2024-01-01' + endDate: '2024-12-31' + description: Period of performance for the grant + infoSessions: + name: Info sessions + eventType: other + details: Every other Tuesday + description: Info sessions for the opportunity + CommonGrants.Models.OpportunityBase: + type: object + required: + - id + - title + - status + - description + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the opportunity + readOnly: true + title: + type: string + description: Title or name of the funding opportunity + example: Small business grant program + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppIds' + description: System and registry-specific identifiers for the opportunity + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppStatus' + description: Status of the opportunity + description: + type: string + description: Description of the opportunity's purpose and scope + example: This program provides funding to small businesses to help them grow and create jobs + funding: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppFunding' + description: Details about the funding available + funders: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRefCollection' + description: Organization(s) offering the funding for this opportunity + example: + primary: + id: 018f2e77-4b5c-7d2e-9f3a-bcdef1234567 + name: Health Resources and Services Administration + identifiers: + otherIds: + org:grants.gov:agency: + registry: + code: org:grants.gov:agency + id: HRSA + keyDates: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OppTimeline' + description: Key dates for the opportunity, such as when the application opens and closes + acceptedApplicantTypes: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.ApplicantType' + description: The type of applicant for the opportunity + source: + type: string + format: uri + description: URL for the original source of the opportunity + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Additional custom fields specific to this opportunity + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: A funding opportunity + CommonGrants.Models.OpportunityDetails: + type: object + properties: + competitions: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.CompetitionBase' + description: The competitions associated with the opportunity + awards: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.AwdRef' + description: |- + Awards that resulted from this opportunity, as references. + + Each entry references an award that resulted from this opportunity; the + award's `opportunity.id`, when it is published, is this record's `id`. + An entry is a reference, not the award record: `GET /awards/` is the + canonical record only where an implementation serves the award routes, + and otherwise the entry's `identifiers`, where the publisher supplies + them, are the key for joining the award in another system. A consumer + must not assume a reference can be dereferenced through this API. + + Absent means the implementation does not publish this link for the + record, and an empty array means the link is published and no awards are + known. Entries carry no ordering guarantee. + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OpportunityBase' + description: A funding opportunity with additional details, like available competitions. + CommonGrants.Models.OrgHierarchyKindOptions: + type: string + enum: + - chapter + - department + - branch + - subsidiary + - fiscalSponsor + - dba + - custom + description: |- + The standard subtypes of a parent or child relationship: + - `chapter`: The child is a chapter of the parent + - `department`: The child is an internal unit of the parent + - `branch`: The child is a branch of the parent + - `subsidiary`: The child is a subsidiary of the parent + - `fiscalSponsor`: The parent fiscally sponsors the child + - `dba`: The child is a record for a name the parent, a legal entity, does business under + - `custom`: Another subtype, named in `customValue` + CommonGrants.Models.OrgHierarchyRelationship: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The other organization. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgHierarchyKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A parent or child relationship. + example: + org: + id: 01912a8b-7c3d-7892-abcd-ef1234567892 + name: Riverside Community Foundation + identifiers: + org:us:ein: + registry: + code: org:us:ein + id: '472345678' + kind: + value: fiscalSponsor + startDate: '2024-07-01' + status: active + CommonGrants.Models.OrgIdDuns: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:xi:duns + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Data Universal Numbering System (DUNS) number. + example: + registry: + code: org:xi:duns + url: https://commongrants.org/registries/org-xi-duns + id: '123456789' + CommonGrants.Models.OrgIdEin: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:ein + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Employer Identification Number (EIN), assigned by the IRS. + example: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + CommonGrants.Models.OrgIdUei: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:uei + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Unique Entity Identifier (UEI) from SAM.gov. + example: + registry: + code: org:us:uei + url: https://commongrants.org/registries/org-us-uei + id: AB0123456789 + CommonGrants.Models.OrgIds: + type: object + properties: + org:us:ein: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIdEin' + description: The organization's Employer Identification Number (EIN), assigned by the IRS. + org:us:uei: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIdUei' + description: The organization's Unique Entity Identifier (UEI) from SAM.gov. + org:xi:duns: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIdDuns' + description: The organization's Data Universal Numbering System (DUNS) number. + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierCollection' + description: |- + A collection of identifiers associated with an organization. + + Extends the generic identifier collection with the base identifiers CommonGrants + defines for organizations. Additional registries can be published under `otherIds`. + CommonGrants.Models.OrgOtherKindOptions: + type: string + enum: + - custom + description: Other relationships define no standard subtypes, so a stated subtype is `custom`. + CommonGrants.Models.OrgOtherRelationship: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The other organization. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgOtherKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A relationship outside the named categories, which need not have a direction. + example: + org: + id: 01912a8b-7c3d-7895-abcd-ef1234567895 + name: Riverside Literacy Coalition + CommonGrants.Models.OrgPatchData: + type: object + properties: + name: + type: string + description: The name this organization is known by; for a legal entity, its legal name. + status: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchOrgStatusOrCreate' + nullable: true + description: Whether the organization exists and operates, or has dissolved or ceased operating. + mission: + type: string + nullable: true + description: The organization's mission statement. + yearFounded: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.calendarYear' + nullable: true + description: The calendar year the organization was founded. + aliases: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.nonEmptyString' + nullable: true + uniqueItems: true + description: Other names this organization goes by, such as a trading name or a short form of its legal name. Not a history of former names. Don't list a name that has its own live trading-name record linked to this organization by a `dba` entry in either record; see the organization relationships guide. + identifiers: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgIdsOrCreate' + nullable: true + description: Identifiers associated with the organization, keyed by registry code. + orgType: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchPCSOrgTypeOrCreate' + nullable: true + description: The organization's type within the Philanthropy Classification System (PCS). + addresses: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchAddressCollectionOrCreate' + nullable: true + description: Collection of physical addresses associated with the organization. + phones: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchPhoneCollectionOrCreate' + nullable: true + description: Collection of phone numbers associated with the organization. + emails: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchEmailCollectionOrCreate' + nullable: true + description: Collection of email addresses associated with the organization. + socials: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgSocialLinksOrCreate' + nullable: true + description: Collection of the organization's social media and web presence links. + relationships: + type: object + properties: + parents: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgHierarchyRelationshipReplaceOnly' + nullable: true + description: Organizations above this one, such as a containing organization or a fiscal sponsor. + children: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgHierarchyRelationshipReplaceOnly' + nullable: true + description: Organizations below this one, such as its chapters or sponsored projects. + succeededBy: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgSuccessionRelationshipReplaceOnly' + nullable: true + description: Organizations that carry on all or part of this one. + succeeds: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgSuccessionRelationshipReplaceOnly' + nullable: true + description: Organizations whose work this one carries on in whole or in part. + recordReplacedBy: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgRecordRelationshipReplaceOnly' + nullable: true + description: Records to use instead of this record. + recordReplaces: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgRecordRelationshipReplaceOnly' + nullable: true + description: Records that this record is used instead of. + otherRelationships: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgOtherRelationshipReplaceOnly' + nullable: true + description: Connections outside the categories above, which need not have a direction. + nullable: true + description: The organization's relationships to other organizations. + customFields: + type: object + additionalProperties: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchCustomFieldOrCreate' + nullable: true + nullable: true + description: Custom fields for the organization. + description: |- + A JSON Merge Patch (RFC 7396) body for updating an organization profile. + + Derived from `OrganizationBase`: every field is optional, fields that can + be cleared accept `null` to unset them, record keys can be deleted by + setting them to `null`, and read-only fields like `id` are excluded. + Sent as `application/merge-patch+json`. + example: + name: Example Nonprofit (Renamed) + mission: To expand access to community health resources. + yearFounded: null + socials: + website: null + emails: + primary: info@example.org + customFields: + legacyCode: null + CommonGrants.Models.OrgPatchOrgIdDunsOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:xi:duns + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Data Universal Numbering System (DUNS) number. + example: + registry: + code: org:xi:duns + url: https://commongrants.org/registries/org-xi-duns + id: '123456789' + CommonGrants.Models.OrgPatchOrgIdEinOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:ein + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Employer Identification Number (EIN), assigned by the IRS. + example: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + CommonGrants.Models.OrgPatchOrgIdUeiOrCreate: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:uei + nullable: true + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + nullable: true + description: Link to the catalog entry for this registry. + nullable: true + description: Registry-level facts shared by every record in this registry. + id: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + nullable: true + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + nullable: true + description: Every known identifier for this record in this registry, including archived values. + description: An organization's Unique Entity Identifier (UEI) from SAM.gov. + example: + registry: + code: org:us:uei + url: https://commongrants.org/registries/org-us-uei + id: AB0123456789 + CommonGrants.Models.OrgPatchOrgStatusOrCreate: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + nullable: true + description: A custom value, used when the selected value is the `custom` option + description: + type: string + nullable: true + description: A human-readable description of the value + description: The status of the organization + example: + value: active + description: The organization exists and operates + CommonGrants.Models.OrgRecordKindOptions: + type: string + enum: + - duplicate + - merged + - custom + description: |- + The standard subtypes of record replacement. A provider's workflow may + treat them alike; they need not be exclusive. + - `duplicate`: The records duplicate each other + - `merged`: The provider combined the records + - `custom`: Another subtype, named in `customValue` + CommonGrants.Models.OrgRecordRelationship: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The other organization. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRecordKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A record replacement relationship. + example: + org: + id: 01912a8b-7c3d-7894-abcd-ef1234567894 + name: Riverside Reading Project + kind: + value: duplicate + CommonGrants.Models.OrgRef: + type: object + required: + - id + - name + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The organization's unique identifier. + readOnly: true + name: + type: string + description: The name this organization is known by; for a legal entity, its legal name. + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIds' + description: Identifiers associated with the organization, keyed by registry code. + description: |- + A reference to an organization, previewing the key fields a consumer needs + to identify it and look it up or join it to another response. Appears + wherever another record points to an organization, such as an award's funder + or recipient. + example: + id: 018f2e77-4b5c-7d2e-9f3a-bcdef1234567 + name: Health Resources and Services Administration + identifiers: + otherIds: + org:grants.gov:agency: + registry: + code: org:grants.gov:agency + id: HRSA + CommonGrants.Models.OrgRefCollection: + type: object + required: + - primary + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The primary organization in the collection. + otherOrgs: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: Other organizations in the collection, keyed by an implementation-defined role. + description: |- + A group of organization references, with a primary organization and + optional others. Appears wherever several organizations share a role on a + record, such as an award's funders or recipient organizations. + example: + primary: + id: 018f2e77-4b5c-7d2e-9f3a-bcdef1234567 + name: Health Resources and Services Administration + identifiers: + otherIds: + org:grants.gov:agency: + registry: + code: org:grants.gov:agency + id: HRSA + CommonGrants.Models.OrgRelationshipStatus: + type: string + enum: + - active + - inactive + description: Whether a relationship is in effect, as stated by the provider. + CommonGrants.Models.OrgRelationships: + type: object + properties: + parents: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgHierarchyRelationship' + description: Organizations above this one, such as a containing organization or a fiscal sponsor. + children: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgHierarchyRelationship' + description: Organizations below this one, such as its chapters or sponsored projects. + succeededBy: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgSuccessionRelationship' + description: Organizations that carry on all or part of this one. + succeeds: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgSuccessionRelationship' + description: Organizations whose work this one carries on in whole or in part. + recordReplacedBy: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgRecordRelationship' + description: Records to use instead of this record. + recordReplaces: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgRecordRelationship' + description: Records that this record is used instead of. + otherRelationships: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Models.OrgOtherRelationship' + description: Connections outside the categories above, which need not have a direction. + description: |- + An organization's relationships to other organizations. + + Each named list holds relationships of one category and direction; + `otherRelationships` holds connections outside those categories. Every list + is optional, list order carries no meaning, and a provider may state a + relationship from either organization's record. A relationship confers no + authority over the other organization. + example: + parents: + - org: + id: 01912a8b-7c3d-7891-abcd-ef1234567891 + name: National Reading Network + kind: + value: chapter + - org: + id: 01912a8b-7c3d-7892-abcd-ef1234567892 + name: Riverside Community Foundation + identifiers: + org:us:ein: + registry: + code: org:us:ein + id: '472345678' + kind: + value: fiscalSponsor + startDate: '2024-07-01' + status: active + CommonGrants.Models.OrgRevision: + type: object + required: + - id + - status + - createdAt + - lastModifiedAt + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: Globally unique id for the revision + readOnly: true + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.RevisionStatus' + description: The lifecycle status of the change + source: + type: string + description: The source system the change came from + patch: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchData' + description: The merge patch that was submitted + snapshot: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrganizationBase' + description: A full snapshot of the record with the change applied + createdAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was created. + readOnly: true + lastModifiedAt: + type: string + format: date-time + description: The timestamp (in UTC) at which the record was last modified. + readOnly: true + description: |- + A single change to an organization profile, recorded in the change ledger. + + The `patch` is an `OrgPatchData` merge patch, and the `snapshot` is the + organization profile with that change applied. + example: + id: 01912a8b-7c3d-7890-abcd-ef1234567890 + status: + value: accepted + description: The change was applied. + source: grants.gov + patch: + mission: To provide support and resources to the community. + snapshot: + id: 083b4567-e89d-42c8-a439-6c1234567890 + name: Example Organization + orgType: + term: Hospital + class: Organization types + description: Institutions with the primary purpose of providing in-patient physical and mental health services... + code: EO000000 + status: + value: active + description: The organization exists and operates + identifiers: + org:us:ein: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + org:us:uei: + registry: + code: org:us:uei + url: https://commongrants.org/registries/org-us-uei + id: AB0123456789 + addresses: + primary: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + otherAddresses: + satellite: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + international: + street1: 123 Rue Principale + city: Montreal + stateOrProvince: QC + country: CA + postalCode: H2Y 1C6 + phones: + primary: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + fax: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + otherPhones: + support: + countryCode: '+1' + number: 333-456-1230 + isMobile: false + marketing: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + emails: + primary: info@example.com + otherEmails: + support: support@example.com + marketing: marketing@example.com + mission: To provide support and resources to the community. + yearFounded: '2024' + socials: + website: https://www.example.com + facebook: https://www.facebook.com/example + twitterOrX: https://x.com/example + instagram: https://www.instagram.com/example + linkedin: https://www.linkedin.com/company/example + otherSocials: + youtube: https://www.youtube.com/example + aliases: + - Example Org + relationships: + parents: + - org: + id: 01912a8b-7c3d-7891-abcd-ef1234567891 + name: National Reading Network + kind: + value: chapter + createdAt: '2026-06-20T14:30:00Z' + lastModifiedAt: '2026-06-20T14:30:00Z' + CommonGrants.Models.OrgSocialLinks: + type: object + properties: + website: + type: string + format: uri + description: The organization's primary website URL. + facebook: + type: string + format: uri + description: The organization's Facebook profile URL. + twitterOrX: + type: string + format: uri + description: The organization's Twitter/X profile URL. + bluesky: + type: string + format: uri + description: The organization's BlueSky profile URL. + instagram: + type: string + format: uri + description: The organization's Instagram profile URL. + linkedin: + type: string + format: uri + description: The organization's LinkedIn profile URL. + otherSocials: + type: object + additionalProperties: + type: string + format: uri + description: Additional social media profiles not covered by the standard fields. + description: A collection of social media and web presence links for an organization. + example: + website: https://www.example.com + facebook: https://www.facebook.com/example + twitterOrX: https://x.com/example + instagram: https://www.instagram.com/example + linkedin: https://www.linkedin.com/company/example + otherSocials: + youtube: https://www.youtube.com/example + CommonGrants.Models.OrgStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: The status of the organization + example: + value: active + description: The organization exists and operates + CommonGrants.Models.OrgStatusOptions: + type: string + enum: + - active + - inactive + - custom + description: |- + The set of values accepted for organization status: + - `active`: The organization exists and operates + - `inactive`: The organization has dissolved or ceased operating; loss of tax-exempt status alone does not make an organization inactive + - `custom`: A status not covered by the other options, described in `customValue` + CommonGrants.Models.OrgSuccessionKindOptions: + type: string + enum: + - merger + - acquisition + - divestiture + - split + - custom + description: |- + The standard subtypes of organizational succession: + - `merger`: Succession through a merger + - `acquisition`: Succession through an acquisition + - `divestiture`: Succession through a divestiture + - `split`: Succession through a split into several organizations + - `custom`: Another subtype, named in `customValue` + CommonGrants.Models.OrgSuccessionRelationship: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRef' + description: The other organization. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgSuccessionKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A succession relationship. + example: + org: + id: 01912a8b-7c3d-7893-abcd-ef1234567893 + name: Riverside Reading East + kind: + value: split + startDate: '2026-01-01' + CommonGrants.Models.OrganizationBase: + type: object + required: + - id + - name + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The organization's unique identifier. + readOnly: true + name: + type: string + description: The name this organization is known by; for a legal entity, its legal name. + identifiers: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgIds' + description: Identifiers associated with the organization, keyed by registry code. + orgType: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PCSOrgType' + description: The organization's type within the Philanthropy Classification System (PCS). + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgStatus' + description: Whether the organization exists and operates, or has dissolved or ceased operating. + addresses: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.AddressCollection' + description: Collection of physical addresses associated with the organization. + phones: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.PhoneCollection' + description: Collection of phone numbers associated with the organization. + emails: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.EmailCollection' + description: Collection of email addresses associated with the organization. + mission: + type: string + description: The organization's mission statement. + yearFounded: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.calendarYear' + description: The calendar year the organization was founded. + socials: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgSocialLinks' + description: Collection of the organization's social media and web presence links. + aliases: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.nonEmptyString' + uniqueItems: true + description: Other names this organization goes by, such as a trading name or a short form of its legal name. Not a history of former names. Don't list a name that has its own live trading-name record linked to this organization by a `dba` entry in either record; see the organization relationships guide. + relationships: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationships' + description: The organization's relationships to other organizations. + customFields: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Fields.CustomField' + description: Custom fields for the organization. + description: An organization that can apply for grants. + example: + id: 083b4567-e89d-42c8-a439-6c1234567890 + name: Example Organization + orgType: + term: Hospital + class: Organization types + description: Institutions with the primary purpose of providing in-patient physical and mental health services... + code: EO000000 + status: + value: active + description: The organization exists and operates + identifiers: + org:us:ein: + registry: + code: org:us:ein + url: https://commongrants.org/registries/org-us-ein + id: '123456789' + org:us:uei: + registry: + code: org:us:uei + url: https://commongrants.org/registries/org-us-uei + id: AB0123456789 + addresses: + primary: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + otherAddresses: + satellite: + street1: 456 Main St + street2: Suite 100 + city: Anytown + stateOrProvince: CA + country: US + postalCode: '12345' + international: + street1: 123 Rue Principale + city: Montreal + stateOrProvince: QC + country: CA + postalCode: H2Y 1C6 + phones: + primary: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + fax: + countryCode: '+1' + number: 555-123-4567 + extension: '123' + isMobile: false + otherPhones: + support: + countryCode: '+1' + number: 333-456-1230 + isMobile: false + marketing: + countryCode: '+1' + number: 444-456-1230 + isMobile: true + emails: + primary: info@example.com + otherEmails: + support: support@example.com + marketing: marketing@example.com + mission: To provide support and resources to the community. + yearFounded: '2024' + socials: + website: https://www.example.com + facebook: https://www.facebook.com/example + twitterOrX: https://x.com/example + instagram: https://www.instagram.com/example + linkedin: https://www.linkedin.com/company/example + otherSocials: + youtube: https://www.youtube.com/example + aliases: + - Example Org + relationships: + parents: + - org: + id: 01912a8b-7c3d-7891-abcd-ef1234567891 + name: National Reading Network + kind: + value: chapter + CommonGrants.Models.RevisionStatus: + type: object + required: + - value + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.RevisionStatusOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + description: |- + The status of a revision, including its lifecycle state and an optional + human-readable description. + example: + value: custom + customValue: escalated + description: The change was escalated for additional review. + CommonGrants.Models.RevisionStatusOptions: + type: string + enum: + - pending + - accepted + - denied + - superseded + - custom + description: |- + The set of values accepted for a revision's status: + - `pending`: Non-terminal. The change is queued for review. + - `accepted`: Terminal. The change was applied, either immediately via a + direct `PATCH` or after a `pending` change was approved. + - `denied`: Terminal. The change was rejected, with a reason. + - `superseded`: Terminal. A competing change was accepted first, so this + change no longer applies. + - `custom`: An implementation-defined status. The receiver documents whether + it is terminal. + + A revision moves once from `pending` into a terminal state; a terminal + revision is never restated. How a receiver resolves a `pending` change (a + human review, a policy engine, a batch job) is out of scope for this contract. + CommonGrants.Models.UpcomingDefault: + type: object + required: + - version + - date + properties: + version: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version that will become the default + date: + type: string + format: date-time + description: When the new default takes effect + additionalProperties: {} + description: A scheduled change to the version a server serves by default + CommonGrants.Models.VersionDiscovery: + type: object + required: + - versions + - defaultVersion + properties: + versions: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + minItems: 1 + description: The versions every route without an `operations` entry serves + defaultVersion: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version every route without an `operations` entry serves when a request doesn't name one, one of `versions` + upcomingDefault: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.UpcomingDefault' + description: A scheduled change to the API-wide default version, if any. Its `version` is one of `versions` + deprecated: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.VersionRetirement' + description: |- + Deprecated versions, keyed by version, with their retirement schedule + + Each key is a version from `versions`, written exactly as it appears + there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses + `0.3.1` as the key here. + + To check whether the version you request is deprecated, compare only + the major and minor. A client requesting `0.3.0` is served `0.3.1`, so + its entry is under `0.3.1`. + operations: + type: object + additionalProperties: + $ref: '#/components/schemas/CommonGrants.Models.OperationVersions' + description: |- + Routes whose versions differ from the API-wide values + + Each key is the HTTP method and the route's published path, separated + by a space, such as `GET /common-grants/forms/{formId}`. Path parameter + names are ignored when matching a key to a route. Omitted when every + route serves the API-wide values. + additionalProperties: {} + description: |- + The protocol versions an API serves + + The top-level fields describe every route that has no entry in + `operations`. Routes that differ from them have an entry in `operations`. + New fields are only ever added to this model; clients ignore fields they + don't recognize. + example: + versions: + - 0.3.0 + - 0.4.0 + - 0.5.0 + defaultVersion: 0.4.0 + upcomingDefault: + version: 0.5.0 + date: '2027-03-01T00:00:00Z' + deprecated: + 0.3.0: + deprecation: '2026-12-01T00:00:00Z' + sunset: '2027-06-01T00:00:00Z' + CommonGrants.Models.VersionRetirement: + type: object + required: + - deprecation + properties: + deprecation: + type: string + format: date-time + description: When the version was or will be deprecated + sunset: + type: string + format: date-time + description: When the server will stop serving the version, if scheduled + additionalProperties: {} + description: The retirement schedule for a deprecated version + CommonGrants.Pagination.PaginatedBodyParams: + type: object + properties: + page: + type: integer + format: int32 + minimum: 1 + description: The page to return + default: 1 + pageSize: + type: integer + format: int32 + minimum: 1 + description: The number of items to return per page + default: 100 + description: Body parameters for paginated routes + CommonGrants.Pagination.PaginatedResultsInfo: + type: object + required: + - page + - pageSize + properties: + page: + type: integer + format: int32 + minimum: 1 + description: Current page number (indexing starts at 1) + example: 1 + pageSize: + type: integer + minimum: 1 + description: Number of items per page + example: 20 + totalItems: + type: integer + description: Total number of items across all pages + example: 100 + totalPages: + type: integer + description: Total number of pages + example: 5 + description: Details about the paginated results + CommonGrants.Patch.OrgPatchAddressCollectionOrCreate: + type: object + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchAddressOrCreate' + description: The primary address for a person or organization. + otherAddresses: + type: object + additionalProperties: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchAddressOrCreate' + nullable: true + nullable: true + description: Additional addresses keyed by a descriptive label (e.g., "work", "home", "international"). + description: A collection of addresses. + CommonGrants.Patch.OrgPatchEmailCollectionOrCreate: + type: object + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.email' + description: The primary email address for a person or organization. + otherEmails: + type: object + additionalProperties: + type: string + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.email' + nullable: true + nullable: true + description: Additional email addresses keyed by a descriptive label (e.g., "work", "personal", "support"). + description: A collection of email addresses. + CommonGrants.Patch.OrgPatchOrgHierarchyRelationshipReplaceOnly: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly' + description: The other organization, which a writer can name by `id` alone. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgHierarchyKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A parent or child relationship, as written. + CommonGrants.Patch.OrgPatchOrgIdsOrCreate: + type: object + properties: + org:us:ein: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchOrgIdEinOrCreate' + nullable: true + description: The organization's Employer Identification Number (EIN), assigned by the IRS. + org:us:uei: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchOrgIdUeiOrCreate' + nullable: true + description: The organization's Unique Entity Identifier (UEI) from SAM.gov. + org:xi:duns: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgPatchOrgIdDunsOrCreate' + nullable: true + description: The organization's Data Universal Numbering System (DUNS) number. + systemId: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchSystemIdOrCreate' + nullable: true + description: The hosting system's own identifier for this record. + otherIds: + type: object + additionalProperties: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchIdentifierOrCreate' + nullable: true + nullable: true + description: |- + Additional identifiers keyed by their registry code, for registries the + protocol does not define as a base identifier on the model. + description: |- + A collection of identifiers associated with an organization. + + Extends the generic identifier collection with the base identifiers CommonGrants + defines for organizations. Additional registries can be published under `otherIds`. + CommonGrants.Patch.OrgPatchOrgOtherRelationshipReplaceOnly: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly' + description: The other organization, which a writer can name by `id` alone. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgOtherKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A relationship outside the named categories, as written. + CommonGrants.Patch.OrgPatchOrgRecordRelationshipReplaceOnly: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly' + description: The other organization, which a writer can name by `id` alone. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRecordKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A record replacement relationship, as written. + CommonGrants.Patch.OrgPatchOrgSocialLinksOrCreate: + type: object + properties: + website: + type: string + format: uri + nullable: true + description: The organization's primary website URL. + facebook: + type: string + format: uri + nullable: true + description: The organization's Facebook profile URL. + twitterOrX: + type: string + format: uri + nullable: true + description: The organization's Twitter/X profile URL. + bluesky: + type: string + format: uri + nullable: true + description: The organization's BlueSky profile URL. + instagram: + type: string + format: uri + nullable: true + description: The organization's Instagram profile URL. + linkedin: + type: string + format: uri + nullable: true + description: The organization's LinkedIn profile URL. + otherSocials: + type: object + additionalProperties: + type: string + format: uri + nullable: true + nullable: true + description: Additional social media profiles not covered by the standard fields. + description: A collection of social media and web presence links for an organization. + CommonGrants.Patch.OrgPatchOrgSuccessionRelationshipReplaceOnly: + type: object + required: + - org + properties: + org: + allOf: + - $ref: '#/components/schemas/CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly' + description: The other organization, which a writer can name by `id` alone. + kind: + type: object + properties: + value: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgSuccessionKindOptions' + description: The selected value, from a predefined set of options + customValue: + type: string + description: A custom value, used when the selected value is the `custom` option + description: + type: string + description: A human-readable description of the value + required: + - value + description: The relationship's subtype within the category its list names. + startDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship started, in ISO 8601 format: YYYY-MM-DD' + endDate: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.isoDate' + description: 'When the relationship ended, in ISO 8601 format: YYYY-MM-DD' + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.OrgRelationshipStatus' + description: Whether the relationship is in effect, as stated by the provider. + description: A succession relationship, as written. + CommonGrants.Patch.OrgPatchOrgTargetRefReplaceOnly: + type: object + required: + - id + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The other organization's unique identifier. + name: + type: string + description: "The other organization's name. Ignored if supplied: the receiver fills it in from its own record." + identifiers: + type: object + properties: + org:us:ein: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:ein + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.employerTaxId' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: The organization's Employer Identification Number (EIN), assigned by the IRS. + org:us:uei: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:us:uei + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.samUEI' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: The organization's Unique Entity Identifier (UEI) from SAM.gov. + org:xi:duns: + type: object + properties: + registry: + type: object + properties: + code: + type: string + enum: + - org:xi:duns + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.duns' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: The organization's Data Universal Numbering System (DUNS) number. + systemId: + type: object + properties: + registry: + type: object + properties: + code: + type: string + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.uuid' + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: The hosting system's own identifier for this record. + otherIds: + type: object + additionalProperties: + type: object + properties: + registry: + type: object + properties: + code: + type: string + description: Canonical CommonGrants registry code, `::` (e.g. `org:us:ein`). + url: + type: string + format: uri + description: Link to the catalog entry for this registry. + description: Registry-level facts shared by every record in this registry. + id: + type: string + description: |- + The primary identifier string, when the registry has a single canonical value. + + May be omitted for registries with no natural primary; consumers should read + `allIds` in that case. + allIds: + type: array + items: + type: object + properties: + id: + type: string + description: The identifier string. + status: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.IdentifierStatus' + description: Whether the identifier is currently valid or retired. + required: + - id + - status + description: Every known identifier for this record in this registry, including archived values. + description: |- + Additional identifiers keyed by their registry code, for registries the + protocol does not define as a base identifier on the model. + description: 'Identifiers associated with the other organization, keyed by registry code. Ignored if supplied: the receiver fills them in from its own record.' + description: |- + A writable reference to a relationship's other organization. + + Unlike `Models.OrgRef`, whose `id` is read-only, `id` is writable here so a + patch can name the other organization, and the rest is optional so it can + be named by `id` alone. The receiver identifies the target by `id` and + rejects an `id` it doesn't recognize. It ignores a supplied `name` and + `identifiers` and fills both in from its own record on reads and revision + snapshots. They stay accepted, rather than read-only, so a writer can + resend entries copied from a read: read-only members would be dropped + from this closed schema, which would then reject them. Schema validation + checks only this shape; it does not look up or fill in the target. + CommonGrants.Patch.OrgPatchPCSOrgTypeOrCreate: + type: object + properties: + class: + type: string + enum: + - Organization types + description: The PCS term for the organization type. + term: + type: string + description: The plain language PCS term. + code: + type: string + pattern: ^[A-Z]{2}[0-9]{6}$ + description: The code for this PCS term. + example: UC000000 + description: + type: string + nullable: true + description: Description of the PCS term + description: |- + A Philanthropy Classification System (PCS) term for organization types. + + See https://taxonomy.candid.org/organization-type for more information. + CommonGrants.Patch.OrgPatchPhoneCollectionOrCreate: + type: object + properties: + primary: + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchPhoneOrCreate' + description: The person's primary phone number. + fax: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchPhoneOrCreate' + nullable: true + description: The person's fax number, if applicable. + otherPhones: + type: object + additionalProperties: + type: object + allOf: + - $ref: '#/components/schemas/CommonGrants.Fields.OrgPatchPhoneOrCreate' + nullable: true + nullable: true + description: Additional phone numbers not covered by the standard fields. + description: A collection of phone numbers for a person. + CommonGrants.Responses.Accepted: + type: object + required: + - data + properties: + data: + description: Response data + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 202 response with data + CommonGrants.Responses.ApplicationSubmissionError: + type: object + required: + - status + properties: + status: + type: number + enum: + - 400 + example: 400 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A failure to submit an application due to validation errors + example: + status: 400 + message: Application submission failed due to validation errors + errors: + - field: formA.name + message: Name is required + 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: + - status + - message + - errors + properties: + status: + type: integer + format: int32 + example: 400 + message: + type: string + description: Human-readable error message + example: Error + errors: + type: array + 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: + - status + - message + properties: + status: + type: integer + format: int32 + example: 200 + message: + type: string + example: Success + CommonGrants.Responses.VersionConflictDetail: + type: object + required: + - code + properties: + code: + type: string + enum: + - version.conflict + description: Stable error code that clients branch on + additionalProperties: {} + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorDetail' + description: The request sent more than one `CG-Version` value + CommonGrants.Responses.VersionConflictError: + type: object + required: + - status + - errors + properties: + status: + type: number + enum: + - 400 + example: 400 + errors: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Responses.VersionConflictDetail' + minItems: 1 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A request that sent more than one `CG-Version` value, even the same value twice + example: + status: 400 + message: The request sent more than one CG-Version value + errors: + - field: CG-Version + code: version.conflict + message: Received CG-Version values 0.5.0 and 0.6.0 + supported: + - 0.5.0 + - 0.6.0 + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions + CommonGrants.Responses.VersionDiscoveryResponse: + type: object + required: + - data + properties: + data: + allOf: + - $ref: '#/components/schemas/CommonGrants.Models.VersionDiscovery' + description: The protocol versions the API serves + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Success' + description: A 200 response listing the protocol versions an API serves + CommonGrants.Responses.VersionErrorDetail: + type: object + required: + - field + - message + - supported + - defaultVersion + properties: + field: + type: string + enum: + - CG-Version + description: The request header the error is about + message: + type: string + description: Human-readable description of the problem + supported: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + minItems: 1 + description: The versions this route serves + defaultVersion: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version this route serves when a request doesn't name one + discovery: + type: string + format: uri + description: |- + The server's version discovery URL + + Omitted by servers that serve one version and don't publish discovery. + description: Details shared by every version error, describing the route that was called + CommonGrants.Responses.VersionErrorScope: + type: string + enum: + - deployment + - operation + description: Whether a version is unavailable on the whole server or only on the route called + CommonGrants.Responses.VersionMalformedDetail: + type: object + required: + - code + - requested + properties: + code: + type: string + enum: + - version.malformed + description: Stable error code that clients branch on + requested: + type: string + description: The value received, as sent + additionalProperties: {} + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorDetail' + description: The `CG-Version` value isn't a full `MAJOR.MINOR.PATCH` version + CommonGrants.Responses.VersionMalformedError: + type: object + required: + - status + - errors + properties: + status: + type: number + enum: + - 400 + example: 400 + errors: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Responses.VersionMalformedDetail' + minItems: 1 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A `CG-Version` header that isn't a full `MAJOR.MINOR.PATCH` version + example: + status: 400 + message: The CG-Version header is not a valid CommonGrants version + errors: + - field: CG-Version + code: version.malformed + message: Version 0.5 is not a full MAJOR.MINOR.PATCH version + requested: '0.5' + supported: + - 0.5.0 + - 0.6.0 + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions + CommonGrants.Responses.VersionRetiredDetail: + type: object + required: + - code + - requested + - scope + - sunset + properties: + code: + type: string + enum: + - version.retired + description: Stable error code that clients branch on + requested: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version requested + scope: + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorScope' + description: Whether the server or only this route doesn't serve the version + sunset: + type: string + format: date-time + description: When the version stopped being served + additionalProperties: {} + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorDetail' + description: The requested version was retired from this server or this route + CommonGrants.Responses.VersionRetiredError: + type: object + required: + - status + - errors + properties: + status: + type: number + enum: + - 406 + example: 406 + errors: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Responses.VersionRetiredDetail' + minItems: 1 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A requested version that was retired from this server or route + example: + status: 406 + message: The requested CommonGrants version has been retired + errors: + - field: CG-Version + code: version.retired + message: 'Version 0.3.0 was retired on 2027-06-01. Supported versions: 0.4.0, 0.5.0, 0.6.0' + requested: 0.3.0 + supported: + - 0.4.0 + - 0.5.0 + - 0.6.0 + scope: deployment + defaultVersion: 0.4.0 + discovery: https://grants.example.org/common-grants/versions + sunset: '2027-06-01T00:00:00Z' + CommonGrants.Responses.VersionUnsupportedDetail: + type: object + required: + - code + - requested + - scope + properties: + code: + type: string + enum: + - version.unsupported + description: Stable error code that clients branch on + requested: + allOf: + - $ref: '#/components/schemas/CommonGrants.Types.protocolVersion' + description: The version requested + scope: + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorScope' + description: Whether the server or only this route doesn't serve the version + additionalProperties: {} + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.VersionErrorDetail' + description: The requested version isn't served by this server or this route + CommonGrants.Responses.VersionUnsupportedError: + type: object + required: + - status + - errors + properties: + status: + type: number + enum: + - 406 + example: 406 + errors: + type: array + items: + $ref: '#/components/schemas/CommonGrants.Responses.VersionUnsupportedDetail' + minItems: 1 + allOf: + - $ref: '#/components/schemas/CommonGrants.Responses.Error' + description: A requested version that this server or route doesn't serve + example: + status: 406 + message: The requested CommonGrants version is not available for this route + errors: + - field: CG-Version + code: version.unsupported + message: 'Version 0.4.0 is not served by GET /common-grants/forms. Supported versions: 0.5.0, 0.6.0' + requested: 0.4.0 + supported: + - 0.5.0 + - 0.6.0 + scope: operation + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions + CommonGrants.Sorting.SortBodyParams: + type: object + required: + - sortBy + properties: + sortBy: + description: The field to sort by + example: lastModifiedAt + customSortBy: + type: string + description: Implementation-defined sort key + example: customField + sortOrder: + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortOrder' + description: The order to sort by + example: asc + description: Sorting parameters included in the request body + CommonGrants.Sorting.SortOrder: + type: string + enum: + - asc + - desc + CommonGrants.Sorting.SortedResultsInfo: + type: object + required: + - sortBy + - sortOrder + properties: + sortBy: + type: string + description: The field results are sorted by, or "custom" if an implementation-defined sort key is used + example: lastModifiedAt + customSortBy: + type: string + description: Implementation-defined sort key used to sort the results, if applicable + example: customField + sortOrder: + allOf: + - $ref: '#/components/schemas/CommonGrants.Sorting.SortOrder' + description: The order in which the results are sorted, e.g. ascending or descending + example: asc + errors: + type: array + items: + type: string + description: Non-fatal errors that occurred during sorting + description: Information about the sort order of the items returned + CommonGrants.Types.calendarYear: + type: string + pattern: ^[0-9]{4}$ + description: A calendar year + example: '2025' + CommonGrants.Types.decimalString: + type: string + pattern: ^-?[0-9]+\.?[0-9]*$ + description: A decimal number (with variable scale) encoded as a string, to avoid floating point issues + example: '-100.5' + CommonGrants.Types.duns: + type: string + pattern: ^[0-9]{9}$ + description: A Data Universal Numbering System (DUNS) number, normalized to nine digits + example: '123456789' + CommonGrants.Types.email: + type: string + format: email + description: An email address + example: test@example.com + CommonGrants.Types.employerTaxId: + type: string + pattern: ^[0-9]{9}$ + description: An Employer Identification Number (EIN) issued by the IRS, normalized to nine digits + example: '123456789' + CommonGrants.Types.isoDate: + type: string + format: date + description: A date on a calendar in ISO 8601 format YYYY-MM-DD + example: '2025-01-01' + CommonGrants.Types.isoTime: + type: string + format: time + description: A time on a clock, without a timezone, in ISO 8601 format HH:mm:ss + example: '17:00:00' + CommonGrants.Types.nonEmptyString: + type: string + minLength: 1 + description: A string with at least one character + example: Example + CommonGrants.Types.protocolVersion: + type: string + pattern: ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ + description: |- + A published CommonGrants protocol version, such as `0.6.0` + + A full `MAJOR.MINOR.PATCH` version with no `v` prefix and no leading zeros. + example: 0.6.0 + CommonGrants.Types.samUEI: + type: string + pattern: ^[A-HJ-NP-Z0-9]{12}$ + description: A Unique Entity Identifier (UEI) issued by SAM.gov + example: AB0123456789 + CommonGrants.Types.uuid: + type: string + format: uuid + description: A universally unique identifier + example: 30a12e5e-5940-4c08-921c-17a8960fcf4b + securitySchemes: + OAuth2Auth: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://auth.example.com/oauth/token + scopes: + org:read: '' + org:write: '' + org.changes:write: '' + org.changes:read: '' + authorizationCode: + authorizationUrl: https://auth.example.com/authorize + tokenUrl: https://auth.example.com/oauth/token + scopes: + org:read: '' + org:write: '' + org.changes:write: '' + org.changes:read: '' diff --git a/website/public/schemas/yaml/OperationVersions.yaml b/website/public/schemas/yaml/OperationVersions.yaml new file mode 100644 index 000000000..a36a7304b --- /dev/null +++ b/website/public/schemas/yaml/OperationVersions.yaml @@ -0,0 +1,41 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: OperationVersions.yaml +type: object +properties: + versions: + type: array + items: + $ref: protocolVersion.yaml + minItems: 1 + description: The versions this route serves + defaultVersion: + $ref: protocolVersion.yaml + description: The version this route serves when a request doesn't name one, one of `versions` + upcomingDefault: + $ref: UpcomingDefault.yaml + description: A scheduled change to this route's default version, if any. Its `version` is one of `versions` + deprecated: + $ref: "#/$defs/RecordVersionRetirement" + description: |- + Deprecated versions of this route, keyed by version, with their retirement schedule + + Each key is a version from `versions`, written exactly as it appears + there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses + `0.3.1` as the key here. + + To check whether the version you request is deprecated, compare only + the major and minor. A client requesting `0.3.0` is served `0.3.1`, so + its entry is under `0.3.1`. + propertyNames: + $ref: protocolVersion.yaml +required: + - versions + - defaultVersion +unevaluatedProperties: {} +description: The versions a single route serves, when they differ from the API-wide values +$defs: + RecordVersionRetirement: + type: object + properties: {} + unevaluatedProperties: + $ref: VersionRetirement.yaml diff --git a/website/public/schemas/yaml/UpcomingDefault.yaml b/website/public/schemas/yaml/UpcomingDefault.yaml new file mode 100644 index 000000000..266e7a54a --- /dev/null +++ b/website/public/schemas/yaml/UpcomingDefault.yaml @@ -0,0 +1,16 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: UpcomingDefault.yaml +type: object +properties: + version: + $ref: protocolVersion.yaml + description: The version that will become the default + date: + type: string + format: date-time + description: When the new default takes effect +required: + - version + - date +unevaluatedProperties: {} +description: A scheduled change to the version a server serves by default diff --git a/website/public/schemas/yaml/VersionConflictDetail.yaml b/website/public/schemas/yaml/VersionConflictDetail.yaml new file mode 100644 index 000000000..a53e88832 --- /dev/null +++ b/website/public/schemas/yaml/VersionConflictDetail.yaml @@ -0,0 +1,14 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionConflictDetail.yaml +type: object +properties: + code: + type: string + const: version.conflict + description: Stable error code that clients branch on +required: + - code +allOf: + - $ref: VersionErrorDetail.yaml +unevaluatedProperties: {} +description: The request sent more than one `CG-Version` value diff --git a/website/public/schemas/yaml/VersionConflictError.yaml b/website/public/schemas/yaml/VersionConflictError.yaml new file mode 100644 index 000000000..7a64d5826 --- /dev/null +++ b/website/public/schemas/yaml/VersionConflictError.yaml @@ -0,0 +1,34 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionConflictError.yaml +type: object +properties: + status: + type: number + const: 400 + examples: + - 400 + errors: + type: array + items: + $ref: VersionConflictDetail.yaml + minItems: 1 +required: + - status + - errors +allOf: + - $ref: Error.yaml +unevaluatedProperties: + not: {} +examples: + - status: 400 + message: The request sent more than one CG-Version value + errors: + - field: CG-Version + code: version.conflict + message: Received CG-Version values 0.5.0 and 0.6.0 + supported: + - 0.5.0 + - 0.6.0 + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions +description: A request that sent more than one `CG-Version` value, even the same value twice diff --git a/website/public/schemas/yaml/VersionDiscovery.yaml b/website/public/schemas/yaml/VersionDiscovery.yaml new file mode 100644 index 000000000..872c54906 --- /dev/null +++ b/website/public/schemas/yaml/VersionDiscovery.yaml @@ -0,0 +1,87 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionDiscovery.yaml +type: object +properties: + versions: + type: array + items: + $ref: protocolVersion.yaml + minItems: 1 + description: The versions every route without an `operations` entry serves + defaultVersion: + $ref: protocolVersion.yaml + description: The version every route without an `operations` entry serves when a request doesn't name one, one of `versions` + upcomingDefault: + $ref: UpcomingDefault.yaml + description: A scheduled change to the API-wide default version, if any. Its `version` is one of `versions` + deprecated: + $ref: "#/$defs/RecordVersionRetirement" + description: |- + Deprecated versions, keyed by version, with their retirement schedule + + Each key is a version from `versions`, written exactly as it appears + there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses + `0.3.1` as the key here. + + To check whether the version you request is deprecated, compare only + the major and minor. A client requesting `0.3.0` is served `0.3.1`, so + its entry is under `0.3.1`. + propertyNames: + $ref: protocolVersion.yaml + operations: + $ref: "#/$defs/RecordOperationVersions" + description: |- + Routes whose versions differ from the API-wide values + + Each key is the HTTP method and the route's published path, separated + by a space, such as `GET /common-grants/forms/{formId}`. Path parameter + names are ignored when matching a key to a route. Omitted when every + route serves the API-wide values. +required: + - versions + - defaultVersion +unevaluatedProperties: {} +examples: + - versions: + - 0.3.0 + - 0.4.0 + - 0.5.0 + defaultVersion: 0.4.0 + upcomingDefault: + version: 0.5.0 + date: 2027-03-01T00:00:00Z + deprecated: + 0.3.0: + deprecation: 2026-12-01T00:00:00Z + sunset: 2027-06-01T00:00:00Z + - versions: + - 0.4.0 + defaultVersion: 0.4.0 + operations: + GET /common-grants/forms: + versions: + - 0.5.0 + defaultVersion: 0.5.0 + GET /common-grants/forms/{formId}: + versions: + - 0.4.0 + - 0.5.0 + defaultVersion: 0.4.0 +description: |- + The protocol versions an API serves + + The top-level fields describe every route that has no entry in + `operations`. Routes that differ from them have an entry in `operations`. + New fields are only ever added to this model; clients ignore fields they + don't recognize. +$defs: + RecordVersionRetirement: + type: object + properties: {} + unevaluatedProperties: + $ref: VersionRetirement.yaml + RecordOperationVersions: + type: object + properties: {} + unevaluatedProperties: + $ref: OperationVersions.yaml diff --git a/website/public/schemas/yaml/VersionDiscoveryResponse.yaml b/website/public/schemas/yaml/VersionDiscoveryResponse.yaml new file mode 100644 index 000000000..f2f1792f4 --- /dev/null +++ b/website/public/schemas/yaml/VersionDiscoveryResponse.yaml @@ -0,0 +1,14 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionDiscoveryResponse.yaml +type: object +properties: + data: + $ref: VersionDiscovery.yaml + description: The protocol versions the API serves +required: + - data +allOf: + - $ref: Success.yaml +unevaluatedProperties: + not: {} +description: A 200 response listing the protocol versions an API serves diff --git a/website/public/schemas/yaml/VersionErrorDetail.yaml b/website/public/schemas/yaml/VersionErrorDetail.yaml new file mode 100644 index 000000000..e529bb7e8 --- /dev/null +++ b/website/public/schemas/yaml/VersionErrorDetail.yaml @@ -0,0 +1,33 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionErrorDetail.yaml +type: object +properties: + field: + type: string + const: CG-Version + description: The request header the error is about + message: + type: string + description: Human-readable description of the problem + supported: + type: array + items: + $ref: protocolVersion.yaml + minItems: 1 + description: The versions this route serves + defaultVersion: + $ref: protocolVersion.yaml + description: The version this route serves when a request doesn't name one + discovery: + type: string + format: uri + description: |- + The server's version discovery URL + + Omitted by servers that serve one version and don't publish discovery. +required: + - field + - message + - supported + - defaultVersion +description: Details shared by every version error, describing the route that was called diff --git a/website/public/schemas/yaml/VersionErrorScope.yaml b/website/public/schemas/yaml/VersionErrorScope.yaml new file mode 100644 index 000000000..045ca61e2 --- /dev/null +++ b/website/public/schemas/yaml/VersionErrorScope.yaml @@ -0,0 +1,7 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionErrorScope.yaml +type: string +enum: + - deployment + - operation +description: Whether a version is unavailable on the whole server or only on the route called diff --git a/website/public/schemas/yaml/VersionMalformedDetail.yaml b/website/public/schemas/yaml/VersionMalformedDetail.yaml new file mode 100644 index 000000000..da41caec0 --- /dev/null +++ b/website/public/schemas/yaml/VersionMalformedDetail.yaml @@ -0,0 +1,18 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionMalformedDetail.yaml +type: object +properties: + code: + type: string + const: version.malformed + description: Stable error code that clients branch on + requested: + type: string + description: The value received, as sent +required: + - code + - requested +allOf: + - $ref: VersionErrorDetail.yaml +unevaluatedProperties: {} +description: The `CG-Version` value isn't a full `MAJOR.MINOR.PATCH` version diff --git a/website/public/schemas/yaml/VersionMalformedError.yaml b/website/public/schemas/yaml/VersionMalformedError.yaml new file mode 100644 index 000000000..27d5358a5 --- /dev/null +++ b/website/public/schemas/yaml/VersionMalformedError.yaml @@ -0,0 +1,35 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionMalformedError.yaml +type: object +properties: + status: + type: number + const: 400 + examples: + - 400 + errors: + type: array + items: + $ref: VersionMalformedDetail.yaml + minItems: 1 +required: + - status + - errors +allOf: + - $ref: Error.yaml +unevaluatedProperties: + not: {} +examples: + - status: 400 + message: The CG-Version header is not a valid CommonGrants version + errors: + - field: CG-Version + code: version.malformed + message: Version 0.5 is not a full MAJOR.MINOR.PATCH version + requested: "0.5" + supported: + - 0.5.0 + - 0.6.0 + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions +description: A `CG-Version` header that isn't a full `MAJOR.MINOR.PATCH` version diff --git a/website/public/schemas/yaml/VersionRetiredDetail.yaml b/website/public/schemas/yaml/VersionRetiredDetail.yaml new file mode 100644 index 000000000..6684336c9 --- /dev/null +++ b/website/public/schemas/yaml/VersionRetiredDetail.yaml @@ -0,0 +1,27 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionRetiredDetail.yaml +type: object +properties: + code: + type: string + const: version.retired + description: Stable error code that clients branch on + requested: + $ref: protocolVersion.yaml + description: The version requested + scope: + $ref: VersionErrorScope.yaml + description: Whether the server or only this route doesn't serve the version + sunset: + type: string + format: date-time + description: When the version stopped being served +required: + - code + - requested + - scope + - sunset +allOf: + - $ref: VersionErrorDetail.yaml +unevaluatedProperties: {} +description: The requested version was retired from this server or this route diff --git a/website/public/schemas/yaml/VersionRetiredError.yaml b/website/public/schemas/yaml/VersionRetiredError.yaml new file mode 100644 index 000000000..ffd5213ab --- /dev/null +++ b/website/public/schemas/yaml/VersionRetiredError.yaml @@ -0,0 +1,38 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionRetiredError.yaml +type: object +properties: + status: + type: number + const: 406 + examples: + - 406 + errors: + type: array + items: + $ref: VersionRetiredDetail.yaml + minItems: 1 +required: + - status + - errors +allOf: + - $ref: Error.yaml +unevaluatedProperties: + not: {} +examples: + - status: 406 + message: The requested CommonGrants version has been retired + errors: + - field: CG-Version + code: version.retired + message: "Version 0.3.0 was retired on 2027-06-01. Supported versions: 0.4.0, 0.5.0, 0.6.0" + requested: 0.3.0 + supported: + - 0.4.0 + - 0.5.0 + - 0.6.0 + scope: deployment + defaultVersion: 0.4.0 + discovery: https://grants.example.org/common-grants/versions + sunset: 2027-06-01T00:00:00Z +description: A requested version that was retired from this server or route diff --git a/website/public/schemas/yaml/VersionRetirement.yaml b/website/public/schemas/yaml/VersionRetirement.yaml new file mode 100644 index 000000000..7aad7db8e --- /dev/null +++ b/website/public/schemas/yaml/VersionRetirement.yaml @@ -0,0 +1,16 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionRetirement.yaml +type: object +properties: + deprecation: + type: string + format: date-time + description: When the version was or will be deprecated + sunset: + type: string + format: date-time + description: When the server will stop serving the version, if scheduled +required: + - deprecation +unevaluatedProperties: {} +description: The retirement schedule for a deprecated version diff --git a/website/public/schemas/yaml/VersionUnsupportedDetail.yaml b/website/public/schemas/yaml/VersionUnsupportedDetail.yaml new file mode 100644 index 000000000..03c34cc63 --- /dev/null +++ b/website/public/schemas/yaml/VersionUnsupportedDetail.yaml @@ -0,0 +1,22 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionUnsupportedDetail.yaml +type: object +properties: + code: + type: string + const: version.unsupported + description: Stable error code that clients branch on + requested: + $ref: protocolVersion.yaml + description: The version requested + scope: + $ref: VersionErrorScope.yaml + description: Whether the server or only this route doesn't serve the version +required: + - code + - requested + - scope +allOf: + - $ref: VersionErrorDetail.yaml +unevaluatedProperties: {} +description: The requested version isn't served by this server or this route diff --git a/website/public/schemas/yaml/VersionUnsupportedError.yaml b/website/public/schemas/yaml/VersionUnsupportedError.yaml new file mode 100644 index 000000000..9b0ac3cd8 --- /dev/null +++ b/website/public/schemas/yaml/VersionUnsupportedError.yaml @@ -0,0 +1,36 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: VersionUnsupportedError.yaml +type: object +properties: + status: + type: number + const: 406 + examples: + - 406 + errors: + type: array + items: + $ref: VersionUnsupportedDetail.yaml + minItems: 1 +required: + - status + - errors +allOf: + - $ref: Error.yaml +unevaluatedProperties: + not: {} +examples: + - status: 406 + message: The requested CommonGrants version is not available for this route + errors: + - field: CG-Version + code: version.unsupported + message: "Version 0.4.0 is not served by GET /common-grants/forms. Supported versions: 0.5.0, 0.6.0" + requested: 0.4.0 + supported: + - 0.5.0 + - 0.6.0 + scope: operation + defaultVersion: 0.5.0 + discovery: https://grants.example.org/common-grants/versions +description: A requested version that this server or route doesn't serve diff --git a/website/public/schemas/yaml/protocolVersion.yaml b/website/public/schemas/yaml/protocolVersion.yaml new file mode 100644 index 000000000..ed837e13c --- /dev/null +++ b/website/public/schemas/yaml/protocolVersion.yaml @@ -0,0 +1,10 @@ +$schema: https://json-schema.org/draft/2020-12/schema +$id: protocolVersion.yaml +type: string +examples: + - 0.6.0 +pattern: ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ +description: |- + A published CommonGrants protocol version, such as `0.6.0` + + A full `MAJOR.MINOR.PATCH` version with no `v` prefix and no leading zeros. diff --git a/website/src/content/docs/governance/adr/0028-mock-api-hosting.md b/website/src/content/docs/governance/adr/0028-mock-api-hosting.md index cd9e492e4..4748c4cf5 100644 --- a/website/src/content/docs/governance/adr/0028-mock-api-hosting.md +++ b/website/src/content/docs/governance/adr/0028-mock-api-hosting.md @@ -3,6 +3,10 @@ title: Mock API hosting description: Records the decision to serve the fixture-backed mock CommonGrants API from the docs website itself, so the browser, curl, and the SDK all hit the same endpoint and see the same data. --- +:::note +The path version in this record (`/api/v{version}`) is superseded by [ADR 0032](https://commongrants.org/governance/adr/0032-api-version-negotiation/). The mock now serves every route under `/api/common-grants` and selects the protocol version with the `CG-Version` request header. +::: + We want visitors to test the CommonGrants API against a mock for every published spec version (v0.1.0 to v0.4.0). We're turning Swagger UI's "Try it out" back on in the browser, but our core goal is **determinism**. A user should be able to try a request in the browser, copy the `curl` command and run it in their terminal, point the SDK at the same URL, and get the **same data** every time. The mock also gives the quickstart a sandbox: a new SDK user can fetch realistic grant data with no local setup. So the mock has three consumers: diff --git a/website/src/lib/api-docs-version.ts b/website/src/lib/api-docs-version.ts index caf2dd10c..1501e619f 100644 --- a/website/src/lib/api-docs-version.ts +++ b/website/src/lib/api-docs-version.ts @@ -13,3 +13,47 @@ export function resolveVersion(param: string, versions: string[]): string { const normalized = param.replace(/^v/, ""); return versions.includes(normalized) ? normalized : versions[0]; } + +/** + * Swagger UI `requestInterceptor` body: sends the selected spec's version as + * `header` on calls to the mock, so an older spec page isn't served the + * mock's default version. A non-empty value the user typed into the header + * field wins. Other requests, such as the spec fetch, pass through untouched. + * + * @param request - The request Swagger UI is about to send. + * @param options.version - The version selected on the page. + * @param options.basePath - The mock's mount point, e.g. `/api`. + * @param options.header - The version header's name, e.g. `CG-Version`. + * @param options.origin - The page's origin, for resolving relative URLs. + * @returns The same request, with the header set when it applies. + */ +export function withVersionHeader( + request: T, + options: { + version: string; + basePath: string; + header: string; + origin: string; + }, +): T { + const { version, basePath, header, origin } = options; + const url = new URL(request.url, origin); + if (url.origin !== origin || !url.pathname.startsWith(`${basePath}/`)) { + return request; + } + + // Swagger UI's request type leaves `headers` untyped. + const headers = ((request as { headers?: Record }).headers ??= + {}); + const name = header.toLowerCase(); + const existing = Object.keys(headers).find( + (key) => key.toLowerCase() === name, + ); + if (existing !== undefined && headers[existing] !== "") { + return request; + } + + if (existing !== undefined) delete headers[existing]; + headers[header] = version; + return request; +} diff --git a/website/src/lib/mock/data/availability.ts b/website/src/lib/mock/data/availability.ts index f0bc74747..e11ffe942 100644 --- a/website/src/lib/mock/data/availability.ts +++ b/website/src/lib/mock/data/availability.ts @@ -53,9 +53,14 @@ export function isAtLeastVersion( return versionIndex(version) >= versionIndex(minVersion); } +/** Every supported version at or after `minVersion`. */ +export function versionsFrom(minVersion: Version): Version[] { + return SUPPORTED_VERSIONS.filter( + (version) => versionIndex(version) >= versionIndex(minVersion), + ); +} + /** Every supported version in which `resource` is served. */ export function versionsServing(resource: ResourceName): Version[] { - return SUPPORTED_VERSIONS.filter((version) => - isResourceAvailable(resource, version), - ); + return versionsFrom(RESOURCE_MIN_VERSION[resource]); } diff --git a/website/src/lib/mock/data/fixtures.ts b/website/src/lib/mock/data/fixtures.ts index ed7a17f9f..256cec111 100644 --- a/website/src/lib/mock/data/fixtures.ts +++ b/website/src/lib/mock/data/fixtures.ts @@ -33,6 +33,8 @@ import { orgRefCollection, HRSA_ORG_ID, NSF_ORG_ID } from "./organizations"; * identically to v0.3.0. v0.5.0 adds `OppRef.identifiers`, which * `shapeOpportunityForVersion` strips for every earlier version, and replaces * each nested competition's `opportunityId` with an `opportunity` reference. + * v0.6.0 adds only the version negotiation headers, so it shapes identically + * to v0.5.0. */ export const SUPPORTED_VERSIONS = [ "0.1.0", @@ -40,6 +42,7 @@ export const SUPPORTED_VERSIONS = [ "0.3.0", "0.4.0", "0.5.0", + "0.6.0", ] as const; /** A protocol version the opportunity handlers can shape responses for. */ @@ -50,6 +53,18 @@ export function isSupportedVersion(value: string): value is Version { return (SUPPORTED_VERSIONS as readonly string[]).includes(value); } +/** + * The hosted version sharing `requested`'s major and minor, if any: a request + * for `0.5.1` is served by `0.5.0`. Expects a well-formed `MAJOR.MINOR.PATCH`. + */ +export function hostedVersionFor(requested: string): Version | undefined { + const [major, minor] = requested.split("."); + return SUPPORTED_VERSIONS.find((version) => { + const [hostedMajor, hostedMinor] = version.split("."); + return hostedMajor === major && hostedMinor === minor; + }); +} + /** Which endpoint shape to project: the list returns `OpportunityBase`, the * single-item read returns `OpportunityDetails` (v0.2+). */ export type ShapeVariant = "list" | "detail"; diff --git a/website/src/lib/mock/docs-wiring.ts b/website/src/lib/mock/docs-wiring.ts index 3f164480a..b77744893 100644 --- a/website/src/lib/mock/docs-wiring.ts +++ b/website/src/lib/mock/docs-wiring.ts @@ -7,12 +7,11 @@ import { MOCK_API_BASE_PATH } from "./router"; /** - * Builds the root-relative server URL for one spec, e.g. `/api/v0.4.0`. The - * version rides in the path, so this doubles as an SDK `baseUrl`. + * The root-relative server URL every spec advertises. The version rides in + * the `CG-Version` header (ADR 0032), so all versions share one URL, which + * doubles as an SDK `baseUrl`. */ -export function serverUrlFor(version: string): string { - return `${MOCK_API_BASE_PATH}/v${version}`; -} +export const MOCK_SERVER_URL = MOCK_API_BASE_PATH; /** * Public directory holding the mock-advertising spec copies, written each build diff --git a/website/src/lib/mock/handlers/applications.ts b/website/src/lib/mock/handlers/applications.ts index b073c7055..540544a3c 100644 --- a/website/src/lib/mock/handlers/applications.ts +++ b/website/src/lib/mock/handlers/applications.ts @@ -21,10 +21,7 @@ import { type Application, type AppFormResponse, } from "../data/applications"; -import { - APPLICATION_SEARCH_MIN_VERSION, - isAtLeastVersion, -} from "../data/availability"; +import { isAtLeastVersion } from "../data/availability"; import { getCompetitionById } from "../data/competitions"; import type { Version } from "../data/fixtures"; import { getFormById } from "../data/forms"; @@ -164,7 +161,7 @@ function titleFieldFor(version: Version): "name" | "title" { } /** - * `POST /v{version}/common-grants/applications/start` — answers 201 with the + * `POST /common-grants/applications/start` — answers 201 with the * application the write would have created. Nothing is retained. */ export async function startApplication( @@ -244,7 +241,7 @@ export async function startApplication( } /** - * `GET /v{version}/common-grants/applications/{appId}` — a single application, + * `GET /common-grants/applications/{appId}` — a single application, * with its form responses and validation errors. */ export function getApplication(appId: string, version: Version): Response { @@ -259,7 +256,7 @@ export function getApplication(appId: string, version: Version): Response { } /** - * `PUT /v{version}/common-grants/applications/{appId}/submit`. Whether it + * `PUT /common-grants/applications/{appId}/submit`. Whether it * answers 200 or 400 is decided by the fixture's own `validationErrors`, so * both branches are reachable. * @@ -382,23 +379,14 @@ async function readSearchRequest( } /** - * `POST /v{version}/common-grants/applications/search`. Added in v0.3, so - * v0.2 answers a protocol-shaped 404 — gated here, not in the router, because - * the rest of `/applications` is served at v0.2. + * `POST /common-grants/applications/search`. Added in v0.3; the router rejects + * earlier versions before this runs, since the rest of `/applications` is + * served at v0.2. */ export async function searchApplications( request: Request, version: Version, ): Promise { - if (!isAtLeastVersion(version, APPLICATION_SEARCH_MIN_VERSION)) { - return errorResponse(404, "Not found", [ - { - field: "path", - message: `Application search was added in v${APPLICATION_SEARCH_MIN_VERSION} and is not served by v${version}`, - }, - ]); - } - const parsed = await readSearchRequest(request); if (!parsed.ok) { return parsed.response; @@ -546,7 +534,7 @@ function lookupForm( } /** - * `GET /v{version}/common-grants/applications/{appId}/forms/{formId}` — read + * `GET /common-grants/applications/{appId}/forms/{formId}` — read * one form response. */ export function readFormResponse( @@ -579,7 +567,7 @@ export function readFormResponse( } /** - * `PUT /v{version}/common-grants/applications/{appId}/forms/{formId}` — echoes + * `PUT /common-grants/applications/{appId}/forms/{formId}` — echoes * the body back in an `AppFormResponse` envelope: `notStarted` for an empty * body, `complete` otherwise. */ diff --git a/website/src/lib/mock/handlers/awards.ts b/website/src/lib/mock/handlers/awards.ts index f0e71df5e..e06bbf1d5 100644 --- a/website/src/lib/mock/handlers/awards.ts +++ b/website/src/lib/mock/handlers/awards.ts @@ -117,7 +117,7 @@ function moneyFilterValue(award: Award): Money | undefined { } /** - * `GET /v{version}/common-grants/awards` — the paginated list, ordered + * `GET /common-grants/awards` — the paginated list, ordered * newest-modified first. */ export function listAwards(request: Request, version: Version): Response { @@ -146,7 +146,7 @@ export function listAwards(request: Request, version: Version): Response { } /** - * `GET /v{version}/common-grants/awards/{awdId}` — a single record. A + * `GET /common-grants/awards/{awdId}` — a single record. A * malformed id answers 400, not a route miss. */ export function getAward(awdId: string, version: Version): Response { @@ -167,7 +167,7 @@ export function getAward(awdId: string, version: Version): Response { } /** - * `POST /v{version}/common-grants/awards/search` — filtered, sorted, paginated + * `POST /common-grants/awards/search` — filtered, sorted, paginated * search over the same fixture set. */ export async function searchAwards( diff --git a/website/src/lib/mock/handlers/competitions.ts b/website/src/lib/mock/handlers/competitions.ts index 9e158c1de..827baf552 100644 --- a/website/src/lib/mock/handlers/competitions.ts +++ b/website/src/lib/mock/handlers/competitions.ts @@ -14,7 +14,7 @@ import { errorResponse, successResponse } from "../http/envelope"; import { isUuid } from "../http/query"; /** - * `GET /v{version}/common-grants/competitions/{compId}` — a single + * `GET /common-grants/competitions/{compId}` — a single * competition. A malformed id answers 400, not a route miss. */ export function getCompetition(compId: string, version: Version): Response { diff --git a/website/src/lib/mock/handlers/forms.ts b/website/src/lib/mock/handlers/forms.ts index 924f80cfe..a7565454e 100644 --- a/website/src/lib/mock/handlers/forms.ts +++ b/website/src/lib/mock/handlers/forms.ts @@ -16,7 +16,7 @@ import { } from "../http/query"; /** - * `GET /v{version}/common-grants/forms` — the paginated list, ordered + * `GET /common-grants/forms` — the paginated list, ordered * newest-modified first per the operation's `@doc`. */ export function listForms(request: Request, version: Version): Response { @@ -45,7 +45,7 @@ export function listForms(request: Request, version: Version): Response { } /** - * `GET /v{version}/common-grants/forms/{formId}` — a single form. A malformed + * `GET /common-grants/forms/{formId}` — a single form. A malformed * id answers 400, not a route miss. */ export function getForm(formId: string, version: Version): Response { diff --git a/website/src/lib/mock/handlers/opportunities.ts b/website/src/lib/mock/handlers/opportunities.ts index 90bb6688a..cdadd4405 100644 --- a/website/src/lib/mock/handlers/opportunities.ts +++ b/website/src/lib/mock/handlers/opportunities.ts @@ -114,7 +114,7 @@ function sortKey(opp: WireOpportunity, sortBy: string): string | number { } /** - * `GET /v{version}/common-grants/opportunities` — the paginated list, ordered + * `GET /common-grants/opportunities` — the paginated list, ordered * newest-modified first. */ export function listOpportunities( @@ -144,7 +144,7 @@ export function listOpportunities( } /** - * `GET /v{version}/common-grants/opportunities/{oppId}` — a single record. The + * `GET /common-grants/opportunities/{oppId}` — a single record. The * id is validated here, not in the router, so a malformed id answers 400 * rather than a route miss. */ @@ -168,7 +168,7 @@ export function getOpportunity(oppId: string, version: Version): Response { } /** - * `POST /v{version}/common-grants/opportunities/search` — filtered, sorted, + * `POST /common-grants/opportunities/search` — filtered, sorted, * paginated search over the same fixture set. */ export async function searchOpportunities( diff --git a/website/src/lib/mock/handlers/organizations.ts b/website/src/lib/mock/handlers/organizations.ts index bdcd3ae28..5108e3374 100644 --- a/website/src/lib/mock/handlers/organizations.ts +++ b/website/src/lib/mock/handlers/organizations.ts @@ -126,7 +126,7 @@ function lookupOrg(orgId: string): OrgLookup { } /** - * `GET /v{version}/common-grants/orgs` — the paginated list, ordered by name + * `GET /common-grants/orgs` — the paginated list, ordered by name * (`OrganizationBase` has no `lastModifiedAt`). `registry` + `id` filter by * external identifier as a pair; one without the other is a 400. */ @@ -182,7 +182,7 @@ export function listOrganizations( } /** - * `GET /v{version}/common-grants/orgs/{orgId}` — a single profile. `?at` is + * `GET /common-grants/orgs/{orgId}` — a single profile. `?at` is * accepted and validated but does not change the response — the fixtures hold * one current profile per org, not a history. */ @@ -252,7 +252,7 @@ function echoedRevision( } /** - * `PATCH /v{version}/common-grants/orgs/{orgId}` — answers 200 with an + * `PATCH /common-grants/orgs/{orgId}` — answers 200 with an * `accepted` revision whose `snapshot` is the fixture with the merge patch * applied. Nothing is retained. */ @@ -281,7 +281,7 @@ export async function updateOrganization( } /** - * `POST /v{version}/common-grants/orgs/{orgId}/changes` — answers 202 with a + * `POST /common-grants/orgs/{orgId}/changes` — answers 202 with a * `pending` revision and a `Location` header. Nothing is stored, so polling * that URL answers 404; the header's shape is still part of the contract. */ @@ -316,7 +316,7 @@ export async function submitOrgChange( } /** - * `GET /v{version}/common-grants/orgs/{orgId}/changes` — the fixture change + * `GET /common-grants/orgs/{orgId}/changes` — the fixture change * history, newest first. Echoed writes never appear here. */ export function listOrgChanges( @@ -350,7 +350,7 @@ export function listOrgChanges( } /** - * `GET /v{version}/common-grants/orgs/{orgId}/changes/{changeId}` — one + * `GET /common-grants/orgs/{orgId}/changes/{changeId}` — one * change, scoped to the org: a change id that belongs to a different * organization answers 404. */ diff --git a/website/src/lib/mock/handlers/versions.ts b/website/src/lib/mock/handlers/versions.ts new file mode 100644 index 000000000..eb7dd4310 --- /dev/null +++ b/website/src/lib/mock/handlers/versions.ts @@ -0,0 +1,86 @@ +/** + * Handler for `GET /common-grants/versions`, the ADR 0032 discovery route. It + * sits outside version selection, so it never reads `CG-Version`. + */ + +import { + APPLICATION_SEARCH_MIN_VERSION, + versionsFrom, + versionsServing, + type ResourceName, +} from "../data/availability"; +import { SUPPORTED_VERSIONS, type Version } from "../data/fixtures"; +import { successResponse } from "../http/envelope"; +import { DEFAULT_VERSION } from "../http/version"; + +/** The discovery route's published path, below the mount point. */ +export const VERSIONS_PATH = "/common-grants/versions"; + +/** The absolute discovery URL that version errors point to. */ +export function discoveryUrl(origin: string, basePath: string): string { + return `${origin}${basePath}${VERSIONS_PATH}`; +} + +/** + * Every route added after 0.1.0, keyed as discovery publishes it, mapped to + * the resource whose availability governs it. The opportunity routes serve + * the whole baseline, so they have no entry. + */ +const ROUTES_BY_RESOURCE: Record< + Exclude, + string[] +> = { + applications: [ + "GET /common-grants/applications/{appId}", + "GET /common-grants/applications/{appId}/forms/{formId}", + "PUT /common-grants/applications/{appId}/forms/{formId}", + "POST /common-grants/applications/start", + "PUT /common-grants/applications/{appId}/submit", + ], + competitions: ["GET /common-grants/competitions/{compId}"], + forms: ["GET /common-grants/forms", "GET /common-grants/forms/{formId}"], + awards: [ + "GET /common-grants/awards", + "GET /common-grants/awards/{awdId}", + "POST /common-grants/awards/search", + ], + orgs: [ + "GET /common-grants/orgs", + "GET /common-grants/orgs/{orgId}", + "PATCH /common-grants/orgs/{orgId}", + "GET /common-grants/orgs/{orgId}/changes", + "POST /common-grants/orgs/{orgId}/changes", + "GET /common-grants/orgs/{orgId}/changes/{changeId}", + ], +}; + +interface OperationVersions { + versions: Version[]; + defaultVersion: Version; +} + +function operations(): Record { + const entries: Record = {}; + for (const [resource, routes] of Object.entries(ROUTES_BY_RESOURCE)) { + const versions = versionsServing(resource as ResourceName); + for (const key of routes) { + entries[key] = { versions, defaultVersion: DEFAULT_VERSION }; + } + } + entries["POST /common-grants/applications/search"] = { + versions: versionsFrom(APPLICATION_SEARCH_MIN_VERSION), + defaultVersion: DEFAULT_VERSION, + }; + return entries; +} + +/** `GET /common-grants/versions`: the baseline plus each route that differs. */ +export function getVersionDiscovery(): Response { + return successResponse({ + data: { + versions: [...SUPPORTED_VERSIONS], + defaultVersion: DEFAULT_VERSION, + operations: operations(), + }, + }); +} diff --git a/website/src/lib/mock/http/cors.ts b/website/src/lib/mock/http/cors.ts index 16c8060c9..e4b20e7cb 100644 --- a/website/src/lib/mock/http/cors.ts +++ b/website/src/lib/mock/http/cors.ts @@ -5,19 +5,33 @@ */ import { SUPPORTED_METHODS } from "./methods"; +import { VERSION_HEADER, VERSION_SERVED_HEADER } from "./version"; /** * `X-API-Key` and `Authorization` are listed because the TS SDK sends them - * when auth is configured; a preflight must name non-simple headers. The - * methods come from `SUPPORTED_METHODS` so they cannot drift from the router. + * when auth is configured, and `CG-Version` because clients select a version + * with it; a preflight must name non-simple headers. The methods come from + * `SUPPORTED_METHODS` so they cannot drift from the router. */ const CORS_HEADERS: Record = { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": [...SUPPORTED_METHODS, "OPTIONS"].join(", "), - "Access-Control-Allow-Headers": "Content-Type, X-API-Key, Authorization", + "Access-Control-Allow-Headers": `Content-Type, X-API-Key, Authorization, ${VERSION_HEADER}`, "Access-Control-Max-Age": "86400", }; +/** + * The ADR 0032 response headers a browser client may read. The mock retires + * nothing, so it never sends `Deprecation`, `Sunset` or `Link`; they are listed + * to match the ADR. + */ +const EXPOSED_HEADERS = [ + VERSION_SERVED_HEADER, + "Deprecation", + "Sunset", + "Link", +].join(", "); + /** * Answers 204 to an `OPTIONS` preflight for any path, matched or not — on * purpose: a preflight asks about policy, not whether the resource exists. @@ -32,6 +46,7 @@ export function withCors(response: Response): Response { for (const [name, value] of Object.entries(CORS_HEADERS)) { headers.set(name, value); } + headers.set("Access-Control-Expose-Headers", EXPOSED_HEADERS); return new Response(response.body, { status: response.status, diff --git a/website/src/lib/mock/http/envelope.ts b/website/src/lib/mock/http/envelope.ts index 8dacf9bac..3248c63ad 100644 --- a/website/src/lib/mock/http/envelope.ts +++ b/website/src/lib/mock/http/envelope.ts @@ -4,6 +4,8 @@ * into the body's `status` field, as `Responses.Success` declares. */ +import type { VersionError } from "./version"; + /** A single `{field, message}` validation error carried in the `errors` array. */ export interface FieldError { field: string; @@ -46,6 +48,19 @@ export function acceptedResponse(data: unknown, location?: string): Response { ); } +/** + * Builds a 0.6.0 version error (`version.malformed`, `.unsupported`, + * `.conflict`). `discovery` is the absolute discovery URL, omitted when unset. + */ +export function versionErrorResponse( + error: VersionError, + discovery?: string, +): Response { + const detail = + discovery === undefined ? error.detail : { ...error.detail, discovery }; + return errorResponse(error.status, error.message, [detail]); +} + /** * Runs `handle`, converting an uncaught throw into a protocol-shaped 500. An * uncaught throw would skip `withCors`, so the browser would report an opaque diff --git a/website/src/lib/mock/http/version.ts b/website/src/lib/mock/http/version.ts new file mode 100644 index 000000000..3c694a2c2 --- /dev/null +++ b/website/src/lib/mock/http/version.ts @@ -0,0 +1,154 @@ +/** + * Resolves the `CG-Version` request header to the protocol version a route is + * served in, per ADR 0032. Pure: the router supplies the header value and the + * route's versions, and turns a returned error into a response with + * `versionErrorResponse` (`./envelope.ts`). + */ + +import { hostedVersionFor, type Version } from "../data/fixtures"; + +export const VERSION_HEADER = "CG-Version" as const; +export const VERSION_SERVED_HEADER = "CG-Version-Served"; + +/** Every route's default today; the router passes it as `RouteVersions.defaultVersion`. */ +export const DEFAULT_VERSION: Version = "0.6.0"; + +/** The versions one route serves, as version errors report them. */ +export interface RouteVersions { + /** Request method and path, e.g. `GET /common-grants/awards`. */ + label: string; + versions: readonly Version[]; + defaultVersion: Version; +} + +/** Fields every version error carries, describing the route called. */ +interface VersionErrorBase { + field: typeof VERSION_HEADER; + message: string; + supported: Version[]; + defaultVersion: Version; +} + +/** One `errors[]` entry of a 0.6.0 version error, minus `discovery`. */ +export type VersionErrorDetail = VersionErrorBase & + ( + | { code: "version.conflict" } + | { code: "version.malformed"; requested: string } + | { + code: "version.unsupported"; + requested: string; + scope: "deployment" | "operation"; + } + ); + +/** A version error ready to render: status, envelope message, and detail. */ +export interface VersionError { + status: 400 | 406; + message: string; + detail: VersionErrorDetail; +} + +export type VersionResolution = { version: Version } | { error: VersionError }; + +/** `protocolVersion`'s pattern from the 0.6.0 schemas: no `v`, no leading zeros. */ +const PROTOCOL_VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/; + +/** + * Resolves a raw `CG-Version` value (`null` when absent) for one route. + * Checks, in order: more than one value, format, whether the server serves the + * major.minor, whether this route does. + */ +export function resolveRequestedVersion( + headerValue: string | null, + route: RouteVersions, +): VersionResolution { + if (headerValue === null) return { version: route.defaultVersion }; + + const routeFields = { + field: VERSION_HEADER, + supported: [...route.versions], + defaultVersion: route.defaultVersion, + }; + const supportedText = route.versions.join(", "); + + // Fetch `Headers` joins a repeated header with ", ", so a comma means two values. + if (headerValue.includes(",")) { + // Quoted so an empty value (`"0.5.0, "`) still reads in the message. + const values = headerValue + .split(",") + .map((value) => JSON.stringify(value.trim())); + return { + error: { + status: 400, + message: "The request sent more than one CG-Version value", + detail: { + ...routeFields, + code: "version.conflict", + message: `Received CG-Version values ${values.join(" and ")}`, + }, + }, + }; + } + + const trimmed = headerValue.trim(); + if (!PROTOCOL_VERSION.test(trimmed)) { + return { + error: { + status: 400, + message: "The CG-Version header is not a valid CommonGrants version", + detail: { + ...routeFields, + code: "version.malformed", + message: `Version ${headerValue} is not a full MAJOR.MINOR.PATCH version`, + requested: headerValue, + }, + }, + }; + } + + const hosted = hostedVersionFor(trimmed); + if (hosted !== undefined && route.versions.includes(hosted)) { + return { version: hosted }; + } + + const scope = hosted === undefined ? "deployment" : "operation"; + const servedBy = scope === "deployment" ? "this server" : route.label; + return { + error: { + status: 406, + message: + scope === "deployment" + ? "The requested CommonGrants version is not available on this server" + : "The requested CommonGrants version is not available for this route", + detail: { + ...routeFields, + code: "version.unsupported", + message: `Version ${trimmed} is not served by ${servedBy}. Supported versions: ${supportedText}`, + requested: trimmed, + scope, + }, + }, + }; +} + +/** Adds `Vary: CG-Version`, since the response depends on the request header. */ +export function withVaryVersion(response: Response): Response { + const headers = new Headers(response.headers); + headers.append("Vary", VERSION_HEADER); + + return new Response(response.body, { + status: response.status, + statusText: response.statusText, + headers, + }); +} + +/** Adds `CG-Version-Served` and `Vary: CG-Version` to a response served in `version`. */ +export function withVersionHeaders( + response: Response, + version: Version, +): Response { + const varied = withVaryVersion(response); + varied.headers.set(VERSION_SERVED_HEADER, version); + return varied; +} diff --git a/website/src/lib/mock/router.ts b/website/src/lib/mock/router.ts index 56417228f..4c112a3bc 100644 --- a/website/src/lib/mock/router.ts +++ b/website/src/lib/mock/router.ts @@ -2,21 +2,23 @@ * Routes mock API requests to the fixture-backed resource handlers. Mounted * under `/api` by the Astro endpoint (`src/pages/api/[...path].ts`). * - * Opportunities keep the 3A Worker's regex verbatim and are matched first, so - * the golden byte-identity corpus (`golden-envelopes.spec.ts`) stays pinned. - * Version gating lives in `data/availability.ts`. + * The protocol version comes from the `CG-Version` header, never the path + * (ADR 0032). A request is matched to a route first, then its version is + * resolved against the versions that route serves (`data/availability.ts`), + * then it is dispatched. The discovery route (`/common-grants/versions`) + * skips version resolution. + * + * The opportunity routes keep the behavior the golden byte-identity corpus + * (`golden-envelopes.spec.ts`) pins. */ import { - isResourceAvailable, - RESOURCE_MIN_VERSION, + APPLICATION_SEARCH_MIN_VERSION, + versionsFrom, + versionsServing, type ResourceName, } from "./data/availability"; -import { - SUPPORTED_VERSIONS, - isSupportedVersion, - type Version, -} from "./data/fixtures"; +import { SUPPORTED_VERSIONS, type Version } from "./data/fixtures"; import { getApplication, readFormResponse, @@ -41,8 +43,24 @@ import { submitOrgChange, updateOrganization, } from "./handlers/organizations"; +import { + discoveryUrl, + getVersionDiscovery, + VERSIONS_PATH, +} from "./handlers/versions"; import { preflightResponse, withCors } from "./http/cors"; -import { errorResponse, withErrorBoundary } from "./http/envelope"; +import { + errorResponse, + versionErrorResponse, + withErrorBoundary, +} from "./http/envelope"; +import { + DEFAULT_VERSION, + VERSION_HEADER, + resolveRequestedVersion, + withVaryVersion, + withVersionHeaders, +} from "./http/version"; const SERVICE_NAME = "CommonGrants mock API"; @@ -53,20 +71,12 @@ const SERVICE_NAME = "CommonGrants mock API"; export const MOCK_API_BASE_PATH = "/api"; /** - * `/v{version}/common-grants/opportunities` with an optional trailing segment. - * Verbatim from the Worker so the corpus-pinned surface matches identically; - * `version` is captured loosely and narrowed by `isSupportedVersion`. + * Resource segment for every route; the remainder is matched per resource + * below. Segments use `[^/]+`, never `[^/]*`, so a trailing slash + * is a route-miss 404 rather than a 400 from an empty id — matching what + * `/opportunities/` has always answered. */ -const OPPORTUNITIES_ROUTE = - /^\/v([^/]+)\/common-grants\/opportunities(?:\/([^/]+))?$/; - -/** - * Version prefix + resource segment for every non-opportunity route; the - * remainder is matched per resource below. Segments use `[^/]+`, never - * `[^/]*`, so a trailing slash is a route-miss 404 rather than a 400 from an - * empty id — matching what `/opportunities/` has always answered. - */ -const RESOURCE_ROUTE = /^\/v([^/]+)\/common-grants\/([^/]+)((?:\/[^/]+)*)$/; +const RESOURCE_ROUTE = /^\/common-grants\/([^/]+)((?:\/[^/]+)*)$/; /** `/{id}`, `/{id}/changes`, and `/{id}/changes/{changeId}` for the org routes. */ const ORG_CHANGES_ROUTE = /^\/([^/]+)\/changes(?:\/([^/]+))?$/; @@ -105,32 +115,6 @@ function routeMissResponse(method: string, pathname: string): Response { ]); } -/** - * 404 for a resource added after the requested version. Deliberately distinct - * from a plain route miss — it tells the caller what to change. - */ -function resourceNotInVersionResponse( - resource: ResourceName, - version: string, -): Response { - return errorResponse(404, "Not found", [ - { - field: "path", - message: `The ${resource} endpoints were added in v${RESOURCE_MIN_VERSION[resource]} and are not served by v${version}`, - }, - ]); -} - -/** Protocol-shaped 404 for a version this mock does not serve at all. */ -function unsupportedVersionResponse(version: string): Response { - return errorResponse(404, "Unsupported protocol version", [ - { - field: "version", - message: `Version ${version} is not served by this mock; supported versions are ${SUPPORTED_VERSIONS.join(", ")}`, - }, - ]); -} - /** * Reduces a docs-origin pathname to the path the Worker would have seen, or * `undefined` when the request isn't the mock's. `/api` and `/api/` are both @@ -144,15 +128,15 @@ function stripBasePath(pathname: string): string | undefined { return undefined; } -/** - * Dispatches the opportunity endpoints — matched before anything else so the - * corpus-pinned surface is unaffected by the routing added around it. - */ +/** Dispatches the opportunity endpoints, whose behavior the golden corpus pins. */ async function routeOpportunities( request: Request, version: Version, - segment: string | undefined, + remainder: string, ): Promise { + const segment = remainder === "" ? undefined : remainder.slice(1); + if (segment !== undefined && segment.includes("/")) return undefined; + // `GET .../search` falls through to the detail handler and answers 400 // "Must be a valid UUID", as the Worker does — only POST serves `/search`. if (request.method === "GET") { @@ -286,8 +270,61 @@ async function routeCompetitions( return compId.includes("/") ? undefined : getCompetition(compId, version); } +/** + * Resolves the version for a matched route, then dispatches. A version error + * carries `Vary` but no `CG-Version-Served`; every response after selection + * carries both, including a route miss inside a known resource. + */ +async function serveVersioned( + request: Request, + { origin, pathname }: URL, + path: string, + versions: readonly Version[], + dispatchRoute: (version: Version) => Promise, +): Promise { + const resolution = resolveRequestedVersion( + request.headers.get(VERSION_HEADER), + { + label: `${request.method} ${path}`, + versions, + defaultVersion: DEFAULT_VERSION, + }, + ); + if ("error" in resolution) { + return withVaryVersion( + versionErrorResponse( + resolution.error, + discoveryUrl(origin, MOCK_API_BASE_PATH), + ), + ); + } + + const response = await dispatchRoute(resolution.version); + return withVersionHeaders( + response ?? routeMissResponse(request.method, pathname), + resolution.version, + ); +} + +/** `POST /applications/search` is served from `APPLICATION_SEARCH_MIN_VERSION`. */ +function versionsForRoute( + resource: ResourceName, + method: string, + remainder: string, +): readonly Version[] { + if ( + resource === "applications" && + method === "POST" && + remainder === "/search" + ) { + return versionsFrom(APPLICATION_SEARCH_MIN_VERSION); + } + return versionsServing(resource); +} + async function route(request: Request): Promise { - const { pathname } = new URL(request.url); + const url = new URL(request.url); + const { pathname } = url; const path = stripBasePath(pathname); if (path === undefined) { @@ -299,15 +336,11 @@ async function route(request: Request): Promise { return healthResponse(); } - // Opportunities get their own regex and the first look (see module doc). - const opportunityMatch = OPPORTUNITIES_ROUTE.exec(path); - if (opportunityMatch) { - const [, version, segment] = opportunityMatch; - if (!isSupportedVersion(version)) { - return unsupportedVersionResponse(version); - } - const response = await routeOpportunities(request, version, segment); - return response ?? routeMissResponse(request.method, pathname); + // Discovery sits outside version selection, so it never resolves a version. + if (path === VERSIONS_PATH) { + return request.method === "GET" + ? getVersionDiscovery() + : routeMissResponse(request.method, pathname); } const match = RESOURCE_ROUTE.exec(path); @@ -315,21 +348,19 @@ async function route(request: Request): Promise { return routeMissResponse(request.method, pathname); } - const [, version, segment, remainder] = match; - if (!isSupportedVersion(version)) { - return unsupportedVersionResponse(version); - } - + const [, segment, remainder] = match; const resource = RESOURCE_BY_SEGMENT[segment]; if (resource === undefined) { return routeMissResponse(request.method, pathname); } - if (!isResourceAvailable(resource, version)) { - return resourceNotInVersionResponse(resource, version); - } - const response = await dispatch(request, version, resource, remainder); - return response ?? routeMissResponse(request.method, pathname); + return serveVersioned( + request, + url, + path, + versionsForRoute(resource, request.method, remainder), + (version) => dispatch(request, version, resource, remainder), + ); } /** Hands a matched resource to its own router. */ @@ -340,6 +371,8 @@ function dispatch( remainder: string, ): Promise { switch (resource) { + case "opportunities": + return routeOpportunities(request, version, remainder); case "awards": return routeAwards(request, version, remainder); case "orgs": @@ -350,10 +383,6 @@ function dispatch( return routeForms(request, version, remainder); case "competitions": return routeCompetitions(request, version, remainder); - case "opportunities": - // Reachable when a path like `/opportunities/foo/bar` fails the stricter - // OPPORTUNITIES_ROUTE; `undefined` makes it the route miss it should be. - return Promise.resolve(undefined); } } @@ -364,6 +393,6 @@ export async function handleMockRequest(request: Request): Promise { } // Every non-preflight response passes through CORS and the error boundary; - // `preflightResponse()` sets the same headers itself. + // `preflightResponse()` sets the same `Allow-*` headers itself. return withCors(await withErrorBoundary(() => route(request))); } diff --git a/website/src/pages/protocol/api-docs.astro b/website/src/pages/protocol/api-docs.astro index 9c7deae6a..d7dabc9d1 100644 --- a/website/src/pages/protocol/api-docs.astro +++ b/website/src/pages/protocol/api-docs.astro @@ -1,12 +1,14 @@ --- import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro"; import "swagger-ui-dist/swagger-ui.css"; -import { SPEC_DIR_URL } from "@/lib/mock/docs-wiring"; +import { MOCK_SERVER_URL, SPEC_DIR_URL } from "@/lib/mock/docs-wiring"; import { SUPPORTED_METHODS } from "@/lib/mock/http/methods"; +import { VERSION_HEADER } from "@/lib/mock/http/version"; // Available OpenAPI versions (mirror of the emitted specs in public/openapi/) const availableVersions = [ - { version: "0.5.0", label: "v0.5.0 (Latest)" }, + { version: "0.6.0", label: "v0.6.0 (Latest)" }, + { version: "0.5.0", label: "v0.5.0" }, { version: "0.4.0", label: "v0.4.0" }, { version: "0.3.0", label: "v0.3.0" }, { version: "0.2.0", label: "v0.2.0" }, @@ -31,6 +33,8 @@ const availableVersions = [
@@ -87,7 +91,7 @@ const availableVersions = [