com.tsingxiao.unionj.generator.mock.docparser.MockDocParser Maven / Gradle / Ivy
package com.tsingxiao.unionj.generator.mock.docparser;
import com.tsingxiao.unionj.generator.mock.docparser.entity.Api;
import com.tsingxiao.unionj.generator.mock.schemafaker.SchemaFaker;
import com.tsingxiao.unionj.generator.openapi3.model.Openapi3;
import com.tsingxiao.unionj.generator.openapi3.parser.Openapi3Parser;
import lombok.Data;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
/**
* MockDocParser class.
*
* created by wubin
* v0.1
* com.tsingxiao.unionj.generator.mock.docparser
* @author tqccc
* @version $Id: $Id
*/
@Data
public class MockDocParser {
/**
* parse.
*
* @param doc a {@link java.io.File} object.
* @return a {@link com.tsingxiao.unionj.generator.mock.docparser.entity.Api} object.
* @throws java.io.IOException if any.
*/
public static Api parse(File doc) throws IOException {
Openapi3 openAPI = new Openapi3Parser().parse(doc);
return Api.convert(openAPI);
}
/**
* parse.
*
* @param doc a {@link java.net.URL} object.
* @return a {@link com.tsingxiao.unionj.generator.mock.docparser.entity.Api} object.
* @throws java.io.IOException if any.
*/
public static Api parse(URL doc) throws IOException {
Openapi3 openAPI = new Openapi3Parser().parse(doc);
return Api.convert(openAPI);
}
/**
* parse.
*
* @param doc a {@link java.io.InputStream} object.
* @return a {@link com.tsingxiao.unionj.generator.mock.docparser.entity.Api} object.
* @throws java.io.IOException if any.
*/
public static Api parse(InputStream doc) throws IOException {
Openapi3 openAPI = new Openapi3Parser().parse(doc);
return Api.convert(openAPI);
}
/**
* parse.
*
* @param openAPI a {@link com.tsingxiao.unionj.generator.openapi3.model.Openapi3} object.
* @return a {@link com.tsingxiao.unionj.generator.mock.docparser.entity.Api} object.
* @throws java.io.IOException if any.
*/
public static Api parse(Openapi3 openAPI) throws IOException {
return Api.convert(openAPI);
}
/**
* parse.
*
* @param doc a {@link java.io.File} object.
* @param faker a {@link com.tsingxiao.unionj.generator.mock.schemafaker.SchemaFaker} object.
* @return a {@link com.tsingxiao.unionj.generator.mock.docparser.entity.Api} object.
* @throws java.io.IOException if any.
*/
public static Api parse(File doc, SchemaFaker faker) throws IOException {
Openapi3 openAPI = new Openapi3Parser().parse(doc);
return Api.convert(openAPI, faker);
}
/**
* parse.
*
* @param doc a {@link java.net.URL} object.
* @param faker a {@link com.tsingxiao.unionj.generator.mock.schemafaker.SchemaFaker} object.
* @return a {@link com.tsingxiao.unionj.generator.mock.docparser.entity.Api} object.
* @throws java.io.IOException if any.
*/
public static Api parse(URL doc, SchemaFaker faker) throws IOException {
Openapi3 openAPI = new Openapi3Parser().parse(doc);
return Api.convert(openAPI, faker);
}
/**
* parse.
*
* @param doc a {@link java.io.InputStream} object.
* @param faker a {@link com.tsingxiao.unionj.generator.mock.schemafaker.SchemaFaker} object.
* @return a {@link com.tsingxiao.unionj.generator.mock.docparser.entity.Api} object.
* @throws java.io.IOException if any.
*/
public static Api parse(InputStream doc, SchemaFaker faker) throws IOException {
Openapi3 openAPI = new Openapi3Parser().parse(doc);
return Api.convert(openAPI, faker);
}
/**
* parse.
*
* @param openAPI a {@link com.tsingxiao.unionj.generator.openapi3.model.Openapi3} object.
* @param faker a {@link com.tsingxiao.unionj.generator.mock.schemafaker.SchemaFaker} object.
* @return a {@link com.tsingxiao.unionj.generator.mock.docparser.entity.Api} object.
* @throws java.io.IOException if any.
*/
public static Api parse(Openapi3 openAPI, SchemaFaker faker) throws IOException {
return Api.convert(openAPI, faker);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy