Repository navigation
Closed
Labels
priority: highHigh prioritytype flag: breaking changeProposed change breaks current APItype: styleRelated to code styleworkload: hoursLikely takes hours to resolve
Milestone
Description
The fields, query parameters and stored names that the registry adds to the GA4GH Service Registry and Service Info specifications are snake_case, whereas these specifications are camelCase (createdAt, contactUrl). Move all additions to camelCase, so that the API is consistent and predictable, including what is stored.
Rules
- API fields and query parameters: camelCase, no prefix; additions follow the style of the spec they extend.
- Fields added to spec objects (service info
registration_rules): camelCase, grouped under one key, kept to a minimum. - Stored fields and indexes in MongoDB: camelCase, same names as the API.
- Config keys stay
snake_case(FOCA's config style), also where the service info publishes them as camelCase. Python code stays PEP 8. Errorcodevalues (e.g.,duplicate-service) are values, not field names, and stay. - No migration code. 1.0.0rc1 to 1.0.0rc2 needs a fresh database, stated in
docs/upgrading.mdanddocs/releases/1.0.0rc2.md. The app refuses to start on data in the old format, which it detects cheaply at startup. Indexes and startup code made obsolete go.
API fields and query parameters
Where Old New Stored as (new)
GET /service-info registration_rules registrationRules not stored (from config, on each request)
registrationRules url_schemes urlSchemes not stored (custom.endpoints.services.url_schemes)
registrationRules service_types serviceTypes not stored (custom.access_control.service_types)
registrationRules max_unused_service_types maxUnusedServiceTypes not stored (custom.access_control.max_unused_service_types)
registrationRules max_services_per_user maxServicesPerUser not stored (custom.access_control.max_services_per_user)
GET|PUT /service-info/listing service_id serviceId not stored (the entry's id; the entry has _selfEntry)
GET /services/{id}/permissions user_id userId user_names.userId for names; roles in policy_rules (FOCA)
PUT .../permissions/users/{userId} user_id userId same
GET /me user_id userId not stored (token)
GET /me admin_available adminAvailable not stored
GET /me may_add_service_types mayAddServiceTypes not stored
GET /me service_types_pending serviceTypesPending not stored
GET /me services[] service_id serviceId not stored (policy_rules, FOCA)
GET /approvals service_types serviceTypes not stored (the pending service types)
Invitation, InvitationCreated service_id serviceId invitations.serviceId
Invitation, InvitationCreated created_by createdBy invitations.createdBy
Invitation, InvitationCreated created_at createdAt invitations.createdAt
Invitation, InvitationCreated expires_at expiresAt invitations.expiresAt
Invitation accepted user_id userId invitations.accepted.userId
Invitation accepted accepted_at acceptedAt invitations.accepted.acceptedAt
POST /invitations/accept service_id serviceId not stored (response)
GET /services/{id}/verification verified_at verifiedAt services._verifiedAt (unchanged)
GET /verifications verified_at verifiedAt services._verifiedAt (unchanged)
GET /verifications service_id serviceId not stored (the service's id)
GET /services/{id}/invitations (query) include_accepted includeAccepted not stored
Stored fields that are not served
Collection Old New Note
invitations token_hash tokenHash never served
invitations created_as createdAs never served
user_names service_id serviceId
user_names user_id userId
service_types created_by createdBy not served
service_locks started_at startedAt
Indexes
Collection Old New
invitations token_hash_1 tokenHash_1
invitations service_id_1_created_at_1 serviceId_1_createdAt_1
invitations accepted_expires_at acceptedExpiresAt
invitations expires_at_1 expiresAt_1 (TTL, set on startup from keep_expired_days)
user_names service_id_1_user_id_1 serviceId_1_userId_1
service_types created_by_1 createdBy_1
service_locks service_1_started_at_1 service_1_startedAt_1
service_locks started_at_1 startedAt_1
Unchanged
- Internal fields of stored services, which are camelCase already and whose
_prefix keeps them apart from the fields of the spec:_serviceKey,_pending,_createdBy,_selfEntry,_verifiedAt. - Stored fields with one word:
role,label,accepted,name,email,pending,count,service,token,path,from,to. - Names of collections (
service_types,service_counts,user_names,service_locks, FOCA'spolicy_rules), as they are keys of the config. - Config keys, also those named above, and the claim
email_verified, which comes from identity providers.
Docs
The sentence in docs/api.md on snake_case makes way for a short "API style" section. The OpenAPI additions, docs and tests change with the names.
Metadata
Metadata
Assignees
Labels
priority: highHigh prioritytype flag: breaking changeProposed change breaks current APItype: styleRelated to code styleworkload: hoursLikely takes hours to resolve
Activity