How do you override models with swagger-core 1.5.3? #1499

Closed
jayree05 opened this Issue Oct 15, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@jayree05

Hi -

I'm trying to upgrade to swagger-core 1.5.3 and I've discovered that the OverrideConverter class has been removed. However, the documentation on the wiki still refers to this class. What should I be using in the new version to achieve the same functionality?

@webron

This comment has been minimized.

Show comment
Hide comment
@webron

webron Oct 16, 2015

Member

So yeah, it has changed and not documented yet (sorry about that).

In the meantime, you can have a look at the test - https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-core/src/test/java/io/swagger/model/override/CustomConverterTest.java - and we'll do our best to answer any follow up questions you may have.

Member

webron commented Oct 16, 2015

So yeah, it has changed and not documented yet (sorry about that).

In the meantime, you can have a look at the test - https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-core/src/test/java/io/swagger/model/override/CustomConverterTest.java - and we'll do our best to answer any follow up questions you may have.

@jayree05

This comment has been minimized.

Show comment
Hide comment
@jayree05

jayree05 Oct 16, 2015

Thank you very much! I used that example along with this: https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-core/src/test/java/io/swagger/model/override/SamplePropertyConverter.java to figure out how to create a property (that example you linked me to just returns null).

I think I have everything set up. But now I'm wondering, where do I put this code. The old way was to put it in the constructor of a servlet class. Newer documentation puts a lot of startup type code in the the init function of a servlet class, which is what I did. But it doesn't appear to be working. I'm wondering if it's because you have to create a local instance of the ModelConverters class instead of using it statically. I hope that question makes sense...

Thank you very much! I used that example along with this: https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-core/src/test/java/io/swagger/model/override/SamplePropertyConverter.java to figure out how to create a property (that example you linked me to just returns null).

I think I have everything set up. But now I'm wondering, where do I put this code. The old way was to put it in the constructor of a servlet class. Newer documentation puts a lot of startup type code in the the init function of a servlet class, which is what I did. But it doesn't appear to be working. I'm wondering if it's because you have to create a local instance of the ModelConverters class instead of using it statically. I hope that question makes sense...

@jayree05

This comment has been minimized.

Show comment
Hide comment
@jayree05

jayree05 Oct 16, 2015

Never mind! I figured it out. I needed to use the ModelConverters.getInstance() method. Thanks again for your help!

Never mind! I figured it out. I needed to use the ModelConverters.getInstance() method. Thanks again for your help!

@webron

This comment has been minimized.

Show comment
Hide comment
@webron

webron Oct 17, 2015

Member

Glad it worked out. Can we close this issue?

Member

webron commented Oct 17, 2015

Glad it worked out. Can we close this issue?

@webron webron closed this Oct 19, 2015

@fehguy fehguy added this to the v1.5.4 milestone Oct 19, 2015

@Download

This comment has been minimized.

Show comment
Hide comment
@Download

Download Mar 27, 2017

It is still not documented though :(

It is still not documented though :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment