Hi Dan,

 

Most likely – different versions. The online editor tends to use a snapshot 
version of the codegen, meaning it’s a bit more cutting edge – however, we 
don’t always update it to the latest snapshot.

Try switching to version 2.2.2-SNAPSHOT and see if you can spot a difference.

 

 

 

From: <[email protected]> on behalf of Daniel Lee Pit Sen 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Monday, 23 January 2017 at 18:21
To: Swagger <[email protected]>
Subject: Generating code from swagger-codegen versus code generated by Swagger 
UI

 

Hello 

 

I am new to Swagger. 

 

I used Swagger Editor to generate Client Code: Jaxrs Cxf Client by uploading 
schema: myschema.json. The interface AuditAPI was generated with the following 
method signature:

 

@GET

    @Path("/abc/{id}/audits/{auditId}")

    @Consumes({ "application/json" })

    @Produces({ "application/json" })

    @ApiOperation(value = "Single entry", tags={  })

    public Audit abcIdAuditsAuditIdGet(@PathParam("id") Integer id, 
@PathParam("auditId") Integer auditId);

 

 

I then used swagger-codegen-maven-plugin to generate jaxrs-cxf client code. The 
same interface AuditAPI was generated but the method signature is different:

 

plugin>
   <groupId>io.swagger</groupId>
   <artifactId>swagger-codegen-maven-plugin</artifactId>
   <version>2.2.1</version>
   <executions>
      <execution>
         <goals>
            <goal>generate</goal>
         </goals>
         <configuration>
            <inputSpec>src/main/resources/schemas/myschema.json</inputSpec>
            <language>jaxrs-cxf</language>
            <configOptions>
               <output>target/generated-sources/swagger</output>
            </configOptions>
         </configuration>
      </execution>
   </executions>
</plugin>
 

@GET
@Path("/abc/{id}/audits/{auditId}")
@Consumes({ "application/json" })
@Produces({ "application/json" })
public Response abcIdAuditsAuditIdGet(@PathParam("id") Integer 
id,@PathParam("auditId") Integer auditId);
 
 
Can anyone explain to me why the generated codes are different?
 
 

Regards

Dan (swagger newb)

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to