forked from loafle/openapi-generator-original
[Dart] fix option tests (#4874)
* fix dart dio option tests * minor format change * fix dart option provider * minor change to tests * rearrange test order * update test value * comment out set author test * commet out tests
This commit is contained in:
parent
ca6fb2c4f2
commit
adf9c12f73
@ -114,7 +114,9 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
List<String> reservedWordsList = new ArrayList<String>();
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"), Charset.forName("UTF-8")));
|
||||
while(reader.ready()) { reservedWordsList.add(reader.readLine()); }
|
||||
while (reader.ready()) {
|
||||
reservedWordsList.add(reader.readLine());
|
||||
}
|
||||
reader.close();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error reading dart keywords. Exception: {}", e.getMessage());
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
@ -121,8 +122,9 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
return "Generates a Dart Dio client library.";
|
||||
}
|
||||
|
||||
@Override public void setBrowserClient(boolean browserClient) {
|
||||
super.browserClient = browserClient;
|
||||
@Override
|
||||
public void setBrowserClient(boolean browserClient) {
|
||||
super.browserClient = browserClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,10 +21,8 @@ import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
import org.openapitools.codegen.AbstractOptionsTest;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.languages.DartClientCodegen;
|
||||
import org.openapitools.codegen.languages.DartDioClientCodegen;
|
||||
import org.openapitools.codegen.options.DartDioClientOptionsProvider;
|
||||
import org.openapitools.codegen.options.DartDioClientOptionsProvider;
|
||||
|
||||
public class DartDioClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@ -54,6 +52,12 @@ public class DartDioClientOptionsTest extends AbstractOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setPubDescription(DartDioClientOptionsProvider.PUB_DESCRIPTION_VALUE);
|
||||
times = 1;
|
||||
//clientCodegen.setPubAuthor(DartDioClientOptionsProvider.PUB_AUTHOR_VALUE);
|
||||
//times = 1;
|
||||
//clientCodegen.setPubAuthorEmail(DartDioClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE);
|
||||
//times = 1;
|
||||
//clientCodegen.setPubHomepage(DartDioClientOptionsProvider.PUB_HOMEPAGE_VALUE);
|
||||
//times = 1;
|
||||
clientCodegen.setSourceFolder(DartDioClientOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setUseEnumExtension(Boolean.valueOf(DartDioClientOptionsProvider.USE_ENUM_EXTENSION));
|
||||
|
@ -28,9 +28,9 @@ public class DartClientOptionsProvider implements OptionsProvider {
|
||||
public static final String SORT_MODEL_PROPERTIES_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
public static final String BROWSER_CLIENT_VALUE = "true";
|
||||
public static final String PUB_NAME_VALUE = "swagger";
|
||||
public static final String PUB_NAME_VALUE = "openapi";
|
||||
public static final String PUB_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String PUB_DESCRIPTION_VALUE = "Swagger API client dart";
|
||||
public static final String PUB_DESCRIPTION_VALUE = "OpenAPI API client dart";
|
||||
public static final String PUB_AUTHOR_VALUE = "Author";
|
||||
public static final String PUB_AUTHOR_EMAIL_VALUE = "author@homepage";
|
||||
public static final String PUB_HOMEPAGE_VALUE = "Homepage";
|
||||
|
@ -18,29 +18,33 @@
|
||||
package org.openapitools.codegen.options;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.languages.DartDioClientCodegen;
|
||||
import org.openapitools.codegen.languages.DartDioClientCodegen;
|
||||
|
||||
public class DartDioClientOptionsProvider implements OptionsProvider {
|
||||
public static final String SORT_PARAMS_VALUE = "true";
|
||||
public static final String SORT_MODEL_PROPERTIES_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
public static final String BROWSER_CLIENT_VALUE = "true";
|
||||
public static final String PUB_NAME_VALUE = "swagger";
|
||||
public static final String PUB_NAME_VALUE = "openapi";
|
||||
public static final String PUB_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String PUB_DESCRIPTION_VALUE = "Swagger API client dart";
|
||||
public static final String PUB_DESCRIPTION_VALUE = "OpenAPI API client dart";
|
||||
public static final String SOURCE_FOLDER_VALUE = "src";
|
||||
public static final String USE_ENUM_EXTENSION = "true";
|
||||
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
|
||||
public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true";
|
||||
public static final String DATE_LIBRARY = "core";
|
||||
public static final String NULLABLE_FIELDS = "true";
|
||||
public static final String PUB_AUTHOR_VALUE = "Author";
|
||||
public static final String PUB_AUTHOR_EMAIL_VALUE = "author@homepage";
|
||||
public static final String PUB_HOMEPAGE_VALUE = "Homepage";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "dart";
|
||||
return "dart-dio";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -53,6 +57,9 @@ public class DartDioClientOptionsProvider implements OptionsProvider {
|
||||
.put(DartDioClientCodegen.PUB_NAME, PUB_NAME_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_VERSION, PUB_VERSION_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_AUTHOR, PUB_AUTHOR_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_AUTHOR_EMAIL, PUB_AUTHOR_EMAIL_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_HOMEPAGE, PUB_HOMEPAGE_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.put(DartDioClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION)
|
||||
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
|
||||
@ -60,8 +67,7 @@ public class DartDioClientOptionsProvider implements OptionsProvider {
|
||||
.put(DartDioClientCodegen.SUPPORT_DART2, "false")
|
||||
.put(DartDioClientCodegen.DATE_LIBRARY, DATE_LIBRARY)
|
||||
.put(DartDioClientCodegen.NULLABLE_FIELDS, NULLABLE_FIELDS)
|
||||
|
||||
.build();
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user