question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SmallRye OpenAPI includes coroutine context in schema

See original GitHub issue

Describe the bug

When using the quarkus-smallrye-openapi extension with routes that use suspend fun (Kotlin coroutines), the generated OpenAPI specification will show coroutine continuations (ContinuationSuperResponse or ContinuationSuperList) as the request body schema.

OpenAPI sample (click to expand)
---
openapi: 3.0.3
info:
  title: quarkus-kotlin-quickstart API
  version: 1.0.0-SNAPSHOT
paths:
  /fruits:
    get:
      tags:
      - Fruit Resource
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContinuationSuperList'
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Fruit'
    post:
      tags:
      - Fruit Resource
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Fruit'
      responses:
        "200":
          description: OK
  /fruits/{id}:
    get:
      tags:
      - Fruit Resource
      parameters:
      - name: id
        in: path
        required: true
        schema:
          format: int64
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContinuationSuperResponse'
      responses:
        "200":
          description: OK
    delete:
      tags:
      - Fruit Resource
      parameters:
      - name: id
        in: path
        required: true
        schema:
          format: int64
          type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContinuationSuperResponse'
      responses:
        "200":
          description: OK
components:
  schemas:
    ContinuationSuperList:
      type: object
      properties:
        context:
          $ref: '#/components/schemas/CoroutineContext'
    ContinuationSuperResponse:
      type: object
      properties:
        context:
          $ref: '#/components/schemas/CoroutineContext'
    CoroutineContext:
      type: object
    Fruit:
      type: object
      properties:
        id:
          format: int64
          type: integer
        name:
          type: string

Expected behavior

The internal continuation classes to be excluded from the generated schema.

Actual behavior

The response schema is a continuation:

paths:
  /fruits:
    get:
      tags:
      - Fruit Resource
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContinuationSuperList'

How to Reproduce?

Run https://github.com/rgmz/quarkus-kotlin-openapi-21509 and visit http://localhost:8080/q/openapi

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.4.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
MikeEdgarcommented, Nov 30, 2021

Fix incorporated with #21813

0reactions
mhmtszrcommented, Nov 28, 2021

We are having the same problem, could please say whenever it is resolved?

Read more comments on GitHub >

github_iconTop Results From Across the Web

MicroProfile OpenAPI for everyone - Quarkus
In this blog post we will look at how the SmallRye Implementation extends this with some extra features, and support for more web...
Read more >
Kotlin coroutines integration - SmallRye Mutiny
The module mutiny-kotlin provides an integration with Kotlin coroutines. There are currently four extension methods available for converting between Mutiny and ...
Read more >
Kickstart your first Quarkus application | by Hantsy - Medium
SmallRye Context Propagation quarkus-smallrye-context-propagation ... Unfortunately, the CommentResource is not included in the generated OpenAPI schema, ...
Read more >
IntelliJ IDEA 2021.3 - ComponentSource
IntelliJ IDEA has a helpful option that allows you to preview the results of intention actions and quick-fixes before applying them to your...
Read more >
Table of Contents - OpenAPI/Swagger Support
Micronaut includes support for producing OpenAPI (Swagger) YAML at ... In micronaut configuration file you can define a server context path (with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found