papsign / Ktor-OpenAPI-Generator

Ktor OpenAPI/Swagger 3 Generator
Apache License 2.0
241 stars 42 forks source link

Example Project #80

Closed juliocesarsantos1020 closed 3 years ago

juliocesarsantos1020 commented 3 years ago

Do you have a project where I can better understand how to use this library?

SimonBrodtmann commented 3 years ago

I guess it would suffice if the examples weren't so minimalistic. Just add a complete example here and there. Not just one line. One thing I'm currently struggling with:

route("{str}") {
    get<StringParam, ResponseType> { params ->  // get request on '/{str}', str will be the string 
        respond(ResponseType(...))
    }
}

No context around it and, most important, "ResponseType(...)". Common. Make it a real example. Tell me how you access the value of "str". As someone new to Kotlin it's a real struggle with such minimalistic examples.

Besides that, I want to say thank you for this library. I'm very happy with the things that I already got to work.

Wicpar commented 3 years ago

I don't really know how to make it more explicit, making documentation is not my strong suit, String param is the param object, here with a simple string, populated from the request parameters. The response type is the type that is serialized when you send a response with the respond function.

Wicpar commented 3 years ago

@juliocesarsantos1020 see the test folder, you have multiple files with a full example, some more complex than the other

SerVB commented 3 years ago

@juliocesarsantos1020 , you can check my project out: https://github.com/SerVB/e-shop

@Wicpar , maybe it's worth adding something like "showcase" section to the README, to link projects that use Ktor-OpenAPI-Generator?

Wicpar commented 3 years ago

@SerVB sure, you can do a PR for that section at the bottom of the readme.