Closed moalshak closed 1 month ago
/cc @MikeEdgar (swagger-ui), @geoand (kotlin), @phillip-kruger (swagger-ui)
This is an OpenAPI issue (not a swagger ui one). Changing the title to reflect that.
@MikeEdgar this might need to be reported in SmallRye ?
@MikeEdgar this might need to be reported in SmallRye ?
Yeah, possibly. Let me check how this is rendered in the OpenAPI to be sure. The OpenAPI won't have an example value by default, so the example map
object shown in the screenshot may actually be generated by Swagger UI.
@moalshak , OpenAPI 3.0.x does not allow for a schema for object keys, so you will need to provide an example
in the Kotlin code for this. OpenAPI 3.1.0 (which is currently under development in smallrye-open-api) will have a propertyNames
attribute [1] for schemas which could possibly allow this to work automatically if Swagger UI supports it.
data class MyMap(
@Schema(example = "... example object here...")
val map: Map<UUID, UUID>
)
[1] https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-10.3.2.4
Closing here.
Describe the bug
When using a
UUID
as the key for a map (in a request body), the swagger UI does not generate the example body correctlyExpected behavior
An example UUID is generated just like when used in value
Actual behavior
A random "additionalPropX" is generated
How to Reproduce?
Output of
uname -a
orver
Ubuntu
Output of
java -version
17
Quarkus version or git rev
3.12.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)8.9
Additional information
No response