Package de.kosmos_lab.web.server
Class OpenApiParser
- java.lang.Object
-
- de.kosmos_lab.web.server.OpenApiParser
-
- Direct Known Subclasses:
AsyncApiParser
public class OpenApiParser extends Object
-
-
Constructor Summary
Constructors Constructor Description OpenApiParser(WebServer server)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Parameter p, org.json.JSONArray params)voidadd(Tag tag, org.json.JSONArray array)voidadd(ApiEndpoint endpoint, Operation operation, Method method, org.json.JSONObject paths)voidadd(String tag, boolean value, org.json.JSONObject json, Boolean ignoreIfThis)voidadd(String tag, double value, org.json.JSONObject json, Double ignoreIfThis)voidadd(String tag, int value, org.json.JSONObject json, Integer ignoreIfThis)voidadd(String tag, ExternalDocumentation value, org.json.JSONObject json)voidadd(String tag, Header[] value, org.json.JSONObject json)voidadd(String tag, Contact contact, org.json.JSONObject json)voidadd(String tag, License license, org.json.JSONObject json)voidadd(String tag, Content[] value, org.json.JSONObject json)voidadd(String tag, DiscriminatorMapping[] value, org.json.JSONObject json)voidadd(String tag, ExampleObject[] examples, org.json.JSONObject json)voidadd(String tag, SchemaProperty[] properties, org.json.JSONObject json)voidadd(String tag, Schema schema, org.json.JSONObject json)voidadd(String tag, OAuthFlow flow, org.json.JSONObject json)voidadd(String tag, OAuthFlows flows, org.json.JSONObject json)voidadd(String tag, Tag[] tags, org.json.JSONObject json)voidadd(String tag, Class<?>[] clzlist, org.json.JSONObject json)voidadd(String tag, Class<?> clz, org.json.JSONObject json)voidadd(String tag, String[] values, org.json.JSONObject json)voidadd(String tag, String value, org.json.JSONObject json)voidadd(String tag, String value, org.json.JSONObject json, boolean parseValue)voidadd(String tag, HashSet<Tag> tags, org.json.JSONObject json)voidadd(String tag, org.json.JSONArray values, org.json.JSONObject json)voidadd(String tag, org.json.JSONObject values, org.json.JSONObject json)protected voidaddException(String n, Class<?> ex, org.json.JSONObject resp)StringasYaml(String jsonString)booleancheckExample(ExampleObject e, org.json.JSONObject schema, SchemaType type)booleancheckExample(String value, org.json.JSONObject schema, SchemaType type)TuplecheckExamples()used to check if the examples are all correctorg.json.JSONObjectcreateJSONSchemaFromSchema(org.json.JSONObject schema)HashMap<String,String>extractExamples(Schema schema)HashMap<String,String>extractExamples(Parameter parameter)HashMap<String,String>extractExamples(String example, ExampleObject[] examples)org.json.JSONArraygetExamplesArray(ExampleObject[] examples)org.json.JSONArraygetExamplesArray(HashMap<String,String> examples)org.json.JSONArraygetExamplesArray(List<ExampleObject> examples)org.json.JSONObjectgetExamplesObject(ExampleObject[] examples)org.json.JSONObjectgetExamplesObject(HashMap<String,String> examples)org.json.JSONObjectgetExamplesObject(List<ExampleObject> examples)static OpenApiParsergetInstance(WebServer server)org.json.JSONObjectgetJSON()Set<Class<? extends jakarta.servlet.http.HttpServlet>>getServlets()StringgetStringFromResource(String name)StringgetYAML()ObjectparseValue(String value)StringprepareString(String input)org.json.JSONObjecttoJSON(AsyncInfo info)org.json.JSONObjecttoJSON(Info info)org.json.JSONObjecttoJSON(ArraySchema arraySchema)org.json.JSONObjecttoJSON(ExampleObject example)org.json.JSONObjecttoJSON(ObjectSchema p)org.json.JSONObjecttoJSON(Schema schema)org.json.JSONObjecttoJSON(SchemaProperty[] properties)org.json.JSONObjecttoJSON(Parameter p)
-
-
-
Constructor Detail
-
OpenApiParser
public OpenApiParser(WebServer server)
-
-
Method Detail
-
getInstance
public static OpenApiParser getInstance(WebServer server)
-
asYaml
public String asYaml(String jsonString) throws com.fasterxml.jackson.core.JsonProcessingException, IOException
- Throws:
com.fasterxml.jackson.core.JsonProcessingExceptionIOException
-
getYAML
public String getYAML() throws IOException
- Throws:
IOException
-
toJSON
public org.json.JSONObject toJSON(AsyncInfo info)
-
toJSON
public org.json.JSONObject toJSON(Info info)
-
getJSON
public org.json.JSONObject getJSON()
-
toJSON
public org.json.JSONObject toJSON(ObjectSchema p)
-
checkExamples
public Tuple checkExamples()
used to check if the examples are all correct- Returns:
-
add
public void add(String tag, OAuthFlows flows, org.json.JSONObject json)
-
add
public void add(Tag tag, org.json.JSONArray array)
-
add
public void add(ApiEndpoint endpoint, Operation operation, Method method, org.json.JSONObject paths)
-
toJSON
public org.json.JSONObject toJSON(ArraySchema arraySchema)
-
createJSONSchemaFromSchema
public org.json.JSONObject createJSONSchemaFromSchema(org.json.JSONObject schema)
-
checkExample
public boolean checkExample(String value, org.json.JSONObject schema, SchemaType type)
-
checkExample
public boolean checkExample(ExampleObject e, org.json.JSONObject schema, SchemaType type)
-
getExamplesObject
public org.json.JSONObject getExamplesObject(ExampleObject[] examples)
-
getExamplesObject
public org.json.JSONObject getExamplesObject(List<ExampleObject> examples)
-
getExamplesArray
public org.json.JSONArray getExamplesArray(ExampleObject[] examples)
-
getExamplesArray
public org.json.JSONArray getExamplesArray(List<ExampleObject> examples)
-
toJSON
public org.json.JSONObject toJSON(Parameter p)
-
add
public void add(Parameter p, org.json.JSONArray params)
-
toJSON
public org.json.JSONObject toJSON(SchemaProperty[] properties)
-
add
public void add(String tag, SchemaProperty[] properties, org.json.JSONObject json)
-
toJSON
public org.json.JSONObject toJSON(ExampleObject example)
-
add
public void add(String tag, ExampleObject[] examples, org.json.JSONObject json)
-
toJSON
public org.json.JSONObject toJSON(Schema schema)
-
extractExamples
public HashMap<String,String> extractExamples(String example, ExampleObject[] examples)
-
add
public void add(String tag, DiscriminatorMapping[] value, org.json.JSONObject json)
-
add
public void add(String tag, ExternalDocumentation value, org.json.JSONObject json)
-
add
public void add(String tag, org.json.JSONObject values, org.json.JSONObject json)
-
add
public void add(String tag, org.json.JSONArray values, org.json.JSONObject json)
-
-