Comments (5)
i will add such a mechanism as it is part of the standard.
until then you can use the new branch with the reworked models. null fields are now filtered when you use OpenAPIModel.build()
it will generate the appropriate hashmaps and remove empty and null values
from ktor-openapi-generator.
you can specify it per request like this:
get<Unit, Response>(example = Response(...)) {
}
post<Unit, Response, Request>(
exampleRequest = Request(...),
exampleResponse = Response(...)
) { params, request ->
}
No mechanism exists yet to provide examples per model globally.
from ktor-openapi-generator.
Yeah, I use examples for methods. I'm not an experienced user of OpenAPI, so I don't know if examples of fields are also usually defined...
If yes, I want an opportunity to define them.
If no, just remove these "example" fields.
from ktor-openapi-generator.
Added @WithExample
in the latest commit.
SwagerUI doesn't handle it properly anyway.
@WithExample
class C(val l: @Clamp(0, 10) Long) : Base() {
companion object: ExampleProvider<C> {
override val example: C? = C(5)
}
}
or
@WithExample(CExampleProvider::class)
class C(val l: @Clamp(0, 10) Long) : Base()
...
object CExampleProvider: ExampleProvider<C> {
override val example: C? = C(5)
}
from ktor-openapi-generator.
implementation 'com.github.papsign:Ktor-OpenAPI-Generator:0.2-beta.0-experimental'
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.