-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completely refactor SwaggerResolver to support all sorts of goodness #73
Conversation
I'm trying to get this tested, but it looks like the scala-based unit tests are not running. When you cleaned up the |
I didn't intentionally disable scala tests running. This snippet in swagger-core's base pom file seems to be doing something with testng and scala test. This is missing from swagger-parser's base pom file. Do I need to replicate this? |
I'm thinking the testng is causing it: @RunWith(classOf[JUnitRunner])
class RemoteUrlTest extends FlatSpec with Matchers {
it should "read a remote URL" in {
val output = RemoteUrl.urlToString("http://petstore.swagger.io/v2/pet/1", null)
output should not be (null)
} I'll see if we can get it to run with testng. I don't think it'll do both junit and testng at the same time without some configuration. |
@Helmsdown I fixed the tests in 5acd565 Once we port the tests to java we can remove this. |
@fehguy Most appreciated! |
So I took SwaggerResolver apart and put it back together to support several things. Some of these things were supported to begin with (but definitely not all)
Things I was trying to support with the change:
As always feedback on my code is appreciated.
A note on the tests
I added JMockit as a test dependency. I hadn't seen any other examples of mocking libraries being used in the other swagger libraries. I am a very big fan of JMockit because it doesn't make me work very hard to mock out classes. Of course this is your codebase and you guys get to decide what the dependencies are. I only ask you take a look at the test classes I wrote and let me know if you have any questions as to how I am using JMockit.
Name Conflicts
I implemented some simple logic to supports "deconflicting" references.
For example:
In order to resolve these, they will both need to go into the #/definitions map. This means you have a some choices:
I went with option 4 for now. Let me know your thoughts on this. With any of the options, we should strongly suggest to developers to not have conflicting names (at least until we can have a discussion on whether or not namespaces make sense for swagger specs).