fix: Using Map.Entry to avoid "reference to Entry is ambiguous" (#16445)

* fix: Using Map.Entry to avoid "reference to Entry is ambiguous"

when spec defines a model Entry it conflicts.  Also rest of mustache
uses  Map.Entry to matching it

* fix: Map.Entry - update samples
This commit is contained in:
William Caine
2023-08-30 00:57:53 -04:00
committed by GitHub
parent 8386a6eaaf
commit 134dc98a71
197 changed files with 164 additions and 361 deletions

View File

@@ -42,7 +42,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -172,9 +171,9 @@ public class Bird {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Bird.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Bird` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -42,7 +42,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -172,9 +171,9 @@ public class Category {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Category.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Category` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -46,7 +46,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -208,9 +207,9 @@ public class DataQuery extends Query {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!DataQuery.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DataQuery` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -46,7 +46,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -460,9 +459,9 @@ public class DefaultValue {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!DefaultValue.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DefaultValue` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -43,7 +43,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -203,9 +202,9 @@ public class NumberPropertiesOnly {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!NumberPropertiesOnly.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NumberPropertiesOnly` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -46,7 +46,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -355,9 +354,9 @@ public class Pet {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Pet.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Pet` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -44,7 +44,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;

View File

@@ -42,7 +42,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -172,9 +171,9 @@ public class Tag {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!Tag.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Tag` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -42,7 +42,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -228,9 +227,9 @@ public class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}

View File

@@ -44,7 +44,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.openapitools.client.JSON;
@@ -154,9 +153,9 @@ public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
}
}
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
for (Map.Entry<String, JsonElement> entry : entries) {
if (!TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
}