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

extension in utoipa::path response #1255

Open
francis2tm opened this issue Dec 23, 2024 · 2 comments
Open

extension in utoipa::path response #1255

francis2tm opened this issue Dec 23, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@francis2tm
Copy link

Hello! First of all - Amazing project.

I need a way for my openapi to look like this:

  /v1/my/path:
    post:
      responses:
        '200':
          description: My Endpoint
          content:
            text/event-stream:
              x-my-extension: "[DONE]"
              schema:
                $ref: '#/components/schemas/MyEndpointResponse'

Currently, I cannot find a away to insert an extension in the response, like x-my-extension: "[DONE]" in my example.

Is there a way to do this?

Thanks in advance

@juhaku
Copy link
Owner

juhaku commented Jan 2, 2025

At the moment there are no direct support for extensions in utoipa::path attribute macro. And only way to add those is manually via Modify trait or otherwise edit the OpenApi before serving. The response itself does support extensions https://docs.rs/utoipa/latest/utoipa/openapi/response/struct.Response.html but it is a bit convoluted to add one for now.

@juhaku
Copy link
Owner

juhaku commented Jan 2, 2025

Related #1228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants