Skip to content

Generating different structs for different error codes #2085

Description

@VladislavYakonyuk

We use server code generation with the strict-server: true parameter. During generation, we obtain the following structures for the response

GetHealthcheck200JSONResponse{
   Timestamp: time.Now().UnixMilli(),
}

GetHealthcheck500JSONResponse{
   Timestamp: time.Now().UnixMilli(),
}

And this happens with absolutely any response, a separate structure is created for each error code specified in the API contract. We find this inconvenient, but couldn't figure out how to make a generic structure or our own wrapper. Could you suggest how to be in this situation?

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions