micronaut-projects / micronaut-projects/micronaut-openapi
Openapi ignores securitySchemes
- Dominant language
- Java
- Stars
- 114
- Forks
- 121
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 25
Description
### Expected Behavior
When generating a project using an OpenAPI that contains security schemas, whether of type OAuth2 or Basic, the security information should be generated in the final compiled Swagger file located in `classes/META-INF/swagger/openapi`
### Actual Behaviour
Example of an input file
```yaml
openapi: 3.0.1
info:
title: Service
version: 1.0.0
paths:
/hello-abacate:
get:
tags: []
summary: oi
description: Manda um oi ao usuário e o mostra links úteis
operationId: hello
security:
- microservice_auth: [ read ]
responses:
"200":
description: Movimento incluido com sucesso
content:
application/json:
schema:
$ref: "#/components/schemas/Hello"
components:
securitySchemes:
microservice_auth:
type: "oauth2"
flows:
clientCredentials:
tokenUrl: "/proxy/oauth/token"
scopes:
read: Permite ler dados
write: Permite alterar dados
schemas:
Hello:
type: object
properties:
mensagem:
type: string
```
Output after compilation
```yaml
openapi: 3.0.1
info:
title: Service
version: 1.0.0
paths:
/hello-abacate:
get:
summary: oi
description: oi Manda um oi ao usuário e o mostra links úteis
operationId: hello
responses:
"200":
description: Movimento incluido com sucesso (status code 200)
content:
application/json:
schema:
$ref: "#/components/schemas/Hello"
components:
schemas:
Hello:
type: object
properties:
mensagem:
type: string
nullable: true
description: Hello
```
### Steps To Reproduce
1. Compile the example project
2. Check the compiled files
### Environment Information
SO: Windows 11
JDK 25
Maven 3.9.9
### Example Application
https://github.com/viniciusxyz/micronaut-openapi-multi-module
### Version
4.10.7 (Platform)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked example application and compile the provided OpenAPI input, then compare the generated classes/META-INF/swagger/openapi output with the expected securitySchemes and operation security. Trace the OpenAPI compilation path responsible for copying components and operation metadata. Done means OAuth2 and Basic security information is preserved in the compiled Swagger file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100