1
0
mirror of https://github.com/akpaevj/OpenAPI.1C.git synced 2024-11-24 08:12:15 +02:00

fixed critical errors

This commit is contained in:
akpaevj 2023-12-16 02:35:51 +03:00
parent 2d68b908b4
commit 4c2a795cc5
4 changed files with 8 additions and 11 deletions

View File

@ -85,7 +85,7 @@ public class HttpServiceUtil
var methodParameters = method.getParameters(); var methodParameters = method.getParameters();
var templateHasParameters = templateParameters != null && templateParameters.size() > 0; var templateHasParameters = templateParameters != null && templateParameters.size() > 0;
var methodHasParameters = templateParameters != null && templateParameters.size() > 0; var methodHasParameters = methodParameters != null && methodParameters.size() > 0;
var hasParameters = templateHasParameters && methodHasParameters; var hasParameters = templateHasParameters && methodHasParameters;
if (hasParameters) if (hasParameters)
@ -116,8 +116,12 @@ public class HttpServiceUtil
for (var openApiParameter : parameters) for (var openApiParameter : parameters)
{ {
var parameter = openApiParameter;
if (parameter.isRef())
parameter = root.resolveReference(openApiParameter.getRef(), openApiParameter.getClass());
var paramTemplateContent = ""; //$NON-NLS-1$ var paramTemplateContent = ""; //$NON-NLS-1$
var in = openApiParameter.getIn(); var in = parameter.getIn();
switch (in) switch (in)
{ {
case "path": //$NON-NLS-1$ case "path": //$NON-NLS-1$
@ -132,14 +136,7 @@ public class HttpServiceUtil
if (paramTemplateContent.length() > 0) if (paramTemplateContent.length() > 0)
{ {
var paramTemplate = new StringTemplate(paramTemplateContent); var paramTemplate = new StringTemplate(paramTemplateContent);
paramTemplate.setAttribute("PARAM_NAME", parameter.getName()); //$NON-NLS-1$
if (openApiParameter.isRef())
{
var value = root.resolveReference(openApiParameter.getRef(), openApiParameter.getClass());
paramTemplate.setAttribute("PARAM_NAME", value.getName()); //$NON-NLS-1$
}
else
paramTemplate.setAttribute("PARAM_NAME", openApiParameter.getName()); //$NON-NLS-1$
builder.append(paramTemplate.toString()); builder.append(paramTemplate.toString());
builder.append(System.lineSeparator()); builder.append(System.lineSeparator());

View File

@ -100,7 +100,7 @@ public class OpenApiRoot
var nodeText = node.toPrettyString(); var nodeText = node.toPrettyString();
T value = mapper.readValue(nodeText, type); T value = mapper.readValue(nodeText, type);
if (value.isRef()) if (value.isRef())
return resolveReference(ref, type); return resolveReference(value.getRef(), type);
else else
return value; return value;
} }