Skip to content
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

feat: add biome config #713

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["biomejs.biome", "esbenp.prettier-vscode"]
}
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[jsonc]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
37 changes: 37 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"files": {
"maxSize": 90485760
},
"formatter": {
"indentStyle": "tab",
"formatWithErrors": true
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingCommas": "es5"
},
"globals": ["Bun"]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"all": true,
"noNodejsModules": "off"
},
"performance": {
"all": true
},
"security": {
"all": true
}
}
},
"organizeImports": {
"enabled": true
}
}
Binary file modified bun.lockb
Binary file not shown.
15 changes: 2 additions & 13 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -984,12 +984,7 @@
"role": {
"type": "string",
"example": "artist",
"enum": [
"artist",
"author",
"composer",
"performer"
]
"enum": ["artist", "author", "composer", "performer"]
},
"normDb": {
"type": "object",
Expand Down Expand Up @@ -1094,13 +1089,7 @@
"properties": {
"type": {
"type": "string",
"enum": [
"cover",
"artist",
"anchor",
"audio",
"video"
],
"enum": ["cover", "artist", "anchor", "audio", "video"],
"example": "cover"
},
"url": {
Expand Down
63 changes: 28 additions & 35 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ info:
description: >-
ARD system to distribute real-time (live) metadata for primarily radio
broadcasts.
termsOfService: 'https://www.ard.de'
termsOfService: https://www.ard.de
contact:
email: [email protected]
license:
name: European Union Public License 1.2
url: 'https://spdx.org/licenses/EUPL-1.2.html'
url: https://spdx.org/licenses/EUPL-1.2.html
version: 1.8.0
externalDocs:
description: ARD Eventhub Documentation
url: 'https://swrlab.github.io/ard-eventhub/'
url: https://swrlab.github.io/ard-eventhub/
servers:
- url: /
description: Local (domain-relative) environment
Expand Down Expand Up @@ -131,7 +131,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
'/events/de.ard.eventhub.v1.radio.track.next':
/events/de.ard.eventhub.v1.radio.track.next:
post:
tags:
- events
Expand Down Expand Up @@ -168,7 +168,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
'/events/de.ard.eventhub.v1.radio.track.playing':
/events/de.ard.eventhub.v1.radio.track.playing:
post:
tags:
- events
Expand Down Expand Up @@ -289,7 +289,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/errorInternalServerError'
'/subscriptions/{name}':
/subscriptions/{name}:
get:
tags:
- subscriptions
Expand Down Expand Up @@ -413,10 +413,10 @@ components:
description: >
New event to be distributed to subscribers.

The Eventhub format validation expects only a subset of these
variables as minimum set. All other fields are technically optional,
but **highly encouraged** to be included, so a best-possible metadata
exchange is possible.
The Eventhub format validation expects only a subset of these variables
as minimum set. All other fields are technically optional, but **highly
encouraged** to be included, so a best-possible metadata exchange is
possible.

The subset is defined in the list of required fields of Schemas
`eventV1PostBody`, resulting in this body:
Expand Down Expand Up @@ -450,9 +450,9 @@ components:
Event created

*Note:* The first request of an event for an externalId that is not
registered yet, will return the status `failed: 1`. This indicates
that a new topic for the externalId has been created, and the request
needs to be repeated:
registered yet, will return the status `failed: 1`. This indicates that
a new topic for the externalId has been created, and the request needs
to be repeated:

```json

Expand All @@ -466,7 +466,6 @@ components:

If the request returns the status `blocked: 1`, it indicates that you
are not allowed to publish events under the given publisherId.

content:
application/json:
schema:
Expand Down Expand Up @@ -593,7 +592,6 @@ components:
trace:
type: string
example: null

services:
type: object
required:
Expand All @@ -603,24 +601,26 @@ components:
properties:
type:
type: string
example: 'PermanentLivestream'
example: PermanentLivestream
enum:
- 'EventLivestream'
- 'PermanentLivestream'
- EventLivestream
- PermanentLivestream
externalId:
type: string
example: 'crid://swr.de/123450'
example: crid://swr.de/123450
publisherId:
type: string
description: |
External ID or globally unique identifier (Core ID) for the associated publisher.
When no Core ID is provided, the External ID will be converted by Eventhub.
description: >
External ID or globally unique identifier (Core ID) for the
associated publisher.

When no Core ID is provided, the External ID will be converted by
Eventhub.
example: '248000'
id:
type: string
description: Globally unique identifier, created by Eventhub
example: 'urn:ard:permanent-livestream:49267f7d67be180d'

example: urn:ard:permanent-livestream:49267f7d67be180d
reference:
type: object
additionalProperties: false
Expand Down Expand Up @@ -656,7 +656,6 @@ components:
items:
type: string
example: https://normdb.ivz.cn.ard.de/sendereihe/427

eventV1PostBody:
additionalProperties: false
required:
Expand Down Expand Up @@ -830,10 +829,10 @@ components:
example: cover
url:
type: string
example: 'https://example.com/cover.jpg'
example: https://example.com/cover.jpg
templateUrl:
type: string
example: 'https://example.com/cover.jpg?width={width}'
example: https://example.com/cover.jpg?width={width}
nullable: true
description:
type: string
Expand Down Expand Up @@ -861,7 +860,6 @@ components:
be a true string in the future, do not expect this string to remain
numbers only!
example: '1234567890'

eventV1ResBody:
type: object
properties:
Expand All @@ -882,7 +880,6 @@ components:
trace:
type: string
example: null

subscriptionPost:
required:
- type
Expand All @@ -905,7 +902,7 @@ components:
url:
type: string
description: Publicly accessible URL that should receive the events
example: 'https://example.com/my/webhook/for/this/subscription'
example: https://example.com/my/webhook/for/this/subscription
contact:
type: string
description: >-
Expand All @@ -916,13 +913,11 @@ components:
type: string
description: ID of the topic to subscribe to
example: topic-id-to-subscribe-to

subscriptionsList:
type: array
items:
allOf:
- $ref: '#/components/schemas/subscriptionResponse'

subscriptionResponse:
type: object
properties:
Expand Down Expand Up @@ -969,7 +964,7 @@ components:
url:
type: string
description: Publicly accessible URL that should receive the events
example: 'https://example.com/my/webhook/for/this/subscription'
example: https://example.com/my/webhook/for/this/subscription
contact:
type: string
description: >-
Expand All @@ -980,7 +975,6 @@ components:
type: string
description: ID of the institution the current user belongs to
example: urn:ard:institution:institution-id

subscriptionDeleted:
type: object
properties:
Expand All @@ -990,7 +984,6 @@ components:
trace:
type: string
example: null

topicResponse:
type: array
items:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"docker:run": "docker run --env-file .env -p 8080:8080 --name ard-eventhub swr/ard-eventhub",
"docker:scan": "bun docker:build && docker scout quickview",
"docker:clean": "docker rm ard-eventhub",
"openapi:format": "bunx biome format openapi.json --write && bunx prettier openapi.yaml -w",
"license": "bunx license-compliance",
"reinstall": "rm -rf node_modules && rm bun.lockb && bun install"
},
Expand All @@ -45,7 +46,7 @@
},
"devDependencies": {
"@biomejs/biome": "^1.8.2",
"@swrlab/swr-prettier-config": "^0.3.0",
"@swrlab/style-guide": "swrlab/style-guide",
"chai": "^4.4.1",
"chai-http": "^4.4.0",
"docsify-cli": "^4.4.4",
Expand All @@ -60,5 +61,5 @@
"strip-ansi": "^6.0.1",
"update-notifier": "^5.1.0"
},
"prettier": "@swrlab/swr-prettier-config"
"prettier": "@swrlab/style-guide/prettier"
}
Loading