Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New samples #10298

Merged
merged 11 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions bin/go-petstore-mixed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/3_0_0/petstore-mixed.yaml -l go -o samples/client/petstore/go/go-petstore-mixed/swagger --flatten-inline-schema"

java $JAVA_OPTS -jar $executable $ags
31 changes: 31 additions & 0 deletions bin/nodejs-petstore-mixed-server-v3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/3_0_0/petstore-mixed.yaml -l nodejs-server -o samples/server/petstore/nodejs-petstore-mixed -Dservice"

java $JAVA_OPTS -jar $executable $ags
31 changes: 31 additions & 0 deletions bin/typescript-fetch-petstore-mixed-with-npm-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/3_0_0/petstore-mixed.yaml -l typescript-fetch -c bin/typescript-fetch-petstore-with-npm-version.json -o samples/client/petstore/typescript-fetch/builds/mixed-with-npm-version"

java $JAVA_OPTS -jar $executable $ags
4 changes: 2 additions & 2 deletions bin/typescript-fetch-petstore-with-npm-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=bin/logback.xml"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-fetch -c bin/typescript-fetch-petstore-with-npm-version.json -o samples/client/petstore/typescript-fetch/builds/with-npm-version"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/3_0_0/petstore.yaml -l typescript-fetch -c bin/typescript-fetch-petstore-with-npm-version.json -o samples/client/petstore/typescript-fetch/builds/with-npm-version"

# java $JAVA_OPTS -jar $executable $ags
java $JAVA_OPTS -jar $executable $ags
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class Generate implements Runnable {
protected Boolean disableExamples;
protected Boolean resolveFully;
protected Boolean ignoreImportMappings;
protected Boolean flattenInlineSchema;
private String url;
private List<CodegenArgument> codegenArguments;

Expand Down Expand Up @@ -224,6 +225,10 @@ public void setResolveFully(Boolean resolveFully) {
this.resolveFully = resolveFully;
}

public void setFlattenInlineSchema(Boolean flattenInlineSchema) {
this.flattenInlineSchema = flattenInlineSchema;
}

public void setIgnoreImportMappings(Boolean ignoreImportMappings) {
this.ignoreImportMappings = ignoreImportMappings;
}
Expand Down Expand Up @@ -331,6 +336,10 @@ public void run() {
configurator.setIgnoreFileOverride(ignoreFileOverride);
}

if (flattenInlineSchema != null) {
configurator.setFlattenInlineSchema(flattenInlineSchema);
}

if (removeOperationIdPrefix != null) {
configurator.setRemoveOperationIdPrefix(removeOperationIdPrefix);
}
Expand Down
7 changes: 6 additions & 1 deletion modules/swagger-codegen-cli/src/main/resources/oas3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ components:
type: "boolean"
title: "fully resolve schemas"
description: "fully resolves json schemas when loading definitions."
x-option: "--resolve-fully"
x-option: "--resolve-fully"
flattenInlineSchema:
type: "boolean"
title: "flatten inline schemas"
description: "flattens inline composed schemas."
x-option: "--flatten-inline-schema"
ConfigHelp:
x-command: "config-help"
x-command-description: "Config help for chosen lang"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case,
public static final String HAS_OPTIONAL_EXT_NAME = PREFIX_HAS + "optional";
public static final String HAS_CHILDREN_EXT_NAME = PREFIX_HAS + "children";
public static final String HAS_ONLY_READ_ONLY_EXT_NAME = PREFIX_HAS + "only-read-only";
public static final String HAS_INNER_OBJECT_NAME = PREFIX_HAS + "inner-object";

public static final String IS_SIMPLE_TYPE_EXT_NAME = PREFIX_IS + "simple-type";
public static final String IS_PRIMITIVE_TYPE_EXT_NAME = PREFIX_IS + "primitive-type";
public static final String IS_OBJECT_EXT_NAME = PREFIX_IS + "object";
public static final String IS_CONTAINER_EXT_NAME = PREFIX_IS + "container";
public static final String IS_NOT_CONTAINER_EXT_NAME = PREFIX_IS + "not-container";
public static final String IS_DEFAULT_EXT_NAME = PREFIX_IS + "default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ public Boolean getIsPrimitiveType() {
return getBooleanValue(CodegenConstants.IS_PRIMITIVE_TYPE_EXT_NAME);
}

public Boolean getIsObject() {
return getBooleanValue(CodegenConstants.IS_OBJECT_EXT_NAME);
}

public Boolean getHasInnerObject() {
return getBooleanValue(CodegenConstants.HAS_INNER_OBJECT_NAME);
}

public Boolean getIsContainer() {
return getBooleanValue(CodegenConstants.IS_CONTAINER_EXT_NAME);
}
Expand Down
Loading