diff --git a/api/src/test/kotlin/com/few/api/web/controller/helper/PayloadDocumentationExtension.kt b/api/src/test/kotlin/com/few/api/web/controller/helper/PayloadDocumentationExtension.kt new file mode 100644 index 000000000..d7b24f436 --- /dev/null +++ b/api/src/test/kotlin/com/few/api/web/controller/helper/PayloadDocumentationExtension.kt @@ -0,0 +1,29 @@ +package com.few.api.web.controller.helper + +import org.springframework.restdocs.payload.FieldDescriptor +import org.springframework.restdocs.payload.JsonFieldType + +fun FieldDescriptor.fieldWithObject(description: String): FieldDescriptor { + return this.type(JsonFieldType.OBJECT).description(description) +} + +fun FieldDescriptor.fieldWithArray(description: String): FieldDescriptor { + return this.type(JsonFieldType.ARRAY).description(description) +} + +fun FieldDescriptor.fieldWithString(description: String): FieldDescriptor { + return this.type(JsonFieldType.STRING).description(description) +} + +fun FieldDescriptor.fieldWithNumber(description: String): FieldDescriptor { + return this.type(JsonFieldType.NUMBER).description(description) +} + +fun FieldDescriptor.fieldWithBoolean(description: String): FieldDescriptor { + return this.type(JsonFieldType.BOOLEAN).description(description) +} + +fun FieldDescriptor.fieldWithNull(description: String): FieldDescriptor { + return this.type(JsonFieldType.NULL).description(description) +} +class PayloadDocumentationExtension \ No newline at end of file