Skip to content

[TypeScript][Inversify] fix date path parameters #8047

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gualtierim
Copy link
Contributor

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Fix the date path parameters as in the PR #7479

@TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny

@gualtierim gualtierim changed the title typescript-inversify fix date path parameters [TypeScript][Inversify] fix date path parameters Apr 20, 2018
Copy link
Contributor

@macjohnny macjohnny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@macjohnny
Copy link
Contributor

macjohnny commented Apr 20, 2018

@gualtierim could you try it with the following code and post it here?

paths:
  /pet/{birthday}/foo/{id:.+}/{bla_bla}/bar:
    get:
      tags:
        - pet
      operationId: findPetsByStatusfoo
      produces:
        - application/xml
        - application/json
      parameters:
        - name: birthday
          in: path
          required: true
          type: string
          format: date-time
        - name: id:.+
          in: path
          required: true
          type: string
        - name: bla_bla
          in: path
          required: true
          type: string
          format: date-time
      responses:
        '200':
          schema:
            type: array
            items:
              $ref: '#/definitions/Pet'

@gualtierim
Copy link
Contributor Author

gualtierim commented Apr 27, 2018

The result is:

public findPetsByStatusfoo(birthday: Date, id_: string, blaBla: Date, observe?: 'body', headers?: Headers): Observable<Array<Pet>>;
public findPetsByStatusfoo(birthday: Date, id_: string, blaBla: Date, observe?: 'response', headers?: Headers): Observable<HttpResponse<Array<Pet>>>;
public findPetsByStatusfoo(birthday: Date, id_: string, blaBla: Date, observe: any = 'body', headers: Headers = {}): Observable<any> {
        ....

        const response: Observable<HttpResponse<Array<Pet>>> = this.httpClient.get(`${this.basePath}/pet/${encodeURIComponent(String(birthday.toISOString()))}/foo/${encodeURIComponent(String(id_))}/${encodeURIComponent(String(blaBla.toISOString()))}/bar`, headers);
        if (observe == 'body') {
               return response.map(httpResponse => <Array<Pet>>(httpResponse.response));
        }
        return response;
}

@macjohnny
Copy link
Contributor

Excellent, so it seems to be correct

@TiFu
Copy link
Contributor

TiFu commented Apr 27, 2018

Circleci failing seems to be unrelated:

[info] downloading https://jcenter.bintray.com/jline/jline/2.12.1/jline-2.12.1.jar ...
[warn] 	[FAILED     ] jline#jline;2.12.1!jline.jar: The HTTP response code for https://jcenter.bintray.com/jline/jline/2.12.1/jline-2.12.1.jar did not indicate a success. See log for more detail. (36ms)
[warn] 	[FAILED     ] jline#jline;2.12.1!jline.jar: The HTTP response code for https://jcenter.bintray.com/jline/jline/2.12.1/jline-2.12.1.jar did not indicate a success. See log for more detail. (36ms)
[warn] ==== jcenter: tried
[warn]   https://jcenter.bintray.com/jline/jline/2.12.1/jline-2.12.1.jar

@gualtierim
Copy link
Contributor Author

gualtierim commented May 7, 2018

@TiFu I forked the master and i make only the changes described in the PR. In my opinion the error is unrelated. I didn't change dependencies or tests.

@gualtierim
Copy link
Contributor Author

In the README is not present any reference to the typescript-inversify. Maybe it can be useful. Thanks!

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

Successfully merging this pull request may close these issues.

4 participants