Skip to content
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

Hotfix/add path parameters #179

Closed
wants to merge 2 commits into from

Conversation

sonus
Copy link

@sonus sonus commented May 9, 2019

This is to add path params to the collection params interface

@luisfpg
Copy link
Collaborator

luisfpg commented Jul 1, 2019

Please, can you explain a bit more what this does, with examples?

@sonus
Copy link
Author

sonus commented Jul 1, 2019

Hi @luisfpg

For example, you have a request like this

/api/subscribe/{type_id}:
{
    parameters: [
        {
            name: "categoryId",
            in: "query",
            required: false,
            type: "string"
        }
        ..
    ]
}

This will generate getSubscribeCollection and getSubscribeCollectionResponse methods with parameter inside the url that cant be passed

    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;
    if (params.categoryId != null) __params = __params.set('categoryId', params.categoryId.toString());
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/api/subscribe/${type_id}`,
      __body,
      {
        headers: __headers,
        params: __params,
        responseType: 'json'
      });

So what I have added here is to read it from path and add to parameters variable

@luisfpg
Copy link
Collaborator

luisfpg commented Aug 8, 2019

Actually, by the swagger specification, you're required to declare the parameters which are in path, i.e., it is wrong to automagically create parameters because they are in the path.
In your example the specification is inconsistent - you should have the type_id parameter in the parameters collection, with in: path.
Hence, not merging.

@luisfpg luisfpg closed this Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants