Skip to content

requiredParamCount not working #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wing328 opened this issue Apr 29, 2015 · 1 comment
Closed

requiredParamCount not working #701

wing328 opened this issue Apr 29, 2015 · 1 comment
Milestone

Comments

@wing328
Copy link
Contributor

wing328 commented Apr 29, 2015

The following code block using #requiredParamCount does not seem to work in Java's and other languages' template:

    {{#requiredParamCount}}
    // verify required params are set
    if({{/requiredParamCount}}{{#requiredParams}} {{paramName}} == null {{#hasMore}}|| {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}) {
       throw new ApiException(400, "missing required params");
    }
    {{/requiredParamCount}}

as this code block does not produce anything even thought the method has required parameter(s). For example, updatePetWithForm has a required parameter petId but there's no code generated for verifying the required parameter petId:

public void updatePetWithForm (String petId, String name, String status) throws ApiException {
    Object postBody = null;


    // create path and map variables
    String path = "/pet/{petId}".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));

    // query params
    Map<String, String> queryParams = new HashMap<String, String>();
    Map<String, String> headerParams = new HashMap<String, String>();
    Map<String, String> formParams = new HashMap<String, String>();

I can look into fixing {{#requireParamCount}} or use {{#allParams}}{{#required}} as a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants