iheartradio / play-swagger

Swagger spec generator for play framework
Apache License 2.0
403 stars 131 forks source link

Match a default value of "null" to JsNull #568

Closed Nezisi closed 1 year ago

Nezisi commented 1 year ago

A route with a null default parameter (for example: "parameter: java.lang.Boolean ?= null") leads to an IllegalArgumentException: [error] stack trace is suppressed; run last swagger for the full output [error] (swagger) java.lang.IllegalArgumentException: For input string: "null" [error] Total time: 10 s, completed May 5, 2023, 9:40:12 AM

The IllegalArgumentException occurs as the string value "null" cannot be cast to JsBoolean (value.toBoolean).

While working out a fix, I stumbled upon: https://github.com/iheartradio/play-swagger/issues/132

This should resolve both issues – an unquoted string (?= null) will be cast to JsNull, a quoted string (?= "null") will be treated as-is.

Nezisi commented 1 year ago

@Javakky-pxv Could you take a look at it, please? :pray:

Javakky-pxv commented 1 year ago

@Nezisi Sorry for missing the PR here. Sorry for the inconvenience, but we are having problems with deploy, so this release will take a little more time 🙇

Nezisi commented 1 year ago

:+1: That was faster than I expected ;) :)

Thanks a lot!