Skip to content

Commit 920edc4

Browse files
committed
refactor project yaml-doc-tool into openapi-doc-tool #1
1 parent 4797496 commit 920edc4

19 files changed

+225
-313
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- refactor project yaml-doc-tool into openapi-doc-tool <https://github.com/fugerit-org/openapi-doc-tool/issues/1>
13+
1014
## [1.0.3] - 2025-04-18
1115

1216
### Changed

pom.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<groupId>org.fugerit.java</groupId>
6-
<artifactId>yaml-doc-tool</artifactId>
6+
<artifactId>open-doc-tool</artifactId>
77

88
<parent>
99
<groupId>org.fugerit.java.universe</groupId>
1010
<artifactId>fj-universe-tool</artifactId>
11-
<version>2.4.5</version>
11+
<version>3.0.0</version>
1212
<relativePath/>
1313
</parent>
1414

1515
<version>1.0.4-SNAPSHOT</version>
1616
<packaging>jar</packaging>
1717

18-
<name>yaml-doc-tool</name>
19-
<description>Tool for auto documentation of yaml / openapi</description>
18+
<name>openapi-doc-tool</name>
19+
<description>Tool for auto documentation of OpenAPI</description>
2020
<url>http://www.fugerit.org/</url>
2121

2222
<scm>
23-
<connection>scm:git:git://github.com/fugerit-org/yaml-doc-tool.git</connection>
24-
<developerConnection>scm:git:ssh://github.com/fugerit-org/yaml-doc-tool.git</developerConnection>
25-
<url>https://github.com/fugerit-org/yaml-doc-tool.git</url>
23+
<connection>scm:git:git://github.com/fugerit-org/openapi-doc-tool.git</connection>
24+
<developerConnection>scm:git:ssh://github.com/fugerit-org/openapi-doc-tool.git</developerConnection>
25+
<url>https://github.com/fugerit-org/openapi-doc-tool.git</url>
2626
<tag>HEAD</tag>
2727
</scm>
2828

2929
<issueManagement>
3030
<system>GitHub</system>
31-
<url>https://github.com/fugerit-org/yaml-doc-tool/issues</url>
31+
<url>https://github.com/fugerit-org/openapi-doc-tool/issues</url>
3232
</issueManagement>
3333

3434
<properties>
@@ -39,9 +39,9 @@
3939
<!-- sonar cloud configuration -->
4040
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
4141
<sonar.organization>fugerit-org</sonar.organization>
42-
<sonar.projectKey>fugerit-org_yaml-doc-tool</sonar.projectKey>
42+
<sonar.projectKey>fugerit-org_openapi-doc-tool</sonar.projectKey>
4343
<!-- tool main class -->
44-
<tool-main-class>org.fugerit.java.yaml.doc.YamlDocMain</tool-main-class>
44+
<tool-main-class>org.fugerit.java.openapi.doc.OpenAPIDocMain</tool-main-class>
4545
</properties>
4646

4747
<licenses>

src/main/java/org/fugerit/java/yaml/doc/YamlDocCheckModel.java renamed to src/main/java/org/fugerit/java/openapi/doc/OpenAPIDocCheckModel.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.fugerit.java.yaml.doc;
1+
package org.fugerit.java.openapi.doc;
22

33
import java.io.File;
44
import java.io.FileReader;
@@ -24,7 +24,7 @@
2424
import lombok.extern.slf4j.Slf4j;
2525

2626
@Slf4j
27-
public class YamlDocCheckModel {
27+
public class OpenAPIDocCheckModel {
2828

2929
public static final String ARG_CHECK_TYPE = "check-type";
3030

@@ -34,7 +34,7 @@ public class YamlDocCheckModel {
3434

3535
public static final String ARG_CHECK_ONCE = "check-once";
3636

37-
private YamlDocCheckModel() {
37+
private OpenAPIDocCheckModel() {
3838
}
3939

4040
@SuppressWarnings("unchecked")
@@ -99,12 +99,12 @@ private static void check(CheckContext context, String path, Class<?> typeModel,
9999
@SuppressWarnings("unchecked")
100100
public static int handleModelCheck(Properties props) throws ConfigException {
101101
SimpleValue<Integer> res = new SimpleValue<>(Result.RESULT_CODE_OK);
102-
String inputYaml = props.getProperty(YamlDocMain.ARG_INPUT_YAML);
102+
String inputYaml = props.getProperty(OpenAPIDocMain.ARG_INPUT_YAML);
103103
String checkType = props.getProperty(ARG_CHECK_TYPE);
104104
String checkSchema = props.getProperty(ARG_CHECK_SCHEMA);
105-
String outputFile = props.getProperty(YamlDocMain.ARG_OUTPUT_FILE);
105+
String outputFile = props.getProperty(OpenAPIDocMain.ARG_OUTPUT_FILE);
106106
if (StringUtils.isEmpty(inputYaml)) {
107-
throw new ConfigException(MISSING_REQUIRED + YamlDocMain.ARG_INPUT_YAML);
107+
throw new ConfigException(MISSING_REQUIRED + OpenAPIDocMain.ARG_INPUT_YAML);
108108
}
109109
if (StringUtils.isEmpty(checkType)) {
110110
throw new ConfigException(MISSING_REQUIRED + ARG_CHECK_TYPE);

src/main/java/org/fugerit/java/yaml/doc/YamlDocConfig.java renamed to src/main/java/org/fugerit/java/openapi/doc/OpenAPIDocConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
package org.fugerit.java.yaml.doc;
1+
package org.fugerit.java.openapi.doc;
22

33
import java.util.Locale;
44
import java.util.Properties;
55

6-
public class YamlDocConfig {
6+
public class OpenAPIDocConfig {
77

88
public static final Integer VERSION_0 = 0;
99
public static final Integer VERSION_1 = 1;
1010
public static final Integer VERSION_DEFAULT = VERSION_1; // default version is last version
1111

12-
public YamlDocConfig() {
12+
public OpenAPIDocConfig() {
1313
this.locale = Locale.getDefault();
1414
if (this.locale == null) {
1515
this.locale = Locale.ENGLISH;
@@ -30,7 +30,7 @@ public void setOutputFormat(String outputFormat) {
3030
this.outputFormat = outputFormat;
3131
}
3232

33-
public YamlDocConfig(String outputFormat) {
33+
public OpenAPIDocConfig(String outputFormat) {
3434
this();
3535
this.outputFormat = outputFormat;
3636
}

src/main/java/org/fugerit/java/yaml/doc/YamlDocFacade.java renamed to src/main/java/org/fugerit/java/openapi/doc/OpenAPIDocFacade.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.fugerit.java.yaml.doc;
1+
package org.fugerit.java.openapi.doc;
22

33
import java.io.OutputStream;
44
import java.io.Reader;
@@ -15,21 +15,21 @@
1515
import org.slf4j.LoggerFactory;
1616
import org.yaml.snakeyaml.Yaml;
1717

18-
public class YamlDocFacade {
18+
public class OpenAPIDocFacade {
1919

20-
private static final Logger logger = LoggerFactory.getLogger(YamlDocFacade.class);
20+
private static final Logger logger = LoggerFactory.getLogger(OpenAPIDocFacade.class);
2121

2222
private static final String BUNDLE_LABEL_PATH = "lang.label";
2323

24-
public static final String CHAIN_ID_YAML_DOC_TEMPLATE = "yaml-doc-template";
24+
public static final String CHAIN_ID_YAML_DOC_TEMPLATE = "openapi-doc-template";
2525

2626
private static final FreemarkerDocProcessConfig INSTANCE = FreemarkerDocProcessConfigFacade
2727
.loadConfigSafe("cl://doc-facade/fm-process-config-yaml.xml");
2828

2929
private static final boolean VALIDATE_DOC_XML = false;
3030

3131
@SuppressWarnings("unchecked")
32-
public int handle(Reader inputYaml, OutputStream outputData, YamlDocConfig config) throws Exception {
32+
public int handle(Reader inputYaml, OutputStream outputData, OpenAPIDocConfig config) throws Exception {
3333
int result = Result.RESULT_CODE_OK;
3434
// yaml parsing
3535
Yaml yaml = new Yaml();
@@ -46,14 +46,14 @@ public int handle(Reader inputYaml, OutputStream outputData, YamlDocConfig confi
4646
}
4747
labels.putAll(config.getLabelsOverride());
4848
// build model
49-
YamlModel yamlModel = new YamlModel();
50-
yamlModel.setPaths(paths);
51-
yamlModel.setSchemas(schemas);
52-
yamlModel.setLabels(labels);
53-
yamlModel.setConfig(config);
49+
OpenAPIModel openAPIModel = new OpenAPIModel();
50+
openAPIModel.setPaths(paths);
51+
openAPIModel.setSchemas(schemas);
52+
openAPIModel.setLabels(labels);
53+
openAPIModel.setConfig(config);
5454
// generation
5555
logger.info("docFacade -> {} (validate) {}", INSTANCE, VALIDATE_DOC_XML);
56-
DocProcessContext context = DocProcessContext.newContext(YamlModel.ATT_NAME, yamlModel);
56+
DocProcessContext context = DocProcessContext.newContext(OpenAPIModel.ATT_NAME, openAPIModel);
5757
INSTANCE.process(CHAIN_ID_YAML_DOC_TEMPLATE, config.getOutputFormat(), context, outputData, VALIDATE_DOC_XML);
5858
return result;
5959
}

src/main/java/org/fugerit/java/yaml/doc/YamlDocMain.java renamed to src/main/java/org/fugerit/java/openapi/doc/OpenAPIDocMain.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.fugerit.java.yaml.doc;
1+
package org.fugerit.java.openapi.doc;
22

33
import java.io.File;
44
import java.io.FileInputStream;
@@ -17,17 +17,17 @@
1717
import org.fugerit.java.core.util.PropsIO;
1818
import org.fugerit.java.core.util.collection.ListMapStringKey;
1919
import org.fugerit.java.doc.base.typehelper.excel.ExcelHelperConsts;
20-
import org.fugerit.java.yaml.doc.config.OpenapiConfig;
21-
import org.fugerit.java.yaml.doc.config.YamlDocCatalog;
20+
import org.fugerit.java.openapi.doc.config.OpenapiConfig;
21+
import org.fugerit.java.openapi.doc.config.OpenAPIDocCatalog;
2222
import org.slf4j.Logger;
2323
import org.slf4j.LoggerFactory;
2424

25-
public class YamlDocMain {
25+
public class OpenAPIDocMain {
2626

27-
private YamlDocMain() {
27+
private OpenAPIDocMain() {
2828
}
2929

30-
private static final Logger logger = LoggerFactory.getLogger(YamlDocMain.class);
30+
private static final Logger logger = LoggerFactory.getLogger(OpenAPIDocMain.class);
3131

3232
public static final String ARG_EXCLUDE_PATHS = "exclude-paths";
3333

@@ -63,7 +63,7 @@ private static void addIfNotEmpty(Properties props, String key, String value) {
6363
}
6464
}
6565

66-
private static void setup(YamlDocConfig config, Properties props) throws IOException {
66+
private static void setup(OpenAPIDocConfig config, Properties props) throws IOException {
6767
String language = props.getProperty(ARG_LANGUAGE);
6868
String labelOverride = props.getProperty(ARG_LABEL_OVVERRIDE);
6969
String excludePaths = props.getProperty(ARG_EXCLUDE_PATHS);
@@ -103,11 +103,11 @@ private static void handleSingleMode(Properties props) throws ConfigException {
103103
String outputFormat = fileName.substring(fileName.lastIndexOf('.') + 1);
104104
try (Reader reader = new FileReader(inputFile);
105105
FileOutputStream fos = new FileOutputStream(outputFile)) {
106-
YamlDocConfig config = new YamlDocConfig(outputFormat);
106+
OpenAPIDocConfig config = new OpenAPIDocConfig(outputFormat);
107107
setup(config, props);
108108
config.setExcelTryAutoresize(BooleanUtils.isTrue(
109109
props.getProperty(ARG_EXCEL_TRY_AUTORESIZE, ExcelHelperConsts.PROP_XLS_TRY_AUTORESIZE_DEFAULT)));
110-
YamlDocFacade facade = new YamlDocFacade();
110+
OpenAPIDocFacade facade = new OpenAPIDocFacade();
111111
facade.handle(reader, fos, config);
112112
}
113113
}
@@ -122,24 +122,24 @@ private static void handleMultiMode(Properties props) throws ConfigException {
122122
throw new ConfigException("Required params : " + ARG_CONFIG_PATH + ", " + ARG_ID_CATALOG);
123123
} else {
124124
logger.info("configPath:{}, idCatalog:{}", configPath, idCatalog);
125-
YamlDocCatalog config = new YamlDocCatalog();
125+
OpenAPIDocCatalog config = new OpenAPIDocCatalog();
126126
try (FileInputStream fis = new FileInputStream(new File(configPath))) {
127-
config = (YamlDocCatalog) GenericListCatalogConfig.load(fis, config);
127+
config = (OpenAPIDocCatalog) GenericListCatalogConfig.load(fis, config);
128128
logger.info("keys : {}", config.getIdSet());
129129
ListMapStringKey<OpenapiConfig> catalog = config.getListMap(idCatalog);
130130
for (OpenapiConfig current : catalog) {
131131
Properties propsCurrent = new Properties();
132-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_INPUT_YAML, current.getInputYaml());
133-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_OUTPUT_FILE, current.getOutputFile());
134-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_LANGUAGE, current.getLanguage());
135-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_LABEL_OVVERRIDE, current.getLabelsOverride());
136-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_EXCEL_TRY_AUTORESIZE, current.getExcelTryAutoresize());
137-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_EXCLUDE_PATHS, current.getExcludePaths());
138-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_EXCLUDE_SCHEMAS, current.getExcludeSchemas());
139-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_USE_OPENAPI_TITLE, current.getUseOpenapiTitle());
140-
addIfNotEmpty(propsCurrent, YamlDocMain.ARG_VERSION, current.getVersion());
132+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_INPUT_YAML, current.getInputYaml());
133+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_OUTPUT_FILE, current.getOutputFile());
134+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_LANGUAGE, current.getLanguage());
135+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_LABEL_OVVERRIDE, current.getLabelsOverride());
136+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_EXCEL_TRY_AUTORESIZE, current.getExcelTryAutoresize());
137+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_EXCLUDE_PATHS, current.getExcludePaths());
138+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_EXCLUDE_SCHEMAS, current.getExcludeSchemas());
139+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_USE_OPENAPI_TITLE, current.getUseOpenapiTitle());
140+
addIfNotEmpty(propsCurrent, OpenAPIDocMain.ARG_VERSION, current.getVersion());
141141
logger.info("using parameters -> {}", props);
142-
YamlDocMain.worker(propsCurrent);
142+
OpenAPIDocMain.worker(propsCurrent);
143143
}
144144
}
145145
}
@@ -151,7 +151,7 @@ public static void worker(Properties props) throws ConfigException {
151151
if (ARG_MODE_SINGLE.equalsIgnoreCase(mode)) {
152152
handleSingleMode(props);
153153
} else if (ARG_MODE_CHECK_MODEL.equalsIgnoreCase(mode)) {
154-
YamlDocCheckModel.handleModelCheck(props);
154+
OpenAPIDocCheckModel.handleModelCheck(props);
155155
} else {
156156
handleMultiMode(props);
157157
}

src/main/java/org/fugerit/java/yaml/doc/YamlModel.java renamed to src/main/java/org/fugerit/java/openapi/doc/OpenAPIModel.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
package org.fugerit.java.yaml.doc;
1+
package org.fugerit.java.openapi.doc;
22

33
import java.util.Map;
44
import java.util.Properties;
55

6-
public class YamlModel {
6+
public class OpenAPIModel {
77

8-
public static final String ATT_NAME = "yamlModel";
8+
public static final String ATT_NAME = "openapiModel";
99

10-
private YamlDocConfig config;
10+
private OpenAPIDocConfig config;
1111

12-
public YamlDocConfig getConfig() {
12+
public OpenAPIDocConfig getConfig() {
1313
return config;
1414
}
1515

16-
public void setConfig(YamlDocConfig config) {
16+
public void setConfig(OpenAPIDocConfig config) {
1717
this.config = config;
1818
}
1919

src/main/java/org/fugerit/java/yaml/doc/config/YamlDocCatalog.java renamed to src/main/java/org/fugerit/java/openapi/doc/config/OpenAPIDocCatalog.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
package org.fugerit.java.yaml.doc.config;
1+
package org.fugerit.java.openapi.doc.config;
22

33
import org.fugerit.java.core.cfg.xml.CustomListCatalogConfig;
44
import org.fugerit.java.core.util.collection.ListMapStringKey;
55

6-
public class YamlDocCatalog extends CustomListCatalogConfig<OpenapiConfig, ListMapStringKey<OpenapiConfig>> {
6+
public class OpenAPIDocCatalog extends CustomListCatalogConfig<OpenapiConfig, ListMapStringKey<OpenapiConfig>> {
77

88
/**
99
*
1010
*/
1111
private static final long serialVersionUID = -4378688201418189400L;
1212

13-
public YamlDocCatalog() {
13+
public OpenAPIDocCatalog() {
1414
super("openapi-catalog", "openapi");
1515
this.getGeneralProps().setProperty(ATT_TYPE, OpenapiConfig.class.getName());
1616
}

src/main/java/org/fugerit/java/yaml/doc/config/OpenapiConfig.java renamed to src/main/java/org/fugerit/java/openapi/doc/config/OpenapiConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.fugerit.java.yaml.doc.config;
1+
package org.fugerit.java.openapi.doc.config;
22

33
import org.fugerit.java.core.cfg.xml.BasicIdConfigType;
44

src/main/java/org/fugerit/java/yaml/doc/fun/PrintExampleFun.java renamed to src/main/java/org/fugerit/java/openapi/doc/fun/PrintExampleFun.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.fugerit.java.yaml.doc.fun;
1+
package org.fugerit.java.openapi.doc.fun;
22

33
import java.util.List;
44

0 commit comments

Comments
 (0)