Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
minor improve to rust server (OpenAPITools#5020)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 authored Jan 17, 2020
1 parent 67d23fc commit 3f074a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ private boolean isMimetypeOctetStream(String mimetype) {
}

private boolean isMimetypePlain(String mimetype) {
return isMimetypePlainText(mimetype) || isMimetypeHtmlText(mimetype) || isMimetypeOctetStream(mimetype);
return isMimetypePlainText(mimetype) || isMimetypeHtmlText(mimetype) || isMimetypeOctetStream(mimetype);
}

@Override
Expand All @@ -560,7 +560,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation

pathFormatString = pathFormatString.replace(paramSearch, paramReplace);
}
op.vendorExtensions.put("pathFormatString", pathFormatString);
op.vendorExtensions.put("x-path-format-string", pathFormatString);

// The Rust code will need to contain a series of regular expressions.
// For performance, we'll construct these at start-of-day and re-use
Expand Down Expand Up @@ -1019,7 +1019,7 @@ public CodegenModel fromModel(String name, Schema model) {
am.getItems() != null &&
!StringUtils.isEmpty(am.getItems().get$ref())) {
Schema inner_schema = allDefinitions.get(
ModelUtils.getSimpleRef(am.getItems().get$ref()));
ModelUtils.getSimpleRef(am.getItems().get$ref()));

if (inner_schema.getXml() != null &&
inner_schema.getXml().getName() != null) {
Expand Down Expand Up @@ -1271,9 +1271,7 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) {
// the user than the alternative.
LOGGER.warn("Ignoring additionalProperties (see https://github.com/OpenAPITools/openapi-generator/issues/318) alongside defined properties");
cm.dataType = null;
}
else
{
} else {
String type;

if (typeMapping.containsKey(cm.additionalPropertiesType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ impl<F, C> Api<C> for Client<F> where
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, param_{{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}, context: &C) -> Box<dyn Future<Item={{{operationId}}}Response, Error=ApiError>> {
let mut uri = format!(
"{}{{{basePathWithoutHost}}}{{#vendorExtensions}}{{pathFormatString}}{{/vendorExtensions}}",
"{}{{{basePathWithoutHost}}}{{{vendorExtensions.x-path-format-string}}}",
self.base_path{{#pathParams}}, {{{paramName}}}=utf8_percent_encode(&param_{{{paramName}}}.to_string(), ID_ENCODE_SET){{/pathParams}}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ paths:
schema:
type: string
responses:
200:
"200":
content: {}
description: Success
tags:
Expand Down

0 comments on commit 3f074a2

Please sign in to comment.