Comments (12)
Its is fixed with:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen</artifactId>
<version>2.1.4</version>
</dependency>
any chance of a release using the latest swagger-codegen?
from swagger-codegen-tooling.
hi @jbadeau,
please try out this release, 0.4.17. Its updated to latest swagger-codegen. Let me know if it works or any trouble you have.
Cheers
Jörg
from swagger-codegen-tooling.
Hi, thank you very much for the release. Unfortunately it did not solve the model problem but it solved some other ones. I tried the official io.swagger generator and it works fine for model generation. I see that your change pulls in the correct version so I'm at a loss as to why it doesn't work. I will investigate the cause and report back. Thank you for such a fast response.
from swagger-codegen-tooling.
This project has its own templates ... so it could be that the templates here in the repository have to be updated too.
Which output format ("language" parameter) are you using?
from swagger-codegen-tooling.
My setup where ${swagger-codegen.version} = 0.4.17
<plugin>
<groupId>org.zalando.maven.plugins</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
<id>generate rest api</id>
<phase>generate-sources</phase>
<goals>
<goal>codegen</goal>
</goals>
<configuration>
<apiFile>${project.basedir}/src/main/resources/swagger/sopid/swagger.yaml</apiFile>
<language>springinterfacesResponseEntity</language>
<apiPackage>com.abc.h6x.offerings.sopid.web</apiPackage>
<modelPackage>com.abc.h6x.offerings.sopid.web.resource</modelPackage>
<enableBuilderSupport>true</enableBuilderSupport>
<enable303>true</enable303>
<outputDirectory>${basedir}/src/main/java-gen</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.zalando.stups</groupId>
<artifactId>swagger-codegen-template-spring-interfaces</artifactId>
<version>${swagger-codegen.version}</version>
</dependency>
</dependencies>
</plugin>
I just noticed that you have your own model template. I assumed you where delegating to the io.swagger DefaultGenerator. Oops!
Comparing:
The output for the fields is a bit different in the latest io.swagger template. Don't know enough about the template logic to comment though.
from swagger-codegen-tooling.
can you please verify this with 0.4.20.
Yes we delegate as much as possible to the original-codegenerator. And we only had some fixes for issues in their code. But it seems they put a lot of fixes into their own codebase. Good for us, we can remove our code ;-).
Please close this issue if everything is working or let use know the issues to fix this asap.
Cheers
Jörg
from swagger-codegen-tooling.
I already left work but I'll check it first thing tomorrow.
from swagger-codegen-tooling.
Any news for me on this issue? Is it working as expected?
from swagger-codegen-tooling.
Very sorry for the late response. I ended up having to go to China for a while :O. Unfortunately 0.4.20 does not produce the correct results.
Given:
productComponentValueCd:
type: object
additionalProperties:
type: string
produces:
private String productComponentValueCd = null;
but should produce:
private Map<String, String> productComponentValueCd = null;
from swagger-codegen-tooling.
Hi @jbadeau,
hope you enjoyed china.
Thanks for your feedback but I'm wondering why it does not work for you. For me it does. So I created an integration-test with a configuration similar to yours here. So it's in the project now and you can verify it by your own. Just clone it or pull to get the latest version, change into the 'swagger-codegen-maven-plugin'-directory and run 'mvn clean install -Pintegration' (takes a while, many tests). I added your case to the 'Pet'-type in the swagger-definition. If the build has finished you find everything int 'target/it/issue_21/target/generated-sources/swagger-codegen/de/zalando/model/Pet.java'. Should be
private Map<String,String> test = new HashMap<String,String>();
also with 'getter/setter' for the field.
Please check that. If it does not work on your machine, could please provide a complete sample-swagger-definition with all the things in it you normally define. That would be really helpfull for me.
Thanks for your cooperation.
Jörg
from swagger-codegen-tooling.
Hi,
So your petstore example works in your project and it also works in mine but our stuff is not working.
The differences I see are:
- we are using YAML instead of JSON (i only posted the issue in json to use code highlighting)
- we have split the API and Resources into 2 files like: petstore-service-spec.yaml and petstore-resources.yaml
We reference the resources in the spec like:
responses:
'200':
description: sopids response
schema:
type: array
items:
$ref: './petstore-resources#/Pet'
from swagger-codegen-tooling.
So, I will close this issue because generation for Model basically works as expected. The thing with splitted files goes into it's own issue (#23).
from swagger-codegen-tooling.
Related Issues (20)
- Is there a working sample for generating interfaces with Maven Plugin? HOT 2
- BasePath not generated with JAX-RS interfaces HOT 4
- custom mustache template HOT 5
- Name collision with APIs HOT 3
- Inverted Spring MVC query param required generation HOT 2
- Do not generate consumes for requests without body HOT 3
- apiPackage required even when skipApigeneration defined HOT 3
- consumes annotation field on HTTP actions without a body HOT 4
- Using swagger-codegen-maven-plugin with maven 2.0.11 HOT 5
- Support basePath for springinterfacesSplitResponseEntityNoSwaggerAnnotations template HOT 1
- Rename generated Controller-classes from *Impl to *Controller to not HOT 2
- Add 'pom.xml.releaseBackup' to git-ignore.
- Add some more badges to README
- Re-enable gradle plugin HOT 5
- Upgrade swagger dependencies HOT 7
- Evaluate official maven plugin for swagger-codegen HOT 3
- Problem generating enums with special characters HOT 1
- support spring-boot-hateoas HOT 1
- support apiPrefix parameter
- maven.plugin.validation warnings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger-codegen-tooling.