Commit
…hen creating ControlTagDefinition. Fixes #759
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ | |
import org.killbill.clock.Clock; | ||
import org.killbill.commons.metrics.TimedResource; | ||
|
||
import com.google.common.base.Preconditions; | ||
import com.google.inject.Inject; | ||
import com.google.inject.Singleton; | ||
import io.swagger.annotations.Api; | ||
|
@@ -129,8 +130,11 @@ public Response createTagDefinition(final TagDefinitionJson json, | |
verifyNonNullOrEmpty(json, "TagDefinitionJson body should be specified"); | ||
verifyNonNullOrEmpty(json.getName(), "TagDefinition name needs to be set", | ||
json.getDescription(), "TagDefinition description needs to be set"); | ||
Preconditions.checkArgument(json.getApplicableObjectTypes() != null && | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sbrossie
Author
Member
|
||
!json.getApplicableObjectTypes().isEmpty(), "Applicable object types must be set"); | ||
|
||
final TagDefinition createdTagDef = tagUserApi.createTagDefinition(json.getName(), json.getDescription(), context.createCallContextNoAccountId(createdBy, reason, comment, request)); | ||
|
||
final TagDefinition createdTagDef = tagUserApi.createTagDefinition(json.getName(), json.getDescription(), TagDefinitionJson.toObjectType(json.getApplicableObjectTypes()), context.createCallContextNoAccountId(createdBy, reason, comment, request)); | ||
return uriBuilder.buildResponse(uriInfo, TagDefinitionResource.class, "getTagDefinition", createdTagDef.getId(), request); | ||
} | ||
|
||
|
2 comments
on commit 8719ab4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add validation that the object tagged is of the right applicable type? It should already be done implicitly in JAX-RS, but not at the Java API level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add the test assertion.
Alternatively, we could default to all (current behavior)?