Skip to content
Closed

Apex #687

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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ COPY ./LICENSE ${GEN_DIR}
COPY ./google_checkstyle.xml ${GEN_DIR}

# Modules are copied individually here to allow for caching of docker layers between major.minor versions
# NOTE: openapi-generator-online is not included here
COPY ./modules/openapi-generator-gradle-plugin ${GEN_DIR}/modules/openapi-generator-gradle-plugin
COPY ./modules/openapi-generator-maven-plugin ${GEN_DIR}/modules/openapi-generator-maven-plugin
COPY ./modules/openapi-generator-online ${GEN_DIR}/modules/openapi-generator-online
COPY ./modules/openapi-generator-cli ${GEN_DIR}/modules/openapi-generator-cli
COPY ./modules/openapi-generator ${GEN_DIR}/modules/openapi-generator
COPY ./pom.xml ${GEN_DIR}
Expand Down
10 changes: 6 additions & 4 deletions bin/rust-server-petstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ then
mvn -B clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/rust-server -i modules/openapi-generator/src/test/resources/2_0/rust-server/petstore-with-fake-endpoints-models-for-testing.yaml -g rust-server -o samples/server/petstore/rust-server -DpackageName=petstore_api --additional-properties hideGenerationTimestamp=true $@"
for spec_path in modules/openapi-generator/src/test/resources/2_0/rust-server/* ; do
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
spec=$(basename "$spec_path" | sed 's/.yaml//')
ags="generate -t modules/openapi-generator/src/main/resources/rust-server -i $spec_path -g rust-server -o samples/server/petstore/rust-server/output/$spec -DpackageName=$spec --additional-properties hideGenerationTimestamp=true $@"

java $JAVA_OPTS -jar $executable $ags
java $JAVA_OPTS -jar $executable $ags
done
Original file line number Diff line number Diff line change
Expand Up @@ -4423,7 +4423,11 @@ public CodegenParameter fromRequestBody(RequestBody body, Map<String, Schema> sc
}

if (StringUtils.isEmpty(bodyParameterName)) {
codegenParameter.baseName = mostInnerItem.complexType;
if(StringUtils.isEmpty(mostInnerItem.complexType)) {
codegenParameter.baseName = "request_body";
} else {
codegenParameter.baseName = mostInnerItem.complexType;
}
} else {
codegenParameter.baseName = bodyParameterName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,14 @@ private void configureGeneratorProperties() {

URL url = URLPathUtils.getServerURL(openAPI);
contextPath = config.escapeText(url.getPath());
basePath = config.escapeText(URLPathUtils.getHost(openAPI));
basePathWithoutHost = contextPath; // for backward compatibility
basePath = config.escapeText(URLPathUtils.getHost(openAPI));
if ("/".equals(basePath.substring(basePath.length() - 1))) {
// remove trailing "/"
// https://host.example.com/ => https://host.example.com
basePath = basePath.substring(0, basePath.length() - 1);
}

}

private void configureOpenAPIInfo() {
Expand Down
Loading