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

Response Type only working if array #19

Open
FNG-2002 opened this issue Dec 11, 2023 · 1 comment
Open

Response Type only working if array #19

FNG-2002 opened this issue Dec 11, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@FNG-2002
Copy link

FNG-2002 commented Dec 11, 2023

Hello, I encountered following problem.

I have following DTO:

struct GetStudentDTO: Content {
    var id: UUID
    var courseOfStudy: String
    var email: String
}

And following route:

student.get("me", use: getMe)
            .openAPI(
                summary: "[Student] Get me object",
                description: "This route returns general information about the student.",
                response: .type(GetStudentDTO.self),
                auth: .bearer()
            )

But in Swagger I don't see a response type.
grafik

But if the response type is an array it does work.

student.get("me", use: getMe)
            .openAPI(
                summary: "[Student] Get me object",
                description: "This route returns general information about the student.",
                response: .type([GetStudentDTO].self),
                auth: .bearer()
            )

grafik

Can you please help me with that?
Thanks in advance

@dankinsoid dankinsoid self-assigned this Dec 20, 2023
@dankinsoid dankinsoid added the bug Something isn't working label Dec 20, 2023
@dankinsoid
Copy link
Owner

dankinsoid commented Dec 20, 2023

@FNG-2002 Hi! I'm unable to reproduce the bug, is your GetStudentDTO exactly the same as in the description?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants