-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
[core] [regression] set parentName when a single possible parent exists #3771
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -896,6 +896,8 @@ public static List<Schema> getInterfaces(ComposedSchema composed) { | |
| public static String getParentName(ComposedSchema composedSchema, Map<String, Schema> allSchemas) { | ||
| List<Schema> interfaces = getInterfaces(composedSchema); | ||
|
|
||
| List<String> refedParentNames = new ArrayList<>(); | ||
|
|
||
| if (interfaces != null && !interfaces.isEmpty()) { | ||
| for (Schema schema : interfaces) { | ||
| // get the actual schema | ||
|
|
@@ -911,13 +913,21 @@ public static String getParentName(ComposedSchema composedSchema, Map<String, Sc | |
| } else { | ||
| LOGGER.debug("Not a parent since discriminator.propertyName is not set {}", s.get$ref()); | ||
| // not a parent since discriminator.propertyName is not set | ||
| refedParentNames.add(parentName); | ||
| } | ||
| } else { | ||
| // not a ref, doing nothing | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // parent name only makes sense when there is a single obvious parent | ||
| if (refedParentNames.size() == 1) { | ||
| LOGGER.warn("[deprecated] inheritance without use of 'discriminator.propertyName' is deprecated " + | ||
| "and will be removed in a future release. Generating model for {}", composedSchema.getName()); | ||
| return refedParentNames.get(0); | ||
|
||
| } | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.