Skip to content

Commit

Permalink
fix issue kongchen#17
Browse files Browse the repository at this point in the history
  • Loading branch information
kongchen committed Jul 31, 2013
1 parent 03ab8a9 commit fd7b8a9
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 0 deletions.
Expand Up @@ -45,6 +45,9 @@ public Set<MustacheDataType> getDataTypes() {
}

public void addDateType(MustacheDocument mustacheDocument, MustacheDataType dataType) {
if (dataTypes.contains(dataType)) {
return;
}
dataTypes.add(dataType);
for (MustacheItem item : dataType.getItems()) {
String trueType = TypeUtils.getTrueType(item.getType());
Expand Down
Expand Up @@ -40,6 +40,16 @@ private void prepare() {
apiSource.setSwaggerDirectory(null);
}

@Test
public void testIssue17() throws Exception, GenerateException {
apiSource.setLocations("issue17");
AbstractDocumentSource documentSource = new MavenDocumentSource(apiSource, new SystemStreamLog());
documentSource.loadDocuments();
OutputTemplate outputTemplate = new OutputTemplate(documentSource);
Assert.assertEquals(outputTemplate.getDataTypes().size(), 1);
Assert.assertEquals(outputTemplate.getDataTypes().iterator().next().getName(), "Child");
}

@Test
public void testWithFormat() throws Exception, GenerateException {
apiSource.setWithFormatSuffix(true);
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/issue17/Child.java
@@ -0,0 +1,18 @@
package issue17;

/**
* Created with IntelliJ IDEA.
* User: kongchen
* Date: 7/31/13
*/
public class Child extends Parent{
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
28 changes: 28 additions & 0 deletions src/test/java/issue17/IssueResource.java
@@ -0,0 +1,28 @@
package issue17;

import com.sun.jersey.api.NotFoundException;
import com.wordnik.swagger.annotations.*;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
* Created with IntelliJ IDEA.
* User: kongchen
* Date: 5/13/13
*/
@Path("/issue17")
@Api(value = "/issue17", description = "For issue 17")
@Produces({"application/json"})
public class IssueResource {
@GET
@Path("/{carId}")
@ApiOperation(value = "For issue 17",responseClass = "issue17.Child")
public Response getIssue17()
throws NotFoundException {
return Response.noContent().build();
}
}
32 changes: 32 additions & 0 deletions src/test/java/issue17/Parent.java
@@ -0,0 +1,32 @@
package issue17;

/**
* Created with IntelliJ IDEA.
* User: kongchen
* Date: 7/31/13
*/
public class Parent {
protected Child child;
private String cannotsee;
protected String cansee;

public Child getChild(){
return child;
}

public String getCannotsee() {
return cannotsee;
}

public void setCannotsee(String cannotsee) {
this.cannotsee = cannotsee;
}

public String getCansee() {
return cansee;
}

public void setCansee(String cansee) {
this.cansee = cansee;
}
}

0 comments on commit fd7b8a9

Please sign in to comment.