This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #365 from sbtqa/rest-remove-empties
Remove empty objects
- Loading branch information
Showing
12 changed files
with
123 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
page-factory-doc/src/main/asciidoc/rest_properties.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
=== Настройки проекта | ||
[width="100%",options="header,footer"] | ||
|==================== | ||
^.^| Параметр ^.^| Описание ^.^| Значение по умолчанию | ||
| api.baseURI | ||
| Базовый урл | ||
|
||
Пример: https//localhost:8080 | ||
| | ||
|
||
| api.endpoint.package | ||
| Путь к Endpoint объектам | ||
|
||
Пример: ru.qa.rest | ||
| | ||
|
||
| api.template.encoding | ||
| Кодировка шаблона | ||
| UTF-8 | ||
|
||
| api.ssl.relaxed | ||
| Упрощенная схема работы с ssl | ||
|
||
Возможные значения: true или false. | ||
| false | ||
|
||
| api.template.remove.optional | ||
| Удалять опциональные параметры, которые после подстановки параметров в шаблон, остались с плейхолдером | ||
|
||
Возможные значения: true или false. | ||
| true | ||
|
||
| api.template.remove.empties | ||
| Удалять пустые вида "key": { } из шаблона | ||
|
||
Возможные значения: true или false. | ||
| false | ||
|==================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
plugins/rest-plugin/src/test/java/ru/sbtqa/tag/api/entries/template/EmptyObjectsEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ru.sbtqa.tag.api.entries.template; | ||
|
||
import ru.sbtqa.tag.api.EndpointEntry; | ||
import ru.sbtqa.tag.api.annotation.Body; | ||
import ru.sbtqa.tag.api.annotation.Header; | ||
import ru.sbtqa.tag.api.annotation.Validation; | ||
import ru.sbtqa.tag.pagefactory.Rest; | ||
import ru.sbtqa.tag.pagefactory.annotations.rest.Endpoint; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
@Endpoint(method = Rest.POST, path = "client/typed-arrays", title = "empty objects", template = "templates/EmptyObjects.json", shouldRemoveEmptyObjects = true) | ||
public class EmptyObjectsEntry extends EndpointEntry { | ||
|
||
@Body(name = "first") | ||
private String first; | ||
|
||
@Validation(title = "result") | ||
public void validate() { | ||
String expected = "{ " + | ||
"\"first\" : \"parameter\" }"; | ||
getResponse().body("result", equalTo(expected)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ public void validate() { | |
"}] }"; | ||
getResponse().body("result", equalTo(expected)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
plugins/rest-plugin/src/test/resources/templates/EmptyObjects.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"minusOne": { | ||
|
||
}, | ||
"zero": { }, | ||
"first": "${first}", | ||
"second": { }, | ||
"third": { | ||
|
||
|
||
|
||
}, | ||
"four": {} | ||
, "fifth":{},"sixth":{},"seventh": | ||
{ } | ||
} |