mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-23 02:20:01 +01:00
feat(api): report login methods and add GET /capabilities
This commit is contained in:
parent
294c1a9a6a
commit
28d023449d
17 changed files with 458 additions and 79 deletions
|
|
@ -3,7 +3,7 @@
|
|||
"info": {
|
||||
"title": "Navidrome API",
|
||||
"version": "1.0.0",
|
||||
"description": "Navidrome API v1. Spec-first, additive within v1. Clients discover implemented\ncapability modules through `GET /server` and never sniff versions.\n\nEnums are open: new values may be added to any enum within v1. Clients must\naccept values they do not recognise instead of failing.\n\nEvery operation declares `x-stability-level`: `alpha` operations may change or\ndisappear without notice, `beta` and `stable` operations only change additively.\nA level is only ever raised, never lowered.\n\n`HEAD` is accepted wherever `GET` is. A `405` response lists the allowed methods\nin its `Allow` header.\n\nOperations that need an access token declare `security: [{bearerAuth: []}]` and the scope they need in\n`x-scope` (OpenAPI 3.0 does not allow scopes on bearer schemes). A revoked grant, and every token minted\nfrom it, stops working within one access-token lifetime at most.\n",
|
||||
"description": "Navidrome API v1. Spec-first, additive within v1. Clients discover implemented\ncapability modules through `GET /capabilities` and never sniff versions.\n\nEnums are open: new values may be added to any enum within v1. Clients must\naccept values they do not recognise instead of failing.\n\nEvery operation declares `x-stability-level`: `alpha` operations may change or\ndisappear without notice, `beta` and `stable` operations only change additively.\nA level is only ever raised, never lowered.\n\n`HEAD` is accepted wherever `GET` is. A `405` response lists the allowed methods\nin its `Allow` header.\n\nOperations that need an access token declare `security: [{bearerAuth: []}]` and the scope they need in\n`x-scope` (OpenAPI 3.0 does not allow scopes on bearer schemes). A revoked grant, and every token minted\nfrom it, stops working within one access-token lifetime at most.\n",
|
||||
"license": {
|
||||
"name": "GPL-3.0",
|
||||
"url": "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
],
|
||||
"security": [],
|
||||
"summary": "Describe the server",
|
||||
"description": "Returns the public server description. No authentication required.\nAuthenticated requests will additionally receive the implemented capability modules\nonce authentication is available.\n",
|
||||
"description": "Returns the public server description. No authentication required.\nCapability modules are listed by `GET /capabilities`.\n",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Server description.",
|
||||
|
|
@ -53,6 +53,41 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/capabilities": {
|
||||
"get": {
|
||||
"operationId": "getCapabilities",
|
||||
"x-module": "core",
|
||||
"x-stability-level": "alpha",
|
||||
"tags": [
|
||||
"server"
|
||||
],
|
||||
"summary": "List implemented capability modules",
|
||||
"description": "The capability modules this server implements. Any valid access token may read it, whatever its scopes.",
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Implemented modules.",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Capabilities"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"$ref": "#/components/responses/Unauthorized"
|
||||
},
|
||||
"500": {
|
||||
"$ref": "#/components/responses/InternalError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/openapi.json": {
|
||||
"get": {
|
||||
"operationId": "getOpenAPISpecJSON",
|
||||
|
|
@ -512,17 +547,23 @@
|
|||
"description": "True until the first admin user has been created."
|
||||
},
|
||||
"loginMethods": {
|
||||
"type": "array",
|
||||
"description": "Login methods this server accepts. New methods may be added; clients ignore values they do not recognise.",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"password"
|
||||
]
|
||||
}
|
||||
"$ref": "#/components/schemas/LoginMethods"
|
||||
}
|
||||
}
|
||||
},
|
||||
"LoginMethods": {
|
||||
"type": "object",
|
||||
"description": "Login methods this server accepts, keyed by method. A missing key means the method is not offered.\nKeys are optional on purpose: discovery is read by clients of any version against servers of any\nversion, so new methods are added as new optional keys. Clients ignore keys they do not know.\n",
|
||||
"properties": {
|
||||
"password": {
|
||||
"$ref": "#/components/schemas/PasswordLoginMethod"
|
||||
}
|
||||
}
|
||||
},
|
||||
"PasswordLoginMethod": {
|
||||
"type": "object",
|
||||
"description": "Username and password login (`POST /auth/login`). No settings yet."
|
||||
},
|
||||
"Problem": {
|
||||
"type": "object",
|
||||
"description": "RFC 9457 problem details, returned for every 4xx and 5xx response.",
|
||||
|
|
@ -598,6 +639,44 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Capabilities": {
|
||||
"type": "object",
|
||||
"description": "Capability modules this server implements, keyed by module. Keys are optional; a missing key means the\nmodule is not implemented. New modules are added as new optional keys. These are server facts, not what\nthe calling token may use.\n",
|
||||
"properties": {
|
||||
"core": {
|
||||
"$ref": "#/components/schemas/CoreCapability"
|
||||
},
|
||||
"password": {
|
||||
"$ref": "#/components/schemas/PasswordCapability"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CoreCapability": {
|
||||
"type": "object",
|
||||
"description": "The mandatory core module.",
|
||||
"required": [
|
||||
"version"
|
||||
],
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "integer",
|
||||
"description": "Module version. Bumped only on semantic change."
|
||||
}
|
||||
}
|
||||
},
|
||||
"PasswordCapability": {
|
||||
"type": "object",
|
||||
"description": "The password login module (login, first-admin setup, password change).",
|
||||
"required": [
|
||||
"version"
|
||||
],
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "integer",
|
||||
"description": "Module version. Bumped only on semantic change."
|
||||
}
|
||||
}
|
||||
},
|
||||
"TokenRequest": {
|
||||
"type": "object",
|
||||
"description": "Optional narrowing of a new access token.",
|
||||
|
|
@ -924,6 +1003,21 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Unauthorized": {
|
||||
"description": "Missing, invalid, or expired credentials.",
|
||||
"headers": {
|
||||
"WWW-Authenticate": {
|
||||
"$ref": "#/components/headers/WWWAuthenticate"
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Problem"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"NotModified": {
|
||||
"description": "Not modified.",
|
||||
"headers": {
|
||||
|
|
@ -942,21 +1036,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Unauthorized": {
|
||||
"description": "Missing, invalid, or expired credentials.",
|
||||
"headers": {
|
||||
"WWW-Authenticate": {
|
||||
"$ref": "#/components/headers/WWWAuthenticate"
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Problem"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"PayloadTooLarge": {
|
||||
"description": "The request body is too large (`payload_too_large`).",
|
||||
"content": {
|
||||
|
|
@ -1047,14 +1126,14 @@
|
|||
}
|
||||
},
|
||||
"headers": {
|
||||
"ETag": {
|
||||
"description": "Entity tag for `If-None-Match` revalidation.",
|
||||
"WWWAuthenticate": {
|
||||
"description": "RFC 6750 Bearer challenge, for example `Bearer error=\"insufficient_scope\", scope=\"read\"`.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"WWWAuthenticate": {
|
||||
"description": "RFC 6750 Bearer challenge, for example `Bearer error=\"insufficient_scope\", scope=\"read\"`.",
|
||||
"ETag": {
|
||||
"description": "Entity tag for `If-None-Match` revalidation.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ info:
|
|||
version: 1.0.0
|
||||
description: |
|
||||
Navidrome API v1. Spec-first, additive within v1. Clients discover implemented
|
||||
capability modules through `GET /server` and never sniff versions.
|
||||
capability modules through `GET /capabilities` and never sniff versions.
|
||||
|
||||
Enums are open: new values may be added to any enum within v1. Clients must
|
||||
accept values they do not recognise instead of failing.
|
||||
|
|
@ -40,8 +40,7 @@ paths:
|
|||
summary: Describe the server
|
||||
description: |
|
||||
Returns the public server description. No authentication required.
|
||||
Authenticated requests will additionally receive the implemented capability modules
|
||||
once authentication is available.
|
||||
Capability modules are listed by `GET /capabilities`.
|
||||
responses:
|
||||
'200':
|
||||
description: Server description.
|
||||
|
|
@ -51,6 +50,23 @@ paths:
|
|||
$ref: '#/components/schemas/ServerInfo'
|
||||
'500':
|
||||
$ref: '#/components/responses/InternalError'
|
||||
/capabilities:
|
||||
get:
|
||||
operationId: getCapabilities
|
||||
x-module: core
|
||||
x-stability-level: alpha
|
||||
tags: [server]
|
||||
summary: List implemented capability modules
|
||||
description: The capability modules this server implements. Any valid access token may read it, whatever its scopes.
|
||||
security: [{bearerAuth: []}]
|
||||
responses:
|
||||
'200':
|
||||
description: Implemented modules.
|
||||
content:
|
||||
application/json:
|
||||
schema: {$ref: '#/components/schemas/Capabilities'}
|
||||
'401': {$ref: '#/components/responses/Unauthorized'}
|
||||
'500': {$ref: '#/components/responses/InternalError'}
|
||||
/openapi.json:
|
||||
get:
|
||||
operationId: getOpenAPISpecJSON
|
||||
|
|
@ -342,12 +358,19 @@ components:
|
|||
type: boolean
|
||||
description: True until the first admin user has been created.
|
||||
loginMethods:
|
||||
type: array
|
||||
description: Login methods this server accepts. New methods may be added; clients ignore values they do not recognise.
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- password
|
||||
$ref: '#/components/schemas/LoginMethods'
|
||||
LoginMethods:
|
||||
type: object
|
||||
description: |
|
||||
Login methods this server accepts, keyed by method. A missing key means the method is not offered.
|
||||
Keys are optional on purpose: discovery is read by clients of any version against servers of any
|
||||
version, so new methods are added as new optional keys. Clients ignore keys they do not know.
|
||||
properties:
|
||||
password:
|
||||
$ref: '#/components/schemas/PasswordLoginMethod'
|
||||
PasswordLoginMethod:
|
||||
type: object
|
||||
description: Username and password login (`POST /auth/login`). No settings yet.
|
||||
Problem:
|
||||
type: object
|
||||
description: RFC 9457 problem details, returned for every 4xx and 5xx response.
|
||||
|
|
@ -409,6 +432,35 @@ components:
|
|||
message:
|
||||
type: string
|
||||
description: Why the value was rejected.
|
||||
Capabilities:
|
||||
type: object
|
||||
description: |
|
||||
Capability modules this server implements, keyed by module. Keys are optional; a missing key means the
|
||||
module is not implemented. New modules are added as new optional keys. These are server facts, not what
|
||||
the calling token may use.
|
||||
properties:
|
||||
core:
|
||||
$ref: '#/components/schemas/CoreCapability'
|
||||
password:
|
||||
$ref: '#/components/schemas/PasswordCapability'
|
||||
CoreCapability:
|
||||
type: object
|
||||
description: The mandatory core module.
|
||||
required:
|
||||
- version
|
||||
properties:
|
||||
version:
|
||||
type: integer
|
||||
description: Module version. Bumped only on semantic change.
|
||||
PasswordCapability:
|
||||
type: object
|
||||
description: The password login module (login, first-admin setup, password change).
|
||||
required:
|
||||
- version
|
||||
properties:
|
||||
version:
|
||||
type: integer
|
||||
description: Module version. Bumped only on semantic change.
|
||||
TokenRequest:
|
||||
type: object
|
||||
description: Optional narrowing of a new access token.
|
||||
|
|
@ -654,6 +706,15 @@ components:
|
|||
application/problem+json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Problem'
|
||||
Unauthorized:
|
||||
description: Missing, invalid, or expired credentials.
|
||||
headers:
|
||||
WWW-Authenticate:
|
||||
$ref: '#/components/headers/WWWAuthenticate'
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Problem'
|
||||
NotModified:
|
||||
description: Not modified.
|
||||
headers:
|
||||
|
|
@ -665,15 +726,6 @@ components:
|
|||
application/problem+json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Problem'
|
||||
Unauthorized:
|
||||
description: Missing, invalid, or expired credentials.
|
||||
headers:
|
||||
WWW-Authenticate:
|
||||
$ref: '#/components/headers/WWWAuthenticate'
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Problem'
|
||||
PayloadTooLarge:
|
||||
description: "The request body is too large (`payload_too_large`)."
|
||||
content:
|
||||
|
|
@ -733,11 +785,11 @@ components:
|
|||
maximum: 2000
|
||||
default: 100
|
||||
headers:
|
||||
ETag:
|
||||
description: Entity tag for `If-None-Match` revalidation.
|
||||
schema:
|
||||
type: string
|
||||
WWWAuthenticate:
|
||||
description: 'RFC 6750 Bearer challenge, for example `Bearer error="insufficient_scope", scope="read"`.'
|
||||
schema:
|
||||
type: string
|
||||
ETag:
|
||||
description: Entity tag for `If-None-Match` revalidation.
|
||||
schema:
|
||||
type: string
|
||||
|
|
|
|||
10
api/openapi/components/schemas/Capabilities.yaml
Normal file
10
api/openapi/components/schemas/Capabilities.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
type: object
|
||||
description: |
|
||||
Capability modules this server implements, keyed by module. Keys are optional; a missing key means the
|
||||
module is not implemented. New modules are added as new optional keys. These are server facts, not what
|
||||
the calling token may use.
|
||||
properties:
|
||||
core:
|
||||
$ref: ./CoreCapability.yaml
|
||||
password:
|
||||
$ref: ./PasswordCapability.yaml
|
||||
5
api/openapi/components/schemas/CoreCapability.yaml
Normal file
5
api/openapi/components/schemas/CoreCapability.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
type: object
|
||||
description: The mandatory core module.
|
||||
required: [version]
|
||||
properties:
|
||||
version: {type: integer, description: Module version. Bumped only on semantic change.}
|
||||
8
api/openapi/components/schemas/LoginMethods.yaml
Normal file
8
api/openapi/components/schemas/LoginMethods.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
type: object
|
||||
description: |
|
||||
Login methods this server accepts, keyed by method. A missing key means the method is not offered.
|
||||
Keys are optional on purpose: discovery is read by clients of any version against servers of any
|
||||
version, so new methods are added as new optional keys. Clients ignore keys they do not know.
|
||||
properties:
|
||||
password:
|
||||
$ref: ./PasswordLoginMethod.yaml
|
||||
5
api/openapi/components/schemas/PasswordCapability.yaml
Normal file
5
api/openapi/components/schemas/PasswordCapability.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
type: object
|
||||
description: The password login module (login, first-admin setup, password change).
|
||||
required: [version]
|
||||
properties:
|
||||
version: {type: integer, description: Module version. Bumped only on semantic change.}
|
||||
2
api/openapi/components/schemas/PasswordLoginMethod.yaml
Normal file
2
api/openapi/components/schemas/PasswordLoginMethod.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
type: object
|
||||
description: Username and password login (`POST /auth/login`). No settings yet.
|
||||
|
|
@ -15,8 +15,4 @@ properties:
|
|||
type: boolean
|
||||
description: True until the first admin user has been created.
|
||||
loginMethods:
|
||||
type: array
|
||||
description: Login methods this server accepts. New methods may be added; clients ignore values they do not recognise.
|
||||
items:
|
||||
type: string
|
||||
enum: [password]
|
||||
$ref: ./LoginMethods.yaml
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ info:
|
|||
version: 1.0.0
|
||||
description: |
|
||||
Navidrome API v1. Spec-first, additive within v1. Clients discover implemented
|
||||
capability modules through `GET /server` and never sniff versions.
|
||||
capability modules through `GET /capabilities` and never sniff versions.
|
||||
|
||||
Enums are open: new values may be added to any enum within v1. Clients must
|
||||
accept values they do not recognise instead of failing.
|
||||
|
|
@ -32,6 +32,8 @@ tags:
|
|||
paths:
|
||||
/server:
|
||||
$ref: ./paths/server.yaml
|
||||
/capabilities:
|
||||
$ref: ./paths/capabilities.yaml
|
||||
/openapi.json:
|
||||
$ref: ./paths/openapi.yaml#/json
|
||||
/openapi.yaml:
|
||||
|
|
|
|||
16
api/openapi/paths/capabilities.yaml
Normal file
16
api/openapi/paths/capabilities.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
get:
|
||||
operationId: getCapabilities
|
||||
x-module: core
|
||||
x-stability-level: alpha
|
||||
tags: [server]
|
||||
summary: List implemented capability modules
|
||||
description: The capability modules this server implements. Any valid access token may read it, whatever its scopes.
|
||||
security: [{bearerAuth: []}]
|
||||
responses:
|
||||
'200':
|
||||
description: Implemented modules.
|
||||
content:
|
||||
application/json:
|
||||
schema: {$ref: ../components/schemas/Capabilities.yaml}
|
||||
'401': {$ref: ../components/responses/Unauthorized.yaml}
|
||||
'500': {$ref: ../components/responses/InternalError.yaml}
|
||||
|
|
@ -7,8 +7,7 @@ get:
|
|||
summary: Describe the server
|
||||
description: |
|
||||
Returns the public server description. No authentication required.
|
||||
Authenticated requests will additionally receive the implemented capability modules
|
||||
once authentication is available.
|
||||
Capability modules are listed by `GET /capabilities`.
|
||||
responses:
|
||||
'200':
|
||||
description: Server description.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue