Skip to content

Commit d6539ba

Browse files
eriktimwing328
authored andcommitted
Add Elm language - BETA (#6947)
This is the initial Codegen for Elm 0.18. Please try it out and provide feedback. Not yet supported: * path variables; * additionalProperties; * authentication; * recursive types.
1 parent 538f28e commit d6539ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1933
-0
lines changed

bin/elm-petstore.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=`ls -ld "$SCRIPT"`
7+
link=`expr "$ls" : '.*-> \(.*\)$'`
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=`dirname "$SCRIPT"`/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=`dirname "$SCRIPT"`/..
17+
APP_DIR=`cd "${APP_DIR}"; pwd`
18+
fi
19+
20+
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29+
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l elm -o samples/client/petstore/elm"
30+
31+
java $JAVA_OPTS -jar $executable $ags

bin/windows/elm-petstore.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
8+
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l elm -o samples\client\petstore\elm
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenProperty.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class CodegenProperty implements Cloneable {
4949
public Map<String, Object> vendorExtensions;
5050
public boolean hasValidation; // true if pattern, maximum, etc are set (only used in the mustache template)
5151
public boolean isInherited;
52+
public String discriminatorValue;
5253
public String nameInCamelCase; // property name in camel case
5354
// enum name based on the property name, usually use as a prefix (e.g. VAR_NAME) for enum name (e.g. VAR_NAME_VALUE1)
5455
public String enumName;
@@ -131,6 +132,7 @@ public int hashCode()
131132
result = prime * result + ((isMapContainer ? 13:31));
132133
result = prime * result + ((isListContainer ? 13:31));
133134
result = prime * result + Objects.hashCode(isInherited);
135+
result = prime * result + Objects.hashCode(discriminatorValue);
134136
result = prime * result + Objects.hashCode(nameInCamelCase);
135137
result = prime * result + Objects.hashCode(enumName);
136138
result = prime * result + ((maxItems == null) ? 0 : maxItems.hashCode());
@@ -312,6 +314,9 @@ public boolean equals(Object obj) {
312314
if (!Objects.equals(this.isInherited, other.isInherited)) {
313315
return false;
314316
}
317+
if (!Objects.equals(this.discriminatorValue, other.discriminatorValue)) {
318+
return false;
319+
}
315320
if (!Objects.equals(this.nameInCamelCase, other.nameInCamelCase)) {
316321
return false;
317322
}

0 commit comments

Comments
 (0)