Automatically document required roles in OpenAPI specifications
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- java, openapi
- Ambito
- api, documentation
Direzione di ricerca
Read ManagerWebService.getOpenApiResource() and the resolve configuration in manager/build.gradle to trace runtime and build time OpenAPI generation. Then inspect the JAX-RS resources for @RolesAllowed, including inherited annotations, and check how Swagger Core exposes operations to Swagger UI. Done when both generation paths show the required roles while preserving the existing distinction between roles and OAuth2 scopes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
Currently, the generated OpenAPI specifications don't document which roles are required to access individual endpoints, even though these roles are already defined using @RolesAllowed annotations on the JAX-RS resources.
We could use a custom Swagger Core OpenApiReader (configured via readerClass) to automatically extract these roles and include them in the operation descriptions and/or as an OpenAPI extension (e.g. x-roles-allowed).
For example, @RolesAllowed(Constants.READ_ADMIN_ROLE) could produce:
get:
description: |
Retrieve the health status of the system.
**Allowed roles:** `read:admin`
x-roles-allowed:
- read:admin
Configuration
The custom reader should be configured for both runtime and build-time OpenAPI generation.
Runtime generation — ManagerWebService.getOpenApiResource():
SwaggerConfiguration oasConfig =
new SwaggerConfiguration()
.resourcePackages(Set.of("org.openremote.model.*"))
.openAPI(loadOpenApiBase())
.readerClass(RolesOpenApiReader.class.getName())
.defaultResponseCode("200");
Build-time generation — manager/build.gradle:
resolve {
// Existing configuration...
readerClass = 'org.openremote.manager.web.RolesOpenApiReader'
}
These are illustrative configuration snippets; the custom reader still needs to be implemented.
Acceptance criteria
- Automatically extract roles from method-level and class-level
@RolesAllowedannotations, including inherited annotations. - Include the roles in operation descriptions and/or as an
x-roles-allowedextension. - Ensure the roles are visible in Swagger UI.
- Support both runtime generation in
ManagerWebServiceand build-time generation using the Gradleresolvetask. - Preserve the existing authentication and authorization behavior, including the distinction between roles and OAuth2 scopes.
- Avoid duplicating role information in OpenAPI-specific annotations.
- Lingua principale
- Java
- Stelle
- 1.9k
- Fork
- 478
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openremote/openremote
-
Infrastructure
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
openremote/openremote#3502 ·
-
Bug Gateways
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
openremote/openremote#3457 · 1 commento ·
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
openremote/openremote#3439 ·
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
openremote/openremote#3438 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
openremote/openremote#3278 · 3 commenti ·
Tutte le issue di openremote/openremote
Issue simili
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 70/100
Vakore/ZappierGames#248 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
thelastpickle/cassandra-reaper#1748 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
A proxy that fails to start logs a RejectedExecutionException stack trace from its shutdown hookApertafollow-up
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Sanne/incus-spawn#1953 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
OneBusAway/maglev#1917 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni