Skip to content

Required false for non-optional body, no parameter name #145

Description

@NZhuravlev

Hello! This piece of code:

ResourceSnippetDetails details = resourceDetails()
	.requestSchema(new Schema(requestSchemaName))
	.responseSchema(new Schema(responseSchemaName));
given()
	.spec(this.spec)
	.filter(document("{class-name}/{method-name}", details, null,
		preprocessResponse(prettyPrint()),
		requestFields(
			fieldWithPath("[]").description("Blah"))
			.andWithPrefix("[].",
				fieldWithPath("id").description("ID")
					.type(JsonFieldType.NUMBER),
				fieldWithPath("name").description("Name")
					.type(JsonFieldType.STRING))
		)
	);

generates this part of resource.json

  "requestFields" : [ {
    "attributes" : { },
    "description" : "Blah",
    "ignored" : false,
    "path" : "[]",
    "type" : "ARRAY",
    "optional" : false
  }, {
    "attributes" : { },
    "description" : "ID",
    "ignored" : false,
    "path" : "[].id",
    "type" : "NUMBER",
    "optional" : false
  }, {
    "attributes" : { },
    "description" : "Name",
    "ignored" : false,
    "path" : "[].name",
    "type" : "STRING",
    "optional" : false
  }
...

which results in:

- in: body
  name: ""
  required: false

Looks like a bug since the body was not marked as optional. As for the lack of the name, usually, it states "body" there (for example https://editor.swagger.io/) but here it's empty. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions