Skip to content

echo strict server when content-type is Text/plain #1676

Closed

Description

@elodieapiou

This previous problem has created a new problem for echo strict #1132

I create an api response with a header and a "text/plain" content.
When my api is generated with oapi-codegen, my response is malformed.
Instead of creating a structure containing my header and content, it only creates a string.

i use the version v1.13.0, which is deprecated. From v1.13.1 to v2.2.0, api does not generate correctly.

Here is my code:

file openapi.yml, my response to be generated

Capture d’écran 2024-07-02 à 10 36 31

What i want (generated with the version v1.13.0)

Capture d’écran 2024-07-02 à 10 40 14

What i have (generated with the version v2.2.0)

Capture d’écran 2024-07-02 à 10 41 12

I think the problem may be here : https://github.com/oapi-codegen/oapi-codegen/blob/v2.2.0/pkg/codegen/templates/strict/strict-interface.tmpl#L42

Capture d’écran 2024-07-02 à 11 22 05

I'm blocked.

Thank you

Activity

  1. berthierpe commented on Jul 2, 2024

    @berthierpe

    I have the same issue

  2. jamietanna commented on Jul 3, 2024

    @jamietanna
    Member

    Ooh that's an interesting bug, thanks for reporting! Yep that doesn't look right - we should be preserving other parts of the type, like the headers

  3. added this to the v2.4.0 milestone on Jul 3, 2024
  4. added
    bug
    on Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugserver:strict

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions