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

InfluxDB 2.0: The schemas for a list of Tasks and a list of Runs aren't defined in swagger [area/api] #12590

Closed
bednar opened this issue Mar 13, 2019 · 0 comments
Assignees

Comments

@bednar
Copy link
Contributor

bednar commented Mar 13, 2019

The /tasks/{taskID}/runs response is defined as a generic object:

'/tasks/{taskID}/runs':
    get:
      tags:
        - Tasks
      summary: Retrieve list of run records for a task
      parameters:
        - $ref: '#/components/parameters/TraceSpan'
        - in: path
          name: taskID
          schema:
            type: string
          required: true
          description: ID of task to get runs for
        - in: query
          name: after
          schema:
            type: string
          description: returns runs after specified ID
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          description: the number of runs to return
        - in: query
          name: afterTime
          schema:
            type: string
            format: date-time
          description: filter runs to those scheduled after this time, RFC3339
        - in: query
          name: beforeTime
          schema:
            type: string
            format: date-time
          description: filter runs to those scheduled before this time, RFC3339
      responses:
        '200':
          description: a list of task runs
          content:
            application/json:
              schema:
                type: object
                properties:
                  runs:
                    type: array
                    items:
                      $ref: "#/components/schemas/Run"
                  links:
                    $ref: "#/components/schemas/Links"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

and this cause that the generated client use auto named response type InlineResponse2002:

tasksTaskIDRunsGet(taskID: string, zapTraceSpan?: string, after?: string, limit?: number, afterTime?: Date, beforeTime?: Date, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse2002> {
            const localVarAxiosArgs = TasksApiAxiosParamCreator(configuration).tasksTaskIDRunsGet(taskID, zapTraceSpan, after, limit, afterTime, beforeTime, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url})
                return axios.request(axiosRequestArgs);                
            };
        }

The response schema for /tasks/{taskID}/runs should be Runs:

'/tasks/{taskID}/runs':
    get:
      tags:
        - Tasks
      summary: Retrieve list of run records for a task
      parameters:
        - $ref: '#/components/parameters/TraceSpan'
        - in: path
          name: taskID
          schema:
            type: string
          required: true
          description: ID of task to get runs for
        - in: query
          name: after
          schema:
            type: string
          description: returns runs after specified ID
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          description: the number of runs to return
        - in: query
          name: afterTime
          schema:
            type: string
            format: date-time
          description: filter runs to those scheduled after this time, RFC3339
        - in: query
          name: beforeTime
          schema:
            type: string
            format: date-time
          description: filter runs to those scheduled before this time, RFC3339
      responses:
        '200':
          description: a list of task runs
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Runs"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
...

Runs:
      type: object
      properties:
        links:
          readOnly: true
          $ref: "#/components/schemas/Links"
        runs:
          type: array
          items:
            $ref: "#/components/schemas/Run"

The /tasks response is defined as a generic object:

/tasks:
    get:
      tags:
        - Tasks
      summary: List tasks.
      parameters:
        - $ref: '#/components/parameters/TraceSpan'
        - in: query
          name: after
          schema:
            type: string
          description: returns tasks after specified ID
        - in: query
          name: user
          schema:
            type: string
          description: filter tasks to a specific user ID
        - in: query
          name: org
          schema:
            type: string
          description: filter tasks to a specific organization name
        - in: query
          name: orgID
          schema:
            type: string
          description: filter tasks to a specific organization ID
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
          description: the number of tasks to return
      responses:
        '200':
          description: A list of tasks
          content:
            application/json:
              schema:
                type: object
                properties:
                  tasks:
                    type: array
                    items:
                      $ref: "#/components/schemas/Task"
                  links:
                    $ref: "#/components/schemas/Links"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

and this cause that the generated client use auto named response type InlineResponse2001:

tasksGet(zapTraceSpan?: string, after?: string, user?: string, org?: string, orgID?: string, limit?: number, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse2001> {
            const localVarAxiosArgs = TasksApiAxiosParamCreator(configuration).tasksGet(zapTraceSpan, after, user, org, orgID, limit, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url})
                return axios.request(axiosRequestArgs);                
            };
        },

The response schema for /tasks should be Tasks:

 /tasks:
    get:
      tags:
        - Tasks
      summary: List tasks.
      parameters:
        - $ref: '#/components/parameters/TraceSpan'
        - in: query
          name: after
          schema:
            type: string
          description: returns tasks after specified ID
        - in: query
          name: user
          schema:
            type: string
          description: filter tasks to a specific user ID
        - in: query
          name: org
          schema:
            type: string
          description: filter tasks to a specific organization name
        - in: query
          name: orgID
          schema:
            type: string
          description: filter tasks to a specific organization ID
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
          description: the number of tasks to return
      responses:
        '200':
          description: A list of tasks
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Tasks"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"

...

Tasks:
      type: object
      properties:
        links:
          readOnly: true
          $ref: "#/components/schemas/Links"
        tasks:
          type: array
          items:
            $ref: "#/components/schemas/Task"
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

No branches or pull requests

2 participants