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
As you can see below, WorkflowDefinitionRequest has property SwitchBackBucketGroupParams[].SwitchBackBucketParams[].activity and it should not be null.
@TestvoidcreateWorkflowDefinition() throwsException {
given(workflowService.registerWorkflow(any())).willReturn(1L);
ConstrainedFieldsconstrainedFields = newConstrainedFields(WorkflowDefinitionRequest.class);
this.mockMvc
.perform(RestDocumentationRequestBuilders.post(URL_WORKFLOW)
.contentType(APPLICATION_JSON)
.content(readJson("workflowDefinitionRequest.json")))
.andExpect(status().isCreated())
.andDo(document("create-workflow-definition",
resource(ResourceSnippetParameters.builder()
.description("create test")
.requestSchema(Schema.schema("workflow create request"))
.responseSchema(Schema.schema("201 response"))
.tag(TAG_WORKFLOW_BUILD)
.requestFields(constrainedFields.withPath("name").type(JsonFieldType.STRING).description("name"),
constrainedFields.withPath("description").type(JsonFieldType.STRING).optional().description("description"),
constrainedFields.withPath("switchBackBucketGroupList").type(JsonFieldType.ARRAY).description("bucket group"),
constrainedFields.withMappedPath("switchBackBucketGroupList[].bucketType",
"switchBackBucketGroupList").type(JsonFieldType.STRING).description("type of bucket group"),
constrainedFields.withMappedPath("switchBackBucketGroupList[].description", "switchBackBucketGroupList").type(JsonFieldType.STRING).optional().description("description of bucket group"),
constrainedFields.withMappedPath("switchBackBucketGroupList[].switchBackBucketList", "switchBackBucketGroupList").type(JsonFieldType.ARRAY).description("bucket list of bucket group"),
constrainedFields.withMappedPath("switchBackBucketGroupList[].switchBackBucketList[].activity", "switchBackBucketGroupList[].switchBackBucketList[]").type(JsonFieldType.OBJECT).description("activity of bucket list"),
constrainedFields.withMappedPath("switchBackBucketGroupList[].switchBackBucketList[].activity.name", "switchBackBucketGroupList[].switchBackBucketList[].activity").type(JsonFieldType.STRING).optional().description("name of activity"),
constrainedFields.withMappedPath("switchBackBucketGroupList[].switchBackBucketList[].activity.description", "switchBackBucketGroupList[].switchBackBucketList[].activity").type(JsonFieldType.STRING).optional().description("description of activity"),
constrainedFields.withMappedPath("switchBackBucketGroupList[].switchBackBucketList[].activity.type", "switchBackBucketGroupList[].switchBackBucketList[].activity").type(JsonFieldType.STRING).description("type of activity")
.build())));
}
Generated openapi-3.0.yml file. As you can see below, author should be required but it doesn't show up in the required fields.
components:
schemas:
workflow create request:
title: workflow create requestrequired:
- name
- switchBackBucketGroupListtype: objectproperties:
name:
minLength: 1type: stringdescription: namedefDescription:
type: stringdescription: definition descriptionswitchBackBucketGroupList:
type: arraydescription: bucket groupitems:
required:
- bucketType
- description // 'switchBackBucketGroupList' is a required object, 'switchBackBucketGroupList.description' is not a required field, but 'switchBackBucketGroupList.description' is exposed as a required field
- switchBackBucketListtype: objectproperties:
switchBackBucketList:
type: arraydescription: bucket list of bucket groupitems:
// 'required' not exposedtype: objectproperties:
activity:
type: objectproperties:
description:
type: stringdescription: description of activitytype:
type: stringdescription: type of activityname:
type: stringdescription: name of activitydescription: activity of bucket list
(+ Required is marked on property other than required within the marked object)
Is it a bug or am I missing something?
The text was updated successfully, but these errors were encountered:
LeeJaeDoo
changed the title
Bean Validation on double Nested Fields doesn't work
Bean Validation on 'double' Nested Fields doesn't work
Nov 8, 2022
I'm trying to use ConstrainedFields for Bean Validation but unable to get it to work.
testImplementation("com.epages:restdocs-api-spec-mockmvc:0.16.2")
As you can see below, WorkflowDefinitionRequest has property
SwitchBackBucketGroupParams[].SwitchBackBucketParams[].activity
and it should not be null.Generated openapi-3.0.yml file. As you can see below, author should be required but it doesn't show up in the required fields.
(+ Required is marked on property other than required within the marked object)
Is it a bug or am I missing something?
The text was updated successfully, but these errors were encountered: