question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`data` become `data` in generated code

See original GitHub issue

please replace &#x60 to `

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
macisamuelecommented, Jan 16, 2021

echoing @cortinico here … having a sample spec that is able to trigger the issue helps us more to identify the bug, ensure that it get fixed and have a test that ensures that no regressions would be present in upcoming releases.

Still by trying to create specs that would create such type of API seems that something like the following might represent a minimal spec

swagger: '2.0'
info:
  title: Reproduce https://github.com/Yelp/swagger-gradle-codegen/issues/147
  version: 0.0.0
paths:
  /signin:
    post:
      operationId: SigninUsingPOST
      parameters:
        - in: body
          name: data
          schema:
            type: object
            x-model: SigninRequest
            properties:
              p:
                type: integer
          required: true
      responses:
        default:
          description: ''
          schema:
            type: object
            properties:
              p:
                type: string
            x-model: SignInResponse

as it would generate (with the kotlin generator) the following API file

/**
 * NOTE: This class is auto generated by the Swagger Gradle Codegen for the following API: JUnit Tests
 *
 * More info on this tool is available on https://github.com/Yelp/swagger-gradle-codegen
 */

package com.yelp.codegen.generatecodesamples.apis

import com.yelp.codegen.generatecodesamples.models.SignInResponse
import com.yelp.codegen.generatecodesamples.models.SigninRequest
import io.reactivex.Single
import retrofit2.http.Headers
import retrofit2.http.POST

@JvmSuppressWildcards
interface DefaultApi {
    /**
     * The endpoint is owned by junittests service owner
     * @param `data` (required)
     */
    @Headers(
        "X-Operation-ID: SigninUsingPOST"
    )
    @POST("/signin")
    fun signinUsingPOST(
        @retrofit2.http.Body `data`: SigninRequest
    ): Single<SignInResponse>
}
0reactions
cortinicocommented, Jan 30, 2021

When will be this available? Thanks

We can’t really commit on a timeline, but I’m getting @macisamuele onboard to finalize 2.0.0. Ideally we should merge those PRs first #110 #114 #104 (there might be a couple more).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Type Issues in Generated Code - MATLAB & Simulink
Highlight potential data type issues in report. ... To change the library for a project, during the Generate Code step, in the project...
Read more >
Generated code
Generated code. Identify the source of generated code. When BladeSmith generates source code for your DataBlade module, it uses routines and data structures ......
Read more >
Updating the generated code - OData
When you click Finish, code will be generated afresh and the previously generated files will be replaced with the new code.
Read more >
Are We Ready for AI-Generated Code?
Autocompleted code is convenient and quick, but it may expose your organization to security and compliance risks.
Read more >
RTI Code Generator User's Manual
Real-Time Innovations, RTI, NDDS, RTI Data Distribution Service, DataBus, Connext, ... If you are generating code for Connext DDS, the options are:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found