Skip to content

Commit

Permalink
Upgrade the typescript-generator backend (#54)
Browse files Browse the repository at this point in the history
* Upgrade the typescript-generator backend

* Fixed union types

* Fix tests

* Improve comment
  • Loading branch information
glentakahashi authored and ryanmcnamara committed May 19, 2017
1 parent 1a61e8f commit a1e65a6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ guavaVersion=18.0
feignVersion=8.10.0
jacksonVersion=2.6.1
jaxRsVersion=2.0.1
typescriptGeneratorVersion=1.7.190
typescriptGeneratorVersion=1.25.322
commonsIOVersion=2.4
findbugsAnnotationsVersion=3.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ public Settings getSettings() {
settings.addTypeNamePrefix = generatedInterfacePrefix();
settings.sortDeclarations = true;
settings.noFileComment = true;
// behave like 0.9.0; also fixes when subtypes use generics
settings.disableTaggedUnions = true;
settings.jsonLibrary = JsonLibrary.jackson2;
settings.optionalAnnotations = optionalAnnotations();
settings.outputKind = TypeScriptOutputKind.global;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void testComplexServiceClassEmitTypes() {
"\n" +
" export interface MyObject {\n" +
" y: MyObject;\n" +
" }\n" +
" }\n\n\n // Added by 'EnumConstantsExtension' extension\n" +
"";
assertEquals(expectedOutput, new String(stream.toByteArray()));
}
Expand Down Expand Up @@ -232,7 +232,7 @@ public void testAdditionalClassesToOutput() {
String expectedOutput = "\n" +
" export interface MyObject {\n" +
" y: MyObject;\n" +
" }\n";
" }\n\n\n // Added by 'EnumConstantsExtension' extension\n";
assertEquals(expectedOutput, new String(stream.toByteArray()));
}

Expand All @@ -244,7 +244,7 @@ public void testEnumClass() {
writer.close();
String expectedOutput = "\n" +
" export type MyEnum = \"VALUE1\" | \"VALUE2\";\n" +
"\n" +
"\n\n // Added by 'EnumConstantsExtension' extension\n\n" +
" export const MyEnum = {\n" +
" VALUE1: <MyEnum>\"VALUE1\",\n" +
" VALUE2: <MyEnum>\"VALUE2\",\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module ModuleName.TestComplexServiceClass {
y: IMyObject;
}


// Added by 'EnumConstantsExtension' extension

export interface ITestComplexServiceClass {
allOptionsPost(a: string, dataObject: IDataObject, b?: number): FooReturn<IGenericObject<IMyObject>>;
queryGetter(x?: boolean): FooReturn<IMyObject>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Generated
import { HttpEndpointOptions, HttpApiBridge } from "./httpApiBridge";


// Added by 'EnumConstantsExtension' extension

export interface SimpleService1 {
method1(): FooReturn<string>;
}
Expand Down

0 comments on commit a1e65a6

Please sign in to comment.