Isura is correct IMO. Why do we need to automate code generation with
component build? If we have API change then only we need to trigger code
generation. If there are changes after code generate you can selectively
commit them.

Also we don't need to add class level comments to generated code(inside
/gen directory). Further we can skip validations, code coverage etc for
generated code. Each generated code will have mapped implementation(where
we add our code). So we can add class comments there.

On Wed, Jul 5, 2017 at 1:42 PM, Ruwan Abeykoon <[email protected]> wrote:

> Hi Isura,
>
> On Wed, Jul 5, 2017 at 1:04 PM, Isura Karunaratne <[email protected]> wrote:
>
>> Hi Indunil,
>>
>> On Wed, Jul 5, 2017 at 11:35 AM, Indunil Upeksha Rathnayake <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have used the Swagger Codegen to generation the server stubs from a
>>> Swagger definition of a REST API for IS 5.4.0.
>>>
>>> In there I have added the following plugin to generate server stub for
>>> CXF.
>>>
>>> <plugin>
>>>>     <groupId>org.wso2.maven.plugins</groupId>
>>>>     <artifactId>swagger2cxf-maven-plugin</artifactId>
>>>>     <version>1.0-SNAPSHOT</version>
>>>>     <configuration>
>>>>         <inputSpec>${project.basedir}/src/main/resources/api.identit
>>>> y.oauth2.scope.endpoint.yaml</inputSpec>
>>>>     </configuration>
>>>> </plugin>
>>>>
>>>
>>>
>>> Also add the following maven build helper plugin.
>>>
>>> <plugin>
>>>>     <groupId>org.codehaus.mojo</groupId>
>>>>     <artifactId>build-helper-maven-plugin</artifactId>
>>>>     <executions>
>>>>         <execution>
>>>>             <id>add-source</id>
>>>>                         <phase>generate-sources</phase>
>>>>                         <goals>
>>>>                             <goal>add-source</goal>
>>>>                         </goals>
>>>>                         <configuration>
>>>>                             <sources>
>>>>                                 <source>src/gen/java</source>
>>>>                             </sources>
>>>>                         </configuration>
>>>>                     </execution>
>>>>     </executions>
>>>> </plugin>
>>>>
>>>
>>> Then use "mvn swagger2cxf:generate" command to generate the server stubs
>>> and in src/gen/java folder, set of factories are generated and in main/Java
>>> folder, a set of impl files are generated.
>>>
>>> I have following concerns regarding server stubs generation from Swagger.
>>>
>>>    - Is this can be automated to do in component build?
>>>
>>>
>> No.
>>
>>>
>>>    - Or normally this is the way it should handled and need to commit
>>>    all the generated files to git as well?
>>>
>>> We have to commit generated files.
>>
>
> What are the reasons ?
>
>
>>
>>>
>>>    - If we are committing the generated files to git, is it recommended
>>>    to add class comments in those?
>>>
>>> I don't think we need to add class comments. But, we better to add
>> licence headers.
>>
>> Thanks
>> Isura.
>>
>>>
>>> Thanks and Regards
>>>
>>> --
>>> Indunil Upeksha Rathnayake
>>> Software Engineer | WSO2 Inc
>>> Email    [email protected]
>>> Mobile   0772182255 <077%20218%202255>
>>>
>>
>>
>>
>> --
>>
>> *Isura Dilhara Karunaratne*
>> Senior Software Engineer | WSO2
>> Email: [email protected]
>> Mob : +94 772 254 810 <+94%2077%20225%204810>
>> Blog : http://isurad.blogspot.com/
>>
>>
>>
>>
>
> Cheers,
> Ruwan
>



-- 

*Sanjeewa Malalgoda*
WSO2 Inc.
Mobile : +94713068779

<http://sanjeewamalalgoda.blogspot.com/>blog
:http://sanjeewamalalgoda.blogspot.com/
<http://sanjeewamalalgoda.blogspot.com/>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to