Skip to content

feat: use new config model #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
27da011
fix: allow only uuidv4 ids
alinarublea Jun 6, 2024
427c677
fix: allow only uuidv4 ids
alinarublea Jun 6, 2024
c1b64d0
fix: allow only uuidv4 ids
alinarublea Jun 6, 2024
b91591d
fix: allow default organization
alinarublea Jun 7, 2024
4516d9c
Merge branch 'main' into security-issue
alinarublea Jun 7, 2024
e25308b
Merge branch 'main' into security-issue
alinarublea Jun 7, 2024
5731d5c
Merge branch 'security-issue' of github.com:adobe/spacecat-api-service
alinarublea Jun 7, 2024
81d164d
Merge branch 'main' of github.com:adobe/spacecat-api-service
alinarublea Jun 14, 2024
3ec3e13
feat: use new config model
alinarublea Jun 14, 2024
4354ce4
feat: use new config model
alinarublea Jun 14, 2024
a98274d
fix: update main
alinarublea Jul 1, 2024
4e38af8
fix: unit tests
alinarublea Jul 1, 2024
cf93a85
fix: unit tests
alinarublea Jul 3, 2024
7d582af
fix: add API docs
alinarublea Jul 8, 2024
c8ac6cb
Merge branch 'main' into issue-115-2
alinarublea Jul 8, 2024
a4b79a5
fix: add API docs
alinarublea Jul 15, 2024
a3d09a5
Merge branch 'issue-115-2' of github.com:adobe/spacecat-api-service i…
alinarublea Jul 16, 2024
e6096f5
fix: add API docs
alinarublea Jul 16, 2024
f35bb75
fix: add API docs
alinarublea Jul 16, 2024
d29011f
fix: add API docs
alinarublea Jul 17, 2024
cbe9a3c
fix: add API docs
alinarublea Jul 18, 2024
6fd9409
fix: add API docs
alinarublea Jul 19, 2024
e5ad9c2
fix: add API docs
alinarublea Jul 19, 2024
9388956
fix: add API docs
alinarublea Jul 22, 2024
6046132
fix: add API docs
alinarublea Jul 23, 2024
9a80584
fix: add API docs
alinarublea Jul 23, 2024
da3ccb0
fix: add API docs
alinarublea Jul 23, 2024
6006de7
Merge branch 'main' into issue-115-2
alinarublea Jul 23, 2024
3e8186e
fix: add API docs
alinarublea Jul 23, 2024
2f15d0b
Merge branch 'issue-115-2' of github.com:adobe/spacecat-api-service i…
alinarublea Jul 23, 2024
c0b0c6e
fix: add API docs
alinarublea Jul 23, 2024
d4cce98
fix: add API docs
alinarublea Jul 24, 2024
ff73579
Merge branch 'main' of github.com:adobe/spacecat-api-service into iss…
alinarublea Jul 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/openapi/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ paths:
/sites/{siteId}/latest-audit/{auditType}:
$ref: './audit-api.yaml#/latest-audit-for-site'
/sites/{siteId}/{auditType}:
$ref: './audit-api.yaml#/update-audit-config-for-site'
$ref: './audit-api.yaml#/update-handler-type-config-for-site'
/sites/{siteId}/key-events:
$ref: './key-events-api.yaml#/key-events'
/sites/{siteId}/key-events/{keyEventId}:
Expand Down
6 changes: 3 additions & 3 deletions docs/openapi/audit-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ latest-audit-for-site:
$ref: './responses.yaml#/500'
security:
- api_key: [ ]
update-audit-config-for-site:
update-handler-type-config-for-site:
parameters:
- $ref: './parameters.yaml#/siteId'
- $ref: './parameters.yaml#/auditType'
Expand All @@ -77,14 +77,14 @@ update-audit-config-for-site:
content:
application/json:
schema:
$ref: './schemas.yaml#/UpdateAuditConfigType'
$ref: './schemas.yaml#/UpdateHandlerTypeConfig'
responses:
'200':
description: The updated audit type config object
content:
application/json:
schema:
$ref: './schemas.yaml#/AuditConfigType'
$ref: './schemas.yaml#/HandlerConfig'
'400':
$ref: './responses.yaml#/400-patch-audit-for-site'
'401':
Expand Down
170 changes: 55 additions & 115 deletions docs/openapi/schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,31 @@ EmailAddress:
format: email
example: '[email protected]'
SlackMentionConfig:
type: object
properties:
slack:
type: array
items:
type: string
HandlerConfig:
type: object
additionalProperties: true
properties:
slack:
type: array
items:
type: string
AlertConfig:
type: object
additionalProperties: true
additionalProperties: false
properties:
type:
description: The type of the alert
type: string
byOrg:
description: Whether the alert should be sent by organization
type: boolean
mentions:
description: The Slack mentions to include in the alert
$ref: '#/SlackMentionConfig'
excludedURLs:
description: URLs to be excluded from the handler's processing
type: array
items:
$ref: '#/SlackMentionConfig'
AlertsConfig:
type: array
items:
$ref: '#/AlertConfig'
type: string
format: uri
patternProperties:
"^(404|broken-backlinks)$":
type: object
properties:
mentions:
$ref: '#/SlackMentionConfig'
# Define other properties specific to the alert type here
SlackConfig:
type: object
additionalProperties: true
Expand Down Expand Up @@ -98,9 +97,9 @@ Config:
slack:
description: Optional. The Slack configuration
$ref: '#/SlackConfig'
alerts:
handlers:
description: Optional. The Alert configuration
$ref: '#/AlertsConfig'
$ref: '#/HandlerConfig'
OrganizationConfig:
allOf:
- $ref: '#/Config'
Expand Down Expand Up @@ -137,17 +136,17 @@ Organization:
channel: '#example-channel'
workspace: 'example-workspace'
invitedUserCount: 5
alerts:
- type: '404'
handlers:
'404':
byOrg: true
mentions:
- slack:
slack:
- '@user1'
- '@user2'
- type: 'cwv'
'cwv':
byOrg: false
mentions:
- slack:
slack:
- '@user5'
- '@user6'
createdAt: '2023-12-15T09:30:00Z'
Expand Down Expand Up @@ -177,17 +176,16 @@ OrganizationCreate:
slack:
channel: '#example-channel'
workspace: 'example-workspace'
alerts:
- type: '404'
byOrg: true
handlers:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can start reusing examples, when they become repetitive: https://swagger.io/docs/specification/adding-examples/ -> Reusing Examples

'404':
mentions:
- slack:
slack:
- '@user3'
- '@user4'
- type: 'cwv'
'cwv':
byOrg: false
mentions:
- slack:
slack:
- '@user5'
- '@user6'
OrganizationUpdate:
Expand All @@ -209,19 +207,17 @@ OrganizationUpdate:
slack:
channel: '#example-channel'
workspace: 'example-workspace'
alerts:
- type: '404'
byOrg: true
mentions:
- slack:
- '@user1'
- '@user2'
- type: 'cwv'
byOrg: false
mentions:
- slack:
- '@user5'
- '@user6'
handlers:
'404':
mentions:
slack:
- '@user3'
- '@user4'
'cwv':
mentions:
slack:
- '@user5'
- '@user6'
Site:
type: object
properties:
Expand All @@ -244,9 +240,6 @@ Site:
description: The date and time when the site went live on AEM Edge
nullable: true
$ref: '#/DateTime'
auditConfig:
description: The audit configuration for this site
$ref: '#/AuditConfig'
config:
description: Optional. The configuration of the site. May override the organization configuration.
$ref: '#/SiteConfig'
Expand All @@ -263,30 +256,27 @@ Site:
deliveryType: 'aem_edge'
gitHubURL: 'https://github.com/example/repo'
goLiveDate: '2024-01-20T10:00:00Z'
auditConfig:
auditsDisabled: false
auditTypeConfigs:
'404':
disabled: true
'cwv':
disabled: false
config:
slack:
channel: 'C1234567890'
workspace: 'example-workspace'
alerts:
- type: '404'
byOrg: true
handlers:
'404':
mentions:
- slack:
slack:
- '@user1'
- '@user2'
- type: 'cwv'
byOrg: false
'broken-backlinks':
mentions:
- slack:
slack:
- '@user5'
- '@user6'
excludedURLs:
description: URLs to be excluded from the alert
type: array
items:
type: string
format: uri'
createdAt: '2023-12-15T09:30:00Z'
updatedAt: '2024-01-19T11:20:00Z'
SiteWithLatestAudit:
Expand All @@ -306,13 +296,6 @@ SiteWithLatestAudit:
deliveryType: 'aem_edge'
gitHubURL: 'https://github.com/example/repo'
goLiveDate: '2024-01-20T10:00:00Z'
auditConfig:
auditsDisabled: false
auditTypeConfigs:
'404':
disabled: true
'cwv':
disabled: false
createdAt: '2023-12-15T09:30:00Z'
updatedAt: '2024-01-19T11:20:00Z'
audits:
Expand Down Expand Up @@ -358,9 +341,6 @@ SiteCreate:
description: The date and time when the site went live on AEM Edge
nullable: true
$ref: '#/DateTime'
auditConfig:
description: The audit configuration for this site
$ref: '#/AuditConfig'
example:
organizationId: 'o1p2q3r4-s5t6-u7v8-w9x0-yz12x34y56z'
baseURL: 'https://www.newsite.com'
Expand All @@ -378,33 +358,14 @@ SiteUpdate:
description: The date and time when the site went live on AEM Edge
nullable: true
$ref: '#/DateTime'
auditConfig:
description: The audit configuration for this site
$ref: '#/AuditConfig'
config:
description: Optional. The configuration of the site
$ref: '#/SiteConfig'
example:
organizationId: 'u7y6t5r4-e3w2-x1z0-z9y8-x7v6w5u4t3s2'
deliveryType: 'other'
goLiveDate: '2024-01-20T10:00:00Z'
AuditConfigType:
type: object
properties:
disabled:
description: Whether audits are disabled for the given audit type
type: boolean
excludedURLs:
description: (Optional) Set of urls to exclude. If empty, will remove previously excluded URLs. It's an array of strings
type: array
items:
type: string
example:
disabled: true
excludedURLs:
- 'https://www.adobe.com/some-page'
- 'https://www.adobe.com/another-page'
UpdateAuditConfigType:
UpdateHandlerTypeConfig:
type: object
properties:
excludedURLs:
Expand All @@ -416,23 +377,6 @@ UpdateAuditConfigType:
excludedURLs:
- 'https://www.adobe.com/some-page'
- 'https://www.adobe.com/another-page'
AuditConfig:
type: object
properties:
auditsDisabled:
description: Whether audits are disabled for this site
type: boolean
auditTypeConfigs:
type: object
additionalProperties:
$ref: '#/AuditConfigType'
example:
auditsDisabled: false
auditTypeConfigs:
'404':
disabled: true
'cwv':
disabled: false
Audit:
type: object
readOnly: true
Expand All @@ -446,10 +390,6 @@ Audit:
expiresAt:
description: The date and time when the audit expires in ISO 8601 format
$ref: '#/DateTime'
auditType:
description: The type of the audit
$ref: '#/AuditType'
isError:
type: boolean
deliveryType:
description: The type of the delivery this site is using
Expand Down
Loading
Loading