-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Discussion: Ignoring properties #184
Comments
Sorry for late response, I didn't notice this issue.
@OpenApiIgnore
@JacksonAnnotationsInside
@JsonIgnore
annotation class IgnoreInJacksonAndOpenApi or with some custom handler in our scripting API. |
No worries, and thanks for the reply. No, we do not use I guess then this might be a bug: We do have the following setup: interface IMyLittleMoreThanPojo {
val propertyWeWantInTheApi: ISomeType
val propertyWeDontWant: IOtherType
}
data class ApiMyLittleMoreThanPojo(
override val propertyWeWantInTheApi = ApiSomeType()
) : IMyLittleMoreThanPojo {
@JsonIgnore
override lateinit var propertyWeDontWant: ApiOtherType
internal set
} : This setup then results in the following OpenApi JSON: "ApiMyLittleMoreThanPojo": {
"type": "object",
"additionalProperties": false,
"properties":{
"propertyWeWantInTheApi": {
"$ref":"#/components/schemas/ApiSomeType"
},
"propertyWeDontWant":{
"$ref":"#/components/schemas/ApiOtherType"
}
},
"required":["propertyWeWantInTheApi", "propertyWeDontWant"]
} Due to our setup, we cannot use |
Oh, that's a property, not a field - I thought you're using Java, not Kotlin. You should annotate this with site target, like that: @get:OpenApiIgnore
val propertyWeDontWant: IOtherType |
Thanks for pointing this out! I wasn't aware of site targeted annotations and my apologies for not properly label this as a kotlin problem. |
There's a nice plugin that can simplify this btw: #171 |
When using javalin, one way to handle serialization / deserialization could be done by Jackson and thus, properties that should be ignored are annotated with
@JsonIgnore
.Unfortunately, the openapi plugin corresponding annotation,
@OpenApiIgnore
is not applicable toFIELD
, as@JsonIgnore
is.My thoughts on this are as follows:
@OpenApiIgnore
is configured to not targetFIELD
s? And if not, could we expand the target list accordingly?@JsonIgnore
annotated elements?Thanks in advance!
The text was updated successfully, but these errors were encountered: