forked from loafle/openapi-generator-original
better NPE handling, log warn for const in 3.1 (#16786)
This commit is contained in:
@@ -7665,7 +7665,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
if (found == false) {
|
||||
throw new RuntimeException("Property " + requiredPropertyName + " is missing from getVars");
|
||||
LOGGER.warn("Property {} is not processed correctly (missing from getVars). Maybe it's a const (not yet supported) in openapi v3.1 spec.", requiredPropertyName);
|
||||
continue;
|
||||
}
|
||||
} else if (schema.getAdditionalProperties() instanceof Boolean && Boolean.FALSE.equals(schema.getAdditionalProperties())) {
|
||||
// TODO add processing for requiredPropertyName
|
||||
|
||||
@@ -198,7 +198,7 @@ public class ModelUtils {
|
||||
List<String> schemasUsedInOtherCases = new ArrayList<String>();
|
||||
|
||||
visitOpenAPI(openAPI, (s, t) -> {
|
||||
if (s.get$ref() != null) {
|
||||
if (s != null && s.get$ref() != null) {
|
||||
String ref = getSimpleRef(s.get$ref());
|
||||
if ("application/x-www-form-urlencoded".equalsIgnoreCase(t) ||
|
||||
"multipart/form-data".equalsIgnoreCase(t)) {
|
||||
@@ -320,6 +320,10 @@ public class ModelUtils {
|
||||
* @param visitor the visitor function which is invoked for every visited schema.
|
||||
*/
|
||||
private static void visitSchema(OpenAPI openAPI, Schema schema, String mimeType, List<String> visitedSchemas, OpenAPISchemaVisitor visitor) {
|
||||
if (schema == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
visitor.visit(schema, mimeType);
|
||||
if (schema.get$ref() != null) {
|
||||
String ref = getSimpleRef(schema.get$ref());
|
||||
|
||||
Reference in New Issue
Block a user