Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public interface {{classname}} {
{{#prioritizedContentTypes}}
{{#-first}}
@Headers({
"Content-Type:{{mediaType}}"
"Content-Type:{{{mediaType}}}"
})
{{/-first}}
{{/prioritizedContentTypes}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface {{classname}} {
{{#prioritizedContentTypes}}
{{#-first}}
@Headers({
"Content-Type:{{mediaType}}"
"Content-Type:{{{mediaType}}}"
})
{{/-first}}
{{/prioritizedContentTypes}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface {{classname}} {
{{#prioritizedContentTypes}}
{{#-first}}
@Headers({
"Content-Type:{{mediaType}}"
"Content-Type:{{{mediaType}}}"
})
{{/-first}}
{{/prioritizedContentTypes}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}},
Expand Down
4 changes: 2 additions & 2 deletions modules/swagger-codegen/src/main/resources/apex/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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}}
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
4 changes: 2 additions & 2 deletions modules/swagger-codegen/src/main/resources/ze-ph/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ 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}}"})
{{/isPrimitiveType}}
{{/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
*
Expand Down