Avoiding allOf swagger syntax generated by swagger-core - swagger-2.0

I'm using a generator based on io.swagger's swagger-core + swagger-jaxrs library v1.5.13 and I wonder if there's an option to avoid allOf syntax. The other tool we use doesn't support the allOf syntax and we can't use it.
I don't like bending our java model just because of one problematic technology, is there and option how to tell the library not to generate allOf and flatten the view on a hirarchy of objects instead?
I already have a custom ModelResolver, but I hope for a more elegant solution than transforming the syntax with my code.

Related

How to import external Java libraries in OpenTest framework?

I would like to find out how I can import external libraries into my tests? For example, if i use a Java library for random name/number generation, how do I go about using it in my tests?
Thanks
Before I answer, I would advise that you should avoid using Java code, if you can. For example, a random name/number generator is very easy to implement in JavaScript and you can find plenty of ready-made examples out there. If it's JS code, you can easily embed it in your tests using one of the techniques described here. Even better, you should use capabilities that are provided out-of-the-box with OpenTest: $random and $randomString.
If you really need to use Java code, there are two ways to do it:
The recommended way: create one or more custom OpenTest keywords as described here. This will make it easier for you to maintain your test suite in the future and it also makes it easier for other members of your team to leverage this work in their own tests, especially if they are not familiar with Java.
The "quick and dirty" way: create a user-jars directory in your test actor's working directory and drop the JAR file in there. Then, call your Java code from JavaScript as described here.

Kotlin KFunction reflection - get parameter values

In order to create a simple annotation that logs function calls, I'm trying to grab the following attributes from a function that has said annotation:
Function name
Parameter names
Parameter values
What I have so far uses KCallable as a value, which makes grabbing the name and names from the list of KParameter fairly simple. However, I cannot figure out how to get the values of said parameters to make the log statement more contextual.
Does anyone have ideas on grabbing these parameters values within the annotation? It doesn't need to use KCallable, that just seemed like the most intuitive receiver.
You will need a different approach. Annotations and parameter type are a compile time features while values are a runtime feature.
What you will have to do is use a bytecode processing framework like ASM or google "aspect oriented programming". That allows you to examine the generated bytecode and modify if before the JVM tries to execute it.
The other approach is to write a Kotlin compiler plugin which generates the necessary code (google "Writing Your First Kotlin Compiler Plugin")
This blog post contains an example for Java and Spring using the AOP approach: https://solocoding.dev/blog/eng_spring_centrlize_logging_with_aop
I recommend the compiler plugin because the other approach is much more complicated, brittle and badly documented. Use AOP only if you find a framework which already contains all the features you need.

Requiring a Module With Alloy MVC

Right, so, if I was simply using Titanium, I could write:
var platino = require("co.lanica.platino");
And I'd be good to go. Since moving to Alloy, I don't know how to replicate the same line in the afforementioned MVC framework.
Do I add it under the global namespace? I already added the module in tiapp.xml, but I have no idea how to access it as a variable "platino".
The docs for Alloy are pretty sparse...any suggestions?
Require method is almost same in Alloy, you can use the require keyword in your js file and implement as in classic approach.
checkout the docs.

How to create a closure from String in Dart?

How to use dart-mirror API to create a anonymous closure dynamically?
Like as the interpreter, compile the code during run-time.
var funcstr='bool (String s){ return (s==null); }';
var func=parseStr(funcstr);
// func(s)-> s==null;
var r=func('false');
// r=false;
so, how to do with "parseStr"?
my project:
http://github.com/stevehsu77/surebet
At the moment there is no way to do this. Dart has no eval and no code generation at runtime.
But it is something Gilad Bracha (the language spec lead of Dart) wants to have (https://groups.google.com/a/dartlang.org/forum/#!topic/misc/6O4g7eEHgOU) at least for the development environment.
Also
We’d like to support more powerful reflective features in the future. These would include mirror builders, designed to allow programs to extend and modify themselves, and a mirror-based debugging API as well.
https://www.dartlang.org/articles/reflection-with-mirrors/
So it'll probably be supported some time in the future. But right now it's not possible.
As mentioned above, Dart does not have eval, however it is possible to load new source code in another isolate using spawnUri().
I am not sure if there are any examples of how to use this. Perhaps post a message on the dart discussion group.
Using isolates and spawnUri() is quite a different than using eval, so it may not be the right fit for your project.

Javadoc with Equations?

I'm only familiar with the no-frills javadoc generator, however I'd like to include some mathematical equations in my javadoc (rather than constantly referencing another document).
Is there a convenient option to do something like include/properly render LaTeX (most preferred - then I could just cut-n-paste) or MathML tags?
Check out Doxygen.
It's blazing fast, free, and supports embedded LaTeX.
Maybe something like MathJax or jsMath could be your solution. They're both JavaScript libraries, so you'll have to find a way to add them into your javadocs pages.
While I haven't done it personally, there are ways to create your own using the Doclet or Taglet API to create your own Doclet or Taglet. Several of these have already been done according to a quick search providing one such example http://www.ohloh.net/p/latextaglet
If you're feeling daring enough the latextaglet project is open source, so you might be able to further adapt it to your needs.

Resources