Comments (25)
Laying traps for unsuspecting developers so you can get PR's of them. Genius!
I'm not exactly bristling with free time myself, but let me look at it.
from ktor-openapi-generator.
Hi,
Thank you for this issue, i know this would happen eventually.
Currently only primitive types are implemented since i use the jackson parser as a quick fix, there are no standard parsers for the query parameter standards as far as i know, and the query parameter standards are quite wonky as well.
Here is the spec:
https://swagger.io/docs/specification/serialization/
Here is the relevant function to change the behavior:
https://github.com/papsign/Ktor-OpenAPI-Generator/blob/master/src/main/kotlin/com/papsign/ktor/openapigen/route/OpenAPIRoute.kt#L74
I am quite busy on another project at the moment, feel free to make a pull request, but once finished i can work on it.
from ktor-openapi-generator.
Haha.
I found a library that seems to decode RFC 6570 templates
damnhandy/Handy-URI-Templates#54
I'll see if i can implement it rapidly.
I wanted to avoid implementing the entire RFC from scratch, but if a library gets the job done the modifications are a matter of a few hours at most.
from ktor-openapi-generator.
Good and bad news...
I can't use the library as is, but i can frankenstein in the proper parsing behavior.
from ktor-openapi-generator.
After all implementing it from scratch seems a lot faster now.
I think i can get it done by 15:00 GMT+2
from ktor-openapi-generator.
Do you intend to let us specify how parameters have to be encoded? Or will you just accept anything the client throws at you?
from ktor-openapi-generator.
You will have to specify, defaults being according to the openapi spec, but i will try to make it parse anything you throw at it.
Some collisions are possible, they will be caught during startup.
from ktor-openapi-generator.
I Have finished implementing the primitives:
implementation 'com.github.papsign:Ktor-OpenAPI-Generator:experimental-parameters-a35e1a0143-1'
i will be adding collections and object support very soon
from ktor-openapi-generator.
Wow, you're on fire!
I'll build your branch and see how that works for my usecase. It's really simple, I just need a list of longs, so that shouldn't be a problem. I'll let you know asap.
from ktor-openapi-generator.
I am working on the lists and arrays, it's a little trickier than primitives.
from ktor-openapi-generator.
Just a brainfart. Shouldn't RFC 6570 be implemented as a format for kotlinx-serialization?
from ktor-openapi-generator.
nope, ktor doesn't support RFC 6570 parsing, and no library is made to properly parse individual parameters...
from ktor-openapi-generator.
lists have been added, you can build the latest changes on jitpack
from ktor-openapi-generator.
objects are next, but i think i will limit the support to data classes in the beginning...
It should not be too complicated to extend afterwards.
Once that is done i'll clean the whole mess.
from ktor-openapi-generator.
Deep object support has been added. It does not support empty indices for arrays.
Path param objects and form objects are still missing.
Appropriate errors are thrown on startup if anything is not implemented.
from ktor-openapi-generator.
Hi, I've been trying to use your branch but it's not yet working for me.
Firstly I think you need a 'maven' or 'maven-publish' plugin in gradle to actually generate a pom. The jitpack artifact is only a jar without transitive dependencies. I'm not good with gradle so I'm not sure that is how to fix it.
After adding those dependencies manually (reflections and swagger.js) I get a swagger interface, but my List is still seen as a singular Long.
Possibly I'm missing some dependencies.
from ktor-openapi-generator.
If the main library works the test branch should work as well...
I'm not quite sure how jitpack works but i am able to use it without declaring those other dependencies.
here is the config:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "ch.qos.logback:logback-classic:$logback_version"
implementation "io.ktor:ktor-server-core:$ktor_version"
implementation "io.ktor:ktor-server-host-common:$ktor_version"
implementation "io.ktor:ktor-metrics:$ktor_version"
implementation "io.ktor:ktor-server-sessions:$ktor_version"
implementation "io.ktor:ktor-server-netty:$ktor_version"
implementation "io.ktor:ktor-jackson:$ktor_version"
implementation 'com.github.papsign:Ktor-OpenAPI-Generator:experimental-parameters-SNAPSHOT'
}
from ktor-openapi-generator.
@sheepdreamofandroids It's over, it's done...
The code is now up to spec and in a clean and maintainable state.
I am merging the branch soon after integration testing.
from ktor-openapi-generator.
I have merged the changes into master and made a release.
from ktor-openapi-generator.
I'm trying to use this in my own project and it just doesn't work.
At the same time I created a testcase within your project which works flawlessly.
I've not been able to figure out exactly what is the difference. Mostly because I've been in meetings way more than programming.
Just to let you know why I didn't react yet.
from ktor-openapi-generator.
Alright.
On my side we successfully updated the dependency simply by setting the version to the new release in the project configuration.
Make sure you are also up to date with the kotlin plugin.
from ktor-openapi-generator.
Hi, I had weird effects. First everything worked as expected except for the array parameter and the fact that I couldn't debug my project in Intellij, it would freeze completely.
Now I just upgraded to the latest kotlin plugin (1.3.70) and did the same with the ktor dependency (1.3.2) and now nothing really works anymore.
I'm assuming that is because of the different ktor versions. Is there a particular reason you stick with 1.2.6? I'm quite new to using ktor, so if I'm upgrading too fast, I really like to know.
from ktor-openapi-generator.
No reason the ktor version is not updated.
Try to use the release version as dependencies, snapshots might break regularly.
I'll update the ktor version asap.
from ktor-openapi-generator.
updated version. https://github.com/papsign/Ktor-OpenAPI-Generator/releases/tag/0.1-beta.2
from ktor-openapi-generator.
Thanks so much for the help. Now it works.
The real culprit though was the fact that we are using gson for JSON serialization instead of jackson.
from ktor-openapi-generator.
Related Issues (20)
- Problem with authentication HOT 11
- Reusable enums
- Enum parser is okay with wrong values HOT 3
- Deserialisation of List<UUID> in body fails during runtime HOT 1
- Can't set name of token parameter or cookie name in SecurityScheme
- Add response header to a route
- Default values on @QueryParam HOT 4
- Overriding a primitive converter (UUID) HOT 5
- Serializing collections of different element types is not yet supported HOT 4
- API route with Any must be a data class. HOT 4
- File upload HOT 10
- @Description annotation doesn't work HOT 3
- Is there a simple way to split the endpoints of an application in two different openapi-files? HOT 1
- @HeaderParam is adding header to request body instead of request header
- Support for Ktor 2.0.0 HOT 13
- Enum classes are generated for each usage instead of a schema that can be reused
- How to properly indicate a application/x-www-form-urlencoded response HOT 1
- @Hidden annotation for fields in request / response body HOT 2
- Suggestion for conditional validation HOT 1
- Description for response HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ktor-openapi-generator.