forked from loafle/openapi-generator-original
better error message when parameter ref not defined (#1837)
This commit is contained in:
parent
1ef56b44c2
commit
b7971e2e3d
@ -4191,6 +4191,9 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
protected Parameter getParameterFromRef(String ref, OpenAPI openAPI) {
|
||||
String parameterName = ref.substring(ref.lastIndexOf('/') + 1);
|
||||
Map<String, Parameter> parameterMap = openAPI.getComponents().getParameters();
|
||||
if (parameterMap == null ) { // can't find the ref
|
||||
throw new RuntimeException(ref + " not defined in the spec.");
|
||||
}
|
||||
return parameterMap.get(parameterName);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user