Skip to content

Commit 85e0e28

Browse files
committed
parameter *input-openapi* instead of *input-yaml* (the latter is kept for backward compatibility)
1 parent 8c5a8bc commit 85e0e28

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
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+
- parameter *input-openapi* instead of *input-yaml* (the latter is kept for backward compatibility)
13+
1014
## [2.0.0] - 2025-07-27
1115

1216
### Fixed

src/main/java/org/fugerit/java/openapi/doc/OpenAPIDocCheckModel.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,13 @@ 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(OpenAPIDocMain.ARG_INPUT_YAML);
102+
String inputOpenapi = props.getProperty(OpenAPIDocMain.ARG_INPUT_OPENAPI,
103+
props.getProperty(OpenAPIDocMain.ARG_INPUT_YAML));
103104
String checkType = props.getProperty(ARG_CHECK_TYPE);
104105
String checkSchema = props.getProperty(ARG_CHECK_SCHEMA);
105106
String outputFile = props.getProperty(OpenAPIDocMain.ARG_OUTPUT_FILE);
106-
if (StringUtils.isEmpty(inputYaml)) {
107-
throw new ConfigException(MISSING_REQUIRED + OpenAPIDocMain.ARG_INPUT_YAML);
107+
if (StringUtils.isEmpty(inputOpenapi)) {
108+
throw new ConfigException(MISSING_REQUIRED + OpenAPIDocMain.ARG_INPUT_OPENAPI);
108109
}
109110
if (StringUtils.isEmpty(checkType)) {
110111
throw new ConfigException(MISSING_REQUIRED + ARG_CHECK_TYPE);
@@ -113,7 +114,7 @@ public static int handleModelCheck(Properties props) throws ConfigException {
113114
throw new ConfigException(MISSING_REQUIRED + ARG_CHECK_SCHEMA);
114115
}
115116
ConfigException.apply(() -> {
116-
try (Reader reader = new FileReader(new File(inputYaml));
117+
try (Reader reader = new FileReader(new File(inputOpenapi));
117118
StringWriter buffer = new StringWriter();
118119
PrintWriter report = new PrintWriter(buffer)) {
119120
report.println("# comparison ");

src/main/java/org/fugerit/java/openapi/doc/OpenAPIDocMain.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ private OpenAPIDocMain() {
3333

3434
public static final String ARG_EXCLUDE_SCHEMAS = "exclude-schemas";
3535

36-
public static final String ARG_INPUT_YAML = "input-yaml";
36+
public static final String ARG_INPUT_OPENAPI = "input-openapi";
37+
38+
public static final String ARG_INPUT_YAML = "input-yaml"; // alias to 'input-openapi' for backward compatibility
3739

3840
public static final String ARG_OUTPUT_FILE = "output-file";
3941

@@ -92,12 +94,12 @@ private static void setup(OpenAPIDocConfig config, Properties props) throws IOEx
9294

9395
private static void handleSingleMode(Properties props) throws ConfigException {
9496
ConfigException.apply(() -> {
95-
String inputYaml = props.getProperty(ARG_INPUT_YAML);
97+
String inputOpenapi = props.getProperty(ARG_INPUT_OPENAPI, props.getProperty(ARG_INPUT_YAML));
9698
String outputPath = props.getProperty(ARG_OUTPUT_FILE);
97-
if (StringUtils.isEmpty(inputYaml) || StringUtils.isEmpty(outputPath)) {
98-
throw new ConfigException("Required params : " + ARG_INPUT_YAML + ", " + ARG_OUTPUT_FILE);
99+
if (StringUtils.isEmpty(inputOpenapi) || StringUtils.isEmpty(outputPath)) {
100+
throw new ConfigException("Required params : " + ARG_INPUT_OPENAPI + ", " + ARG_OUTPUT_FILE);
99101
} else {
100-
File inputFile = new File(inputYaml);
102+
File inputFile = new File(inputOpenapi);
101103
File outputFile = new File(outputPath);
102104
String fileName = outputFile.getName();
103105
String outputFormat = fileName.substring(fileName.lastIndexOf('.') + 1);

src/test/java/org/fugerit/java/openapi/doc/TestOpenAPIDocCheckModel.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class TestOpenAPIDocCheckModel {
1818
@Test
1919
public void testOk() throws ConfigException {
2020
Properties params = new Properties();
21-
params.setProperty(OpenAPIDocMain.ARG_INPUT_YAML, "src/test/resources/sample/sample.yaml");
21+
params.setProperty(OpenAPIDocMain.ARG_INPUT_OPENAPI, "src/test/resources/sample/sample.yaml");
2222
params.setProperty(OpenAPIDocCheckModel.ARG_CHECK_SCHEMA, SampleResult.class.getSimpleName());
2323
params.setProperty(OpenAPIDocCheckModel.ARG_CHECK_TYPE, SampleResult.class.getName());
2424
params.setProperty(OpenAPIDocMain.ARG_OUTPUT_FILE, "target/report.md");
@@ -29,7 +29,7 @@ public void testOk() throws ConfigException {
2929
@Test
3030
public void testKo() throws ConfigException {
3131
Properties params = new Properties();
32-
params.setProperty(OpenAPIDocMain.ARG_INPUT_YAML, "src/test/resources/sample/sample_check1.yaml");
32+
params.setProperty(OpenAPIDocMain.ARG_INPUT_OPENAPI, "src/test/resources/sample/sample_check1.yaml");
3333
params.setProperty(OpenAPIDocCheckModel.ARG_CHECK_SCHEMA, SampleResult.class.getSimpleName());
3434
params.setProperty(OpenAPIDocCheckModel.ARG_CHECK_TYPE, SampleResult.class.getName());
3535
params.setProperty(OpenAPIDocCheckModel.ARG_CHECK_ONCE, BooleanUtils.BOOLEAN_TRUE);
@@ -41,7 +41,7 @@ public void testKo() throws ConfigException {
4141
@Test
4242
public void testKo2() throws ConfigException {
4343
Properties params = new Properties();
44-
params.setProperty(OpenAPIDocMain.ARG_INPUT_YAML, "src/test/resources/sample/sample_check2.yaml");
44+
params.setProperty(OpenAPIDocMain.ARG_INPUT_OPENAPI, "src/test/resources/sample/sample_check2.yaml");
4545
params.setProperty(OpenAPIDocCheckModel.ARG_CHECK_SCHEMA, SampleResult.class.getSimpleName());
4646
params.setProperty(OpenAPIDocCheckModel.ARG_CHECK_TYPE, SampleResult.class.getName());
4747
params.setProperty(OpenAPIDocCheckModel.ARG_CHECK_ONCE, BooleanUtils.BOOLEAN_TRUE);
@@ -69,7 +69,7 @@ public void testNoParam() {
6969
public void testMain() {
7070
String[] args = {
7171
ArgUtils.getArgString(OpenAPIDocMain.ARG_MODE), OpenAPIDocMain.ARG_MODE_CHECK_MODEL,
72-
ArgUtils.getArgString(OpenAPIDocMain.ARG_INPUT_YAML), "src/test/resources/sample/sample.yaml",
72+
ArgUtils.getArgString(OpenAPIDocMain.ARG_INPUT_OPENAPI), "src/test/resources/sample/sample.yaml",
7373
ArgUtils.getArgString(OpenAPIDocCheckModel.ARG_CHECK_SCHEMA), SampleResult.class.getSimpleName(),
7474
ArgUtils.getArgString(OpenAPIDocCheckModel.ARG_CHECK_TYPE), SampleResult.class.getName(),
7575
};

0 commit comments

Comments
 (0)