You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -253,6 +253,9 @@ Currently the following constraints are considered when generating JsonSchema fr
253
253
-forString fields annotated with `NotEmpty`, and `NotBlank` the `minLength` constraint in JsonSchema is set to 1
254
254
-forString fields annotated with `Length` the `minLength` and `maxLength` constraints in JsonSchema are set to the value of the corresponding attribute of the annotation
255
255
-forString fields annotated with `Pattern`, the pattern constraint is propagated to JsonSchema
256
+
-forNumber fields annotated with `Min`, the `minimum` constraint is propagated to JsonSchema
257
+
-forNumber fields annotated with `Max`, the `maximum` constraint is propagated to JsonSchema
258
+
-forNumber fields annotated with `Size` the `minimum` and `maximum` constraints in JsonSchema are set to the value of the corresponding attribute of the annotation
256
259
257
260
If you already have your own `ConstraintFields` implementation you can also add the logic from `com.epages.restdocs.apispec.ConstrainedFields` to your own class.
258
261
Here it is important to add the constraints under the key `validationConstraints` into the attributes map if the `FieldDescriptor`.
Copy file name to clipboardExpand all lines: restdocs-api-spec-jsonschema/src/main/kotlin/com/epages/restdocs/apispec/jsonschema/JsonSchemaFromFieldDescriptorsGenerator.kt
Copy file name to clipboardExpand all lines: restdocs-api-spec-jsonschema/src/test/kotlin/com/epages/restdocs/apispec/jsonschema/JsonSchemaFromFieldDescriptorsGeneratorTest.kt
0 commit comments