Ktor-OpenAPI-Generator icon indicating copy to clipboard operation
Ktor-OpenAPI-Generator copied to clipboard

@Hidden annotation for fields in request / response body

Open frynet opened this issue 1 year ago • 2 comments

I've already added annotation @get:JsonIgnore for my fields. It works fine for runtime requests / responses.

But I need to hide some fields in swagger doc for not misleading frontend-developers. (Those fields also marked as required).

I've already tried to find any solution for my issue in this repository but not found.

frynet avatar Sep 09 '22 06:09 frynet

There isn't such a feature. In theory it would't be too complicated to add an annotation to condition spec generation.

Wicpar avatar Sep 22 '22 16:09 Wicpar

https://github.com/papsign/Ktor-OpenAPI-Generator/blob/8e207b4d700c361fee7fbc490f6c1def47798e60/src/main/kotlin/com/papsign/ktor/openapigen/route/OpenAPIRoute.kt#L47

this is the relevant logic to be eliminated i believe, however there may be side effects if the relevant modules use this for initialization. Maybe a per-module logic may be wiser to allow for modular implementation of the feature.

Wicpar avatar Sep 22 '22 16:09 Wicpar