use {{{mediaType}} instead of {{mediaType}} (#7073)

This commit is contained in:
William Cheng 2017-11-29 16:17:51 +08:00 committed by GitHub
parent d2a2292d20
commit 5994a2fb2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 19 additions and 19 deletions

View File

@ -89,11 +89,11 @@ public class {{classname}} {
{{/hasMore}}{{/formParams}}{{/hasFormParams}}
final String[] {{localVariablePrefix}}accepts = { {{#hasProduces}}
{{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}}
{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}
{{/hasProduces}}};
final List<MediaType> {{localVariablePrefix}}accept = {{localVariablePrefix}}apiClient.selectHeaderAccept({{localVariablePrefix}}accepts);
final String[] {{localVariablePrefix}}contentTypes = { {{#hasConsumes}}
{{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}
{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}
{{/hasConsumes}}};
final MediaType {{localVariablePrefix}}contentType = {{localVariablePrefix}}apiClient.selectHeaderContentType({{localVariablePrefix}}contentTypes);

View File

@ -50,7 +50,7 @@ public interface {{classname}} {
{{#prioritizedContentTypes}}
{{#-first}}
@Headers({
"Content-Type:{{mediaType}}"
"Content-Type:{{{mediaType}}}"
})
{{/-first}}
{{/prioritizedContentTypes}}

View File

@ -42,7 +42,7 @@ public interface {{classname}} {
{{#prioritizedContentTypes}}
{{#-first}}
@Headers({
"Content-Type:{{mediaType}}"
"Content-Type:{{{mediaType}}}"
})
{{/-first}}
{{/prioritizedContentTypes}}

View File

@ -42,7 +42,7 @@ public interface {{classname}} {
{{#prioritizedContentTypes}}
{{#-first}}
@Headers({
"Content-Type:{{mediaType}}"
"Content-Type:{{{mediaType}}}"
})
{{/-first}}
{{/prioritizedContentTypes}}

View File

@ -41,8 +41,8 @@ public class {{classname}} {
@{{httpMethod}}
{{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}}
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnBaseType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
{{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},

View File

@ -88,13 +88,13 @@ public class {{classname}} {
{{/headerParams}}
}{{/hasHeaderParams}}{{^hasHeaderParams}}(){{/hasHeaderParams}},
{{#hasProduces}}
new List<String>{ {{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}} },
new List<String>{ {{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}} },
{{/hasProduces}}
{{^hasProduces}}
new List<String>(),
{{/hasProduces}}
{{#hasConsumes}}
new List<String>{ {{#consumes}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/consumes}} },
new List<String>{ {{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}} },
{{/hasConsumes}}
{{^hasConsumes}}
new List<String>(),

View File

@ -706,7 +706,7 @@ print_{{operationId}}_help() {
{{/allParams}}
{{#allParams}}
{{#isBodyParam}}
echo -e " * ${GREEN}body${OFF} ${BLUE}[{{#consumes}}{{mediaType}}{{#hasMore}},{{/hasMore}}{{/consumes}}]${OFF}{{#required}} ${RED}(required)${OFF}{{/required}}${OFF} - {{{description}}}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}body${OFF} ${BLUE}[{{#consumes}}{{{mediaType}}}{{#hasMore}},{{/hasMore}}{{/consumes}}]${OFF}{{#required}} ${RED}(required)${OFF}{{/required}}${OFF} - {{{description}}}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
{{#vendorExtensions}}
{{#x-codegen-body-example}}
@ -791,7 +791,7 @@ call_{{operationId}}() {
{{#-first}}
{{^hasMore}}
if [[ -z $header_content_type ]]; then
header_content_type="{{mediaType}}"
header_content_type="{{{mediaType}}}"
fi
{{/hasMore}}
{{/-first}}
@ -805,7 +805,7 @@ call_{{operationId}}() {
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
{{#consumes}}
echo -e "\\t- {{mediaType}}"
echo -e "\\t- {{{mediaType}}}"
{{/consumes}}
echo ""
echo "Use '--content-type' to set proper content type"

View File

@ -48,7 +48,7 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
std::unordered_set<utility::string_t> responseHttpContentTypes;
{{#produces}}
responseHttpContentTypes.insert( utility::conversions::to_string_t("{{mediaType}}") );
responseHttpContentTypes.insert( utility::conversions::to_string_t("{{{mediaType}}}") );
{{/produces}}
utility::string_t responseHttpContentType;
@ -98,7 +98,7 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
std::unordered_set<utility::string_t> consumeHttpContentTypes;
{{#consumes}}
consumeHttpContentTypes.insert( utility::conversions::to_string_t("{{mediaType}}") );
consumeHttpContentTypes.insert( utility::conversions::to_string_t("{{{mediaType}}}") );
{{/consumes}}
{{#allParams}}

View File

@ -58,7 +58,7 @@ class {{controllerName}} extends Controller
{
{{#bodyParams}}
// Make sure that the client is providing something that we can consume
$consumes = [{{#consumes}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}];
$consumes = [{{#consumes}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}];
$inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0];
if (!in_array($inputFormat, $consumes)) {
// We can't consume the content that the client is sending us
@ -67,7 +67,7 @@ class {{controllerName}} extends Controller
{{/bodyParams}}
// Figure out what data format to return to the client
$produces = [{{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}];
$produces = [{{#produces}}'{{{mediaType}}}'{{#hasMore}}, {{/hasMore}}{{/produces}}];
// Figure out what the client accepts
$clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*';
$responseFormat = $this->getOutputFormat($clientAccepts, $produces);

View File

@ -169,7 +169,7 @@ static bool {{nickname}}Helper(char * accessToken,
headerList = curl_slist_append(headerList, accessHeader.c_str());
{{#hasConsumes}}
{{#consumes}}
headerList = curl_slist_append(headerList, "Content-Type: {{mediaType}}");
headerList = curl_slist_append(headerList, "Content-Type: {{{mediaType}}}");
{{/consumes}}
{{/hasConsumes}}
{{^hasConsumes}}

View File

@ -29,7 +29,7 @@ class {{classname}} implements {{interfacesToImplement}}
{{#bodyParam}}
{{#consumes}}
* TODO check if consumer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="{{mediaType}}")
* @PHA\Consumer(name=PHConsumer\Json::class, mediaType="{{{mediaType}}}")
{{/consumes}}
{{^isPrimitiveType}}
* @PHA\Attribute(name=PHAttribute\Transfer::class, options={"type":{{dataType}}::class,"objectAttr":"{{paramName}}"})
@ -37,7 +37,7 @@ class {{classname}} implements {{interfacesToImplement}}
{{/bodyParam}}
{{#produces}}
* TODO check if producer is valid, if it has correct priority and if it can be moved to class annotation
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="{{mediaType}}")
* @PHA\Producer(name=PHProducer\Transfer::class, mediaType="{{{mediaType}}}")
{{/produces}}
* @param ServerRequestInterface $request
*