verify-api: fix allOf duplicates check

it triggered with a wrongly-formatted message on schemas that did NOT
contain any duplicates..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2020-12-30 12:21:33 +01:00
parent 12299b333b
commit 2fb1bdda20
1 changed files with 2 additions and 2 deletions

View File

@ -46,8 +46,8 @@ fn verify_all_of_schema(schema: &AllOfSchema) -> Result<(), Error> {
let mut keys = HashSet::<&'static str>::new(); let mut keys = HashSet::<&'static str>::new();
let mut dupes = String::new(); let mut dupes = String::new();
for property in schema.properties() { for property in schema.properties() {
if keys.insert(property.0) { if !keys.insert(property.0) {
if dupes.is_empty() { if !dupes.is_empty() {
dupes.push_str(", "); dupes.push_str(", ");
} }
dupes.push_str(property.0); dupes.push_str(property.0);