Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Commit 587e394

Browse files
author
Cyprien Quilici
committed
Merge pull request restlet#1093 from quilicicf/3.10_3969_inputpayload_error_swagger1
Fix empty input payload NPE while creating Swagger 1.2 (restlet/apisp…
2 parents 897872f + 2dc1d27 commit 587e394

File tree

1 file changed

+5
-5
lines changed
  • modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/internal/conversion/swagger/v1_2

1 file changed

+5
-5
lines changed

modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/internal/conversion/swagger/v1_2/SwaggerWriter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,19 @@ private static void fillApiDeclarationInRepresentation(Operation operation,
106106
Collection<String> usedModels) {
107107
// Get in representation
108108
ResourceOperationParameterDeclaration ropd;
109-
PayLoad inRepr = operation.getInputPayLoad();
110-
if (inRepr != null) {
111-
Representation representation = contract.getRepresentation(inRepr
109+
PayLoad inputPayload = operation.getInputPayLoad();
110+
if (inputPayload != null && inputPayload.getType() != null) {
111+
Representation representation = contract.getRepresentation(inputPayload
112112
.getType());
113113

114114
ropd = new ResourceOperationParameterDeclaration();
115115
ropd.setParamType("body");
116116
ropd.setName("body");
117117
ropd.setRequired(true);
118118

119-
ropd.setType(inRepr.getType());
119+
ropd.setType(inputPayload.getType());
120120
if (representation != null) {
121-
usedModels.add(inRepr.getType());
121+
usedModels.add(inputPayload.getType());
122122
}
123123
rod.getParameters().add(ropd);
124124
}

0 commit comments

Comments
 (0)