@@ -26,25 +26,29 @@ object SwaggerScalaModelConverter {
2626 val objectMapper : ObjectMapper = Json .mapper().registerModule(DefaultScalaModule )
2727 private var requiredBasedOnAnnotation = true
2828
29- /** [[io.swagger.v3.oas.annotations.media.Schema ]] annotation has required = [[false ]] by default
30- * This means that all fields that aren't [[Option ]] will, counter to what you would expect based on the type,
31- * <b>not</b> be required by default.
32- * If this behavior is undesired, set [[SwaggerScalaModelConverter.setRequiredBasedOnAnnotation ]] to [[true ]]
33- * and the required property on the annotation will be ignored, unless the field is an [[Option ]].
29+ /** If you use swagger annotations to override what is automatically derived, then be aware that
30+ * [[io.swagger.v3.oas.annotations.media.Schema ]] annotation has required = [[false ]], by default. You are advised to set the required
31+ * flag on this annotation to the correct value. If you would prefer to have the Schema annotation required flag ignored and to rely on
32+ * the this module inferring the value (as ot would if you don't annotate the classes or fields), then set
33+ * [[SwaggerScalaModelConverter.setRequiredBasedOnAnnotation ]] to [[true ]] and the required property on the annotation will be ignored,
34+ * unless the field is an [[Option ]].
3435 *
35- * @param value true by default
36+ * @param value
37+ * true by default
3638 */
3739 def setRequiredBasedOnAnnotation (value : Boolean = true ): Unit = {
3840 requiredBasedOnAnnotation = value
3941 }
4042
41- /** [[io.swagger.v3.oas.annotations.media.Schema ]] annotation has required = [[false ]] by default
42- * This means that all fields that aren't [[Option ]] will, counter to what you would expect based on the type,
43- * <b>not</b> be required by default.
44- * If this behavior is undesired, set [[SwaggerScalaModelConverter.setRequiredBasedOnAnnotation ]] to [[true ]]
45- * and the required property on the annotation will be ignored, unless the field is an [[Option ]].
43+ /** If you use swagger annotations to override what is automatically derived, then be aware that
44+ * [[io.swagger.v3.oas.annotations.media.Schema ]] annotation has required = [[false ]], by default. You are advised to set the required
45+ * flag on this annotation to the correct value. If you would prefer to have the Schema annotation required flag ignored and to rely on
46+ * the this module inferring the value (as ot would if you don't annotate the classes or fields), then set
47+ * [[SwaggerScalaModelConverter.setRequiredBasedOnAnnotation ]] to [[true ]] and the required property on the annotation will be ignored,
48+ * unless the field is an [[Option ]].
4649 *
47- * @return value: true by default
50+ * @return
51+ * value: true by default
4852 */
4953 def isRequiredBasedOnAnnotation : Boolean = requiredBasedOnAnnotation
5054}
0 commit comments