mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 22:50:53 +00:00
update ruby readme template
This commit is contained in:
parent
a08164592a
commit
c1e7da5ec1
@ -294,42 +294,6 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
// Set vendor-extension to be used in template:
|
||||
// x-codegen-hasMoreRequired
|
||||
// x-codegen-hasMoreOptional
|
||||
// x-codegen-hasRequiredParams
|
||||
CodegenParameter lastRequired = null;
|
||||
CodegenParameter lastOptional = null;
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
if (p.required) {
|
||||
lastRequired = p;
|
||||
} else {
|
||||
lastOptional = p;
|
||||
}
|
||||
}
|
||||
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
if (p == lastRequired) {
|
||||
p.vendorExtensions.put("x-codegen-hasMoreRequired", false);
|
||||
} else if (p == lastOptional) {
|
||||
p.vendorExtensions.put("x-codegen-hasMoreOptional", false);
|
||||
} else {
|
||||
p.vendorExtensions.put("x-codegen-hasMoreRequired", true);
|
||||
p.vendorExtensions.put("x-codegen-hasMoreOptional", true);
|
||||
}
|
||||
}
|
||||
op.vendorExtensions.put("x-codegen-hasRequiredParams", lastRequired != null);
|
||||
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
|
@ -76,13 +76,19 @@ require '{{{gemName}}}'
|
||||
{{/authMethods}}end
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
api_instance = {{{moduleName}}}::{{{classname}}}.new{{#hasParams}}
|
||||
{{#vendorExtensions.x-codegen-hasRequiredParams}}{{#allParams}}{{#required}}
|
||||
api_instance = {{{moduleName}}}::{{{classname}}}.new
|
||||
{{#requiredParams}}
|
||||
{{{paramName}}} = {{{example}}} # {{{dataType}}} | {{{description}}}
|
||||
{{/required}}{{/allParams}}{{/vendorExtensions.x-codegen-hasRequiredParams}}{{#hasOptionalParams}}
|
||||
opts = { {{#allParams}}{{^required}}
|
||||
{{{paramName}}}: {{{example}}}{{#vendorExtensions.x-codegen-hasMoreOptional}},{{/vendorExtensions.x-codegen-hasMoreOptional}} # {{{dataType}}} | {{{description}}}{{/required}}{{/allParams}}
|
||||
}{{/hasOptionalParams}}{{/hasParams}}
|
||||
{{/requiredParams}}
|
||||
{{#optionalParams}}
|
||||
{{#-first}}
|
||||
opts = {
|
||||
{{/-first}}
|
||||
{{{paramName}}}: {{{example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}}
|
||||
{{#-last}}
|
||||
}
|
||||
{{/-last}}
|
||||
{{/optionalParams}}
|
||||
|
||||
begin
|
||||
{{#summary}} #{{{.}}}
|
||||
|
@ -55,10 +55,8 @@ Please follow the [installation](#installation) procedure and then run the follo
|
||||
require 'petstore'
|
||||
|
||||
api_instance = Petstore::AnotherFakeApi.new
|
||||
|
||||
client = Petstore::Client.new # Client | client model
|
||||
|
||||
|
||||
begin
|
||||
#To test special tags
|
||||
result = api_instance.test_special_tags(client)
|
||||
|
Loading…
x
Reference in New Issue
Block a user