Mapping a custom type #2354
-
I have used smallrye-open-api to generate a schema in my quarkus app. I have used several custom types in my api eg javax.money.MonetaryAmount i have used a jackson mapping to correctly serialize/deserialise but need the api spec to match the expected format. I can modify on a per property example but a global ref to replace all occurences. @Schema(
name = "Invoice Total",
description = "Total amount for the invoice",
properties = {
@SchemaProperty(
name = "amount",
title = "Monetary amount value",
description = "The numeric value of the total amount",
type = SchemaType.STRING
),
@SchemaProperty(
name = "currency",
title = "Currency code",
description = "ISO 4217 currency code",
type = SchemaType.STRING
)
}
) I have tried implementing an OASFilter but can't see how to replace each occourence Any help appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@acraftydev have you looked at using
Of course any description that is specific to a particular occurrence of the schema still needs to be specified via |
Beta Was this translation helpful? Give feedback.
-
Thank you , I had just found the solution and was about to reply. Found it
hard to find any examples or docs as assumed this would be a common problem.
Thanks
…On Mon, 8 Sept 2025, 14:39 Michael Edgar, ***@***.***> wrote:
@acraftydev <https://github.com/acraftydev> have you looked at using
mp.openapi.schema.<FQCN> to set an application-wide schema? For example,
you can configure something like this:
mp.openapi.schema.javax.money.MonetaryAmount={\
"name": "MonetaryAmount",\
"title": "Monetary amount value",\
"type": "string"\
}
Of course any description that is specific to a particular occurrence of
the schema still needs to be specified via @Schema or using a filter.
—
Reply to this email directly, view it on GitHub
<#2354 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACOS7TAPR7ZFZHISDKAWU33RWBI7AVCNFSM6AAAAACF3RO75OVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIMZUGA4DANI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
.com>
|
Beta Was this translation helpful? Give feedback.
@acraftydev have you looked at using
mp.openapi.schema.<FQCN>
to set an application-wide schema? For example, you can configure something like this:Of course any description that is specific to a particular occurrence of the schema still needs to be specified via
@Schema
or using a filter.