fix: normalize REST paths, add security scheme, fix schema issues, add CI#8
Draft
jeremi wants to merge 13 commits into
Draft
fix: normalize REST paths, add security scheme, fix schema issues, add CI#8jeremi wants to merge 13 commits into
jeremi wants to merge 13 commits into
Conversation
- Rename RPC-style paths to REST conventions: /event/new -> POST /event,
/event/modifications -> PUT /event/{event_id}, /event -> DELETE /event/{event_id},
/event/list_details -> POST /event/search. Same pattern for all 9 resource types.
- Move creation and search payloads from qry query params to requestBody
- Move resource IDs from query params to path params
- Remove requestor_id and request_token query params (security scheme in next commit)
- Add operationId to all 37 operations (camelCase verb+Resource convention)
- Fix content-type key from "json" to "application/json" on all search responses
Add bearerAuth securityScheme (HTTP bearer with JWT format) and apply it globally, aligning the API with section 5.1.4 cross-cutting requirements.
- subscriber_limit: string -> integer in event schemas - Boolean examples: "true" -> true in appointment schemas - format: url -> uri on all URL fields - lat/long: string -> number in venue schema - day_of_week example: "[monday" -> "monday" - free_slots: replace malformed string with proper object array - event_ids example: "[1]" -> ["1"] - Array examples in 8 filter schemas: string -> actual arrays - Entity_id -> entity_id casing fix in free_resource_filter
Extract shared time_slot schema (from/to datetime pair) and use it in: - event_creation_details.slots (array of time_slot, multi-slot creation) - event_details.slot (single time_slot per event) - free_resource_details.free_slots (array of time_slot) This resolves the inconsistency where creation used an inline slots array but read/update used flat from/to fields.
- POST create endpoints: 200 -> 201 Created - DELETE endpoints: 200 -> 204 No Content - Add 401 and 500 responses to all operations - Add required arrays to 9 creation/detail schemas - Fix tag mismatch: 'subscribers' -> 'subscriber' (matching operation usage)
- Add PageParam and PageSizeParam to components/parameters
- Add pagination_metadata schema (page, page_size, total)
- Wrap all 10 search endpoint responses in {data, pagination} envelope
- Pagination query params on all search and availability endpoints
Remove PUT /log/{log_id} and DELETE /log/{log_id} to make the log resource
append-only + read-only. Mutable audit logs contradict the spec's own
cross-cutting requirement 5.1.3 (audit logging) and section 6.9.
Also removes the orphaned log_modify_qry schema.
- Replace hardcoded test instance URL with parameterized server template - Remove empty api/test.txt placeholder file
…ctures) - Fix section numbering in 8-service-apis.md: 4.10-4.13 -> 8.10-8.13 - Update all 35 swagger blocks to reference new REST paths and methods - Remove 2 swagger blocks for deleted log mutation endpoints - Fix event creation endpoint in workflow diagram: Post/entity/new -> POST /event - Update all endpoint references in Mermaid sequence diagrams throughout 9-workflows.md - Fix SubscriberLimit type in 7-data-structures.md: String -> Integer
- Add .spectral.yml with 7 custom rules (security schemes, global security, no query-string auth, valid media types, 201 on create, 204 on delete, 401 required) plus 3 built-in rules - Add GitHub Actions workflow triggered on api/ and .spectral.yml changes - Validated locally: 0 errors, warnings only for pre-existing issues (missing operation descriptions, unused list schemas, URI format examples)
Fixes found by staff engineer review:
- alert_schedule_details: required [name] -> [event_id, message_id, alert_datetime]
(schema has no name property)
- message_details: required [name] -> [category, message_body]
(schema has no name property)
- URI examples updated to valid URIs (https:// prefix)
- Trimmed leading whitespace in alert_preference examples
- Fixed subscriber/search response description ("message list" -> "subscriber list")
Rename {resource}_details -> details in 7 *_new_qry schemas to match
the convention already used by event_new_qry, entity_new_qry, and all
*_modify_qry schemas.
Copy summary text into description on all 35 operations to satisfy the operation-description lint rule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR brings the Scheduler BB OpenAPI spec in line with its own cross-cutting requirements and standard REST/OpenAPI conventions.
No new endpoints are added. Two endpoints are removed (
PUTandDELETEon/log) because mutable audit logs contradict the spec's own audit logging requirements (sections 5.1.3 and 6.9). The remaining 35 operations map 1:1 to the original 35 (excluding the 2 removed).Changes were validated with Spectral (0 errors, 0 warnings) and the OpenAPI spec validator. A GitHub Actions workflow is included to prevent regressions.
What changed
API paths (breaking)
All paths are normalized from RPC-style to REST conventions:
POST /event/newPOST /eventPUT /event/modifications?event_id=XPUT /event/{event_id}DELETE /event?event_id=XDELETE /event/{event_id}GET /event/list_details?qry={...}POST /event/search(body)Same pattern applied to all 9 resource types. Resource IDs moved from query params to path params. Creation and search payloads moved from
qryquery param (nested objects that cannot be serialized in URLs) torequestBody.Security (breaking)
bearerAuthsecurity scheme (HTTP bearer, JWT format) per section 5.1.4requestor_idandrequest_tokenquery parameters (tokens in query strings appear in logs, browser history, and proxy caches)Schema fixes
subscriber_limit:stringtointeger(event schemas)lat/longin venue:stringtonumberformat: urltoformat: uri(all URL fields), with valid URI examples"true"totrue(appointment schemas)free_slots: replaced malformed string withtime_slotobject arraydays_hours.day_of_weekexample:"[monday"to"monday"free_resource_filter.Entity_idcasing toentity_id*_new_qryschemas todetails(matching*_modify_qry)Event slot model
Extracted a shared
time_slotschema ({from, to}datetime pair). Used in:event_creation_details.slots(array, multi-slot creation)event_details.slot(single slot per event)free_resource_details.free_slotsThis resolves the inconsistency where creation used an inline
slotsarray but read/update used flatfrom/tofields.Response codes and required fields
POSTcreate:200to201 CreatedDELETE:200to204 No Content401and500responses to all operationsrequiredarrays to 9 creation/detail schemas (derived from spec section 7)Pagination
All 10 search endpoints now return a
{data, pagination}envelope withpage,page_size, andtotal. Query parameterspage(default 1) andpage_size(default 20, max 100) are defined as reusable components.Audit log integrity
Removed
PUT /log/{log_id}andDELETE /log/{log_id}. The spec mandates audit logging (5.1.3 REQUIRED, 6.9) but the API allowed arbitrary modification and deletion of log records. Logs are now append-only + read-only.Spec markdown
8-service-apis.md:4.10-4.13to8.10-8.139-workflows.mdSubscriberLimittype in7-data-structures.md:StringtoIntegerCI
.spectral.ymlwith 7 custom rules + 3 built-in rules.github/workflows/validate-api.ymltriggered on changes toapi/or.spectral.ymlspec/.gitbook/assets/Housekeeping
api/test.txt*_listschemas (replaced by pagination envelope)subscriberstosubscribersubscriber/searchresponse description (said "message list")operationIdto all 35 operationsdescriptionfield to all 35 operationsBreaking changes
This PR changes every path and removes query-string auth. Any existing client code, test harness, or integration would need to update.
The Gherkin test harness in
test/references the old paths and would need corresponding updates. That work is not included here to keep the PR focused on the spec itself.Not in scope
spec/.gitbook/assets/: 5 files with an older 33-path version. These may be managed by GitBook. After merge, the swagger blocks in8-service-apis.mdload from themainbranch raw URL; if GitBook uses checked-in assets instead, there may be a visual inconsistency in published docs.409 Conflictfor deduplication: Sections 6.1 and 6.2 require duplicate detection, but no endpoint defines a conflict response. Worth adding in a follow-up.Feedback requested
requiredarrays on creation schemas: These are derived from spec section 7 but some are ambiguous. In particular,subscriber_detailsonly requires["name"], which may be too conservative. Please review and adjust.spec/.gitbook/assets/be removed in this PR or left for GitBook to regenerate?Validation
openapi-spec-validator: VALID$refpointers resolve, no orphaned schemas