forked from loafle/openapi-generator-original
Change default inline object name (#2569)
* Change default inline object name For #2516 * PR Review * throughout
This commit is contained in:
parent
d42b6d987a
commit
b7b68ce0bc
@ -408,8 +408,8 @@ public class InlineModelResolver {
|
|||||||
|
|
||||||
private String uniqueName(String key) {
|
private String uniqueName(String key) {
|
||||||
if (key == null) {
|
if (key == null) {
|
||||||
key = "NULL_UNIQUE_NAME";
|
key = "InlineObject";
|
||||||
LOGGER.warn("null key found. Default to NULL_UNIQUE_NAME");
|
LOGGER.warn("Found an inline schema without the `title` attribute. Default the model name to InlineObject instead. To have better control of the model naming, define the model separately so that it can be reused throughout the spec.");
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
|
@ -378,7 +378,7 @@ public class InlineModelResolverTest {
|
|||||||
|
|
||||||
ArraySchema requestBody = (ArraySchema) mediaType.getSchema();
|
ArraySchema requestBody = (ArraySchema) mediaType.getSchema();
|
||||||
assertNotNull(requestBody.getItems().get$ref());
|
assertNotNull(requestBody.getItems().get$ref());
|
||||||
assertEquals("#/components/schemas/NULL_UNIQUE_NAME", requestBody.getItems().get$ref());
|
assertEquals("#/components/schemas/InlineObject", requestBody.getItems().get$ref());
|
||||||
|
|
||||||
Schema items = ModelUtils.getReferencedSchema(openAPI, ((ArraySchema) mediaType.getSchema()).getItems());
|
Schema items = ModelUtils.getReferencedSchema(openAPI, ((ArraySchema) mediaType.getSchema()).getItems());
|
||||||
assertTrue(items.getProperties().get("street") instanceof StringSchema);
|
assertTrue(items.getProperties().get("street") instanceof StringSchema);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user