Skip to content
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

Feat support Option [T] ? = None #458

Merged
merged 2 commits into from
Jun 27, 2022
Merged

Conversation

Javakky-pxv
Copy link
Collaborator

#136

Why do it?

Using variable: Option[T] ? = None in the routes file will result in the following error.

java.lang.IllegalArgumentException: For input string: "None"

Such code may be used to simplify redirection calls.

Redirect(routes.DefaultValueParam.put())

examples

Set up the routes file as follows.

PUT /defaultValueParamOptionalString com.iheart.controllers.DefaultValueParam.put(optionFlag:Option[String] ?= None)

The generated swagger.json will look like this.

{"operationId":"put","tags":["students"],"parameters":[{"in":"query","name":"optionFlag","type":"string","required":false,"x-nullable":true}]}

Copy link
Collaborator

@kailuowang kailuowang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kailuowang kailuowang merged commit f1682a9 into iheartradio:master Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants