forked from loafle/openapi-generator-original
fix path with unescaped value (#19938)
This commit is contained in:
parent
eb92eeb32e
commit
071540f55a
@ -51,7 +51,7 @@ package body {{package}}.Clients is
|
||||
URI.Add_Param ("{{baseName}}", {{paramName}});{{/isLong}}{{#isContainer}}
|
||||
URI.Add_Param ("{{baseName}}", {{paramName}});{{/isContainer}}{{#isDateTime}}
|
||||
URI.Add_Param ("{{baseName}}", {{paramName}});{{/isDateTime}}{{/isQueryParam}}{{/queryParams}}
|
||||
URI.Set_Path ("{{path}}");{{#pathParams}}
|
||||
URI.Set_Path ("{{{path}}}");{{#pathParams}}
|
||||
URI.Set_Path_Param ("{{baseName}}", {{^isString}}{{#vendorExtensions.x-is-model-type}}{{package}}.Models{{/vendorExtensions.x-is-model-type}}{{^vendorExtensions.x-is-model-type}}{{openApiPackageName}}{{/vendorExtensions.x-is-model-type}}.To_String ({{/isString}}{{paramName}}{{^isString}}){{/isString}});{{/pathParams}}
|
||||
Client.Call ({{openApiPackageName}}.Clients.{{httpMethod}}, URI{{#hasBodyParam}}, Req{{/hasBodyParam}}{{#hasFormParams}}, Req{{/hasFormParams}}{{#returnType}}, Reply{{/returnType}});
|
||||
{{#returnProperty}}
|
||||
|
@ -27,7 +27,7 @@ package body {{package}}.Skeletons is
|
||||
new {{openApiPackageName}}.Servers.Operation
|
||||
(Handler => {{operationId}},
|
||||
Method => {{openApiPackageName}}.Servers.{{httpMethod}},
|
||||
URI => URI_Prefix & "{{path}}",
|
||||
URI => URI_Prefix & "{{{path}}}",
|
||||
{{#vendorExtensions.x-produces-media-index}}
|
||||
Mimes => Media_List_{{vendorExtensions.x-produces-media-index}}'Access);
|
||||
{{/vendorExtensions.x-produces-media-index}}
|
||||
@ -259,7 +259,7 @@ package body {{package}}.Skeletons is
|
||||
new {{openApiPackageName}}.Servers.Operation
|
||||
(Handler => {{operationId}},
|
||||
Method => {{openApiPackageName}}.Servers.{{httpMethod}},
|
||||
URI => URI_Prefix & "{{path}}",
|
||||
URI => URI_Prefix & "{{{path}}}",
|
||||
{{#vendorExtensions.x-produces-media-index}}
|
||||
Mimes => Media_List_{{vendorExtensions.x-produces-media-index}}'Access);
|
||||
{{/vendorExtensions.x-produces-media-index}}
|
||||
|
@ -195,7 +195,7 @@ public class {{classname}} {
|
||||
{{#returnType}}
|
||||
GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {};
|
||||
{{/returnType}}
|
||||
return apiClient.invokeAPI("{{classname}}.{{operationId}}", {{#hasPathParams}}localVarPath{{/hasPathParams}}{{^hasPathParams}}"{{path}}"{{/hasPathParams}}, "{{httpMethod}}", {{#queryParams}}{{#-first}}localVarQueryParams{{/-first}}{{/queryParams}}{{^queryParams}}new ArrayList<>(){{/queryParams}}, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}},
|
||||
return apiClient.invokeAPI("{{classname}}.{{operationId}}", {{#hasPathParams}}localVarPath{{/hasPathParams}}{{^hasPathParams}}"{{{path}}}"{{/hasPathParams}}, "{{httpMethod}}", {{#queryParams}}{{#-first}}localVarQueryParams{{/-first}}{{/queryParams}}{{^queryParams}}new ArrayList<>(){{/queryParams}}, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}},
|
||||
{{#headerParams}}{{#-first}}localVarHeaderParams{{/-first}}{{/headerParams}}{{^headerParams}}new LinkedHashMap<>(){{/headerParams}}, {{#cookieParams}}{{#-first}}localVarCookieParams{{/-first}}{{/cookieParams}}{{^cookieParams}}new LinkedHashMap<>(){{/cookieParams}}, {{#formParams}}{{#-first}}localVarFormParams{{/-first}}{{/formParams}}{{^formParams}}new LinkedHashMap<>(){{/formParams}}, localVarAccept, localVarContentType,
|
||||
{{#hasAuthMethods}}localVarAuthNames{{/hasAuthMethods}}{{^hasAuthMethods}}null{{/hasAuthMethods}}, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}});
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class {{classname}} {
|
||||
{{#returnType}}
|
||||
GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {};
|
||||
{{/returnType}}
|
||||
return apiClient.invokeAPI("{{classname}}.{{operationId}}", {{#hasPathParams}}localVarPath{{/hasPathParams}}{{^hasPathParams}}"{{path}}"{{/hasPathParams}}, "{{httpMethod}}", {{#queryParams}}{{#-first}}localVarQueryParams{{/-first}}{{/queryParams}}{{^queryParams}}new ArrayList<>(){{/queryParams}}, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}},
|
||||
return apiClient.invokeAPI("{{classname}}.{{operationId}}", {{#hasPathParams}}localVarPath{{/hasPathParams}}{{^hasPathParams}}"{{{path}}}"{{/hasPathParams}}, "{{httpMethod}}", {{#queryParams}}{{#-first}}localVarQueryParams{{/-first}}{{/queryParams}}{{^queryParams}}new ArrayList<>(){{/queryParams}}, {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}},
|
||||
{{#headerParams}}{{#-first}}localVarHeaderParams{{/-first}}{{/headerParams}}{{^headerParams}}new LinkedHashMap<>(){{/headerParams}}, {{#cookieParams}}{{#-first}}localVarCookieParams{{/-first}}{{/cookieParams}}{{^cookieParams}}new LinkedHashMap<>(){{/cookieParams}}, {{#formParams}}{{#-first}}localVarFormParams{{/-first}}{{/formParams}}{{^formParams}}new LinkedHashMap<>(){{/formParams}}, localVarAccept, localVarContentType,
|
||||
{{#hasAuthMethods}}localVarAuthNames{{/hasAuthMethods}}{{^hasAuthMethods}}null{{/hasAuthMethods}}, {{#returnType}}localVarReturnType{{/returnType}}{{^returnType}}null{{/returnType}}, {{#bodyParam}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/bodyParam}}{{^bodyParam}}false{{/bodyParam}});
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class {{classname}} {
|
||||
public static class {{operationIdCamelCase}}Oper implements Oper {
|
||||
|
||||
public static final Method REQ_METHOD = {{httpMethod}};
|
||||
public static final String REQ_URI = "{{path}}";
|
||||
public static final String REQ_URI = "{{{path}}}";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
private ResponseSpecBuilder respSpec;
|
||||
@ -163,7 +163,7 @@ public class {{classname}} {
|
||||
}
|
||||
|
||||
/**
|
||||
* {{httpMethod}} {{path}}
|
||||
* {{httpMethod}} {{{path}}}
|
||||
* @param handler handler
|
||||
* @param <T> type
|
||||
* @return type
|
||||
@ -175,7 +175,7 @@ public class {{classname}} {
|
||||
{{#returnType}}
|
||||
|
||||
/**
|
||||
* {{httpMethod}} {{path}}
|
||||
* {{httpMethod}} {{{path}}}
|
||||
* @param handler handler
|
||||
* @return {{returnType}}
|
||||
*/
|
||||
|
@ -54,7 +54,7 @@ export default class {{classname}} {
|
||||
{{operationId}}() {
|
||||
return {
|
||||
method: '{{httpMethod}}',
|
||||
url: this.basePath + '{{path}}'
|
||||
url: this.basePath + '{{{path}}}'
|
||||
{{#pathParams}}
|
||||
.replace('{' + '{{baseName}}' + '}', ':{{paramName}}')
|
||||
{{/pathParams}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
<Location "{{basePathWithoutHost}}{{path}}">
|
||||
<Location "{{{basePathWithoutHost}}}{{{path}}}">
|
||||
{{>authConf}}
|
||||
<LimitExcept GET POST PUT DELETE>
|
||||
Require valid-user
|
||||
|
@ -74,7 +74,7 @@ public class {{classname}} {
|
||||
{{/formParams}}
|
||||
|
||||
{{#returnType}}return ({{{.}}}) {{/returnType}}client.invoke(
|
||||
'{{httpMethod}}', '{{path}}',{{#bodyParam}}
|
||||
'{{httpMethod}}', '{{{path}}}',{{#bodyParam}}
|
||||
({{{dataType}}}) params.get('{{paramName}}'){{/bodyParam}}{{^bodyParam}} ''{{/bodyParam}},
|
||||
query, form,
|
||||
new Map<String, Object>{{#hasPathParams}}{
|
||||
|
@ -104,9 +104,9 @@ std::string convertMapResponse(const std::map<KEY_T, VAL_T>& map)
|
||||
|
||||
namespace {{classname}}Resources {
|
||||
{{#operation}}
|
||||
{{vendorExtensions.x-codegen-resource-name}}Resource::{{vendorExtensions.x-codegen-resource-name}}Resource(const std::string& context /* = "{{contextPath}}" */)
|
||||
{{vendorExtensions.x-codegen-resource-name}}Resource::{{vendorExtensions.x-codegen-resource-name}}Resource(const std::string& context /* = "{{{contextPath}}}" */)
|
||||
{
|
||||
this->set_path(context + "{{path}}");
|
||||
this->set_path(context + "{{{path}}}");
|
||||
this->set_method_handler("{{httpMethod}}",
|
||||
std::bind(&{{vendorExtensions.x-codegen-resource-name}}Resource::handler_{{httpMethod}}_internal, this,
|
||||
std::placeholders::_1));
|
||||
|
@ -380,7 +380,7 @@ namespace {{packageName}}.{{apiPackage}}
|
||||
uriBuilderLocalVar.Host = HttpClient.BaseAddress{{nrt!}}.Host;
|
||||
uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
|
||||
uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
|
||||
uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "{{path}}";
|
||||
uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "{{{path}}}";
|
||||
{{/servers}}
|
||||
{{#servers}}
|
||||
{{#-first}}
|
||||
@ -621,7 +621,7 @@ namespace {{packageName}}.{{apiPackage}}
|
||||
|
||||
ILogger<{{operationId}}ApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<{{operationId}}ApiResponse>();
|
||||
|
||||
{{operationId}}ApiResponse apiResponseLocalVar = new{{^net60OrLater}} {{operationId}}ApiResponse{{/net60OrLater}}(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "{{path}}", requestedAtLocalVar, _jsonSerializerOptions);
|
||||
{{operationId}}ApiResponse apiResponseLocalVar = new{{^net60OrLater}} {{operationId}}ApiResponse{{/net60OrLater}}(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "{{{path}}}", requestedAtLocalVar, _jsonSerializerOptions);
|
||||
|
||||
After{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}apiResponseLocalVar {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}});
|
||||
|
||||
@ -674,7 +674,7 @@ namespace {{packageName}}.{{apiPackage}}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
OnError{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}e "{{path}}" uriBuilderLocalVar.Path {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}});
|
||||
OnError{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}e "{{{path}}}" uriBuilderLocalVar.Path {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}});
|
||||
Events.ExecuteOnError{{operationId}}(e);
|
||||
throw;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
-moduledoc """
|
||||
Exposes the following operation IDs:
|
||||
{{#operations}}{{#operation}}
|
||||
- `{{httpMethod}}` to `{{path}}`, OperationId: `{{operationIdOriginal}}`:
|
||||
- `{{httpMethod}}` to `{{{path}}}`, OperationId: `{{{operationIdOriginal}}}`:
|
||||
{{summary}}.
|
||||
{{notes}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
@ -22,7 +22,7 @@ module {{classname}}Handlers =
|
||||
/// </summary>
|
||||
[<FunctionName("{{operationId}}")>]
|
||||
let {{operationId}}
|
||||
([<HttpTrigger(Extensions.Http.AuthorizationLevel.Anonymous, "{{httpMethod}}", Route = "{{contextPath}}{{path}}")>]
|
||||
([<HttpTrigger(Extensions.Http.AuthorizationLevel.Anonymous, "{{httpMethod}}", Route = "{{{contextPath}}}{{{path}}}")>]
|
||||
req:HttpRequest ) =
|
||||
|
||||
{{#hasBodyParam}}
|
||||
|
@ -54,7 +54,7 @@ module App =
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{httpMethod}} >=> {{^hasPathParams}}route{{/hasPathParams}}{{#hasPathParams}}routeBind<{{operationId}}PathParams>{{/hasPathParams}} "{{contextPath}}{{path}}" {{^pathParams}}>=>{{/pathParams}} {{#pathParams}}(fun x -> {{/pathParams}}{{#authMethods}}{{#isOAuth}}requiresAuthentication authFailure{{/isOAuth}}{{#isApiKey}}challenge ApiKeyDefaults.AuthenticationScheme >=> requiresAuthentication authFailure{{/isApiKey}} >=> {{/authMethods}} {{classname}}Handler.{{operationId}}{{#pathParams}} x){{/pathParams}};
|
||||
{{httpMethod}} >=> {{^hasPathParams}}route{{/hasPathParams}}{{#hasPathParams}}routeBind<{{operationId}}PathParams>{{/hasPathParams}} "{{contextPath}}{{{path}}}" {{^pathParams}}>=>{{/pathParams}} {{#pathParams}}(fun x -> {{/pathParams}}{{#authMethods}}{{#isOAuth}}requiresAuthentication authFailure{{/isOAuth}}{{#isApiKey}}challenge ApiKeyDefaults.AuthenticationScheme >=> requiresAuthentication authFailure{{/isApiKey}} >=> {{/authMethods}} {{classname}}Handler.{{operationId}}{{#pathParams}} x){{/pathParams}};
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
|
@ -4,5 +4,5 @@
|
||||
-- /static StaticR Static appStatic
|
||||
|
||||
{{#routes}}
|
||||
{{path}} {{resource}}{{#methods}} {{this}}{{/methods}}
|
||||
{{{path}}} {{resource}}{{#methods}} {{this}}{{/methods}}
|
||||
{{/routes}}
|
||||
|
@ -46,7 +46,7 @@ public class {{classname}} extends RouteBuilder {
|
||||
.endSecurityDefinition(){{/-last}}{{/isApiKey}}{{#isBasic}}{{#isBasicBasic}}
|
||||
.basicAuth("{{name}}"){{#-last}}.end(){{/-last}}{{/isBasicBasic}}{{#isBasicBearer}}
|
||||
.bearerToken("{{name}}"{{#bearerFormat}}, "{{bearerFormat}}"{{/bearerFormat}}){{#-last}}.end(){{/-last}}{{/isBasicBearer}}{{/isBasic}}{{/authMethods}}{{/hasAuthMethods}}{{/camelSecurityDefinitions}}
|
||||
.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}("{{path}}")
|
||||
.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}("{{{path}}}")
|
||||
.description("{{#summary}}{{{.}}}{{/summary}}")
|
||||
.id("{{operationId}}Api"){{#vendorExtensions}}{{#camelRestBindingMode}}
|
||||
.clientRequestValidation(false)
|
||||
|
@ -25,7 +25,7 @@ public class {{classname}}Test {
|
||||
public void {{operationId}}TestJson() throws Exception {
|
||||
String contentType = "application/json";
|
||||
String accept = "application/json";
|
||||
String url = API_URL + "{{path}}";
|
||||
String url = API_URL + "{{{path}}}";
|
||||
HttpRequest httpRequest = Unirest.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(url);{{#hasConsumes}}
|
||||
httpRequest = httpRequest.header("Content-Type", contentType);{{/hasConsumes}}{{#hasProduces}}
|
||||
httpRequest = httpRequest.header("Accept", accept);{{/hasProduces}}{{#pathParams}}
|
||||
@ -45,7 +45,7 @@ public class {{classname}}Test {
|
||||
public void {{operationId}}TestXml() throws Exception {
|
||||
String contentType = "application/xml";
|
||||
String accept = "application/xml";
|
||||
String url = API_URL + "{{path}}";
|
||||
String url = API_URL + "{{{path}}}";
|
||||
HttpRequest httpRequest = Unirest.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(url);{{#hasConsumes}}
|
||||
httpRequest = httpRequest.header("Content-Type", contentType);{{/hasConsumes}}{{#hasProduces}}
|
||||
httpRequest = httpRequest.header("Accept", accept);{{/hasProduces}}{{#pathParams}}
|
||||
|
@ -9,7 +9,7 @@ import cucumber.api.junit.Cucumber;
|
||||
@ActiveProfiles("test")
|
||||
@CucumberOptions(format = { "pretty", "html:target/cucumber-html-report",
|
||||
{{#resourcePaths}}
|
||||
"json:./report/{{path}}-report-json/{{path}}.json",
|
||||
"json:./report/{{{path}}}-report-json/{{{path}}}.json",
|
||||
{{/resourcePaths}} })
|
||||
public class {{serviceName}}Test {
|
||||
}
|
@ -24,9 +24,9 @@ public class ExecuteReport {
|
||||
Configuration configuration = null;
|
||||
ReportBuilder reportBuilder = null;
|
||||
{{#resourcePaths}}
|
||||
reportOutputDirectory = new File("./report/{{path}}-report-html/");
|
||||
reportOutputDirectory = new File("./report/{{{path}}}-report-html/");
|
||||
jsonFiles = new ArrayList();
|
||||
jsonFiles.add("./report/{{path}}-report-json/{{path}}.json");
|
||||
jsonFiles.add("./report/{{{path}}}-report-json/{{{path}}}.json");
|
||||
|
||||
configuration = new Configuration(reportOutputDirectory,projectName);
|
||||
// optionally only if you need
|
||||
|
@ -9,7 +9,7 @@ import org.springframework.boot.SpringApplication
|
||||
import org.springframework.context.ConfigurableApplicationContext
|
||||
|
||||
|
||||
class get{{path}} extends Simulation {
|
||||
class get{{{path}}} extends Simulation {
|
||||
|
||||
|
||||
val app: ConfigurableApplicationContext = SpringApplication.run(classOf[{{basePackage}}.{{serviceName}}Application])
|
||||
|
@ -32,9 +32,9 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter
|
||||
{{#resourcePaths}}
|
||||
http.
|
||||
anonymous().disable()
|
||||
.requestMatchers().antMatchers(HttpMethod.GET, "/{{path}}/**")
|
||||
.requestMatchers().antMatchers(HttpMethod.GET, "/{{{path}}}/**")
|
||||
.and().authorizeRequests()
|
||||
.antMatchers(HttpMethod.GET, "/{{path}}/**").access("hasRole('ADMIN')")
|
||||
.antMatchers(HttpMethod.GET, "/{{{path}}}/**").access("hasRole('ADMIN')")
|
||||
.and().exceptionHandling().accessDeniedHandler(new OAuth2AccessDeniedHandler());
|
||||
{{/resourcePaths}}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
{{#vendorExtensions.requests}}
|
||||
### {{#summary}}{{summary}}{{/summary}}
|
||||
## {{name}}
|
||||
{{httpMethod}} {{basePath}}{{#lambda.doubleMustache}}{{path}}{{/lambda.doubleMustache}}{{>queryParams}}
|
||||
{{httpMethod}} {{basePath}}{{#lambda.doubleMustache}}{{{path}}}{{/lambda.doubleMustache}}{{>queryParams}}
|
||||
{{#consumes}}
|
||||
Content-Type: {{{mediaType}}}
|
||||
{{/consumes}}
|
||||
|
@ -46,7 +46,7 @@ function _oacinternal_{{operationId}}(_api::{{classname}}{{#allParams}}{{#requir
|
||||
|
||||
{{/hasValidation}}
|
||||
{{/allParams}}
|
||||
_ctx = OpenAPI.Clients.Ctx(_api.client, "{{httpMethod}}", _returntypes_{{operationId}}_{{classname}}, "{{path}}", [{{#authMethods}}"{{name}}", {{/authMethods}}]{{#bodyParam}}, {{paramName}}{{/bodyParam}})
|
||||
_ctx = OpenAPI.Clients.Ctx(_api.client, "{{httpMethod}}", _returntypes_{{operationId}}_{{classname}}, "{{{path}}}", [{{#authMethods}}"{{name}}", {{/authMethods}}]{{#bodyParam}}, {{paramName}}{{/bodyParam}})
|
||||
{{#pathParams}}
|
||||
OpenAPI.Clients.set_param(_ctx.path, "{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}", {{paramName}}{{#isListContainer}}; collection_format="{{collectionFormat}}"{{/isListContainer}}) # type {{dataType}}
|
||||
{{/pathParams}}
|
||||
|
@ -61,7 +61,7 @@ end
|
||||
|
||||
function register{{classname}}(router::HTTP.Router, impl; path_prefix::String="", optional_middlewares...)
|
||||
{{#operation}}
|
||||
HTTP.register!(router, "{{httpMethod}}", path_prefix * "{{path}}", OpenAPI.Servers.middleware(impl, {{operationId}}_read, {{operationId}}_validate, {{operationId}}_invoke; optional_middlewares...))
|
||||
HTTP.register!(router, "{{httpMethod}}", path_prefix * "{{{path}}}", OpenAPI.Servers.middleware(impl, {{operationId}}_read, {{operationId}}_validate, {{operationId}}_invoke; optional_middlewares...))
|
||||
{{/operation}}
|
||||
return router
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ The following server methods must be implemented:
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
- **{{operationId}}**
|
||||
- *invocation:* {{httpMethod}} {{path}}
|
||||
- *invocation:* {{httpMethod}} {{{path}}}
|
||||
- *signature:* {{operationId}}(req::HTTP.Request{{#allParams}}{{#required}}, {{paramName}}::{{dataType}}{{/required}}{{/allParams}};{{#allParams}}{{^required}} {{paramName}}=nothing,{{/required}}{{/allParams}}) -> {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Nothing{{/returnType}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
|
@ -23,7 +23,7 @@ fun main() {
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{#lowercase}}{{httpMethod}}{{/lowercase}}("{{path}}", {{classname}}::{{operationId}})
|
||||
{{#lowercase}}{{httpMethod}}{{/lowercase}}("{{{path}}}", {{classname}}::{{operationId}})
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
|
||||
|
@ -18,10 +18,10 @@ object Paths {
|
||||
{{#allParams}}* @param {{paramName}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||
{{/allParams}}*/
|
||||
{{#hasParams}}
|
||||
@Serializable @Resource("{{path}}") class {{operationId}}({{#allParams}}val {{paramName}}: {{{dataType}}}{{^required}}? = null{{/required}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}})
|
||||
@Serializable @Resource("{{{path}}}") class {{operationId}}({{#allParams}}val {{paramName}}: {{{dataType}}}{{^required}}? = null{{/required}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}})
|
||||
{{/hasParams}}
|
||||
{{^hasParams}}
|
||||
@Serializable @Resource("{{path}}") class {{operationId}}
|
||||
@Serializable @Resource("{{{path}}}") class {{operationId}}
|
||||
{{/hasParams}}
|
||||
|
||||
{{/operation}}
|
||||
|
@ -83,7 +83,7 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v
|
||||
value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}}]){{/swagger1AnnotationLibrary}}
|
||||
@RequestMapping(
|
||||
method = [RequestMethod.{{httpMethod}}],
|
||||
value = ["{{#lambdaEscapeInNormalString}}{{path}}{{/lambdaEscapeInNormalString}}"]{{#singleContentTypes}}{{#hasProduces}},
|
||||
value = ["{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}"]{{#singleContentTypes}}{{#hasProduces}},
|
||||
produces = [{{#vendorExtensions.x-accepts}}"{{{.}}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-accepts}}]{{/hasProduces}}{{#hasConsumes}},
|
||||
consumes = "{{{vendorExtensions.x-content-type}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
|
||||
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
|
||||
|
@ -96,7 +96,7 @@ interface {{classname}} {
|
||||
value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{.}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}}, {{/-last}}{{/responses}}]){{/swagger1AnnotationLibrary}}
|
||||
@RequestMapping(
|
||||
method = [RequestMethod.{{httpMethod}}],
|
||||
value = ["{{#lambdaEscapeInNormalString}}{{path}}{{/lambdaEscapeInNormalString}}"]{{#singleContentTypes}}{{#hasProduces}},
|
||||
value = ["{{#lambdaEscapeInNormalString}}{{{path}}}{{/lambdaEscapeInNormalString}}"]{{#singleContentTypes}}{{#hasProduces}},
|
||||
produces = [{{#vendorExtensions.x-accepts}}"{{{.}}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-accepts}}]{{/hasProduces}}{{#hasConsumes}},
|
||||
consumes = "{{{vendorExtensions.x-content-type}}}"{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}},
|
||||
produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}]{{/hasProduces}}{{#hasConsumes}},
|
||||
|
@ -33,7 +33,7 @@ open class {{classname}}Stubs(private val objectMapper: ObjectMapper) {
|
||||
* @return A [{{operationIdCamelCase}}StubBuilder] to configure the response, and the final [MappingBuilder].
|
||||
*/
|
||||
fun {{operationId}}({{#pathParams}}{{paramName}}: StringValuePattern, {{/pathParams}}{{#queryParams}}{{paramName}}: StringValuePattern? = null, {{/queryParams}}configurer: MappingBuilder.() -> MappingBuilder = { this }): {{operationIdCamelCase}}StubBuilder =
|
||||
{{operationIdCamelCase}}StubBuilder(objectMapper, {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(urlPathTemplate("{{path}}"))
|
||||
{{operationIdCamelCase}}StubBuilder(objectMapper, {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(urlPathTemplate("{{{path}}}"))
|
||||
{{#pathParams}}
|
||||
.withPathParam("{{baseName}}", {{paramName}})
|
||||
{{/pathParams}}
|
||||
|
@ -9,7 +9,7 @@
|
||||
<p>{{description}}</p>
|
||||
{{#notes}}<p>{{.}}</p>{{/notes}}
|
||||
<h3 class="section">URL</h3>
|
||||
<code>{{basePath}}{{path}}</code>
|
||||
<code>{{{basePath}}}{{{path}}}</code>
|
||||
<h3 class="section">HTTP Method</h3>
|
||||
<code>{{httpMethod}}</code>
|
||||
<h3 class="section">Response Type</h3>
|
||||
|
@ -36,7 +36,7 @@ class ApiClient extends OAGAC\AbstractApiClient
|
||||
{{>api_arg_declaration
|
||||
}} ): ResponseInterface
|
||||
{
|
||||
$request = $this->createRequest('{{httpMethod}}', '{{path}}', {{#pathParams.0}}$this->getPathParameters($parameters){{/pathParams.0}}{{^pathParams.0}}[]{{/pathParams.0}}, {{#queryParams.0}}$this->getQueryParameters($parameters){{/queryParams.0}}{{^queryParams.0}}[]{{/queryParams.0}});
|
||||
$request = $this->createRequest('{{httpMethod}}', '{{{path}}}', {{#pathParams.0}}$this->getPathParameters($parameters){{/pathParams.0}}{{^pathParams.0}}[]{{/pathParams.0}}, {{#queryParams.0}}$this->getQueryParameters($parameters){{/queryParams.0}}{{^queryParams.0}}[]{{/queryParams.0}});
|
||||
{{#headerParams.0}}
|
||||
$request = $this->addCustomHeaders($request, $parameters);
|
||||
{{/headerParams.0}}
|
||||
|
@ -8,7 +8,7 @@
|
||||
# {{pathPrefix}}
|
||||
{{#operation}}
|
||||
{{bundleAlias}}_{{pathPrefix}}_{{operationIdLowerCase}}:
|
||||
path: {{path}}
|
||||
path: {{{path}}}
|
||||
methods: [{{httpMethod}}]
|
||||
defaults:
|
||||
_controller: {{bundleAlias}}.controller.{{pathPrefix}}::{{operationId}}Action
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "{{path}}{{#isDeprecated}} (DEPRECATED){{/isDeprecated}}",
|
||||
"name": "{{{path}}}{{#isDeprecated}} (DEPRECATED){{/isDeprecated}}",
|
||||
"description": "{{{notes}}}",
|
||||
"item": [
|
||||
{{#vendorExtensions.postmanRequests}}
|
||||
@ -27,7 +27,7 @@
|
||||
}
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{=<% %>=}}{{baseUrl}}<%={{ }}=%>{{path}}",
|
||||
"raw": "{{=<% %>=}}{{baseUrl}}<%={{ }}=%>{{{path}}}",
|
||||
"host": [
|
||||
"{{=<% %>=}}{{baseUrl}}<%={{ }}=%>"
|
||||
],
|
||||
|
@ -38,7 +38,7 @@ for _, name, _ in pkgutil.iter_modules(ns_pkg.__path__, ns_pkg.__name__ + "."):
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
@router.{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}(
|
||||
"{{path}}",
|
||||
"{{{path}}}",
|
||||
responses={
|
||||
{{#responses}}
|
||||
{{code}}: {{=<% %>=}}{<%#dataType%>"model": <%dataType%>, "description": "<%message%>"<%/dataType%><%^dataType%>"description": "<%message%>"<%/dataType%>}<%={{ }}=%>,
|
||||
|
@ -461,7 +461,7 @@
|
||||
|
||||
{{/bodyParams}}
|
||||
{{/hasBodyParam}}
|
||||
local_var_url_path <- "{{path}}"
|
||||
local_var_url_path <- "{{{path}}}"
|
||||
{{#hasPathParams}}
|
||||
{{#pathParams}}
|
||||
if (!missing(`{{paramName}}`)) {
|
||||
|
@ -12,7 +12,7 @@ Rails.application.routes.draw do
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
add_openapi_route '{{httpMethod}}', '{{basePathWithoutHost}}{{path}}', controller_name: '{{classVarName}}', action_name: {{#isRestfulIndex}}'index'{{/isRestfulIndex}}{{#isRestfulCreate}}'create'{{/isRestfulCreate}}{{#isRestfulUpdate}}'update'{{/isRestfulUpdate}}{{#isRestfulShow}}'show'{{/isRestfulShow}}{{#isRestfulDestroy}}'destroy'{{/isRestfulDestroy}}{{^isRestful}}'{{nickname}}'{{/isRestful}}
|
||||
add_openapi_route '{{httpMethod}}', '{{{basePathWithoutHost}}}{{{path}}}', controller_name: '{{classVarName}}', action_name: {{#isRestfulIndex}}'index'{{/isRestfulIndex}}{{#isRestfulCreate}}'create'{{/isRestfulCreate}}{{#isRestfulUpdate}}'update'{{/isRestfulUpdate}}{{#isRestfulShow}}'show'{{/isRestfulShow}}{{#isRestfulDestroy}}'destroy'{{/isRestfulDestroy}}{{^isRestful}}'{{nickname}}'{{/isRestful}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
|
@ -18,7 +18,7 @@ trait {{classname}} extends Service {
|
||||
named("{{classname}}").withCalls(
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
restCall(Method.{{httpMethod}}, "{{path}}{{#queryParams.0}}?{{/queryParams.0}}{{#queryParams}}{{paramName}}{{^-last}}&{{/-last}}{{/queryParams}}", {{operationId}} _){{^-last}}, {{/-last}}
|
||||
restCall(Method.{{httpMethod}}, "{{{path}}}{{#queryParams.0}}?{{/queryParams.0}}{{#queryParams}}{{paramName}}{{^-last}}&{{/-last}}{{/queryParams}}", {{operationId}} _){{^-last}}, {{/-last}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
).withAutoAcl(true)
|
||||
|
@ -19,7 +19,7 @@ import {{import}}
|
||||
class {{classname}}Controller @Inject()(cc: ControllerComponents, api: {{classname}}){{#supportAsync}}(implicit executionContext: ExecutionContext){{/supportAsync}} extends AbstractController(cc) {
|
||||
{{#operation}}
|
||||
/**
|
||||
* {{httpMethod}} {{contextPath}}{{path}}{{#queryParams.0}}?{{/queryParams.0}}{{#queryParams}}{{paramName}}=[value]{{^-last}}&{{/-last}}{{/queryParams}}
|
||||
* {{httpMethod}} {{contextPath}}{{{path}}}{{#queryParams.0}}?{{/queryParams.0}}{{#queryParams}}{{paramName}}=[value]{{^-last}}&{{/-last}}{{/queryParams}}
|
||||
{{#pathParams}}
|
||||
{{#description}}
|
||||
* @param {{paramName}} {{description}}
|
||||
|
@ -35,7 +35,7 @@ object {{classname}} {
|
||||
def {{nickname}}(host: String{{#allParams}}{{#-first}}, {{/-first}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{^-last}}, {{/-last}}{{/allParams}}){{#queryParams}}{{#-first}}(implicit {{/-first}}{{paramName}}Query: QueryParam[{{dataType}}]{{^-last}}, {{/-last}}{{#-last}}){{/-last}}{{/queryParams}}: {{>operationReturnType}}{{#returnType}} implicit val returnTypeDecoder: EntityDecoder[{{returnType}}] = jsonOf[{{returnType}}]
|
||||
|
||||
{{/returnType}}
|
||||
val path = "{{path}}"{{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",escape({{paramName}}.toString)){{/pathParams}}
|
||||
val path = "{{{path}}}"{{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",escape({{paramName}}.toString)){{/pathParams}}
|
||||
|
||||
val httpMethod = Method.{{httpMethod}}
|
||||
val contentType = `Content-Type`(MediaType.`application/json`)
|
||||
@ -64,7 +64,7 @@ class HttpService{{classname}}(service: HttpService) {
|
||||
def {{nickname}}({{#allParams}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{^-last}}, {{/-last}}{{/allParams}}){{#queryParams}}{{#-first}}(implicit {{/-first}}{{paramName}}Query: QueryParam[{{dataType}}]{{^-last}}, {{/-last}}{{#-last}}){{/-last}}{{/queryParams}}: {{>operationReturnType}}{{#returnType}} implicit val returnTypeDecoder: EntityDecoder[{{returnType}}] = jsonOf[{{returnType}}]
|
||||
|
||||
{{/returnType}}
|
||||
val path = "{{path}}"{{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",escape({{paramName}}.toString)){{/pathParams}}
|
||||
val path = "{{{path}}}"{{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",escape({{paramName}}.toString)){{/pathParams}}
|
||||
|
||||
val httpMethod = Method.{{httpMethod}}
|
||||
val contentType = `Content-Type`(MediaType.`application/json`)
|
||||
|
@ -102,7 +102,7 @@ open class {{classname}} {
|
||||
guard let baseURL = self.transport.baseURL ?? self.baseURL else {
|
||||
throw OpenAPITransportError.badURLError()
|
||||
}
|
||||
{{#pathParams}}{{#-last}}var{{/-last}}{{/pathParams}}{{^pathParams}}let{{/pathParams}} localVarPath = "{{path}}"
|
||||
{{#pathParams}}{{#-last}}var{{/-last}}{{/pathParams}}{{^pathParams}}let{{/pathParams}} localVarPath = "{{{path}}}"
|
||||
{{#pathParams}}
|
||||
{{#required}}localVarPath = localVarPath.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: {{> toString}}){{/required}}{{^required}}if let {{paramName}} = {{paramName}} { localVarPath = localVarPath.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: {{> toString}}) } {{/required}}
|
||||
{{/pathParams}}
|
||||
|
@ -80,7 +80,7 @@ module.exports = {
|
||||
{{/allParams}}
|
||||
{{/isMultipart}}
|
||||
const options = {
|
||||
url: utils.replacePathParameters('{{basePath}}{{path}}'),
|
||||
url: utils.replacePathParameters('{{{basePath}}}{{{path}}}'),
|
||||
method: '{{httpMethod}}',
|
||||
removeMissingValuesFrom: { params: true, body: true },
|
||||
headers: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user