Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NZhuravlev opened this issue Aug 5, 2021 · 0 comments
Open

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

NZhuravlev opened this issue Aug 5, 2021 · 0 comments

Comments

@NZhuravlev
Copy link

NZhuravlev commented Aug 5, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant