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

Name collision for /version endpoint #41

Closed
bluenote10 opened this issue Mar 26, 2020 · 5 comments
Closed

Name collision for /version endpoint #41

bluenote10 opened this issue Mar 26, 2020 · 5 comments
Assignees
Labels
invalid This doesn't seem right next major release This changes of code will added at next major release (*.0.0) question Further information is requested

Comments

@bluenote10
Copy link

Another small issue I encountered: It is currently not possible to have a /version endpoint, because of a name collision with the internal version variable. For example:

---
openapi: 3.0.0
info:
  title: SomeAPI
paths:
  "/version":
    get:
      responses:
        '200':
          description: 
          content:
            application/json:
              schema:
                type: string

Relevant parts of generated code:

export class Api<SecurityDataType> {
  public baseUrl = "";
  public title = "SomeAPI";
  public version = "";

  // and later

  version = {
    /**
     * @name versionList
     * @request GET:/version
     */
    versionList: (params?: RequestParams) => this.request<string, any>(`/version`, "GET", params, null),
  };

Error:

Duplicate identifier 'version'.ts(2300)
@js2me
Copy link
Member

js2me commented Mar 26, 2020

Yes, any changes of source code for solving this issue will be major.
As a solution I think needs to move out baseUrl, title, version properties from Api class

@js2me js2me self-assigned this Mar 26, 2020
@js2me js2me added next major release This changes of code will added at next major release (*.0.0) invalid This doesn't seem right question Further information is requested labels Mar 26, 2020
@js2me
Copy link
Member

js2me commented Mar 26, 2020

@bluenote10 I think title and version are not needed for development. May be it should be in description Api class ? (comments)

@js2me
Copy link
Member

js2me commented Mar 26, 2020

All other not route properties probably can be contains in inherited Http class

@js2me js2me mentioned this issue Mar 26, 2020
@js2me
Copy link
Member

js2me commented Mar 26, 2020

Should be fixed in release 1.7.0

@js2me js2me closed this as completed Mar 26, 2020
@bluenote10
Copy link
Author

Works perfectly, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right next major release This changes of code will added at next major release (*.0.0) question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants