Finished OpenAPIWriter

This commit is contained in:
Ziver Koc 2021-03-02 20:34:51 +01:00
parent 02e91a38e9
commit bb8d6a93b4
10 changed files with 215 additions and 107 deletions

View file

@ -37,6 +37,6 @@ public class OpenAPIWriterTest {
OpenAPIWriter writer = new OpenAPIWriter(new WebServiceDef(SOAPTest.MainSOAPClass.class));
writer.addServer("example.com", "Main Server");
assertEquals("", writer.write());
assertEquals("{\"components\": {\"schemas\": {\"SpecialReturnClass\": {\"type\": \"object\", \"properties\": {\"b\": {\"type\": \"array\", \"items\": {\"format\": \"byte\", \"type\": \"string\"}}, \"otherValue1\": {\"type\": \"string\"}, \"otherName2\": {\"type\": \"string\"}, \"inner\": {\"type\": \"object\", \"properties\": {\"innerClassParam2\": {\"type\": \"string\"}, \"innerClassParam1\": {\"type\": \"string\"}}}}}, \"SimpleReturnClass\": {\"type\": \"object\", \"properties\": {\"otherParam1\": {\"type\": \"string\"}, \"param2\": {\"type\": \"string\"}}}}}, \"servers\": [{\"description\": \"Main Server\", \"url\": \"example.com\"}], \"openapi\": \"3.0.1\", \"paths\": {\"/simpleReturnClassMethod\": {\"get\": {\"responses\": {\"200\": {\"description\": \"A successful response.\", \"content\": {\"application/json\": {\"schema\": {\"type\": \"object\", \"$ref\": \"#/components/schemas/SimpleReturnClass\"}}}}}, \"parameters\": [{\"schema\": {\"type\": \"string\"}, \"in\": \"query\", \"name\": \"byte\", \"required\": true}]}}, \"/exceptionMethod\": {\"get\": {\"description\": \"Documentation of method exceptionMethod()\", \"responses\": {\"200\": {\"description\": \"A successful response.\"}}, \"parameters\": [{\"schema\": {\"type\": \"integer\"}, \"in\": \"query\", \"name\": \"otherParam1\", \"required\": false}, {\"schema\": {\"type\": \"integer\"}, \"in\": \"query\", \"name\": \"otherParam2\", \"required\": false}]}}, \"/specialReturnMethod\": {\"get\": {\"responses\": {\"200\": {\"description\": \"A successful response.\", \"content\": {\"application/json\": {\"schema\": {\"type\": \"array\", \"items\": {\"type\": \"object\", \"$ref\": \"#/components/schemas/SpecialReturnClass\"}}}}}}, \"parameters\": [{\"schema\": {\"type\": \"string\"}, \"in\": \"query\", \"name\": \"StringName2\", \"required\": true}]}}, \"/stringArrayMethod\": {\"get\": {\"responses\": {\"200\": {\"description\": \"A successful response.\", \"content\": {\"application/json\": {\"schema\": {\"type\": \"array\", \"items\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}}}}}}, \"parameters\": [{\"schema\": {\"type\": \"string\"}, \"in\": \"query\", \"name\": \"StringName\", \"required\": true}]}}, \"/voidMethod\": {\"get\": {\"responses\": {\"200\": {\"description\": \"A successful response.\"}}, \"parameters\": []}}}, \"info\": {\"description\": \"\", \"title\": \"MainSOAPClass\", \"version\": \"\"}}", writer.write());
}
}

View file

@ -84,29 +84,6 @@ public class SOAPTest {
// TEST CLASSES
// ----------------------------------------------------
@SuppressWarnings("unused")
public static class SpecialReturnClass extends WSReturnObject{
@WSParamName("otherValue1")
public String param1 = "otherValue1";
@WSParamName("otherName2")
public String param2 = "otherValue2";
public byte[] b = new byte[]{0x12, 0x23};
public InnerClass inner = new InnerClass();
}
@SuppressWarnings("unused")
public static class InnerClass extends WSReturnObject{
public String innerClassParam1 = "innerClass1";
public String innerClassParam2 = "innerClass2";
}
@SuppressWarnings("unused")
public static class SimpleReturnClass extends WSReturnObject{
@WSParamName("otherParam1")
public String param1 = "param1";
public String param2 = "param2";
}
@SuppressWarnings("unused")
@WSNamespace("http://test.se:8080/")
public static class MainSOAPClass implements WSInterface{
@ -157,4 +134,30 @@ public class SOAPTest {
private void privateMethod(){ }
}
@SuppressWarnings("unused")
public static class SpecialReturnClass extends WSReturnObject{
@WSParamName("otherValue1")
public String param1 = "otherValue1";
@WSParamName("otherName2")
public String param2 = "otherValue2";
public byte[] b = new byte[]{0x12, 0x23};
public InnerClass inner = new InnerClass();
}
@SuppressWarnings("unused")
public static class InnerClass extends WSReturnObject{
public String innerClassParam1 = "innerClass1";
public String innerClassParam2 = "innerClass2";
}
@SuppressWarnings("unused")
public static class SimpleReturnClass extends WSReturnObject{
@WSParamName("otherParam1")
public String param1 = "param1";
public String param2 = "param2";
}
}