Closed wzph closed 7 years ago
@wzph So I've never explicitly tested against that, but our spec does check out against the OpenAPI 2.0 JSON schema that the project publishes, so I think that it should be roughly valid.
Do you have any idea on what particular quirk is causing the Swagger failure? This smells a little like a swagger-codegen problem, but I'm happy to make a couple tweaks to how we're generating this file if that would help.
So this may not help much, but it's more info. I ran a bunch of other specs (github, azure, aws, google) through swagger-codegen, and they were processed with similar warnings but no errors.
The following complains about definitions[**][type]
being an array instead of a string, but changing to a string did not fix the failure in swagger-codegen.
curl -X POST -d @spec2.json -H 'Content-Type:application/json' http://online.swagger.io/validator/debug
Thanks for the new info!
The following complains about definitions[**][type] being an array instead of a string, but changing to a string did not fix the failure in swagger-codegen.
Hm, interesting. This is something that I could change relatively easily, but I guess it doesn't really seem to be a fix for the problem.
So given that I don't think we're going to be using the Swagger toolchain anytime soon, I'm probably not going to dig into this too deeply right now (I'm sure our formatting isn't quite to its liking, but given that the schema seems to be valid, it seems more like a bug in the generator). However, I'm happy to make any particular fixes to the schema that look like they might be causing the problem if more information becomes available.
Thanks, @brandur-stripe. I agree that making type
a scalar isn't going to do much for my issue.
I don't think we're going to be using the Swagger toolchain anytime soon
Does that mean you are using/supporting a different codegen tool?
Does that mean you are using/supporting a different codegen tool?
I'm interested in doing so, but for now we're using the spec for much more modest uses, like running mock servers that we can hit with our library test suites so that we can move them off doing slow/brittle live API calls. The idea right now though is that we keeping moving forward to more sophisticated uses from there.
@brandur-stripe can you clarify what you mean by this?
like running mock servers that we can hit with our library test suites so that we can move them off doing slow/brittle live API calls
We think it's possible in our own Elixir Stripe library to do something similar using this spec, but I'm fuzzy on the details.
@JoshSmith You can see the details as we're currently implementing them in stripe-ruby here. Basically we spin up a project called Committee and have it ingest the specification into a Sinatra app, then use webmock to redirect requests to api.stripe.com
to the fake.
This works pretty well and all of stripe-ruby is powered off of this right. One problem though is that it's not language agnostic, and currently only works in Ruby.
One thing I'm playing with right now is the idea of shipping a small Go executable that does something similar, but which can then be activated in CI environments. Real HTTP requests are sent against it, but it responds 3-4 orders of magnitude faster than if you were really going across the wire.
I call this stripestub
, and you can see an example of one of our stripe-java suites running against it in Travis here. This is still an early experiment and I can't guarantee official support for it yet, but I'm collecting feedback internally right now and would like to eventually ship stripestub
as an officially supported development tool.
Going to close this in favor of #10 because it seems that they may have tracked down the issue.
Should swagger-codegen succeed in building spec2.json or spec2.yaml? I am getting the following: