Merge remote-tracking branch 'origin/master' into 5.4.x

This commit is contained in:
WILLIAM CHENG
2021-11-21 09:43:21 +08:00
2826 changed files with 72620 additions and 6604 deletions

View File

@@ -86,7 +86,7 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
"--markdown-header"}, title = "markdown header", description = "When format=markdown, include this option to write out markdown headers (e.g. for docusaurus).")
private Boolean markdownHeader;
@Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --supporting-files)")
@Option(name = {"--full-details"}, title = "full generator details", description = "displays CLI options as well as other configs/mappings (implies --instantiation-types, --reserved-words, --language-specific-primitives, --import-mappings, --feature-set)")
private Boolean fullDetails;
private String newline = System.lineSeparator();

View File

@@ -22,7 +22,9 @@ import org.apache.commons.lang3.ArrayUtils;
import org.mockito.MockSettings;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.Generator;
import org.openapitools.codegen.SpecValidationException;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.testng.TestException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -430,4 +432,12 @@ public class GenerateTest {
verify(configurator).toContext();
verifyNoMoreInteractions(configurator);
}
/**
* This test ensures that when the
*/
@Test(expectedExceptions = SpecValidationException.class)
public void testNPEWithInvalidSpecFile() {
setupAndRunTest("-i", "src/test/resources/npe-test.yaml", "-g", "java", "-o", "src/main/java", false, null);
}
}

View File

@@ -0,0 +1,14 @@
test:
get:
responses:
'200':
description: test
content:
application/json:
schema:
type: object
properties:
prop1:
type: array
prop2:
type: date

View File

@@ -0,0 +1,8 @@
openapi: 3.0.0
info:
description: test
version: test
title: test
paths:
/test:
$ref: 'npe-test-spec-file.yaml#/test'