swagger-vue icon indicating copy to clipboard operation
swagger-vue copied to clipboard

Wrong replace thread_id by threadId

Open psy21d opened this issue 6 years ago • 0 comments

this YAML

  /thread/settings_sources_keywords:
    post:
      tags:
        - thread
      summary: ThreadSetSourcesKeywords
      description: ThreadSetSourcesKeywords
      operationId: ThreadSetSourcesKeywords
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: body
          description: Thread settings - keywords
          required: true
          schema:
            $ref: '#/definitions/ThreadKeywords'
      responses:
        '200':
          description: Thread settings, set keywords
        '403':
          description: Access denied
        '405':
          description: Invalid input

generated this code

/**
 * ThreadGetSourcesKeywords
 * request: ThreadGetSourcesKeywords
 * url: ThreadGetSourcesKeywordsURL
 * method: ThreadGetSourcesKeywords_TYPE
 * raw_url: ThreadGetSourcesKeywords_RAW_URL
 * @param threadId - thread id
 */
export const ThreadGetSourcesKeywords = function(parameters = {}) {
  const domain = parameters.$domain ? parameters.$domain : getDomain()
  const config = parameters.$config
  let path = '/thread/settings_sources_keywords_get'
  let body
  let queryParameters = {}
  let form = {}
  if (parameters['threadId'] !== undefined) {
    body = parameters['threadId']
  }
  if (parameters['threadId'] === undefined) {
    return Promise.reject(new Error('Missing required  parameter: threadId'))
  }
  if (parameters.$queryParameters) {
    Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
      queryParameters[parameterName] = parameters.$queryParameters[parameterName]
    });
  }
  return request('post', domain + path, body, queryParameters, form, config)
}
export const ThreadGetSourcesKeywords_RAW_URL = function() {
  return '/thread/settings_sources_keywords_get'
}
export const ThreadGetSourcesKeywords_TYPE = function() {
  return 'post'
}

BUT this

  /thread/settings_periods_get:
    post:
      tags:
        - thread
      summary: ThreadGetPeriods
      description: Get thread periods
      operationId: ThreadGetPeriods
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: body
          required: true
          description: thread id
          schema:
            $ref: '#/definitions/ThreadId'
      responses:
        '200':
          description: Thread settings, get time periods
          schema:
            $ref: '#/definitions/ThreadSettingsPeriods'
        '403':
          description: Access denied
        '405':
          description: Invalid input

generated this code

/**
 * Get thread periods
 * request: ThreadGetPeriods
 * url: ThreadGetPeriodsURL
 * method: ThreadGetPeriods_TYPE
 * raw_url: ThreadGetPeriods_RAW_URL
 * @param body - thread id
 */
export const ThreadGetPeriods = function(parameters = {}) {
  const domain = parameters.$domain ? parameters.$domain : getDomain()
  const config = parameters.$config
  let path = '/thread/settings_periods_get'
  let body
  let queryParameters = {}
  let form = {}
  if (parameters['body'] !== undefined) {
    body = parameters['body']
  }
  if (parameters['body'] === undefined) {
    return Promise.reject(new Error('Missing required  parameter: body'))
  }
  if (parameters.$queryParameters) {
    Object.keys(parameters.$queryParameters).forEach(function(parameterName) {
      queryParameters[parameterName] = parameters.$queryParameters[parameterName]
    });
  }
  return request('post', domain + path, body, queryParameters, form, config)
}

Why in one case it create threadId (unnecessary behavior) and in another make normal body parameter?

schemes

  ThreadId:
    type: object
    required:
      - thread_id
    properties:
      thread_id:
        type: string
        description: thread_id
  ThreadKeywords:
    type: object
    required:
      - thread_id
      - keywords
      - stopkeywords
    properties:
      thread_id:
        type: string
      keywords:
        type: array
        items:
          type: string
      stopkeywords:
        type: array
        items:
          type: string

psy21d avatar Apr 12 '18 22:04 psy21d